kt_path
stringlengths
35
167
kt_source
stringlengths
626
28.9k
classes
listlengths
1
17
austin226__codeforces-kt__4377021/contest1907/src/main/kotlin/C.kt
import kotlin.math.min // https://codeforces.com/contest/1907/problem/C private fun readInt(): Int = readln().toInt() private fun solve(n: Int, s: String): Int { var min = n val checked = mutableSetOf(s) val q = ArrayDeque<String>() q.addFirst(s) while (q.isNotEmpty()) { val str = q.removeFirst() for (i in 0..<str.length - 1) { if (str[i] == str[i + 1]) { continue } // Remove i and i+1 val newStrBuilder = StringBuilder() for (j in str.indices) { if (i != j && i + 1 != j) { newStrBuilder.append(str[j]) } } val newStr = newStrBuilder.toString() if (checked.contains(newStr)) { continue } min = min(newStr.length, min) if (min == 0) { break } q.addLast(newStr) checked.add(newStr) println("Check $newStr") } } return min } private fun testcase() { val n = readInt() val s = readln() val min = solve(n, s) println(min) } fun main() { // val min = solve(20000, "abacd".repeat(20000 / 5)) val min = solve(2000, "abacd".repeat(2000 / 5)) println(min) return val t = readInt() for (i in 0..<t) { testcase() } }
[ { "class_path": "austin226__codeforces-kt__4377021/CKt.class", "javap": "Compiled from \"C.kt\"\npublic final class CKt {\n private static final int readInt();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 3: invokestatic #18 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 6: ireturn\n\n private static final int solve(int, java.lang.String);\n Code:\n 0: iload_0\n 1: istore_2\n 2: iconst_1\n 3: anewarray #22 // class java/lang/String\n 6: astore 4\n 8: aload 4\n 10: iconst_0\n 11: aload_1\n 12: aastore\n 13: aload 4\n 15: invokestatic #28 // Method kotlin/collections/SetsKt.mutableSetOf:([Ljava/lang/Object;)Ljava/util/Set;\n 18: astore_3\n 19: new #30 // class kotlin/collections/ArrayDeque\n 22: dup\n 23: invokespecial #34 // Method kotlin/collections/ArrayDeque.\"<init>\":()V\n 26: astore 4\n 28: aload 4\n 30: aload_1\n 31: invokevirtual #38 // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V\n 34: aload 4\n 36: checkcast #40 // class java/util/Collection\n 39: invokeinterface #44, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 44: ifne 51\n 47: iconst_1\n 48: goto 52\n 51: iconst_0\n 52: ifeq 265\n 55: aload 4\n 57: invokevirtual #48 // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;\n 60: checkcast #22 // class java/lang/String\n 63: astore 5\n 65: iconst_0\n 66: istore 6\n 68: aload 5\n 70: invokevirtual #51 // Method java/lang/String.length:()I\n 73: iconst_1\n 74: isub\n 75: istore 7\n 77: iload 6\n 79: iload 7\n 81: if_icmpge 34\n 84: aload 5\n 86: iload 6\n 88: invokevirtual #55 // Method java/lang/String.charAt:(I)C\n 91: aload 5\n 93: iload 6\n 95: iconst_1\n 96: iadd\n 97: invokevirtual #55 // Method java/lang/String.charAt:(I)C\n 100: if_icmpne 106\n 103: goto 259\n 106: new #57 // class java/lang/StringBuilder\n 109: dup\n 110: invokespecial #58 // Method java/lang/StringBuilder.\"<init>\":()V\n 113: astore 8\n 115: iconst_0\n 116: istore 9\n 118: aload 5\n 120: checkcast #60 // class java/lang/CharSequence\n 123: invokeinterface #61, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 128: istore 10\n 130: iload 9\n 132: iload 10\n 134: if_icmpge 172\n 137: iload 6\n 139: iload 9\n 141: if_icmpeq 166\n 144: iload 6\n 146: iconst_1\n 147: iadd\n 148: iload 9\n 150: if_icmpeq 166\n 153: aload 8\n 155: aload 5\n 157: iload 9\n 159: invokevirtual #55 // Method java/lang/String.charAt:(I)C\n 162: invokevirtual #65 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 165: pop\n 166: iinc 9, 1\n 169: goto 130\n 172: aload 8\n 174: invokevirtual #68 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 177: dup\n 178: ldc #70 // String toString(...)\n 180: invokestatic #76 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 183: astore 9\n 185: aload_3\n 186: aload 9\n 188: invokeinterface #82, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 193: ifeq 199\n 196: goto 259\n 199: aload 9\n 201: invokevirtual #51 // Method java/lang/String.length:()I\n 204: iload_2\n 205: invokestatic #88 // Method java/lang/Math.min:(II)I\n 208: istore_2\n 209: iload_2\n 210: ifne 216\n 213: goto 34\n 216: aload 4\n 218: aload 9\n 220: invokevirtual #91 // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V\n 223: aload_3\n 224: aload 9\n 226: invokeinterface #94, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 231: pop\n 232: new #57 // class java/lang/StringBuilder\n 235: dup\n 236: invokespecial #58 // Method java/lang/StringBuilder.\"<init>\":()V\n 239: ldc #96 // String Check\n 241: invokevirtual #99 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 244: aload 9\n 246: invokevirtual #99 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 249: invokevirtual #68 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 252: getstatic #105 // Field java/lang/System.out:Ljava/io/PrintStream;\n 255: swap\n 256: invokevirtual #110 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 259: iinc 6, 1\n 262: goto 77\n 265: iload_2\n 266: ireturn\n\n private static final void testcase();\n Code:\n 0: invokestatic #127 // Method readInt:()I\n 3: istore_0\n 4: invokestatic #12 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 7: astore_1\n 8: iload_0\n 9: aload_1\n 10: invokestatic #129 // Method solve:(ILjava/lang/String;)I\n 13: istore_2\n 14: getstatic #105 // Field java/lang/System.out:Ljava/io/PrintStream;\n 17: iload_2\n 18: invokevirtual #132 // Method java/io/PrintStream.println:(I)V\n 21: return\n\n public static final void main();\n Code:\n 0: sipush 2000\n 3: ldc #135 // String abacd\n 5: checkcast #60 // class java/lang/CharSequence\n 8: sipush 400\n 11: invokestatic #141 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;\n 14: invokestatic #129 // Method solve:(ILjava/lang/String;)I\n 17: istore_0\n 18: getstatic #105 // Field java/lang/System.out:Ljava/io/PrintStream;\n 21: iload_0\n 22: invokevirtual #132 // Method java/io/PrintStream.println:(I)V\n 25: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #144 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
austin226__codeforces-kt__4377021/codeforces/src/main/kotlin/contest1911/H.kt
// https://codeforces.com/contest/1911/problem/H private fun String.splitWhitespace() = split("\\s+".toRegex()) private fun <T> List<T>.counts(): Map<T, Int> = this.groupingBy { it }.eachCount() private fun <T : Comparable<T>> List<T>.isStrictlyDecreasing(): Boolean = (size <= 1) || (1 until size).all { i -> get(i) < get(i - 1) } private fun <T : Comparable<T>> List<T>.isStrictlyIncreasing(): Boolean = (size <= 1) || (1 until size).all { i -> get(i) > get(i - 1) } /** Return 0 for each index whose member in a belongs to the increasing sequence. * 1 otherwise. null if not possible. */ fun findIncrSeqMembers(a: List<Int>, n: Int): List<Int>? { val res = MutableList(n) { 0 } var incrMax = Int.MIN_VALUE var decrMin = Int.MAX_VALUE if (n > 1 && a[0] >= a[1]) { res[0] = 1 decrMin = res[0] // TODO extend this using a while loop. Take all decreasing numbers into decr until we hit something that has to go into incr. // TODO that probably won't cover many cases... } for (k in a) { if (k < decrMin) { decrMin = k } else if (k > incrMax) { incrMax = k } else { return null } } return res } fun main() { val n = readln().toInt() val a = readln().splitWhitespace().map { it.toInt() } // If there are >2 of any input, print NO findIncrSeqMembers(a, n)?.let { println("YES") println(it.joinToString(" ")) return } println("NO") }
[ { "class_path": "austin226__codeforces-kt__4377021/HKt.class", "javap": "Compiled from \"H.kt\"\npublic final class HKt {\n private static final java.util.List<java.lang.String> splitWhitespace(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #9 // class java/lang/CharSequence\n 4: astore_1\n 5: new #11 // class kotlin/text/Regex\n 8: dup\n 9: ldc #13 // String \\\\s+\n 11: invokespecial #17 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 14: astore_2\n 15: iconst_0\n 16: istore_3\n 17: aload_2\n 18: aload_1\n 19: iload_3\n 20: invokevirtual #21 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 23: areturn\n\n private static final <T> java.util.Map<T, java.lang.Integer> counts(java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: checkcast #28 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: new #30 // class HKt$counts$$inlined$groupingBy$1\n 10: dup\n 11: aload_1\n 12: invokespecial #33 // Method HKt$counts$$inlined$groupingBy$1.\"<init>\":(Ljava/lang/Iterable;)V\n 15: checkcast #35 // class kotlin/collections/Grouping\n 18: invokestatic #41 // Method kotlin/collections/GroupingKt.eachCount:(Lkotlin/collections/Grouping;)Ljava/util/Map;\n 21: areturn\n\n private static final <T extends java.lang.Comparable<? super T>> boolean isStrictlyDecreasing(java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: invokeinterface #56, 1 // InterfaceMethod java/util/List.size:()I\n 6: iconst_1\n 7: if_icmple 126\n 10: iconst_1\n 11: aload_0\n 12: invokeinterface #56, 1 // InterfaceMethod java/util/List.size:()I\n 17: invokestatic #62 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 20: checkcast #28 // class java/lang/Iterable\n 23: astore_1\n 24: iconst_0\n 25: istore_2\n 26: aload_1\n 27: instanceof #64 // class java/util/Collection\n 30: ifeq 49\n 33: aload_1\n 34: checkcast #64 // class java/util/Collection\n 37: invokeinterface #68, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 42: ifeq 49\n 45: iconst_1\n 46: goto 123\n 49: aload_1\n 50: invokeinterface #72, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 55: astore_3\n 56: aload_3\n 57: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 62: ifeq 122\n 65: aload_3\n 66: checkcast #79 // class kotlin/collections/IntIterator\n 69: invokevirtual #82 // Method kotlin/collections/IntIterator.nextInt:()I\n 72: istore 4\n 74: iload 4\n 76: istore 5\n 78: iconst_0\n 79: istore 6\n 81: aload_0\n 82: iload 5\n 84: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 89: checkcast #88 // class java/lang/Comparable\n 92: aload_0\n 93: iload 5\n 95: iconst_1\n 96: isub\n 97: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 102: invokeinterface #92, 2 // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I\n 107: ifge 114\n 110: iconst_1\n 111: goto 115\n 114: iconst_0\n 115: ifne 56\n 118: iconst_0\n 119: goto 123\n 122: iconst_1\n 123: ifeq 130\n 126: iconst_1\n 127: goto 131\n 130: iconst_0\n 131: ireturn\n\n private static final <T extends java.lang.Comparable<? super T>> boolean isStrictlyIncreasing(java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: invokeinterface #56, 1 // InterfaceMethod java/util/List.size:()I\n 6: iconst_1\n 7: if_icmple 126\n 10: iconst_1\n 11: aload_0\n 12: invokeinterface #56, 1 // InterfaceMethod java/util/List.size:()I\n 17: invokestatic #62 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 20: checkcast #28 // class java/lang/Iterable\n 23: astore_1\n 24: iconst_0\n 25: istore_2\n 26: aload_1\n 27: instanceof #64 // class java/util/Collection\n 30: ifeq 49\n 33: aload_1\n 34: checkcast #64 // class java/util/Collection\n 37: invokeinterface #68, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 42: ifeq 49\n 45: iconst_1\n 46: goto 123\n 49: aload_1\n 50: invokeinterface #72, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 55: astore_3\n 56: aload_3\n 57: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 62: ifeq 122\n 65: aload_3\n 66: checkcast #79 // class kotlin/collections/IntIterator\n 69: invokevirtual #82 // Method kotlin/collections/IntIterator.nextInt:()I\n 72: istore 4\n 74: iload 4\n 76: istore 5\n 78: iconst_0\n 79: istore 6\n 81: aload_0\n 82: iload 5\n 84: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 89: checkcast #88 // class java/lang/Comparable\n 92: aload_0\n 93: iload 5\n 95: iconst_1\n 96: isub\n 97: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 102: invokeinterface #92, 2 // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I\n 107: ifle 114\n 110: iconst_1\n 111: goto 115\n 114: iconst_0\n 115: ifne 56\n 118: iconst_0\n 119: goto 123\n 122: iconst_1\n 123: ifeq 130\n 126: iconst_1\n 127: goto 131\n 130: iconst_0\n 131: ireturn\n\n public static final java.util.List<java.lang.Integer> findIncrSeqMembers(java.util.List<java.lang.Integer>, int);\n Code:\n 0: aload_0\n 1: ldc #108 // String a\n 3: invokestatic #114 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #116 // class java/util/ArrayList\n 9: dup\n 10: iload_1\n 11: invokespecial #119 // Method java/util/ArrayList.\"<init>\":(I)V\n 14: astore_3\n 15: iconst_0\n 16: istore 4\n 18: iload 4\n 20: iload_1\n 21: if_icmpge 55\n 24: iload 4\n 26: istore 5\n 28: aload_3\n 29: iload 5\n 31: istore 6\n 33: astore 8\n 35: iconst_0\n 36: istore 7\n 38: iconst_0\n 39: invokestatic #125 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 42: aload 8\n 44: swap\n 45: invokevirtual #129 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 48: pop\n 49: iinc 4, 1\n 52: goto 18\n 55: aload_3\n 56: checkcast #52 // class java/util/List\n 59: astore_2\n 60: ldc #130 // int -2147483648\n 62: istore_3\n 63: ldc #131 // int 2147483647\n 65: istore 4\n 67: iload_1\n 68: iconst_1\n 69: if_icmple 128\n 72: aload_0\n 73: iconst_0\n 74: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 79: checkcast #133 // class java/lang/Number\n 82: invokevirtual #136 // Method java/lang/Number.intValue:()I\n 85: aload_0\n 86: iconst_1\n 87: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 92: checkcast #133 // class java/lang/Number\n 95: invokevirtual #136 // Method java/lang/Number.intValue:()I\n 98: if_icmplt 128\n 101: aload_2\n 102: iconst_0\n 103: iconst_1\n 104: invokestatic #125 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 107: invokeinterface #140, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 112: pop\n 113: aload_2\n 114: iconst_0\n 115: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 120: checkcast #133 // class java/lang/Number\n 123: invokevirtual #136 // Method java/lang/Number.intValue:()I\n 126: istore 4\n 128: aload_0\n 129: invokeinterface #141, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 134: astore 5\n 136: aload 5\n 138: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 143: ifeq 189\n 146: aload 5\n 148: invokeinterface #145, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 153: checkcast #133 // class java/lang/Number\n 156: invokevirtual #136 // Method java/lang/Number.intValue:()I\n 159: istore 6\n 161: iload 6\n 163: iload 4\n 165: if_icmpge 175\n 168: iload 6\n 170: istore 4\n 172: goto 136\n 175: iload 6\n 177: iload_3\n 178: if_icmple 187\n 181: iload 6\n 183: istore_3\n 184: goto 136\n 187: aconst_null\n 188: areturn\n 189: aload_2\n 190: areturn\n\n public static final void main();\n Code:\n 0: invokestatic #160 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 3: invokestatic #164 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 6: istore_0\n 7: invokestatic #160 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 10: invokestatic #166 // Method splitWhitespace:(Ljava/lang/String;)Ljava/util/List;\n 13: checkcast #28 // class java/lang/Iterable\n 16: astore_2\n 17: iconst_0\n 18: istore_3\n 19: aload_2\n 20: astore 4\n 22: new #116 // class java/util/ArrayList\n 25: dup\n 26: aload_2\n 27: bipush 10\n 29: invokestatic #172 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 32: invokespecial #119 // Method java/util/ArrayList.\"<init>\":(I)V\n 35: checkcast #64 // class java/util/Collection\n 38: astore 5\n 40: iconst_0\n 41: istore 6\n 43: aload 4\n 45: invokeinterface #72, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 50: astore 7\n 52: aload 7\n 54: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 59: ifeq 106\n 62: aload 7\n 64: invokeinterface #145, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 69: astore 8\n 71: aload 5\n 73: aload 8\n 75: checkcast #174 // class java/lang/String\n 78: astore 9\n 80: astore 11\n 82: iconst_0\n 83: istore 10\n 85: aload 9\n 87: invokestatic #164 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 90: nop\n 91: invokestatic #125 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 94: aload 11\n 96: swap\n 97: invokeinterface #175, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 102: pop\n 103: goto 52\n 106: aload 5\n 108: checkcast #52 // class java/util/List\n 111: nop\n 112: astore_1\n 113: aload_1\n 114: iload_0\n 115: invokestatic #177 // Method findIncrSeqMembers:(Ljava/util/List;I)Ljava/util/List;\n 118: astore_2\n 119: aload_2\n 120: ifnull 167\n 123: aload_2\n 124: astore 4\n 126: iconst_0\n 127: istore 5\n 129: ldc #179 // String YES\n 131: getstatic #185 // Field java/lang/System.out:Ljava/io/PrintStream;\n 134: swap\n 135: invokevirtual #191 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 138: aload 4\n 140: checkcast #28 // class java/lang/Iterable\n 143: ldc #193 // String\n 145: checkcast #9 // class java/lang/CharSequence\n 148: aconst_null\n 149: aconst_null\n 150: iconst_0\n 151: aconst_null\n 152: aconst_null\n 153: bipush 62\n 155: aconst_null\n 156: invokestatic #197 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 159: getstatic #185 // Field java/lang/System.out:Ljava/io/PrintStream;\n 162: swap\n 163: invokevirtual #191 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 166: return\n 167: ldc #199 // String NO\n 169: getstatic #185 // Field java/lang/System.out:Ljava/io/PrintStream;\n 172: swap\n 173: invokevirtual #191 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 176: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #212 // Method main:()V\n 3: return\n}\n", "javap_err": "" }, { "class_path": "austin226__codeforces-kt__4377021/HKt$counts$$inlined$groupingBy$1.class", "javap": "Compiled from \"_Collections.kt\"\npublic final class HKt$counts$$inlined$groupingBy$1 implements kotlin.collections.Grouping<T, T> {\n final java.lang.Iterable $this_groupingBy;\n\n public HKt$counts$$inlined$groupingBy$1(java.lang.Iterable);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #18 // Field $this_groupingBy:Ljava/lang/Iterable;\n 5: aload_0\n 6: invokespecial #21 // Method java/lang/Object.\"<init>\":()V\n 9: return\n\n public java.util.Iterator<T> sourceIterator();\n Code:\n 0: aload_0\n 1: getfield #18 // Field $this_groupingBy:Ljava/lang/Iterable;\n 4: invokeinterface #32, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 9: areturn\n\n public T keyOf(T);\n Code:\n 0: aload_1\n 1: astore_2\n 2: iconst_0\n 3: istore_3\n 4: aload_2\n 5: areturn\n}\n", "javap_err": "" } ]
austin226__codeforces-kt__4377021/codeforces/src/main/kotlin/contest1911/F.kt
// https://codeforces.com/contest/1911/problem/F private fun String.splitWhitespace() = split("\\s+".toRegex()) private fun <T> List<T>.counts(): Map<T, Int> = this.groupingBy { it }.eachCount() fun idealUniqueWeights(weights: List<Int>): Set<Int> { val uniqueWeights = mutableSetOf<Int>() for (weight in weights.sorted()) { if (weight > 1) { // First try to insert weight-1 if (!uniqueWeights.contains(weight - 1)) { uniqueWeights.add(weight - 1) continue } } // Next try to insert weight if (!uniqueWeights.contains(weight)) { uniqueWeights.add(weight) continue } // Finally try to insert weight+1 if (!uniqueWeights.contains(weight + 1)) { uniqueWeights.add(weight + 1) } } return uniqueWeights } fun main() { // n boxers. n in 1..=150_000 val n = readln().toInt() // weight of each boxer. // n ints, a_i where a_i in 1..150_000 val a = readln().splitWhitespace().map { it.toInt() } println(idealUniqueWeights(a).size) }
[ { "class_path": "austin226__codeforces-kt__4377021/FKt$counts$$inlined$groupingBy$1.class", "javap": "Compiled from \"_Collections.kt\"\npublic final class FKt$counts$$inlined$groupingBy$1 implements kotlin.collections.Grouping<T, T> {\n final java.lang.Iterable $this_groupingBy;\n\n public FKt$counts$$inlined$groupingBy$1(java.lang.Iterable);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #18 // Field $this_groupingBy:Ljava/lang/Iterable;\n 5: aload_0\n 6: invokespecial #21 // Method java/lang/Object.\"<init>\":()V\n 9: return\n\n public java.util.Iterator<T> sourceIterator();\n Code:\n 0: aload_0\n 1: getfield #18 // Field $this_groupingBy:Ljava/lang/Iterable;\n 4: invokeinterface #32, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 9: areturn\n\n public T keyOf(T);\n Code:\n 0: aload_1\n 1: astore_2\n 2: iconst_0\n 3: istore_3\n 4: aload_2\n 5: areturn\n}\n", "javap_err": "" }, { "class_path": "austin226__codeforces-kt__4377021/FKt.class", "javap": "Compiled from \"F.kt\"\npublic final class FKt {\n private static final java.util.List<java.lang.String> splitWhitespace(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #9 // class java/lang/CharSequence\n 4: astore_1\n 5: new #11 // class kotlin/text/Regex\n 8: dup\n 9: ldc #13 // String \\\\s+\n 11: invokespecial #17 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 14: astore_2\n 15: iconst_0\n 16: istore_3\n 17: aload_2\n 18: aload_1\n 19: iload_3\n 20: invokevirtual #21 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 23: areturn\n\n private static final <T> java.util.Map<T, java.lang.Integer> counts(java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: checkcast #28 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: new #30 // class FKt$counts$$inlined$groupingBy$1\n 10: dup\n 11: aload_1\n 12: invokespecial #33 // Method FKt$counts$$inlined$groupingBy$1.\"<init>\":(Ljava/lang/Iterable;)V\n 15: checkcast #35 // class kotlin/collections/Grouping\n 18: invokestatic #41 // Method kotlin/collections/GroupingKt.eachCount:(Lkotlin/collections/Grouping;)Ljava/util/Map;\n 21: areturn\n\n public static final java.util.Set<java.lang.Integer> idealUniqueWeights(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #53 // String weights\n 3: invokestatic #59 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #61 // class java/util/LinkedHashSet\n 9: dup\n 10: invokespecial #64 // Method java/util/LinkedHashSet.\"<init>\":()V\n 13: checkcast #66 // class java/util/Set\n 16: astore_1\n 17: aload_0\n 18: checkcast #28 // class java/lang/Iterable\n 21: invokestatic #72 // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;\n 24: invokeinterface #78, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 29: astore_2\n 30: aload_2\n 31: invokeinterface #84, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 36: ifeq 146\n 39: aload_2\n 40: invokeinterface #88, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 45: checkcast #90 // class java/lang/Number\n 48: invokevirtual #94 // Method java/lang/Number.intValue:()I\n 51: istore_3\n 52: iload_3\n 53: iconst_1\n 54: if_icmple 88\n 57: aload_1\n 58: iload_3\n 59: iconst_1\n 60: isub\n 61: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 64: invokeinterface #104, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 69: ifne 88\n 72: aload_1\n 73: iload_3\n 74: iconst_1\n 75: isub\n 76: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 79: invokeinterface #107, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 84: pop\n 85: goto 30\n 88: aload_1\n 89: iload_3\n 90: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 93: invokeinterface #104, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 98: ifne 115\n 101: aload_1\n 102: iload_3\n 103: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 106: invokeinterface #107, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 111: pop\n 112: goto 30\n 115: aload_1\n 116: iload_3\n 117: iconst_1\n 118: iadd\n 119: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 122: invokeinterface #104, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 127: ifne 30\n 130: aload_1\n 131: iload_3\n 132: iconst_1\n 133: iadd\n 134: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 137: invokeinterface #107, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 142: pop\n 143: goto 30\n 146: aload_1\n 147: areturn\n\n public static final void main();\n Code:\n 0: invokestatic #117 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 3: invokestatic #121 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 6: istore_0\n 7: invokestatic #117 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 10: invokestatic #123 // Method splitWhitespace:(Ljava/lang/String;)Ljava/util/List;\n 13: checkcast #28 // class java/lang/Iterable\n 16: astore_2\n 17: iconst_0\n 18: istore_3\n 19: aload_2\n 20: astore 4\n 22: new #125 // class java/util/ArrayList\n 25: dup\n 26: aload_2\n 27: bipush 10\n 29: invokestatic #129 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 32: invokespecial #132 // Method java/util/ArrayList.\"<init>\":(I)V\n 35: checkcast #134 // class java/util/Collection\n 38: astore 5\n 40: iconst_0\n 41: istore 6\n 43: aload 4\n 45: invokeinterface #135, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 50: astore 7\n 52: aload 7\n 54: invokeinterface #84, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 59: ifeq 106\n 62: aload 7\n 64: invokeinterface #88, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 69: astore 8\n 71: aload 5\n 73: aload 8\n 75: checkcast #137 // class java/lang/String\n 78: astore 9\n 80: astore 11\n 82: iconst_0\n 83: istore 10\n 85: aload 9\n 87: invokestatic #121 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 90: nop\n 91: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 94: aload 11\n 96: swap\n 97: invokeinterface #138, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 102: pop\n 103: goto 52\n 106: aload 5\n 108: checkcast #74 // class java/util/List\n 111: nop\n 112: astore_1\n 113: aload_1\n 114: invokestatic #140 // Method idealUniqueWeights:(Ljava/util/List;)Ljava/util/Set;\n 117: invokeinterface #143, 1 // InterfaceMethod java/util/Set.size:()I\n 122: istore_2\n 123: getstatic #149 // Field java/lang/System.out:Ljava/io/PrintStream;\n 126: iload_2\n 127: invokevirtual #154 // Method java/io/PrintStream.println:(I)V\n 130: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #169 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
austin226__codeforces-kt__4377021/codeforces/src/main/kotlin/contest1911/e.kt
import java.util.* private fun String.splitWhitespace() = split("\\s+".toRegex()) fun greatestPowerUpTo(n: Int): Int? { if (n < 1) { return null } var p = 1 while (p < n) { if (p * 2 > n) { return p } p *= 2 } return p } fun asPower2Sum(n: Int, k: Int): List<Int>? { // First, find the smallest list of powers of 2 we can use to write n. If it's longer than k, return null. val powers = LinkedList<Int>() var remainder = n var powersUsed = 0 while (remainder > 0) { val p = greatestPowerUpTo(remainder)!! remainder -= p powers.add(p) powersUsed++ if (powersUsed > k) { // return null if not possible return null } } // Next, break up any powers we can until we can reach k, or we get all 1's. while (powers.size < k) { val f = powers.first if (f == 1) { // first value is a 1 - we can't reach k return null } powers.removeFirst() if (f == 2) { powers.add(1) powers.add(1) } else { powers.add(0, f / 2) powers.add(0, f / 2) } } return powers.sorted() } fun main() { // Can we write n as a sum of exactly k powers of 2? // n in 1..=1e9 // k in 1..=2e5 val (n, k) = readln().splitWhitespace().map { it.toInt() } asPower2Sum(n, k)?.let { println("YES") println(it.joinToString(" ")) return } println("NO") }
[ { "class_path": "austin226__codeforces-kt__4377021/EKt.class", "javap": "Compiled from \"e.kt\"\npublic final class EKt {\n private static final java.util.List<java.lang.String> splitWhitespace(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #9 // class java/lang/CharSequence\n 4: astore_1\n 5: new #11 // class kotlin/text/Regex\n 8: dup\n 9: ldc #13 // String \\\\s+\n 11: invokespecial #17 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 14: astore_2\n 15: iconst_0\n 16: istore_3\n 17: aload_2\n 18: aload_1\n 19: iload_3\n 20: invokevirtual #21 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 23: areturn\n\n public static final java.lang.Integer greatestPowerUpTo(int);\n Code:\n 0: iload_0\n 1: iconst_1\n 2: if_icmpge 7\n 5: aconst_null\n 6: areturn\n 7: iconst_1\n 8: istore_1\n 9: iload_1\n 10: iload_0\n 11: if_icmpge 33\n 14: iload_1\n 15: iconst_2\n 16: imul\n 17: iload_0\n 18: if_icmple 26\n 21: iload_1\n 22: invokestatic #31 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: areturn\n 26: iload_1\n 27: iconst_2\n 28: imul\n 29: istore_1\n 30: goto 9\n 33: iload_1\n 34: invokestatic #31 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 37: areturn\n\n public static final java.util.List<java.lang.Integer> asPower2Sum(int, int);\n Code:\n 0: new #39 // class java/util/LinkedList\n 3: dup\n 4: invokespecial #42 // Method java/util/LinkedList.\"<init>\":()V\n 7: astore_2\n 8: iload_0\n 9: istore_3\n 10: iconst_0\n 11: istore 4\n 13: iload_3\n 14: ifle 56\n 17: iload_3\n 18: invokestatic #44 // Method greatestPowerUpTo:(I)Ljava/lang/Integer;\n 21: dup\n 22: invokestatic #50 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 25: invokevirtual #54 // Method java/lang/Integer.intValue:()I\n 28: istore 5\n 30: iload_3\n 31: iload 5\n 33: isub\n 34: istore_3\n 35: aload_2\n 36: iload 5\n 38: invokestatic #31 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 41: invokevirtual #58 // Method java/util/LinkedList.add:(Ljava/lang/Object;)Z\n 44: pop\n 45: iinc 4, 1\n 48: iload 4\n 50: iload_1\n 51: if_icmple 13\n 54: aconst_null\n 55: areturn\n 56: aload_2\n 57: invokevirtual #61 // Method java/util/LinkedList.size:()I\n 60: iload_1\n 61: if_icmpge 176\n 64: aload_2\n 65: invokevirtual #65 // Method java/util/LinkedList.getFirst:()Ljava/lang/Object;\n 68: checkcast #28 // class java/lang/Integer\n 71: astore 5\n 73: aload 5\n 75: iconst_1\n 76: istore 6\n 78: dup\n 79: ifnonnull 86\n 82: pop\n 83: goto 96\n 86: invokevirtual #54 // Method java/lang/Integer.intValue:()I\n 89: iload 6\n 91: if_icmpne 96\n 94: aconst_null\n 95: areturn\n 96: aload_2\n 97: invokevirtual #68 // Method java/util/LinkedList.removeFirst:()Ljava/lang/Object;\n 100: pop\n 101: aload 5\n 103: iconst_2\n 104: istore 6\n 106: dup\n 107: ifnonnull 114\n 110: pop\n 111: goto 143\n 114: invokevirtual #54 // Method java/lang/Integer.intValue:()I\n 117: iload 6\n 119: if_icmpne 143\n 122: aload_2\n 123: iconst_1\n 124: invokestatic #31 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 127: invokevirtual #58 // Method java/util/LinkedList.add:(Ljava/lang/Object;)Z\n 130: pop\n 131: aload_2\n 132: iconst_1\n 133: invokestatic #31 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 136: invokevirtual #58 // Method java/util/LinkedList.add:(Ljava/lang/Object;)Z\n 139: pop\n 140: goto 56\n 143: aload_2\n 144: iconst_0\n 145: aload 5\n 147: invokevirtual #54 // Method java/lang/Integer.intValue:()I\n 150: iconst_2\n 151: idiv\n 152: invokestatic #31 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 155: invokevirtual #71 // Method java/util/LinkedList.add:(ILjava/lang/Object;)V\n 158: aload_2\n 159: iconst_0\n 160: aload 5\n 162: invokevirtual #54 // Method java/lang/Integer.intValue:()I\n 165: iconst_2\n 166: idiv\n 167: invokestatic #31 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 170: invokevirtual #71 // Method java/util/LinkedList.add:(ILjava/lang/Object;)V\n 173: goto 56\n 176: aload_2\n 177: checkcast #73 // class java/lang/Iterable\n 180: invokestatic #79 // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;\n 183: areturn\n\n public static final void main();\n Code:\n 0: invokestatic #93 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 3: invokestatic #95 // Method splitWhitespace:(Ljava/lang/String;)Ljava/util/List;\n 6: checkcast #73 // class java/lang/Iterable\n 9: astore_1\n 10: iconst_0\n 11: istore_2\n 12: aload_1\n 13: astore_3\n 14: new #97 // class java/util/ArrayList\n 17: dup\n 18: aload_1\n 19: bipush 10\n 21: invokestatic #101 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 24: invokespecial #104 // Method java/util/ArrayList.\"<init>\":(I)V\n 27: checkcast #106 // class java/util/Collection\n 30: astore 4\n 32: iconst_0\n 33: istore 5\n 35: aload_3\n 36: invokeinterface #110, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 41: astore 6\n 43: aload 6\n 45: invokeinterface #116, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 50: ifeq 97\n 53: aload 6\n 55: invokeinterface #119, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 60: astore 7\n 62: aload 4\n 64: aload 7\n 66: checkcast #121 // class java/lang/String\n 69: astore 8\n 71: astore 10\n 73: iconst_0\n 74: istore 9\n 76: aload 8\n 78: invokestatic #125 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 81: nop\n 82: invokestatic #31 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 85: aload 10\n 87: swap\n 88: invokeinterface #126, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 93: pop\n 94: goto 43\n 97: aload 4\n 99: checkcast #128 // class java/util/List\n 102: nop\n 103: astore_0\n 104: aload_0\n 105: iconst_0\n 106: invokeinterface #132, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 111: checkcast #134 // class java/lang/Number\n 114: invokevirtual #135 // Method java/lang/Number.intValue:()I\n 117: istore_1\n 118: aload_0\n 119: iconst_1\n 120: invokeinterface #132, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 125: checkcast #134 // class java/lang/Number\n 128: invokevirtual #135 // Method java/lang/Number.intValue:()I\n 131: istore_2\n 132: iload_1\n 133: iload_2\n 134: invokestatic #137 // Method asPower2Sum:(II)Ljava/util/List;\n 137: astore_3\n 138: aload_3\n 139: ifnull 186\n 142: aload_3\n 143: astore 5\n 145: iconst_0\n 146: istore 6\n 148: ldc #139 // String YES\n 150: getstatic #145 // Field java/lang/System.out:Ljava/io/PrintStream;\n 153: swap\n 154: invokevirtual #150 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 157: aload 5\n 159: checkcast #73 // class java/lang/Iterable\n 162: ldc #152 // String\n 164: checkcast #9 // class java/lang/CharSequence\n 167: aconst_null\n 168: aconst_null\n 169: iconst_0\n 170: aconst_null\n 171: aconst_null\n 172: bipush 62\n 174: aconst_null\n 175: invokestatic #156 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 178: getstatic #145 // Field java/lang/System.out:Ljava/io/PrintStream;\n 181: swap\n 182: invokevirtual #150 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 185: return\n 186: ldc #158 // String NO\n 188: getstatic #145 // Field java/lang/System.out:Ljava/io/PrintStream;\n 191: swap\n 192: invokevirtual #150 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 195: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #174 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
austin226__codeforces-kt__4377021/contest1907/src/main/kotlin/CFixed.kt
import kotlin.streams.toList // https://codeforces.com/contest/1907/problem/C private fun readInt(): Int = readln().toInt() private fun <T> List<T>.counts(): Map<T, Int> = this.groupingBy { it }.eachCount() private fun solve(n: Int, s: String): Int { // https://codeforces.com/blog/entry/123012 // The final string will always have all of the same characters. // If a character appears more than n/2 times, the final string will consist only of that character. val charCounts = s.chars().toList().counts().toMutableMap() var dominantChar: Int? = null var dominantCharCount: Int? = null for (charCount in charCounts) { if (charCount.value > n / 2) { // One char dominates dominantChar = charCount.key dominantCharCount = charCount.value break } } if (dominantChar == null || dominantCharCount == null) { // No character dominates - all pairs can be deleted return n % 2 } charCounts.remove(dominantChar) return dominantCharCount - charCounts.values.sum() } private fun testcase() { val n = readInt() val s = readln() val min = solve(n, s) println(min) } fun main() { // val min = solve(20000, "abacd".repeat(20000 / 5)) // val min = solve(2000, "aaacd".repeat(2000 / 5)) // println(min) // return val t = readInt() for (i in 0..<t) { testcase() } }
[ { "class_path": "austin226__codeforces-kt__4377021/CFixedKt$counts$$inlined$groupingBy$1.class", "javap": "Compiled from \"_Collections.kt\"\npublic final class CFixedKt$counts$$inlined$groupingBy$1 implements kotlin.collections.Grouping<T, T> {\n final java.lang.Iterable $this_groupingBy;\n\n public CFixedKt$counts$$inlined$groupingBy$1(java.lang.Iterable);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #18 // Field $this_groupingBy:Ljava/lang/Iterable;\n 5: aload_0\n 6: invokespecial #21 // Method java/lang/Object.\"<init>\":()V\n 9: return\n\n public java.util.Iterator<T> sourceIterator();\n Code:\n 0: aload_0\n 1: getfield #18 // Field $this_groupingBy:Ljava/lang/Iterable;\n 4: invokeinterface #32, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 9: areturn\n\n public T keyOf(T);\n Code:\n 0: aload_1\n 1: astore_2\n 2: iconst_0\n 3: istore_3\n 4: aload_2\n 5: areturn\n}\n", "javap_err": "" }, { "class_path": "austin226__codeforces-kt__4377021/CFixedKt.class", "javap": "Compiled from \"CFixed.kt\"\npublic final class CFixedKt {\n private static final int readInt();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 3: invokestatic #18 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 6: ireturn\n\n private static final <T> java.util.Map<T, java.lang.Integer> counts(java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: checkcast #23 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: new #25 // class CFixedKt$counts$$inlined$groupingBy$1\n 10: dup\n 11: aload_1\n 12: invokespecial #29 // Method CFixedKt$counts$$inlined$groupingBy$1.\"<init>\":(Ljava/lang/Iterable;)V\n 15: checkcast #31 // class kotlin/collections/Grouping\n 18: invokestatic #37 // Method kotlin/collections/GroupingKt.eachCount:(Lkotlin/collections/Grouping;)Ljava/util/Map;\n 21: areturn\n\n private static final int solve(int, java.lang.String);\n Code:\n 0: aload_1\n 1: invokevirtual #51 // Method java/lang/String.chars:()Ljava/util/stream/IntStream;\n 4: dup\n 5: ldc #53 // String chars(...)\n 7: invokestatic #59 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 10: invokestatic #65 // Method kotlin/streams/jdk8/StreamsKt.toList:(Ljava/util/stream/IntStream;)Ljava/util/List;\n 13: invokestatic #67 // Method counts:(Ljava/util/List;)Ljava/util/Map;\n 16: invokestatic #73 // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;\n 19: astore_2\n 20: aconst_null\n 21: astore_3\n 22: aconst_null\n 23: astore 4\n 25: aload_2\n 26: invokeinterface #79, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 31: invokeinterface #85, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 36: astore 5\n 38: aload 5\n 40: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 45: ifeq 105\n 48: aload 5\n 50: invokeinterface #95, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 55: checkcast #97 // class java/util/Map$Entry\n 58: astore 6\n 60: aload 6\n 62: invokeinterface #100, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 67: checkcast #102 // class java/lang/Number\n 70: invokevirtual #105 // Method java/lang/Number.intValue:()I\n 73: iload_0\n 74: iconst_2\n 75: idiv\n 76: if_icmple 38\n 79: aload 6\n 81: invokeinterface #108, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 86: checkcast #14 // class java/lang/Integer\n 89: astore_3\n 90: aload 6\n 92: invokeinterface #100, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 97: checkcast #14 // class java/lang/Integer\n 100: astore 4\n 102: goto 105\n 105: aload_3\n 106: ifnull 114\n 109: aload 4\n 111: ifnonnull 118\n 114: iload_0\n 115: iconst_2\n 116: irem\n 117: ireturn\n 118: aload_2\n 119: aload_3\n 120: invokeinterface #112, 2 // InterfaceMethod java/util/Map.remove:(Ljava/lang/Object;)Ljava/lang/Object;\n 125: pop\n 126: aload 4\n 128: invokevirtual #113 // Method java/lang/Integer.intValue:()I\n 131: aload_2\n 132: invokeinterface #117, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 137: checkcast #23 // class java/lang/Iterable\n 140: invokestatic #123 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I\n 143: isub\n 144: ireturn\n\n private static final void testcase();\n Code:\n 0: invokestatic #137 // Method readInt:()I\n 3: istore_0\n 4: invokestatic #12 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 7: astore_1\n 8: iload_0\n 9: aload_1\n 10: invokestatic #139 // Method solve:(ILjava/lang/String;)I\n 13: istore_2\n 14: getstatic #145 // Field java/lang/System.out:Ljava/io/PrintStream;\n 17: iload_2\n 18: invokevirtual #151 // Method java/io/PrintStream.println:(I)V\n 21: return\n\n public static final void main();\n Code:\n 0: invokestatic #137 // Method readInt:()I\n 3: istore_0\n 4: iconst_0\n 5: istore_1\n 6: iload_1\n 7: iload_0\n 8: if_icmpge 20\n 11: invokestatic #155 // Method testcase:()V\n 14: iinc 1, 1\n 17: goto 6\n 20: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #160 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
austin226__codeforces-kt__4377021/contest1907/src/main/kotlin/D.kt
import kotlin.math.max import kotlin.math.min // https://codeforces.com/contest/1907/problem/D private fun String.splitWhitespace() = split("\\s+".toRegex()) private fun readInt(): Int = readln().toInt() private fun readInts(): List<Int> = readln().splitWhitespace().map { it.toInt() } private fun testK(segments: List<IntRange>, k: Int): Boolean { var location = 0..0 for (segment in segments) { // Our location becomes the intersection of this segment, with the locations we can be after // jumping up to k. val locMin = max(0, location.first - k) val locMax = min(1_000_000_000, location.last + k) location = max(locMin, segment.first)..min(locMax, segment.last) // If the intersection is empty, return false. if (location.isEmpty()) { return false } } return true } private fun solve(segments: List<IntRange>): Int { // Find smallest k where testK is true var kL = 0 var kR = 1_000_000_000 var minPassed = kR while (kL < kR) { val kM = (kL + kR) / 2 if (testK(segments, kM)) { minPassed = min(minPassed, kM) // try smaller kR = kM - 1 } else { // Try bigger kL = kM + 1 } } if (kL == kR) { if (testK(segments, kL)) { minPassed = min(minPassed, kL) } } return minPassed } private fun testcase() { val n = readInt() val segments = MutableList(n) { 0..0 } for (i in 0..<n) { val lr = readInts() val l = lr[0] val r = lr[1] segments[i] = l..r } println(solve(segments)) } fun main() { val t = readInt() for (i in 0..<t) { testcase() } }
[ { "class_path": "austin226__codeforces-kt__4377021/DKt.class", "javap": "Compiled from \"D.kt\"\npublic final class DKt {\n private static final java.util.List<java.lang.String> splitWhitespace(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #9 // class java/lang/CharSequence\n 4: astore_1\n 5: new #11 // class kotlin/text/Regex\n 8: dup\n 9: ldc #13 // String \\\\s+\n 11: invokespecial #17 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 14: astore_2\n 15: iconst_0\n 16: istore_3\n 17: aload_2\n 18: aload_1\n 19: iload_3\n 20: invokevirtual #21 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 23: areturn\n\n private static final int readInt();\n Code:\n 0: invokestatic #31 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 3: invokestatic #37 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 6: ireturn\n\n private static final java.util.List<java.lang.Integer> readInts();\n Code:\n 0: invokestatic #31 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 3: invokestatic #42 // Method splitWhitespace:(Ljava/lang/String;)Ljava/util/List;\n 6: checkcast #44 // class java/lang/Iterable\n 9: astore_0\n 10: iconst_0\n 11: istore_1\n 12: aload_0\n 13: astore_2\n 14: new #46 // class java/util/ArrayList\n 17: dup\n 18: aload_0\n 19: bipush 10\n 21: invokestatic #52 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 24: invokespecial #55 // Method java/util/ArrayList.\"<init>\":(I)V\n 27: checkcast #57 // class java/util/Collection\n 30: astore_3\n 31: iconst_0\n 32: istore 4\n 34: aload_2\n 35: invokeinterface #61, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 40: astore 5\n 42: aload 5\n 44: invokeinterface #67, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 49: ifeq 95\n 52: aload 5\n 54: invokeinterface #71, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 59: astore 6\n 61: aload_3\n 62: aload 6\n 64: checkcast #73 // class java/lang/String\n 67: astore 7\n 69: astore 9\n 71: iconst_0\n 72: istore 8\n 74: aload 7\n 76: invokestatic #37 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 79: nop\n 80: invokestatic #77 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 83: aload 9\n 85: swap\n 86: invokeinterface #81, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 91: pop\n 92: goto 42\n 95: aload_3\n 96: checkcast #83 // class java/util/List\n 99: nop\n 100: areturn\n\n private static final boolean testK(java.util.List<kotlin.ranges.IntRange>, int);\n Code:\n 0: new #100 // class kotlin/ranges/IntRange\n 3: dup\n 4: iconst_0\n 5: iconst_0\n 6: invokespecial #103 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 9: astore_2\n 10: aload_0\n 11: invokeinterface #104, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 16: astore_3\n 17: aload_3\n 18: invokeinterface #67, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 23: ifeq 99\n 26: aload_3\n 27: invokeinterface #71, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 32: checkcast #100 // class kotlin/ranges/IntRange\n 35: astore 4\n 37: iconst_0\n 38: aload_2\n 39: invokevirtual #107 // Method kotlin/ranges/IntRange.getFirst:()I\n 42: iload_1\n 43: isub\n 44: invokestatic #113 // Method java/lang/Math.max:(II)I\n 47: istore 5\n 49: ldc #114 // int 1000000000\n 51: aload_2\n 52: invokevirtual #117 // Method kotlin/ranges/IntRange.getLast:()I\n 55: iload_1\n 56: iadd\n 57: invokestatic #120 // Method java/lang/Math.min:(II)I\n 60: istore 6\n 62: new #100 // class kotlin/ranges/IntRange\n 65: dup\n 66: iload 5\n 68: aload 4\n 70: invokevirtual #107 // Method kotlin/ranges/IntRange.getFirst:()I\n 73: invokestatic #113 // Method java/lang/Math.max:(II)I\n 76: iload 6\n 78: aload 4\n 80: invokevirtual #117 // Method kotlin/ranges/IntRange.getLast:()I\n 83: invokestatic #120 // Method java/lang/Math.min:(II)I\n 86: invokespecial #103 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 89: astore_2\n 90: aload_2\n 91: invokevirtual #123 // Method kotlin/ranges/IntRange.isEmpty:()Z\n 94: ifeq 17\n 97: iconst_0\n 98: ireturn\n 99: iconst_1\n 100: ireturn\n\n private static final int solve(java.util.List<kotlin.ranges.IntRange>);\n Code:\n 0: iconst_0\n 1: istore_1\n 2: ldc #114 // int 1000000000\n 4: istore_2\n 5: iload_2\n 6: istore_3\n 7: iload_1\n 8: iload_2\n 9: if_icmpge 51\n 12: iload_1\n 13: iload_2\n 14: iadd\n 15: iconst_2\n 16: idiv\n 17: istore 4\n 19: aload_0\n 20: iload 4\n 22: invokestatic #136 // Method testK:(Ljava/util/List;I)Z\n 25: ifeq 43\n 28: iload_3\n 29: iload 4\n 31: invokestatic #120 // Method java/lang/Math.min:(II)I\n 34: istore_3\n 35: iload 4\n 37: iconst_1\n 38: isub\n 39: istore_2\n 40: goto 7\n 43: iload 4\n 45: iconst_1\n 46: iadd\n 47: istore_1\n 48: goto 7\n 51: iload_1\n 52: iload_2\n 53: if_icmpne 70\n 56: aload_0\n 57: iload_1\n 58: invokestatic #136 // Method testK:(Ljava/util/List;I)Z\n 61: ifeq 70\n 64: iload_3\n 65: iload_1\n 66: invokestatic #120 // Method java/lang/Math.min:(II)I\n 69: istore_3\n 70: iload_3\n 71: ireturn\n\n private static final void testcase();\n Code:\n 0: invokestatic #144 // Method readInt:()I\n 3: istore_0\n 4: new #46 // class java/util/ArrayList\n 7: dup\n 8: iload_0\n 9: invokespecial #55 // Method java/util/ArrayList.\"<init>\":(I)V\n 12: astore_2\n 13: iconst_0\n 14: istore_3\n 15: iload_3\n 16: iload_0\n 17: if_icmpge 55\n 20: iload_3\n 21: istore 4\n 23: aload_2\n 24: iload 4\n 26: istore 5\n 28: astore 7\n 30: iconst_0\n 31: istore 6\n 33: new #100 // class kotlin/ranges/IntRange\n 36: dup\n 37: iconst_0\n 38: iconst_0\n 39: invokespecial #103 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 42: aload 7\n 44: swap\n 45: invokevirtual #145 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 48: pop\n 49: iinc 3, 1\n 52: goto 15\n 55: aload_2\n 56: checkcast #83 // class java/util/List\n 59: astore_1\n 60: iconst_0\n 61: istore_2\n 62: iload_2\n 63: iload_0\n 64: if_icmpge 126\n 67: invokestatic #147 // Method readInts:()Ljava/util/List;\n 70: astore_3\n 71: aload_3\n 72: iconst_0\n 73: invokeinterface #151, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 78: checkcast #153 // class java/lang/Number\n 81: invokevirtual #156 // Method java/lang/Number.intValue:()I\n 84: istore 4\n 86: aload_3\n 87: iconst_1\n 88: invokeinterface #151, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 93: checkcast #153 // class java/lang/Number\n 96: invokevirtual #156 // Method java/lang/Number.intValue:()I\n 99: istore 5\n 101: aload_1\n 102: iload_2\n 103: new #100 // class kotlin/ranges/IntRange\n 106: dup\n 107: iload 4\n 109: iload 5\n 111: invokespecial #103 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 114: invokeinterface #160, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 119: pop\n 120: iinc 2, 1\n 123: goto 62\n 126: aload_1\n 127: invokestatic #162 // Method solve:(Ljava/util/List;)I\n 130: istore_2\n 131: getstatic #168 // Field java/lang/System.out:Ljava/io/PrintStream;\n 134: iload_2\n 135: invokevirtual #173 // Method java/io/PrintStream.println:(I)V\n 138: return\n\n public static final void main();\n Code:\n 0: invokestatic #144 // Method readInt:()I\n 3: istore_0\n 4: iconst_0\n 5: istore_1\n 6: iload_1\n 7: iload_0\n 8: if_icmpge 20\n 11: invokestatic #182 // Method testcase:()V\n 14: iinc 1, 1\n 17: goto 6\n 20: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #186 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
austin226__codeforces-kt__4377021/codeforces/src/main/kotlin/contest1911/G.kt
import java.math.BigInteger private fun String.splitWhitespace() = split("\\s+".toRegex()) // s1 and s2 both have the same length fun averageString(s1: String, s2: String, len: Int): String { // // Work backwards from the end // val avgStrChars = MutableList<Char>(len) { '?' } // var remainder = 0 // for (i in len - 1 downTo 0) { // // Add the chars together, then divide by two // val c1Val = s1[i] - 'a' // val c2Val = s2[i] - 'a' // val (avgC, nextRemainder) = if (c1Val == c2Val) { // Pair(c1Val, 0) // } else if (c1Val < c2Val) { // Pair((c1Val + c2Val) / 2, 0) // } else { // // c1Val > c2Val // Pair((c1Val + c2Val + 26) / 2, -1) // } // // avgStrChars[i] = (remainder + avgC % 26 + ('a'.code)).toChar() // remainder = if (c1Val + c2Val > 25) 1 else 0 // } // // return avgStrChars.joinToString("") var s1Num = BigInteger.ZERO var s2Num = BigInteger.ZERO for (i in 0 until len) { val c1Val = (s1[i] - 'a').toLong() val c2Val = (s2[i] - 'a').toLong() val placeFactor = BigInteger.valueOf(26).pow(len - i - 1) s1Num = s1Num.plus(BigInteger.valueOf(c1Val).times(placeFactor)) s2Num = s2Num.plus(BigInteger.valueOf(c2Val).times(placeFactor)) } val sAvg = s1Num.plus(s2Num).divide(BigInteger.valueOf(2)) val resChars = mutableListOf<Char>() var rem = sAvg var exp = len - 1 while (exp >= 0) { val divisor = BigInteger.valueOf(26).pow(exp) val n = rem.divide(divisor).toInt() rem = rem.mod(divisor) exp-- val c = (n + 'a'.code).toChar() resChars.add(c) } return resChars.joinToString("") } fun main() { // len(s) = len(t) = k // k in 1..=2e5 val k = readln().toInt() val s = readln() val t = readln() // Find the median string that is (> s) and (< t) // We know there are an odd number of such strings // Median will be the same as the mean // Treat strings like k-digit numbers in base 26. println(averageString(s, t, k)) }
[ { "class_path": "austin226__codeforces-kt__4377021/GKt.class", "javap": "Compiled from \"G.kt\"\npublic final class GKt {\n private static final java.util.List<java.lang.String> splitWhitespace(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #9 // class java/lang/CharSequence\n 4: astore_1\n 5: new #11 // class kotlin/text/Regex\n 8: dup\n 9: ldc #13 // String \\\\s+\n 11: invokespecial #17 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 14: astore_2\n 15: iconst_0\n 16: istore_3\n 17: aload_2\n 18: aload_1\n 19: iload_3\n 20: invokevirtual #21 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 23: areturn\n\n public static final java.lang.String averageString(java.lang.String, java.lang.String, int);\n Code:\n 0: aload_0\n 1: ldc #28 // String s1\n 3: invokestatic #34 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #36 // String s2\n 9: invokestatic #34 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: getstatic #42 // Field java/math/BigInteger.ZERO:Ljava/math/BigInteger;\n 15: astore_3\n 16: getstatic #42 // Field java/math/BigInteger.ZERO:Ljava/math/BigInteger;\n 19: astore 4\n 21: iconst_0\n 22: istore 5\n 24: iload 5\n 26: iload_2\n 27: if_icmpge 192\n 30: aload_0\n 31: iload 5\n 33: invokevirtual #48 // Method java/lang/String.charAt:(I)C\n 36: bipush 97\n 38: isub\n 39: i2l\n 40: lstore 6\n 42: aload_1\n 43: iload 5\n 45: invokevirtual #48 // Method java/lang/String.charAt:(I)C\n 48: bipush 97\n 50: isub\n 51: i2l\n 52: lstore 8\n 54: ldc2_w #49 // long 26l\n 57: invokestatic #54 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 60: iload_2\n 61: iload 5\n 63: isub\n 64: iconst_1\n 65: isub\n 66: invokevirtual #58 // Method java/math/BigInteger.pow:(I)Ljava/math/BigInteger;\n 69: astore 10\n 71: aload_3\n 72: astore 11\n 74: aload 11\n 76: invokestatic #62 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 79: aload 11\n 81: astore 11\n 83: lload 6\n 85: invokestatic #54 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 88: dup\n 89: ldc #64 // String valueOf(...)\n 91: invokestatic #67 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 94: astore 12\n 96: aload 10\n 98: invokestatic #62 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 101: aload 12\n 103: aload 10\n 105: invokevirtual #71 // Method java/math/BigInteger.multiply:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 108: dup\n 109: ldc #73 // String multiply(...)\n 111: invokestatic #67 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 114: astore 12\n 116: aload 11\n 118: aload 12\n 120: invokevirtual #76 // Method java/math/BigInteger.add:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 123: dup\n 124: ldc #78 // String add(...)\n 126: invokestatic #67 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 129: astore_3\n 130: aload 4\n 132: astore 11\n 134: aload 11\n 136: invokestatic #62 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 139: aload 11\n 141: astore 11\n 143: lload 8\n 145: invokestatic #54 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 148: dup\n 149: ldc #64 // String valueOf(...)\n 151: invokestatic #67 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 154: astore 12\n 156: aload 12\n 158: aload 10\n 160: invokevirtual #71 // Method java/math/BigInteger.multiply:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 163: dup\n 164: ldc #73 // String multiply(...)\n 166: invokestatic #67 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 169: astore 12\n 171: aload 11\n 173: aload 12\n 175: invokevirtual #76 // Method java/math/BigInteger.add:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 178: dup\n 179: ldc #78 // String add(...)\n 181: invokestatic #67 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 184: astore 4\n 186: iinc 5, 1\n 189: goto 24\n 192: aload_3\n 193: astore 6\n 195: aload 6\n 197: invokestatic #62 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 200: aload 6\n 202: astore 6\n 204: aload 4\n 206: astore 7\n 208: aload 7\n 210: invokestatic #62 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 213: aload 6\n 215: aload 7\n 217: invokevirtual #76 // Method java/math/BigInteger.add:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 220: dup\n 221: ldc #78 // String add(...)\n 223: invokestatic #67 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 226: ldc2_w #79 // long 2l\n 229: invokestatic #54 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 232: invokevirtual #83 // Method java/math/BigInteger.divide:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 235: astore 5\n 237: new #85 // class java/util/ArrayList\n 240: dup\n 241: invokespecial #88 // Method java/util/ArrayList.\"<init>\":()V\n 244: checkcast #90 // class java/util/List\n 247: astore 6\n 249: aload 5\n 251: astore 7\n 253: iload_2\n 254: iconst_1\n 255: isub\n 256: istore 8\n 258: iload 8\n 260: iflt 324\n 263: ldc2_w #49 // long 26l\n 266: invokestatic #54 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 269: iload 8\n 271: invokevirtual #58 // Method java/math/BigInteger.pow:(I)Ljava/math/BigInteger;\n 274: astore 9\n 276: aload 7\n 278: aload 9\n 280: invokevirtual #83 // Method java/math/BigInteger.divide:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 283: invokevirtual #94 // Method java/math/BigInteger.intValue:()I\n 286: istore 10\n 288: aload 7\n 290: aload 9\n 292: invokevirtual #97 // Method java/math/BigInteger.mod:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 295: astore 7\n 297: iinc 8, -1\n 300: iload 10\n 302: bipush 97\n 304: iadd\n 305: i2c\n 306: istore 11\n 308: aload 6\n 310: iload 11\n 312: invokestatic #102 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 315: invokeinterface #105, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 320: pop\n 321: goto 258\n 324: aload 6\n 326: checkcast #107 // class java/lang/Iterable\n 329: ldc #109 // String\n 331: checkcast #9 // class java/lang/CharSequence\n 334: aconst_null\n 335: aconst_null\n 336: iconst_0\n 337: aconst_null\n 338: aconst_null\n 339: bipush 62\n 341: aconst_null\n 342: invokestatic #115 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 345: areturn\n\n public static final void main();\n Code:\n 0: invokestatic #140 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 3: invokestatic #146 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 6: istore_0\n 7: invokestatic #140 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 10: astore_1\n 11: invokestatic #140 // Method kotlin/io/ConsoleKt.readln:()Ljava/lang/String;\n 14: astore_2\n 15: aload_1\n 16: aload_2\n 17: iload_0\n 18: invokestatic #148 // Method averageString:(Ljava/lang/String;Ljava/lang/String;I)Ljava/lang/String;\n 21: getstatic #154 // Field java/lang/System.out:Ljava/io/PrintStream;\n 24: swap\n 25: invokevirtual #159 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 28: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #165 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day24.kt
fun main() { val directions = mapOf('<' to Vector3d.LEFT, '>' to Vector3d.RIGHT, '^' to Vector3d.UP, 'v' to Vector3d.DOWN) val neighboursInTime = directions.values.map { it + Vector3d.BACK }.toSet() + Vector3d.BACK val start = Vector3d(0, -1, 0) fun isEmpty(positionInTime: Vector3d, width: Int, height: Int, initialState: Map<Vector3d, Vector3d?>, start: Vector3d, end: Vector2d) = when { (positionInTime.x == start.x && positionInTime.y == start.y) || (positionInTime.x == end.x && positionInTime.y == end.y) -> true // start or end is OK positionInTime.x !in (0 until width) || positionInTime.y !in (0 until height) -> false directions.values.map { direction -> Pair((Vector3d(positionInTime.x, positionInTime.y, 0) - direction * positionInTime.z).apply { x = (width + (x % width)) % width y = (height + (y % height)) % height }, direction) }.any { (possibleBlizzard, direction) -> possibleBlizzard in initialState && initialState[possibleBlizzard] == direction } -> false else -> true } fun neighbours(node: Vector3d, start: Vector3d, end: Vector2d, width: Int, height: Int, initialState: Map<Vector3d, Vector3d?>): Set<Vector3d> { return neighboursInTime.map { node + it }.filter { isEmpty(it, width, height, initialState, start, end) }.toSet() } fun part1(input: List<String>): Int { val grid = Grid(input.map { it.toCharArray().toList() }) val width = grid.width - 2 val height = grid.height - 2 val end = Vector2d(width - 1, height) val initialState = grid.data.flatten().filter { it.value in directions }.associate { Vector3d(it.position.x, it.position.y, 0) - Vector3d(1, 1, 0) to directions[it.value] } val path = aStar( start = start, isEndNode = { node -> node.x == end.x && node.y == end.y }, heuristic = { (end - Vector2d(it.x, it.y)).manhattan() }, neighbours = { node -> neighbours(node, start, end, width, height, initialState) }) return path.size - 1 } fun part2(input: List<String>): Int { val grid = Grid(input.map { it.toCharArray().toList() }) val width = grid.width - 2 val height = grid.height - 2 val end = Vector2d(width - 1, height) val initialState = grid.data.flatten().filter { it.value in directions }.associate { Vector3d(it.position.x, it.position.y, 0) - Vector3d(1, 1, 0) to directions[it.value] } val path1 = aStar( start = start, isEndNode = { node -> node.x == end.x && node.y == end.y }, heuristic = { (end - Vector2d(it.x, it.y)).manhattan() }, neighbours = { node -> neighbours(node, start, end, width, height, initialState) }) val path2 = aStar( start = path1.first(), isEndNode = { node -> node.x == 0 && node.y == -1 }, heuristic = { (end - Vector2d(it.x, it.y)).manhattan() }, neighbours = { node -> neighbours(node, start, end, width, height, initialState) }) val path3 = aStar( start = path2.first(), isEndNode = { node -> node.x == end.x && node.y == end.y }, heuristic = { (end - Vector2d(it.x, it.y)).manhattan() }, neighbours = { node -> neighbours(node, start, end, width, height, initialState) }) return path1.size + path2.size + path3.size - 3 } test( day = 24, testTarget1 = 18, testTarget2 = 54, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day24Kt$main$1.class", "javap": "Compiled from \"Day24.kt\"\nfinal class Day24Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final Vector3d $start;\n\n final java.util.Map<java.lang.Character, Vector3d> $directions;\n\n final java.util.Set<Vector3d> $neighboursInTime;\n\n Day24Kt$main$1(Vector3d, java.util.Map<java.lang.Character, Vector3d>, java.util.Set<Vector3d>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #14 // Field $start:LVector3d;\n 5: aload_0\n 6: aload_2\n 7: putfield #18 // Field $directions:Ljava/util/Map;\n 10: aload_0\n 11: aload_3\n 12: putfield #22 // Field $neighboursInTime:Ljava/util/Set;\n 15: aload_0\n 16: iconst_1\n 17: ldc #24 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 19: ldc #26 // String part1\n 21: ldc #28 // String main$part1(LVector3d;Ljava/util/Map;Ljava/util/Set;Ljava/util/List;)I\n 23: iconst_0\n 24: invokespecial #31 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 27: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #38 // String p0\n 3: invokestatic #44 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #14 // Field $start:LVector3d;\n 10: aload_0\n 11: getfield #18 // Field $directions:Ljava/util/Map;\n 14: aload_0\n 15: getfield #22 // Field $neighboursInTime:Ljava/util/Set;\n 18: aload_1\n 19: invokestatic #50 // Method Day24Kt.access$main$part1:(LVector3d;Ljava/util/Map;Ljava/util/Set;Ljava/util/List;)I\n 22: invokestatic #56 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #60 // class java/util/List\n 5: invokevirtual #62 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day24Kt$main$2.class", "javap": "Compiled from \"Day24.kt\"\nfinal class Day24Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final Vector3d $start;\n\n final java.util.Map<java.lang.Character, Vector3d> $directions;\n\n final java.util.Set<Vector3d> $neighboursInTime;\n\n Day24Kt$main$2(Vector3d, java.util.Map<java.lang.Character, Vector3d>, java.util.Set<Vector3d>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #14 // Field $start:LVector3d;\n 5: aload_0\n 6: aload_2\n 7: putfield #18 // Field $directions:Ljava/util/Map;\n 10: aload_0\n 11: aload_3\n 12: putfield #22 // Field $neighboursInTime:Ljava/util/Set;\n 15: aload_0\n 16: iconst_1\n 17: ldc #24 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 19: ldc #26 // String part2\n 21: ldc #28 // String main$part2(LVector3d;Ljava/util/Map;Ljava/util/Set;Ljava/util/List;)I\n 23: iconst_0\n 24: invokespecial #31 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 27: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #38 // String p0\n 3: invokestatic #44 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #14 // Field $start:LVector3d;\n 10: aload_0\n 11: getfield #18 // Field $directions:Ljava/util/Map;\n 14: aload_0\n 15: getfield #22 // Field $neighboursInTime:Ljava/util/Set;\n 18: aload_1\n 19: invokestatic #50 // Method Day24Kt.access$main$part2:(LVector3d;Ljava/util/Map;Ljava/util/Set;Ljava/util/List;)I\n 22: invokestatic #56 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #60 // class java/util/List\n 5: invokevirtual #62 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day24Kt.class", "javap": "Compiled from \"Day24.kt\"\npublic final class Day24Kt {\n public static final void main();\n Code:\n 0: iconst_4\n 1: anewarray #8 // class kotlin/Pair\n 4: astore_1\n 5: aload_1\n 6: iconst_0\n 7: bipush 60\n 9: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 12: getstatic #20 // Field Vector3d.Companion:LVector3d$Companion;\n 15: invokevirtual #26 // Method Vector3d$Companion.getLEFT:()LVector3d;\n 18: invokestatic #32 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 21: aastore\n 22: aload_1\n 23: iconst_1\n 24: bipush 62\n 26: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 29: getstatic #20 // Field Vector3d.Companion:LVector3d$Companion;\n 32: invokevirtual #35 // Method Vector3d$Companion.getRIGHT:()LVector3d;\n 35: invokestatic #32 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 38: aastore\n 39: aload_1\n 40: iconst_2\n 41: bipush 94\n 43: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 46: getstatic #20 // Field Vector3d.Companion:LVector3d$Companion;\n 49: invokevirtual #38 // Method Vector3d$Companion.getUP:()LVector3d;\n 52: invokestatic #32 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 55: aastore\n 56: aload_1\n 57: iconst_3\n 58: bipush 118\n 60: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 63: getstatic #20 // Field Vector3d.Companion:LVector3d$Companion;\n 66: invokevirtual #41 // Method Vector3d$Companion.getDOWN:()LVector3d;\n 69: invokestatic #32 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 72: aastore\n 73: aload_1\n 74: invokestatic #47 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 77: astore_0\n 78: aload_0\n 79: invokeinterface #53, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 84: checkcast #55 // class java/lang/Iterable\n 87: astore_2\n 88: iconst_0\n 89: istore_3\n 90: aload_2\n 91: astore 4\n 93: new #57 // class java/util/ArrayList\n 96: dup\n 97: aload_2\n 98: bipush 10\n 100: invokestatic #63 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 103: invokespecial #67 // Method java/util/ArrayList.\"<init>\":(I)V\n 106: checkcast #69 // class java/util/Collection\n 109: astore 5\n 111: iconst_0\n 112: istore 6\n 114: aload 4\n 116: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 121: astore 7\n 123: aload 7\n 125: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 130: ifeq 179\n 133: aload 7\n 135: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 140: astore 8\n 142: aload 5\n 144: aload 8\n 146: checkcast #16 // class Vector3d\n 149: astore 9\n 151: astore 11\n 153: iconst_0\n 154: istore 10\n 156: aload 9\n 158: getstatic #20 // Field Vector3d.Companion:LVector3d$Companion;\n 161: invokevirtual #86 // Method Vector3d$Companion.getBACK:()LVector3d;\n 164: invokevirtual #90 // Method Vector3d.plus:(LVector3d;)LVector3d;\n 167: aload 11\n 169: swap\n 170: invokeinterface #94, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 175: pop\n 176: goto 123\n 179: aload 5\n 181: checkcast #96 // class java/util/List\n 184: nop\n 185: checkcast #55 // class java/lang/Iterable\n 188: invokestatic #100 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 191: getstatic #20 // Field Vector3d.Companion:LVector3d$Companion;\n 194: invokevirtual #86 // Method Vector3d$Companion.getBACK:()LVector3d;\n 197: invokestatic #105 // Method kotlin/collections/SetsKt.plus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;\n 200: astore_1\n 201: new #16 // class Vector3d\n 204: dup\n 205: iconst_0\n 206: iconst_m1\n 207: iconst_0\n 208: invokespecial #108 // Method Vector3d.\"<init>\":(III)V\n 211: astore_2\n 212: bipush 24\n 214: bipush 18\n 216: invokestatic #113 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 219: bipush 54\n 221: invokestatic #113 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 224: new #115 // class Day24Kt$main$1\n 227: dup\n 228: aload_2\n 229: aload_0\n 230: aload_1\n 231: invokespecial #118 // Method Day24Kt$main$1.\"<init>\":(LVector3d;Ljava/util/Map;Ljava/util/Set;)V\n 234: checkcast #120 // class kotlin/jvm/functions/Function1\n 237: new #122 // class Day24Kt$main$2\n 240: dup\n 241: aload_2\n 242: aload_0\n 243: aload_1\n 244: invokespecial #123 // Method Day24Kt$main$2.\"<init>\":(LVector3d;Ljava/util/Map;Ljava/util/Set;)V\n 247: checkcast #120 // class kotlin/jvm/functions/Function1\n 250: invokestatic #129 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 253: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #152 // Method main:()V\n 3: return\n\n private static final boolean main$isEmpty(java.util.Map<java.lang.Character, Vector3d>, Vector3d, int, int, java.util.Map<Vector3d, Vector3d>, Vector3d, Vector2d);\n Code:\n 0: nop\n 1: aload_1\n 2: invokevirtual #161 // Method Vector3d.getX:()I\n 5: aload 5\n 7: invokevirtual #161 // Method Vector3d.getX:()I\n 10: if_icmpne 25\n 13: aload_1\n 14: invokevirtual #164 // Method Vector3d.getY:()I\n 17: aload 5\n 19: invokevirtual #164 // Method Vector3d.getY:()I\n 22: if_icmpeq 49\n 25: aload_1\n 26: invokevirtual #161 // Method Vector3d.getX:()I\n 29: aload 6\n 31: invokevirtual #167 // Method Vector2d.getX:()I\n 34: if_icmpne 53\n 37: aload_1\n 38: invokevirtual #164 // Method Vector3d.getY:()I\n 41: aload 6\n 43: invokevirtual #168 // Method Vector2d.getY:()I\n 46: if_icmpne 53\n 49: iconst_1\n 50: goto 449\n 53: aload_1\n 54: invokevirtual #161 // Method Vector3d.getX:()I\n 57: istore 7\n 59: iconst_0\n 60: iload 7\n 62: if_icmpgt 79\n 65: iload 7\n 67: iload_2\n 68: if_icmpge 75\n 71: iconst_1\n 72: goto 80\n 75: iconst_0\n 76: goto 80\n 79: iconst_0\n 80: ifeq 113\n 83: aload_1\n 84: invokevirtual #164 // Method Vector3d.getY:()I\n 87: istore 7\n 89: iconst_0\n 90: iload 7\n 92: if_icmpgt 109\n 95: iload 7\n 97: iload_3\n 98: if_icmpge 105\n 101: iconst_1\n 102: goto 110\n 105: iconst_0\n 106: goto 110\n 109: iconst_0\n 110: ifne 117\n 113: iconst_0\n 114: goto 449\n 117: aload_0\n 118: invokeinterface #53, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 123: checkcast #55 // class java/lang/Iterable\n 126: astore 7\n 128: iconst_0\n 129: istore 8\n 131: aload 7\n 133: astore 9\n 135: new #57 // class java/util/ArrayList\n 138: dup\n 139: aload 7\n 141: bipush 10\n 143: invokestatic #63 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 146: invokespecial #67 // Method java/util/ArrayList.\"<init>\":(I)V\n 149: checkcast #69 // class java/util/Collection\n 152: astore 10\n 154: iconst_0\n 155: istore 11\n 157: aload 9\n 159: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 164: astore 12\n 166: aload 12\n 168: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 173: ifeq 301\n 176: aload 12\n 178: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 183: astore 13\n 185: aload 10\n 187: aload 13\n 189: checkcast #16 // class Vector3d\n 192: astore 14\n 194: astore 19\n 196: iconst_0\n 197: istore 15\n 199: new #16 // class Vector3d\n 202: dup\n 203: aload_1\n 204: invokevirtual #161 // Method Vector3d.getX:()I\n 207: aload_1\n 208: invokevirtual #164 // Method Vector3d.getY:()I\n 211: iconst_0\n 212: invokespecial #108 // Method Vector3d.\"<init>\":(III)V\n 215: aload 14\n 217: aload_1\n 218: invokevirtual #171 // Method Vector3d.getZ:()I\n 221: invokevirtual #175 // Method Vector3d.times:(I)LVector3d;\n 224: invokevirtual #178 // Method Vector3d.minus:(LVector3d;)LVector3d;\n 227: astore 16\n 229: aload 16\n 231: astore 17\n 233: iconst_0\n 234: istore 18\n 236: aload 17\n 238: iload_2\n 239: aload 17\n 241: invokevirtual #161 // Method Vector3d.getX:()I\n 244: iload_2\n 245: irem\n 246: iadd\n 247: iload_2\n 248: irem\n 249: invokevirtual #181 // Method Vector3d.setX:(I)V\n 252: aload 17\n 254: iload_3\n 255: aload 17\n 257: invokevirtual #164 // Method Vector3d.getY:()I\n 260: iload_3\n 261: irem\n 262: iadd\n 263: iload_3\n 264: irem\n 265: invokevirtual #184 // Method Vector3d.setY:(I)V\n 268: nop\n 269: aload 16\n 271: aload 14\n 273: astore 20\n 275: astore 21\n 277: new #8 // class kotlin/Pair\n 280: dup\n 281: aload 21\n 283: aload 20\n 285: invokespecial #187 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 288: nop\n 289: aload 19\n 291: swap\n 292: invokeinterface #94, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 297: pop\n 298: goto 166\n 301: aload 10\n 303: checkcast #96 // class java/util/List\n 306: nop\n 307: checkcast #55 // class java/lang/Iterable\n 310: astore 7\n 312: nop\n 313: iconst_0\n 314: istore 8\n 316: aload 7\n 318: instanceof #69 // class java/util/Collection\n 321: ifeq 341\n 324: aload 7\n 326: checkcast #69 // class java/util/Collection\n 329: invokeinterface #190, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 334: ifeq 341\n 337: iconst_0\n 338: goto 441\n 341: aload 7\n 343: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 348: astore 9\n 350: aload 9\n 352: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 357: ifeq 440\n 360: aload 9\n 362: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 367: astore 10\n 369: aload 10\n 371: checkcast #8 // class kotlin/Pair\n 374: astore 11\n 376: iconst_0\n 377: istore 12\n 379: aload 11\n 381: invokevirtual #193 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 384: checkcast #16 // class Vector3d\n 387: astore 13\n 389: aload 11\n 391: invokevirtual #196 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 394: checkcast #16 // class Vector3d\n 397: astore 14\n 399: aload 4\n 401: aload 13\n 403: invokeinterface #199, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 408: ifeq 432\n 411: aload 4\n 413: aload 13\n 415: invokeinterface #203, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 420: aload 14\n 422: invokestatic #209 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 425: ifeq 432\n 428: iconst_1\n 429: goto 433\n 432: iconst_0\n 433: ifeq 350\n 436: iconst_1\n 437: goto 441\n 440: iconst_0\n 441: ifeq 448\n 444: iconst_0\n 445: goto 449\n 448: iconst_1\n 449: ireturn\n\n private static final java.util.Set<Vector3d> main$neighbours(java.util.Set<Vector3d>, java.util.Map<java.lang.Character, Vector3d>, Vector3d, Vector3d, Vector2d, int, int, java.util.Map<Vector3d, Vector3d>);\n Code:\n 0: aload_0\n 1: checkcast #55 // class java/lang/Iterable\n 4: astore 8\n 6: iconst_0\n 7: istore 9\n 9: aload 8\n 11: astore 10\n 13: new #57 // class java/util/ArrayList\n 16: dup\n 17: aload 8\n 19: bipush 10\n 21: invokestatic #63 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 24: invokespecial #67 // Method java/util/ArrayList.\"<init>\":(I)V\n 27: checkcast #69 // class java/util/Collection\n 30: astore 11\n 32: iconst_0\n 33: istore 12\n 35: aload 10\n 37: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 42: astore 13\n 44: aload 13\n 46: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 95\n 54: aload 13\n 56: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 61: astore 14\n 63: aload 11\n 65: aload 14\n 67: checkcast #16 // class Vector3d\n 70: astore 15\n 72: astore 17\n 74: iconst_0\n 75: istore 16\n 77: aload_2\n 78: aload 15\n 80: invokevirtual #90 // Method Vector3d.plus:(LVector3d;)LVector3d;\n 83: aload 17\n 85: swap\n 86: invokeinterface #94, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 91: pop\n 92: goto 44\n 95: aload 11\n 97: checkcast #96 // class java/util/List\n 100: nop\n 101: checkcast #55 // class java/lang/Iterable\n 104: astore 8\n 106: nop\n 107: iconst_0\n 108: istore 9\n 110: aload 8\n 112: astore 10\n 114: new #57 // class java/util/ArrayList\n 117: dup\n 118: invokespecial #229 // Method java/util/ArrayList.\"<init>\":()V\n 121: checkcast #69 // class java/util/Collection\n 124: astore 11\n 126: iconst_0\n 127: istore 12\n 129: aload 10\n 131: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 136: astore 13\n 138: aload 13\n 140: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 145: ifeq 198\n 148: aload 13\n 150: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 155: astore 14\n 157: aload 14\n 159: checkcast #16 // class Vector3d\n 162: astore 15\n 164: iconst_0\n 165: istore 16\n 167: aload_1\n 168: aload 15\n 170: iload 5\n 172: iload 6\n 174: aload 7\n 176: aload_3\n 177: aload 4\n 179: invokestatic #231 // Method main$isEmpty:(Ljava/util/Map;LVector3d;IILjava/util/Map;LVector3d;LVector2d;)Z\n 182: ifeq 138\n 185: aload 11\n 187: aload 14\n 189: invokeinterface #94, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 194: pop\n 195: goto 138\n 198: aload 11\n 200: checkcast #96 // class java/util/List\n 203: nop\n 204: checkcast #55 // class java/lang/Iterable\n 207: invokestatic #100 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 210: areturn\n\n private static final boolean main$part1$lambda$9(Vector2d, Vector3d);\n Code:\n 0: aload_1\n 1: ldc #244 // String node\n 3: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokevirtual #161 // Method Vector3d.getX:()I\n 10: aload_0\n 11: invokevirtual #167 // Method Vector2d.getX:()I\n 14: if_icmpne 32\n 17: aload_1\n 18: invokevirtual #164 // Method Vector3d.getY:()I\n 21: aload_0\n 22: invokevirtual #168 // Method Vector2d.getY:()I\n 25: if_icmpne 32\n 28: iconst_1\n 29: goto 33\n 32: iconst_0\n 33: ireturn\n\n private static final int main$part1$lambda$10(Vector2d, Vector3d);\n Code:\n 0: aload_1\n 1: ldc #252 // String it\n 3: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: new #166 // class Vector2d\n 10: dup\n 11: aload_1\n 12: invokevirtual #161 // Method Vector3d.getX:()I\n 15: aload_1\n 16: invokevirtual #164 // Method Vector3d.getY:()I\n 19: invokespecial #255 // Method Vector2d.\"<init>\":(II)V\n 22: invokevirtual #258 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 25: invokevirtual #261 // Method Vector2d.manhattan:()I\n 28: ireturn\n\n private static final java.util.Collection main$part1$lambda$11(Vector3d, Vector2d, int, int, java.util.Map, java.util.Set, java.util.Map, Vector3d);\n Code:\n 0: aload 7\n 2: ldc #244 // String node\n 4: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload 5\n 9: aload 6\n 11: aload 7\n 13: aload_0\n 14: aload_1\n 15: iload_2\n 16: iload_3\n 17: aload 4\n 19: invokestatic #265 // Method main$neighbours:(Ljava/util/Set;Ljava/util/Map;LVector3d;LVector3d;LVector2d;IILjava/util/Map;)Ljava/util/Set;\n 22: checkcast #69 // class java/util/Collection\n 25: areturn\n\n private static final int main$part1(Vector3d, java.util.Map<java.lang.Character, Vector3d>, java.util.Set<Vector3d>, java.util.List<java.lang.String>);\n Code:\n 0: aload_3\n 1: checkcast #55 // class java/lang/Iterable\n 4: astore 5\n 6: iconst_0\n 7: istore 6\n 9: aload 5\n 11: astore 7\n 13: new #57 // class java/util/ArrayList\n 16: dup\n 17: aload 5\n 19: bipush 10\n 21: invokestatic #63 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 24: invokespecial #67 // Method java/util/ArrayList.\"<init>\":(I)V\n 27: checkcast #69 // class java/util/Collection\n 30: astore 8\n 32: iconst_0\n 33: istore 9\n 35: aload 7\n 37: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 42: astore 10\n 44: aload 10\n 46: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 104\n 54: aload 10\n 56: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 61: astore 11\n 63: aload 8\n 65: aload 11\n 67: checkcast #276 // class java/lang/String\n 70: astore 12\n 72: astore 20\n 74: iconst_0\n 75: istore 13\n 77: aload 12\n 79: invokevirtual #280 // Method java/lang/String.toCharArray:()[C\n 82: dup\n 83: ldc_w #282 // String toCharArray(...)\n 86: invokestatic #285 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 89: invokestatic #291 // Method kotlin/collections/ArraysKt.toList:([C)Ljava/util/List;\n 92: aload 20\n 94: swap\n 95: invokeinterface #94, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 100: pop\n 101: goto 44\n 104: aload 8\n 106: checkcast #96 // class java/util/List\n 109: nop\n 110: astore 21\n 112: new #293 // class Grid\n 115: dup\n 116: aload 21\n 118: invokespecial #296 // Method Grid.\"<init>\":(Ljava/util/List;)V\n 121: astore 4\n 123: aload 4\n 125: invokevirtual #299 // Method Grid.getWidth:()I\n 128: iconst_2\n 129: isub\n 130: istore 5\n 132: aload 4\n 134: invokevirtual #302 // Method Grid.getHeight:()I\n 137: iconst_2\n 138: isub\n 139: istore 6\n 141: new #166 // class Vector2d\n 144: dup\n 145: iload 5\n 147: iconst_1\n 148: isub\n 149: iload 6\n 151: invokespecial #255 // Method Vector2d.\"<init>\":(II)V\n 154: astore 7\n 156: aload 4\n 158: invokevirtual #306 // Method Grid.getData:()Ljava/util/List;\n 161: checkcast #55 // class java/lang/Iterable\n 164: invokestatic #310 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 167: checkcast #55 // class java/lang/Iterable\n 170: astore 9\n 172: iconst_0\n 173: istore 10\n 175: aload 9\n 177: astore 11\n 179: new #57 // class java/util/ArrayList\n 182: dup\n 183: invokespecial #229 // Method java/util/ArrayList.\"<init>\":()V\n 186: checkcast #69 // class java/util/Collection\n 189: astore 12\n 191: iconst_0\n 192: istore 13\n 194: aload 11\n 196: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 201: astore 14\n 203: aload 14\n 205: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 210: ifeq 260\n 213: aload 14\n 215: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 220: astore 15\n 222: aload 15\n 224: checkcast #312 // class GridCell\n 227: astore 16\n 229: iconst_0\n 230: istore 17\n 232: aload_1\n 233: aload 16\n 235: invokevirtual #315 // Method GridCell.getValue:()Ljava/lang/Object;\n 238: invokeinterface #199, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 243: nop\n 244: ifeq 203\n 247: aload 12\n 249: aload 15\n 251: invokeinterface #94, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 256: pop\n 257: goto 203\n 260: aload 12\n 262: checkcast #96 // class java/util/List\n 265: nop\n 266: checkcast #55 // class java/lang/Iterable\n 269: astore 9\n 271: nop\n 272: iconst_0\n 273: istore 10\n 275: aload 9\n 277: bipush 10\n 279: invokestatic #63 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 282: invokestatic #319 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 285: bipush 16\n 287: invokestatic #325 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I\n 290: istore 11\n 292: aload 9\n 294: astore 12\n 296: new #327 // class java/util/LinkedHashMap\n 299: dup\n 300: iload 11\n 302: invokespecial #328 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 305: checkcast #49 // class java/util/Map\n 308: astore 13\n 310: iconst_0\n 311: istore 14\n 313: aload 12\n 315: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 320: astore 15\n 322: aload 15\n 324: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 329: ifeq 429\n 332: aload 15\n 334: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 339: astore 16\n 341: aload 13\n 343: astore 17\n 345: aload 16\n 347: checkcast #312 // class GridCell\n 350: astore 18\n 352: iconst_0\n 353: istore 19\n 355: new #16 // class Vector3d\n 358: dup\n 359: aload 18\n 361: invokevirtual #332 // Method GridCell.getPosition:()LVector2d;\n 364: invokevirtual #167 // Method Vector2d.getX:()I\n 367: aload 18\n 369: invokevirtual #332 // Method GridCell.getPosition:()LVector2d;\n 372: invokevirtual #168 // Method Vector2d.getY:()I\n 375: iconst_0\n 376: invokespecial #108 // Method Vector3d.\"<init>\":(III)V\n 379: new #16 // class Vector3d\n 382: dup\n 383: iconst_1\n 384: iconst_1\n 385: iconst_0\n 386: invokespecial #108 // Method Vector3d.\"<init>\":(III)V\n 389: invokevirtual #178 // Method Vector3d.minus:(LVector3d;)LVector3d;\n 392: aload_1\n 393: aload 18\n 395: invokevirtual #315 // Method GridCell.getValue:()Ljava/lang/Object;\n 398: invokeinterface #203, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 403: invokestatic #32 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 406: astore 18\n 408: aload 17\n 410: aload 18\n 412: invokevirtual #335 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 415: aload 18\n 417: invokevirtual #338 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 420: invokeinterface #342, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 425: pop\n 426: goto 322\n 429: aload 13\n 431: nop\n 432: astore 8\n 434: aload_0\n 435: aload 7\n 437: invokedynamic #359, 0 // InvokeDynamic #0:invoke:(LVector2d;)Lkotlin/jvm/functions/Function1;\n 442: aload 7\n 444: invokedynamic #365, 0 // InvokeDynamic #1:invoke:(LVector2d;)Lkotlin/jvm/functions/Function1;\n 449: aload_0\n 450: aload 7\n 452: iload 5\n 454: iload 6\n 456: aload 8\n 458: aload_2\n 459: aload_1\n 460: invokedynamic #373, 0 // InvokeDynamic #2:invoke:(LVector3d;LVector2d;IILjava/util/Map;Ljava/util/Set;Ljava/util/Map;)Lkotlin/jvm/functions/Function1;\n 465: invokestatic #377 // Method UtilsKt.aStar:(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/util/List;\n 468: astore 9\n 470: aload 9\n 472: invokeinterface #380, 1 // InterfaceMethod java/util/List.size:()I\n 477: iconst_1\n 478: isub\n 479: ireturn\n\n private static final boolean main$part2$lambda$15(Vector2d, Vector3d);\n Code:\n 0: aload_1\n 1: ldc #244 // String node\n 3: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokevirtual #161 // Method Vector3d.getX:()I\n 10: aload_0\n 11: invokevirtual #167 // Method Vector2d.getX:()I\n 14: if_icmpne 32\n 17: aload_1\n 18: invokevirtual #164 // Method Vector3d.getY:()I\n 21: aload_0\n 22: invokevirtual #168 // Method Vector2d.getY:()I\n 25: if_icmpne 32\n 28: iconst_1\n 29: goto 33\n 32: iconst_0\n 33: ireturn\n\n private static final int main$part2$lambda$16(Vector2d, Vector3d);\n Code:\n 0: aload_1\n 1: ldc #252 // String it\n 3: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: new #166 // class Vector2d\n 10: dup\n 11: aload_1\n 12: invokevirtual #161 // Method Vector3d.getX:()I\n 15: aload_1\n 16: invokevirtual #164 // Method Vector3d.getY:()I\n 19: invokespecial #255 // Method Vector2d.\"<init>\":(II)V\n 22: invokevirtual #258 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 25: invokevirtual #261 // Method Vector2d.manhattan:()I\n 28: ireturn\n\n private static final java.util.Collection main$part2$lambda$17(Vector3d, Vector2d, int, int, java.util.Map, java.util.Set, java.util.Map, Vector3d);\n Code:\n 0: aload 7\n 2: ldc #244 // String node\n 4: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload 5\n 9: aload 6\n 11: aload 7\n 13: aload_0\n 14: aload_1\n 15: iload_2\n 16: iload_3\n 17: aload 4\n 19: invokestatic #265 // Method main$neighbours:(Ljava/util/Set;Ljava/util/Map;LVector3d;LVector3d;LVector2d;IILjava/util/Map;)Ljava/util/Set;\n 22: checkcast #69 // class java/util/Collection\n 25: areturn\n\n private static final boolean main$part2$lambda$18(Vector3d);\n Code:\n 0: aload_0\n 1: ldc #244 // String node\n 3: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #161 // Method Vector3d.getX:()I\n 10: ifne 25\n 13: aload_0\n 14: invokevirtual #164 // Method Vector3d.getY:()I\n 17: iconst_m1\n 18: if_icmpne 25\n 21: iconst_1\n 22: goto 26\n 25: iconst_0\n 26: ireturn\n\n private static final int main$part2$lambda$19(Vector2d, Vector3d);\n Code:\n 0: aload_1\n 1: ldc #252 // String it\n 3: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: new #166 // class Vector2d\n 10: dup\n 11: aload_1\n 12: invokevirtual #161 // Method Vector3d.getX:()I\n 15: aload_1\n 16: invokevirtual #164 // Method Vector3d.getY:()I\n 19: invokespecial #255 // Method Vector2d.\"<init>\":(II)V\n 22: invokevirtual #258 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 25: invokevirtual #261 // Method Vector2d.manhattan:()I\n 28: ireturn\n\n private static final java.util.Collection main$part2$lambda$20(Vector3d, Vector2d, int, int, java.util.Map, java.util.Set, java.util.Map, Vector3d);\n Code:\n 0: aload 7\n 2: ldc #244 // String node\n 4: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload 5\n 9: aload 6\n 11: aload 7\n 13: aload_0\n 14: aload_1\n 15: iload_2\n 16: iload_3\n 17: aload 4\n 19: invokestatic #265 // Method main$neighbours:(Ljava/util/Set;Ljava/util/Map;LVector3d;LVector3d;LVector2d;IILjava/util/Map;)Ljava/util/Set;\n 22: checkcast #69 // class java/util/Collection\n 25: areturn\n\n private static final boolean main$part2$lambda$21(Vector2d, Vector3d);\n Code:\n 0: aload_1\n 1: ldc #244 // String node\n 3: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokevirtual #161 // Method Vector3d.getX:()I\n 10: aload_0\n 11: invokevirtual #167 // Method Vector2d.getX:()I\n 14: if_icmpne 32\n 17: aload_1\n 18: invokevirtual #164 // Method Vector3d.getY:()I\n 21: aload_0\n 22: invokevirtual #168 // Method Vector2d.getY:()I\n 25: if_icmpne 32\n 28: iconst_1\n 29: goto 33\n 32: iconst_0\n 33: ireturn\n\n private static final int main$part2$lambda$22(Vector2d, Vector3d);\n Code:\n 0: aload_1\n 1: ldc #252 // String it\n 3: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: new #166 // class Vector2d\n 10: dup\n 11: aload_1\n 12: invokevirtual #161 // Method Vector3d.getX:()I\n 15: aload_1\n 16: invokevirtual #164 // Method Vector3d.getY:()I\n 19: invokespecial #255 // Method Vector2d.\"<init>\":(II)V\n 22: invokevirtual #258 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 25: invokevirtual #261 // Method Vector2d.manhattan:()I\n 28: ireturn\n\n private static final java.util.Collection main$part2$lambda$23(Vector3d, Vector2d, int, int, java.util.Map, java.util.Set, java.util.Map, Vector3d);\n Code:\n 0: aload 7\n 2: ldc #244 // String node\n 4: invokestatic #248 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload 5\n 9: aload 6\n 11: aload 7\n 13: aload_0\n 14: aload_1\n 15: iload_2\n 16: iload_3\n 17: aload 4\n 19: invokestatic #265 // Method main$neighbours:(Ljava/util/Set;Ljava/util/Map;LVector3d;LVector3d;LVector2d;IILjava/util/Map;)Ljava/util/Set;\n 22: checkcast #69 // class java/util/Collection\n 25: areturn\n\n private static final int main$part2(Vector3d, java.util.Map<java.lang.Character, Vector3d>, java.util.Set<Vector3d>, java.util.List<java.lang.String>);\n Code:\n 0: aload_3\n 1: checkcast #55 // class java/lang/Iterable\n 4: astore 5\n 6: iconst_0\n 7: istore 6\n 9: aload 5\n 11: astore 7\n 13: new #57 // class java/util/ArrayList\n 16: dup\n 17: aload 5\n 19: bipush 10\n 21: invokestatic #63 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 24: invokespecial #67 // Method java/util/ArrayList.\"<init>\":(I)V\n 27: checkcast #69 // class java/util/Collection\n 30: astore 8\n 32: iconst_0\n 33: istore 9\n 35: aload 7\n 37: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 42: astore 10\n 44: aload 10\n 46: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 104\n 54: aload 10\n 56: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 61: astore 11\n 63: aload 8\n 65: aload 11\n 67: checkcast #276 // class java/lang/String\n 70: astore 12\n 72: astore 20\n 74: iconst_0\n 75: istore 13\n 77: aload 12\n 79: invokevirtual #280 // Method java/lang/String.toCharArray:()[C\n 82: dup\n 83: ldc_w #282 // String toCharArray(...)\n 86: invokestatic #285 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 89: invokestatic #291 // Method kotlin/collections/ArraysKt.toList:([C)Ljava/util/List;\n 92: aload 20\n 94: swap\n 95: invokeinterface #94, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 100: pop\n 101: goto 44\n 104: aload 8\n 106: checkcast #96 // class java/util/List\n 109: nop\n 110: astore 21\n 112: new #293 // class Grid\n 115: dup\n 116: aload 21\n 118: invokespecial #296 // Method Grid.\"<init>\":(Ljava/util/List;)V\n 121: astore 4\n 123: aload 4\n 125: invokevirtual #299 // Method Grid.getWidth:()I\n 128: iconst_2\n 129: isub\n 130: istore 5\n 132: aload 4\n 134: invokevirtual #302 // Method Grid.getHeight:()I\n 137: iconst_2\n 138: isub\n 139: istore 6\n 141: new #166 // class Vector2d\n 144: dup\n 145: iload 5\n 147: iconst_1\n 148: isub\n 149: iload 6\n 151: invokespecial #255 // Method Vector2d.\"<init>\":(II)V\n 154: astore 7\n 156: aload 4\n 158: invokevirtual #306 // Method Grid.getData:()Ljava/util/List;\n 161: checkcast #55 // class java/lang/Iterable\n 164: invokestatic #310 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 167: checkcast #55 // class java/lang/Iterable\n 170: astore 9\n 172: iconst_0\n 173: istore 10\n 175: aload 9\n 177: astore 11\n 179: new #57 // class java/util/ArrayList\n 182: dup\n 183: invokespecial #229 // Method java/util/ArrayList.\"<init>\":()V\n 186: checkcast #69 // class java/util/Collection\n 189: astore 12\n 191: iconst_0\n 192: istore 13\n 194: aload 11\n 196: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 201: astore 14\n 203: aload 14\n 205: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 210: ifeq 260\n 213: aload 14\n 215: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 220: astore 15\n 222: aload 15\n 224: checkcast #312 // class GridCell\n 227: astore 16\n 229: iconst_0\n 230: istore 17\n 232: aload_1\n 233: aload 16\n 235: invokevirtual #315 // Method GridCell.getValue:()Ljava/lang/Object;\n 238: invokeinterface #199, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 243: nop\n 244: ifeq 203\n 247: aload 12\n 249: aload 15\n 251: invokeinterface #94, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 256: pop\n 257: goto 203\n 260: aload 12\n 262: checkcast #96 // class java/util/List\n 265: nop\n 266: checkcast #55 // class java/lang/Iterable\n 269: astore 9\n 271: nop\n 272: iconst_0\n 273: istore 10\n 275: aload 9\n 277: bipush 10\n 279: invokestatic #63 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 282: invokestatic #319 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 285: bipush 16\n 287: invokestatic #325 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I\n 290: istore 11\n 292: aload 9\n 294: astore 12\n 296: new #327 // class java/util/LinkedHashMap\n 299: dup\n 300: iload 11\n 302: invokespecial #328 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 305: checkcast #49 // class java/util/Map\n 308: astore 13\n 310: iconst_0\n 311: istore 14\n 313: aload 12\n 315: invokeinterface #73, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 320: astore 15\n 322: aload 15\n 324: invokeinterface #79, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 329: ifeq 429\n 332: aload 15\n 334: invokeinterface #83, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 339: astore 16\n 341: aload 13\n 343: astore 17\n 345: aload 16\n 347: checkcast #312 // class GridCell\n 350: astore 18\n 352: iconst_0\n 353: istore 19\n 355: new #16 // class Vector3d\n 358: dup\n 359: aload 18\n 361: invokevirtual #332 // Method GridCell.getPosition:()LVector2d;\n 364: invokevirtual #167 // Method Vector2d.getX:()I\n 367: aload 18\n 369: invokevirtual #332 // Method GridCell.getPosition:()LVector2d;\n 372: invokevirtual #168 // Method Vector2d.getY:()I\n 375: iconst_0\n 376: invokespecial #108 // Method Vector3d.\"<init>\":(III)V\n 379: new #16 // class Vector3d\n 382: dup\n 383: iconst_1\n 384: iconst_1\n 385: iconst_0\n 386: invokespecial #108 // Method Vector3d.\"<init>\":(III)V\n 389: invokevirtual #178 // Method Vector3d.minus:(LVector3d;)LVector3d;\n 392: aload_1\n 393: aload 18\n 395: invokevirtual #315 // Method GridCell.getValue:()Ljava/lang/Object;\n 398: invokeinterface #203, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 403: invokestatic #32 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 406: astore 18\n 408: aload 17\n 410: aload 18\n 412: invokevirtual #335 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 415: aload 18\n 417: invokevirtual #338 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 420: invokeinterface #342, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 425: pop\n 426: goto 322\n 429: aload 13\n 431: nop\n 432: astore 8\n 434: aload_0\n 435: aload 7\n 437: invokedynamic #410, 0 // InvokeDynamic #3:invoke:(LVector2d;)Lkotlin/jvm/functions/Function1;\n 442: aload 7\n 444: invokedynamic #414, 0 // InvokeDynamic #4:invoke:(LVector2d;)Lkotlin/jvm/functions/Function1;\n 449: aload_0\n 450: aload 7\n 452: iload 5\n 454: iload 6\n 456: aload 8\n 458: aload_2\n 459: aload_1\n 460: invokedynamic #418, 0 // InvokeDynamic #5:invoke:(LVector3d;LVector2d;IILjava/util/Map;Ljava/util/Set;Ljava/util/Map;)Lkotlin/jvm/functions/Function1;\n 465: invokestatic #377 // Method UtilsKt.aStar:(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/util/List;\n 468: astore 9\n 470: aload 9\n 472: invokestatic #422 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 475: invokedynamic #428, 0 // InvokeDynamic #6:invoke:()Lkotlin/jvm/functions/Function1;\n 480: aload 7\n 482: invokedynamic #432, 0 // InvokeDynamic #7:invoke:(LVector2d;)Lkotlin/jvm/functions/Function1;\n 487: aload_0\n 488: aload 7\n 490: iload 5\n 492: iload 6\n 494: aload 8\n 496: aload_2\n 497: aload_1\n 498: invokedynamic #436, 0 // InvokeDynamic #8:invoke:(LVector3d;LVector2d;IILjava/util/Map;Ljava/util/Set;Ljava/util/Map;)Lkotlin/jvm/functions/Function1;\n 503: invokestatic #377 // Method UtilsKt.aStar:(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/util/List;\n 506: astore 10\n 508: aload 10\n 510: invokestatic #422 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 513: aload 7\n 515: invokedynamic #440, 0 // InvokeDynamic #9:invoke:(LVector2d;)Lkotlin/jvm/functions/Function1;\n 520: aload 7\n 522: invokedynamic #444, 0 // InvokeDynamic #10:invoke:(LVector2d;)Lkotlin/jvm/functions/Function1;\n 527: aload_0\n 528: aload 7\n 530: iload 5\n 532: iload 6\n 534: aload 8\n 536: aload_2\n 537: aload_1\n 538: invokedynamic #448, 0 // InvokeDynamic #11:invoke:(LVector3d;LVector2d;IILjava/util/Map;Ljava/util/Set;Ljava/util/Map;)Lkotlin/jvm/functions/Function1;\n 543: invokestatic #377 // Method UtilsKt.aStar:(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/util/List;\n 546: astore 11\n 548: aload 9\n 550: invokeinterface #380, 1 // InterfaceMethod java/util/List.size:()I\n 555: aload 10\n 557: invokeinterface #380, 1 // InterfaceMethod java/util/List.size:()I\n 562: iadd\n 563: aload 11\n 565: invokeinterface #380, 1 // InterfaceMethod java/util/List.size:()I\n 570: iadd\n 571: iconst_3\n 572: isub\n 573: ireturn\n\n public static final int access$main$part1(Vector3d, java.util.Map, java.util.Set, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: aload_3\n 4: invokestatic #457 // Method main$part1:(LVector3d;Ljava/util/Map;Ljava/util/Set;Ljava/util/List;)I\n 7: ireturn\n\n public static final int access$main$part2(Vector3d, java.util.Map, java.util.Set, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: aload_3\n 4: invokestatic #460 // Method main$part2:(LVector3d;Ljava/util/Map;Ljava/util/Set;Ljava/util/List;)I\n 7: ireturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Utils.kt
import java.io.File import java.math.BigInteger import kotlin.math.abs import kotlin.math.max fun readInput(name: String) = File("aoc2022/src", "$name.txt") .readLines() fun <T> assertEquals(value: T, target: T) { if (value != target) check(false) { "Expected $target got $value" } } fun String.destructured(regex: Regex): MatchResult.Destructured = regex.matchEntire(this) ?.destructured ?: throw IllegalArgumentException("Incorrect line $this") val intLineRegex = """-?\d+""".toRegex() fun String.ints() = intLineRegex.findAll(this).map { it.value.toInt() }.toList() fun <T> test( day: Int, testTarget1: T, testTarget2: T, part1: (List<String>) -> T, part2: (List<String>) -> T, ) { // test if implementation meets criteria from the description, like: val dayNumber = day.toString().padStart(2, '0') val testInput = readInput("Day${dayNumber}_test") val input = readInput("Day${dayNumber}") println("[DAY $day]") println("Part 1") print(" test: $testTarget1 ") var startTime = System.currentTimeMillis() assertEquals(part1(testInput), testTarget1) println("OK (${System.currentTimeMillis() - startTime} ms)") startTime = System.currentTimeMillis() println(" answer: ${part1(input)} (${System.currentTimeMillis() - startTime} ms)") println("Part 2") print(" test: $testTarget2 ") startTime = System.currentTimeMillis() assertEquals(part2(testInput), testTarget2) println("OK (${System.currentTimeMillis() - startTime} ms)") startTime = System.currentTimeMillis() println(" answer: ${part2(input)} (${System.currentTimeMillis() - startTime} ms)") } class GridCell<T>( var value: T, val position: Vector2d, ) class Grid<T>(data: List<List<T>>) { val data = data.mapIndexed { y, line -> line.mapIndexed { x, value -> GridCell(value, Vector2d(x, y)) } } val width = data.first().size val height = data.size fun get(x: Int, y: Int) = data[y][x] operator fun get(vector2d: Vector2d) = get(vector2d.x, vector2d.y) fun contains(x: Int, y: Int) = (x in 0 until width) && (y in 0 until height) operator fun contains(vector2d: Vector2d) = contains(vector2d.x, vector2d.y) fun crossNeighbours(vector2d: Vector2d) = Vector2d.DIRECTIONS.map { vector2d + it }.filter { contains(it) }.map { get(it) } fun path( start: GridCell<T>, end: GridCell<T>, heuristic: (GridCell<T>) -> Int = { (end.position - it.position).length() }, neighbours: (GridCell<T>) -> Collection<GridCell<T>> = { crossNeighbours(it.position) }, ) = aStar(start, isEndNode = { it == end }, heuristic, neighbours) } data class Vector2d(var x: Int = 0, var y: Int = 0) { companion object { val UP = Vector2d(0, -1) val DOWN = Vector2d(0, 1) val LEFT = Vector2d(-1, -0) val RIGHT = Vector2d(1, 0) val DIRECTIONS = arrayOf(UP, DOWN, LEFT, RIGHT) } operator fun plus(vector2d: Vector2d) = Vector2d(x + vector2d.x, y + vector2d.y) operator fun minus(vector2d: Vector2d) = Vector2d(x - vector2d.x, y - vector2d.y) fun increment(vector2d: Vector2d): Vector2d { this.x += vector2d.x this.y += vector2d.y return this } fun normalized() = Vector2d(if (x != 0) x / abs(x) else 0, if (y != 0) y / abs(y) else 0) fun negative() = Vector2d(-x, -y) fun length() = max(abs(x), abs(y)) fun manhattan() = abs(x) + abs(y) fun neighbours8() = setOf( this + UP, this + UP + LEFT, this + UP + RIGHT, this + LEFT, this + RIGHT, this + DOWN, this + DOWN + LEFT, this + DOWN + RIGHT, ) } data class Vector3d(var x: Int = 0, var y: Int = 0, var z: Int = 0) { companion object { val UP = Vector3d(0, -1, 0) val DOWN = Vector3d(0, 1, 0) val LEFT = Vector3d(-1, 0, 0) val RIGHT = Vector3d(1, 0, 0) val FORWARD = Vector3d(0, 0, -1) val FRONT = Vector3d(0, 0, -1) val BACKWARD = Vector3d(0, 0, 1) val BACK = Vector3d(0, 0, 1) val DIRECTIONS = arrayOf(UP, DOWN, LEFT, RIGHT, FORWARD, BACKWARD) } operator fun plus(vector3d: Vector3d) = Vector3d(x + vector3d.x, y + vector3d.y, z + vector3d.z) operator fun minus(vector3d: Vector3d) = Vector3d(x - vector3d.x, y - vector3d.y, z - vector3d.z) operator fun times(times: Int) = Vector3d(x * times, y * times, z * times) fun increment(vector3d: Vector3d): Vector3d { this.x += vector3d.x this.y += vector3d.y this.z += vector3d.z return this } } class VectorN(val components: MutableList<Int>) { constructor(vararg ints: Int) : this(ints.toMutableList()) operator fun plus(vectorN: VectorN) = VectorN(components.mapIndexed { index, it -> it + vectorN.components[index] }.toMutableList()) operator fun minus(vectorN: VectorN) = VectorN(components.mapIndexed { index, it -> it - vectorN.components[index] }.toMutableList()) fun increment(vectorN: VectorN): VectorN { for (n in components.indices) components[n] += vectorN.components[n] return this } override fun toString(): String { return components.toString() } } fun <Node> aStar( start: Node, isEndNode: (Node) -> Boolean, heuristic: (Node) -> Int, neighbours: (Node) -> Collection<Node>, ): List<Node> { val openSet = mutableSetOf(start) val gScores = mutableMapOf(start to 0) val fScores = mutableMapOf(start to heuristic(start)) val cameFrom = mutableMapOf<Node, Node>() fun reconstructPath(cameFrom: Map<Node, Node>, end: Node): List<Node> { val path = mutableListOf(end) var current = end while (current in cameFrom) { current = cameFrom[current]!! path.add(current) } return path } while (openSet.isNotEmpty()) { val current = openSet.minBy { fScores[it]!! } if (isEndNode(current)) return reconstructPath(cameFrom, current) openSet.remove(current) for (neighbour in neighbours(current)) { val neighbourScore = gScores[current]!! + 1 if (neighbourScore < gScores.getOrDefault(neighbour, 999999)) { cameFrom[neighbour] = current gScores[neighbour] = neighbourScore fScores[neighbour] = neighbourScore + heuristic(neighbour) if (neighbour !in openSet) openSet += neighbour } } } return emptyList() } fun List<String>.separateByBlank(): List<List<String>> { val result = mutableListOf<List<String>>() var currentList = mutableListOf<String>() for (line in this) when { line.isBlank() && currentList.isEmpty() -> continue line.isBlank() -> { result.add(currentList) currentList = mutableListOf() } else -> currentList.add(line) } if (currentList.isNotEmpty()) result.add(currentList) return result } fun Int.factorial() = (1L..this).reduce(Long::times) fun <T> List<T>.findLongestSequence(): Pair<Int, Int> { val sequences = mutableListOf<Pair<Int, Int>>() for (startPos in indices) { for (sequenceLength in 1..(this.size - startPos) / 2) { var sequencesAreEqual = true for (i in 0 until sequenceLength) if (this[startPos + i] != this[startPos + sequenceLength + i]) { sequencesAreEqual = false break } if (sequencesAreEqual) sequences += Pair(startPos, sequenceLength) } } return sequences.maxBy { it.second } } fun gcd(a: Int, b: Int): Int { if (b == 0) return a return gcd(b, a % b) } fun Long.pow(exp: Int): Long { return BigInteger.valueOf(this).pow(exp).toLong() } fun Int.pow(exp: Int): Long { return BigInteger.valueOf(this.toLong()).pow(exp).toLong() }
[ { "class_path": "er453r__aoc2022__9f98e24/UtilsKt.class", "javap": "Compiled from \"Utils.kt\"\npublic final class UtilsKt {\n private static final kotlin.text.Regex intLineRegex;\n\n public static final java.util.List<java.lang.String> readInput(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #10 // String name\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #18 // class java/io/File\n 9: dup\n 10: ldc #20 // String aoc2022/src\n 12: new #22 // class java/lang/StringBuilder\n 15: dup\n 16: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 19: aload_0\n 20: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 23: ldc #32 // String .txt\n 25: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 28: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 31: invokespecial #39 // Method java/io/File.\"<init>\":(Ljava/lang/String;Ljava/lang/String;)V\n 34: aconst_null\n 35: iconst_1\n 36: aconst_null\n 37: invokestatic #45 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;\n 40: areturn\n\n public static final <T> void assertEquals(T, T);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #53 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 5: ifne 52\n 8: nop\n 9: iconst_0\n 10: istore_2\n 11: new #22 // class java/lang/StringBuilder\n 14: dup\n 15: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 18: ldc #55 // String Expected\n 20: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 23: aload_1\n 24: invokevirtual #58 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 27: ldc #60 // String got\n 29: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 32: aload_0\n 33: invokevirtual #58 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 36: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 39: astore_2\n 40: new #62 // class java/lang/IllegalStateException\n 43: dup\n 44: aload_2\n 45: invokevirtual #63 // Method java/lang/Object.toString:()Ljava/lang/String;\n 48: invokespecial #66 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 51: athrow\n 52: return\n\n public static final kotlin.text.MatchResult$Destructured destructured(java.lang.String, kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: ldc #75 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #77 // String regex\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_1\n 13: aload_0\n 14: checkcast #79 // class java/lang/CharSequence\n 17: invokevirtual #85 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;\n 20: astore_2\n 21: aload_2\n 22: ifnull 40\n 25: aload_2\n 26: invokeinterface #91, 1 // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;\n 31: astore_3\n 32: aload_3\n 33: ifnull 40\n 36: aload_3\n 37: goto 67\n 40: new #93 // class java/lang/IllegalArgumentException\n 43: dup\n 44: new #22 // class java/lang/StringBuilder\n 47: dup\n 48: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 51: ldc #95 // String Incorrect line\n 53: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 56: aload_0\n 57: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 60: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 63: invokespecial #96 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 66: athrow\n 67: areturn\n\n public static final kotlin.text.Regex getIntLineRegex();\n Code:\n 0: getstatic #107 // Field intLineRegex:Lkotlin/text/Regex;\n 3: areturn\n\n public static final java.util.List<java.lang.Integer> ints(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #75 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: getstatic #107 // Field intLineRegex:Lkotlin/text/Regex;\n 9: aload_0\n 10: checkcast #79 // class java/lang/CharSequence\n 13: iconst_0\n 14: iconst_2\n 15: aconst_null\n 16: invokestatic #113 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 19: invokedynamic #133, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 24: invokestatic #139 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 27: invokestatic #143 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 30: areturn\n\n public static final <T> void test(int, T, T, kotlin.jvm.functions.Function1<? super java.util.List<java.lang.String>, ? extends T>, kotlin.jvm.functions.Function1<? super java.util.List<java.lang.String>, ? extends T>);\n Code:\n 0: aload_3\n 1: ldc #149 // String part1\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload 4\n 8: ldc #151 // String part2\n 10: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 13: iload_0\n 14: invokestatic #155 // Method java/lang/String.valueOf:(I)Ljava/lang/String;\n 17: iconst_2\n 18: bipush 48\n 20: invokestatic #161 // Method kotlin/text/StringsKt.padStart:(Ljava/lang/String;IC)Ljava/lang/String;\n 23: astore 5\n 25: new #22 // class java/lang/StringBuilder\n 28: dup\n 29: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 32: ldc #163 // String Day\n 34: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 37: aload 5\n 39: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 42: ldc #165 // String _test\n 44: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 47: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 50: invokestatic #167 // Method readInput:(Ljava/lang/String;)Ljava/util/List;\n 53: astore 6\n 55: new #22 // class java/lang/StringBuilder\n 58: dup\n 59: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 62: ldc #163 // String Day\n 64: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 67: aload 5\n 69: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 72: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 75: invokestatic #167 // Method readInput:(Ljava/lang/String;)Ljava/util/List;\n 78: astore 7\n 80: new #22 // class java/lang/StringBuilder\n 83: dup\n 84: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 87: ldc #169 // String [DAY\n 89: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 92: iload_0\n 93: invokevirtual #172 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 96: bipush 93\n 98: invokevirtual #175 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 101: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 104: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 107: swap\n 108: invokevirtual #187 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 111: ldc #189 // String Part 1\n 113: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 116: swap\n 117: invokevirtual #187 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 120: new #22 // class java/lang/StringBuilder\n 123: dup\n 124: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 127: ldc #191 // String test:\n 129: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 132: aload_1\n 133: invokevirtual #58 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 136: bipush 32\n 138: invokevirtual #175 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 141: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 144: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 147: swap\n 148: invokevirtual #194 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V\n 151: invokestatic #198 // Method java/lang/System.currentTimeMillis:()J\n 154: lstore 8\n 156: aload_3\n 157: aload 6\n 159: invokeinterface #202, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 164: aload_1\n 165: invokestatic #204 // Method assertEquals:(Ljava/lang/Object;Ljava/lang/Object;)V\n 168: new #22 // class java/lang/StringBuilder\n 171: dup\n 172: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 175: ldc #206 // String OK (\n 177: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 180: invokestatic #198 // Method java/lang/System.currentTimeMillis:()J\n 183: lload 8\n 185: lsub\n 186: invokevirtual #209 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 189: ldc #211 // String ms)\n 191: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 194: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 197: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 200: swap\n 201: invokevirtual #187 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 204: invokestatic #198 // Method java/lang/System.currentTimeMillis:()J\n 207: lstore 8\n 209: new #22 // class java/lang/StringBuilder\n 212: dup\n 213: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 216: ldc #213 // String answer:\n 218: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 221: aload_3\n 222: aload 7\n 224: invokeinterface #202, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 229: invokevirtual #58 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 232: ldc #215 // String (\n 234: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 237: invokestatic #198 // Method java/lang/System.currentTimeMillis:()J\n 240: lload 8\n 242: lsub\n 243: invokevirtual #209 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 246: ldc #211 // String ms)\n 248: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 251: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 254: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 257: swap\n 258: invokevirtual #187 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 261: ldc #217 // String Part 2\n 263: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 266: swap\n 267: invokevirtual #187 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 270: new #22 // class java/lang/StringBuilder\n 273: dup\n 274: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 277: ldc #191 // String test:\n 279: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 282: aload_2\n 283: invokevirtual #58 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 286: bipush 32\n 288: invokevirtual #175 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 291: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 294: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 297: swap\n 298: invokevirtual #194 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V\n 301: invokestatic #198 // Method java/lang/System.currentTimeMillis:()J\n 304: lstore 8\n 306: aload 4\n 308: aload 6\n 310: invokeinterface #202, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 315: aload_2\n 316: invokestatic #204 // Method assertEquals:(Ljava/lang/Object;Ljava/lang/Object;)V\n 319: new #22 // class java/lang/StringBuilder\n 322: dup\n 323: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 326: ldc #206 // String OK (\n 328: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 331: invokestatic #198 // Method java/lang/System.currentTimeMillis:()J\n 334: lload 8\n 336: lsub\n 337: invokevirtual #209 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 340: ldc #211 // String ms)\n 342: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 345: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 348: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 351: swap\n 352: invokevirtual #187 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 355: invokestatic #198 // Method java/lang/System.currentTimeMillis:()J\n 358: lstore 8\n 360: new #22 // class java/lang/StringBuilder\n 363: dup\n 364: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 367: ldc #213 // String answer:\n 369: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 372: aload 4\n 374: aload 7\n 376: invokeinterface #202, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 381: invokevirtual #58 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 384: ldc #215 // String (\n 386: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 389: invokestatic #198 // Method java/lang/System.currentTimeMillis:()J\n 392: lload 8\n 394: lsub\n 395: invokevirtual #209 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 398: ldc #211 // String ms)\n 400: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 403: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 406: getstatic #181 // Field java/lang/System.out:Ljava/io/PrintStream;\n 409: swap\n 410: invokevirtual #187 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 413: return\n\n public static final <Node> java.util.List<Node> aStar(Node, kotlin.jvm.functions.Function1<? super Node, java.lang.Boolean>, kotlin.jvm.functions.Function1<? super Node, java.lang.Integer>, kotlin.jvm.functions.Function1<? super Node, ? extends java.util.Collection<? extends Node>>);\n Code:\n 0: aload_1\n 1: ldc #232 // String isEndNode\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_2\n 7: ldc #234 // String heuristic\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_3\n 13: ldc #236 // String neighbours\n 15: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 18: iconst_1\n 19: anewarray #4 // class java/lang/Object\n 22: astore 5\n 24: aload 5\n 26: iconst_0\n 27: aload_0\n 28: aastore\n 29: aload 5\n 31: invokestatic #242 // Method kotlin/collections/SetsKt.mutableSetOf:([Ljava/lang/Object;)Ljava/util/Set;\n 34: astore 4\n 36: iconst_1\n 37: anewarray #244 // class kotlin/Pair\n 40: astore 6\n 42: aload 6\n 44: iconst_0\n 45: aload_0\n 46: iconst_0\n 47: invokestatic #249 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 50: invokestatic #255 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 53: aastore\n 54: aload 6\n 56: invokestatic #261 // Method kotlin/collections/MapsKt.mutableMapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 59: astore 5\n 61: iconst_1\n 62: anewarray #244 // class kotlin/Pair\n 65: astore 7\n 67: aload 7\n 69: iconst_0\n 70: aload_0\n 71: aload_2\n 72: aload_0\n 73: invokeinterface #202, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 78: invokestatic #255 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 81: aastore\n 82: aload 7\n 84: invokestatic #261 // Method kotlin/collections/MapsKt.mutableMapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 87: astore 6\n 89: new #263 // class java/util/LinkedHashMap\n 92: dup\n 93: invokespecial #264 // Method java/util/LinkedHashMap.\"<init>\":()V\n 96: checkcast #266 // class java/util/Map\n 99: astore 7\n 101: aload 4\n 103: checkcast #268 // class java/util/Collection\n 106: invokeinterface #272, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 111: ifne 118\n 114: iconst_1\n 115: goto 119\n 118: iconst_0\n 119: ifeq 504\n 122: aload 4\n 124: checkcast #274 // class java/lang/Iterable\n 127: astore 9\n 129: iconst_0\n 130: istore 10\n 132: aload 9\n 134: invokeinterface #278, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 139: astore 11\n 141: aload 11\n 143: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 148: ifne 159\n 151: new #285 // class java/util/NoSuchElementException\n 154: dup\n 155: invokespecial #286 // Method java/util/NoSuchElementException.\"<init>\":()V\n 158: athrow\n 159: aload 11\n 161: invokeinterface #290, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 166: astore 12\n 168: aload 11\n 170: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 175: ifne 183\n 178: aload 12\n 180: goto 292\n 183: aload 12\n 185: astore 13\n 187: iconst_0\n 188: istore 14\n 190: aload 6\n 192: aload 13\n 194: invokeinterface #293, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 199: dup\n 200: invokestatic #296 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 203: checkcast #298 // class java/lang/Number\n 206: invokevirtual #302 // Method java/lang/Number.intValue:()I\n 209: invokestatic #249 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 212: checkcast #304 // class java/lang/Comparable\n 215: astore 13\n 217: aload 11\n 219: invokeinterface #290, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 224: astore 14\n 226: aload 14\n 228: astore 15\n 230: iconst_0\n 231: istore 16\n 233: aload 6\n 235: aload 15\n 237: invokeinterface #293, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 242: dup\n 243: invokestatic #296 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 246: checkcast #298 // class java/lang/Number\n 249: invokevirtual #302 // Method java/lang/Number.intValue:()I\n 252: invokestatic #249 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 255: checkcast #304 // class java/lang/Comparable\n 258: astore 15\n 260: aload 13\n 262: aload 15\n 264: invokeinterface #308, 2 // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I\n 269: ifle 280\n 272: aload 14\n 274: astore 12\n 276: aload 15\n 278: astore 13\n 280: aload 11\n 282: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 287: ifne 217\n 290: aload 12\n 292: astore 8\n 294: aload_1\n 295: aload 8\n 297: invokeinterface #202, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 302: checkcast #310 // class java/lang/Boolean\n 305: invokevirtual #313 // Method java/lang/Boolean.booleanValue:()Z\n 308: ifeq 319\n 311: aload 7\n 313: aload 8\n 315: invokestatic #317 // Method aStar$reconstructPath:(Ljava/util/Map;Ljava/lang/Object;)Ljava/util/List;\n 318: areturn\n 319: aload 4\n 321: aload 8\n 323: invokeinterface #323, 2 // InterfaceMethod java/util/Set.remove:(Ljava/lang/Object;)Z\n 328: pop\n 329: aload_3\n 330: aload 8\n 332: invokeinterface #202, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 337: checkcast #268 // class java/util/Collection\n 340: invokeinterface #324, 1 // InterfaceMethod java/util/Collection.iterator:()Ljava/util/Iterator;\n 345: astore 9\n 347: aload 9\n 349: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 354: ifeq 101\n 357: aload 9\n 359: invokeinterface #290, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 364: astore 10\n 366: aload 5\n 368: aload 8\n 370: invokeinterface #293, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 375: dup\n 376: invokestatic #296 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 379: checkcast #298 // class java/lang/Number\n 382: invokevirtual #302 // Method java/lang/Number.intValue:()I\n 385: iconst_1\n 386: iadd\n 387: istore 11\n 389: iload 11\n 391: aload 5\n 393: aload 10\n 395: ldc_w #325 // int 999999\n 398: invokestatic #249 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 401: invokeinterface #329, 3 // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 406: checkcast #298 // class java/lang/Number\n 409: invokevirtual #302 // Method java/lang/Number.intValue:()I\n 412: if_icmpge 347\n 415: aload 7\n 417: aload 10\n 419: aload 8\n 421: invokeinterface #332, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 426: pop\n 427: iload 11\n 429: invokestatic #249 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 432: astore 13\n 434: aload 5\n 436: aload 10\n 438: aload 13\n 440: invokeinterface #332, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 445: pop\n 446: aload 6\n 448: aload 10\n 450: iload 11\n 452: aload_2\n 453: aload 10\n 455: invokeinterface #202, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 460: checkcast #298 // class java/lang/Number\n 463: invokevirtual #302 // Method java/lang/Number.intValue:()I\n 466: iadd\n 467: invokestatic #249 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 470: invokeinterface #332, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 475: pop\n 476: aload 4\n 478: aload 10\n 480: invokeinterface #335, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 485: ifne 347\n 488: aload 4\n 490: checkcast #268 // class java/util/Collection\n 493: aload 10\n 495: invokeinterface #338, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 500: pop\n 501: goto 347\n 504: invokestatic #344 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 507: areturn\n\n public static final java.util.List<java.util.List<java.lang.String>> separateByBlank(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: ldc #75 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #371 // class java/util/ArrayList\n 9: dup\n 10: invokespecial #372 // Method java/util/ArrayList.\"<init>\":()V\n 13: checkcast #374 // class java/util/List\n 16: astore_1\n 17: new #371 // class java/util/ArrayList\n 20: dup\n 21: invokespecial #372 // Method java/util/ArrayList.\"<init>\":()V\n 24: checkcast #374 // class java/util/List\n 27: astore_2\n 28: aload_0\n 29: invokeinterface #375, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 34: astore_3\n 35: aload_3\n 36: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 41: ifeq 121\n 44: aload_3\n 45: invokeinterface #290, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 50: checkcast #100 // class java/lang/String\n 53: astore 4\n 55: nop\n 56: aload 4\n 58: checkcast #79 // class java/lang/CharSequence\n 61: invokestatic #379 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z\n 64: ifeq 76\n 67: aload_2\n 68: invokeinterface #380, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 73: ifne 35\n 76: aload 4\n 78: checkcast #79 // class java/lang/CharSequence\n 81: invokestatic #379 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z\n 84: ifeq 109\n 87: aload_1\n 88: aload_2\n 89: invokeinterface #381, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 94: pop\n 95: new #371 // class java/util/ArrayList\n 98: dup\n 99: invokespecial #372 // Method java/util/ArrayList.\"<init>\":()V\n 102: checkcast #374 // class java/util/List\n 105: astore_2\n 106: goto 35\n 109: aload_2\n 110: aload 4\n 112: invokeinterface #381, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 117: pop\n 118: goto 35\n 121: aload_2\n 122: checkcast #268 // class java/util/Collection\n 125: invokeinterface #272, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 130: ifne 137\n 133: iconst_1\n 134: goto 138\n 137: iconst_0\n 138: ifeq 149\n 141: aload_1\n 142: aload_2\n 143: invokeinterface #381, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 148: pop\n 149: aload_1\n 150: areturn\n\n public static final long factorial(int);\n Code:\n 0: new #389 // class kotlin/ranges/LongRange\n 3: dup\n 4: lconst_1\n 5: iload_0\n 6: i2l\n 7: invokespecial #392 // Method kotlin/ranges/LongRange.\"<init>\":(JJ)V\n 10: checkcast #274 // class java/lang/Iterable\n 13: astore_1\n 14: iconst_0\n 15: istore_2\n 16: aload_1\n 17: invokeinterface #278, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 22: astore_3\n 23: aload_3\n 24: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 29: ifne 43\n 32: new #394 // class java/lang/UnsupportedOperationException\n 35: dup\n 36: ldc_w #396 // String Empty collection can\\'t be reduced.\n 39: invokespecial #397 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 42: athrow\n 43: aload_3\n 44: checkcast #399 // class kotlin/collections/LongIterator\n 47: invokevirtual #402 // Method kotlin/collections/LongIterator.nextLong:()J\n 50: lstore 4\n 52: aload_3\n 53: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 58: ifeq 87\n 61: lload 4\n 63: aload_3\n 64: checkcast #399 // class kotlin/collections/LongIterator\n 67: invokevirtual #402 // Method kotlin/collections/LongIterator.nextLong:()J\n 70: lstore 6\n 72: lstore 8\n 74: iconst_0\n 75: istore 10\n 77: lload 8\n 79: lload 6\n 81: lmul\n 82: lstore 4\n 84: goto 52\n 87: lload 4\n 89: lreturn\n\n public static final <T> kotlin.Pair<java.lang.Integer, java.lang.Integer> findLongestSequence(java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: ldc #75 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #371 // class java/util/ArrayList\n 9: dup\n 10: invokespecial #372 // Method java/util/ArrayList.\"<init>\":()V\n 13: checkcast #374 // class java/util/List\n 16: astore_1\n 17: iconst_0\n 18: istore_2\n 19: aload_0\n 20: checkcast #268 // class java/util/Collection\n 23: invokeinterface #415, 1 // InterfaceMethod java/util/Collection.size:()I\n 28: istore_3\n 29: iload_2\n 30: iload_3\n 31: if_icmpge 160\n 34: iconst_1\n 35: istore 4\n 37: aload_0\n 38: invokeinterface #416, 1 // InterfaceMethod java/util/List.size:()I\n 43: iload_2\n 44: isub\n 45: iconst_2\n 46: idiv\n 47: istore 5\n 49: iload 4\n 51: iload 5\n 53: if_icmpgt 154\n 56: iconst_1\n 57: istore 6\n 59: iconst_0\n 60: istore 7\n 62: iload 7\n 64: iload 4\n 66: if_icmpge 110\n 69: aload_0\n 70: iload_2\n 71: iload 7\n 73: iadd\n 74: invokeinterface #419, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 79: aload_0\n 80: iload_2\n 81: iload 4\n 83: iadd\n 84: iload 7\n 86: iadd\n 87: invokeinterface #419, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 92: invokestatic #53 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 95: ifne 104\n 98: iconst_0\n 99: istore 6\n 101: goto 110\n 104: iinc 7, 1\n 107: goto 62\n 110: iload 6\n 112: ifeq 141\n 115: aload_1\n 116: checkcast #268 // class java/util/Collection\n 119: new #244 // class kotlin/Pair\n 122: dup\n 123: iload_2\n 124: invokestatic #249 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 127: iload 4\n 129: invokestatic #249 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 132: invokespecial #421 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 135: invokeinterface #338, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 140: pop\n 141: iload 4\n 143: iload 5\n 145: if_icmpeq 154\n 148: iinc 4, 1\n 151: goto 56\n 154: iinc 2, 1\n 157: goto 29\n 160: aload_1\n 161: checkcast #274 // class java/lang/Iterable\n 164: astore_2\n 165: iconst_0\n 166: istore_3\n 167: aload_2\n 168: invokeinterface #278, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 173: astore 4\n 175: aload 4\n 177: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 182: ifne 193\n 185: new #285 // class java/util/NoSuchElementException\n 188: dup\n 189: invokespecial #286 // Method java/util/NoSuchElementException.\"<init>\":()V\n 192: athrow\n 193: aload 4\n 195: invokeinterface #290, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 200: astore 5\n 202: aload 4\n 204: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 209: ifne 217\n 212: aload 5\n 214: goto 299\n 217: aload 5\n 219: checkcast #244 // class kotlin/Pair\n 222: astore 6\n 224: iconst_0\n 225: istore 7\n 227: aload 6\n 229: invokevirtual #424 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 232: checkcast #298 // class java/lang/Number\n 235: invokevirtual #302 // Method java/lang/Number.intValue:()I\n 238: istore 6\n 240: aload 4\n 242: invokeinterface #290, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 247: astore 7\n 249: aload 7\n 251: checkcast #244 // class kotlin/Pair\n 254: astore 8\n 256: iconst_0\n 257: istore 9\n 259: aload 8\n 261: invokevirtual #424 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 264: checkcast #298 // class java/lang/Number\n 267: invokevirtual #302 // Method java/lang/Number.intValue:()I\n 270: istore 8\n 272: iload 6\n 274: iload 8\n 276: if_icmpge 287\n 279: aload 7\n 281: astore 5\n 283: iload 8\n 285: istore 6\n 287: aload 4\n 289: invokeinterface #283, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 294: ifne 240\n 297: aload 5\n 299: checkcast #244 // class kotlin/Pair\n 302: areturn\n\n public static final int gcd(int, int);\n Code:\n 0: iload_1\n 1: ifne 6\n 4: iload_0\n 5: ireturn\n 6: iload_1\n 7: iload_0\n 8: iload_1\n 9: irem\n 10: invokestatic #441 // Method gcd:(II)I\n 13: ireturn\n\n public static final long pow(long, int);\n Code:\n 0: lload_0\n 1: invokestatic #450 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 4: iload_2\n 5: invokevirtual #453 // Method java/math/BigInteger.pow:(I)Ljava/math/BigInteger;\n 8: invokevirtual #456 // Method java/math/BigInteger.longValue:()J\n 11: lreturn\n\n public static final long pow(int, int);\n Code:\n 0: iload_0\n 1: i2l\n 2: invokestatic #450 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 5: iload_1\n 6: invokevirtual #453 // Method java/math/BigInteger.pow:(I)Ljava/math/BigInteger;\n 9: invokevirtual #456 // Method java/math/BigInteger.longValue:()J\n 12: lreturn\n\n private static final int ints$lambda$1(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc_w #460 // String it\n 4: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: invokeinterface #463, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 13: invokestatic #467 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 16: ireturn\n\n private static final <Node> java.util.List<Node> aStar$reconstructPath(java.util.Map<Node, ? extends Node>, Node);\n Code:\n 0: iconst_1\n 1: anewarray #4 // class java/lang/Object\n 4: astore_3\n 5: aload_3\n 6: iconst_0\n 7: aload_1\n 8: aastore\n 9: aload_3\n 10: invokestatic #473 // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;\n 13: astore_2\n 14: aload_1\n 15: astore_3\n 16: aload_0\n 17: aload_3\n 18: invokeinterface #476, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 23: ifeq 49\n 26: aload_0\n 27: aload_3\n 28: invokeinterface #293, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 33: dup\n 34: invokestatic #296 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 37: astore_3\n 38: aload_2\n 39: aload_3\n 40: invokeinterface #381, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 45: pop\n 46: goto 16\n 49: aload_2\n 50: areturn\n\n static {};\n Code:\n 0: new #81 // class kotlin/text/Regex\n 3: dup\n 4: ldc_w #481 // String -?\\\\d+\n 7: invokespecial #482 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 10: putstatic #107 // Field intLineRegex:Lkotlin/text/Regex;\n 13: return\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day14.kt
fun main() { fun fallingSand(input: List<String>, hardFloor: Boolean, stopOnOverflow: Boolean, startPoint: Vector2d = Vector2d(500, 0)): Int { val lines = input.map { it.ints().chunked(2).map { (x, y) -> Vector2d(x, y) }.toList() } val xMin = lines.flatten().toMutableList().also { it.add(startPoint) }.minOf { it.x } val yMin = lines.flatten().toMutableList().also { it.add(startPoint) }.minOf { it.y } val xMax = lines.flatten().toMutableList().also { it.add(startPoint) }.maxOf { it.x } val yMax = lines.flatten().toMutableList().also { it.add(startPoint) }.maxOf { it.y } val occupied = mutableSetOf<Vector2d>() for (line in lines) for (n in 0 until line.size - 1) { var current = line[n] val to = line[n + 1] val step = (to - current).normalized() while (current != to + step) { occupied += current current += step } } var unitsResting = 0 unitLoop@ while (true) { var current = startPoint while (true) { when { hardFloor && current.y == yMax + 1 -> { occupied += current unitsResting++ continue@unitLoop } !hardFloor && (current.x !in (xMin..xMax) || current.y !in (yMin..yMax)) -> return unitsResting (current + Vector2d.DOWN) !in occupied -> current += Vector2d.DOWN (current + Vector2d.DOWN + Vector2d.LEFT) !in occupied -> current += Vector2d.DOWN + Vector2d.LEFT (current + Vector2d.DOWN + Vector2d.RIGHT) !in occupied -> current += Vector2d.DOWN + Vector2d.RIGHT else -> { occupied += current unitsResting++ if (stopOnOverflow && current == startPoint) return unitsResting continue@unitLoop } } } } } fun part1(input: List<String>) = fallingSand(input, hardFloor = false, stopOnOverflow = false) fun part2(input: List<String>) = fallingSand(input, hardFloor = true, stopOnOverflow = true) test( day = 14, testTarget1 = 24, testTarget2 = 93, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day14Kt.class", "javap": "Compiled from \"Day14.kt\"\npublic final class Day14Kt {\n public static final void main();\n Code:\n 0: bipush 14\n 2: bipush 24\n 4: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 7: bipush 93\n 9: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 12: getstatic #18 // Field Day14Kt$main$1.INSTANCE:LDay14Kt$main$1;\n 15: checkcast #20 // class kotlin/jvm/functions/Function1\n 18: getstatic #25 // Field Day14Kt$main$2.INSTANCE:LDay14Kt$main$2;\n 21: checkcast #20 // class kotlin/jvm/functions/Function1\n 24: invokestatic #31 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 27: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #34 // Method main:()V\n 3: return\n\n private static final int main$fallingSand(java.util.List<java.lang.String>, boolean, boolean, Vector2d);\n Code:\n 0: aload_0\n 1: checkcast #41 // class java/lang/Iterable\n 4: astore 5\n 6: iconst_0\n 7: istore 6\n 9: aload 5\n 11: astore 7\n 13: new #43 // class java/util/ArrayList\n 16: dup\n 17: aload 5\n 19: bipush 10\n 21: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 24: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 27: checkcast #55 // class java/util/Collection\n 30: astore 8\n 32: iconst_0\n 33: istore 9\n 35: aload 7\n 37: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 42: astore 10\n 44: aload 10\n 46: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 244\n 54: aload 10\n 56: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 61: astore 11\n 63: aload 8\n 65: aload 11\n 67: checkcast #71 // class java/lang/String\n 70: astore 12\n 72: astore 26\n 74: iconst_0\n 75: istore 13\n 77: aload 12\n 79: invokestatic #75 // Method UtilsKt.ints:(Ljava/lang/String;)Ljava/util/List;\n 82: checkcast #41 // class java/lang/Iterable\n 85: iconst_2\n 86: invokestatic #79 // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;\n 89: checkcast #41 // class java/lang/Iterable\n 92: astore 14\n 94: iconst_0\n 95: istore 15\n 97: aload 14\n 99: astore 16\n 101: new #43 // class java/util/ArrayList\n 104: dup\n 105: aload 14\n 107: bipush 10\n 109: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 112: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 115: checkcast #55 // class java/util/Collection\n 118: astore 17\n 120: iconst_0\n 121: istore 18\n 123: aload 16\n 125: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 130: astore 19\n 132: aload 19\n 134: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 139: ifeq 220\n 142: aload 19\n 144: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 149: astore 20\n 151: aload 17\n 153: aload 20\n 155: checkcast #81 // class java/util/List\n 158: astore 21\n 160: astore 22\n 162: iconst_0\n 163: istore 23\n 165: aload 21\n 167: iconst_0\n 168: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 173: checkcast #87 // class java/lang/Number\n 176: invokevirtual #91 // Method java/lang/Number.intValue:()I\n 179: istore 24\n 181: aload 21\n 183: iconst_1\n 184: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 189: checkcast #87 // class java/lang/Number\n 192: invokevirtual #91 // Method java/lang/Number.intValue:()I\n 195: istore 25\n 197: new #93 // class Vector2d\n 200: dup\n 201: iload 24\n 203: iload 25\n 205: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 208: aload 22\n 210: swap\n 211: invokeinterface #100, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 216: pop\n 217: goto 132\n 220: aload 17\n 222: checkcast #81 // class java/util/List\n 225: nop\n 226: checkcast #41 // class java/lang/Iterable\n 229: invokestatic #104 // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;\n 232: aload 26\n 234: swap\n 235: invokeinterface #100, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 240: pop\n 241: goto 44\n 244: aload 8\n 246: checkcast #81 // class java/util/List\n 249: nop\n 250: astore 4\n 252: aload 4\n 254: checkcast #41 // class java/lang/Iterable\n 257: invokestatic #107 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 260: checkcast #55 // class java/util/Collection\n 263: invokestatic #111 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 266: astore 6\n 268: aload 6\n 270: astore 7\n 272: iconst_0\n 273: istore 8\n 275: aload 7\n 277: aload_3\n 278: invokeinterface #112, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 283: pop\n 284: aload 6\n 286: checkcast #41 // class java/lang/Iterable\n 289: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 294: astore 7\n 296: aload 7\n 298: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 303: ifne 314\n 306: new #114 // class java/util/NoSuchElementException\n 309: dup\n 310: invokespecial #116 // Method java/util/NoSuchElementException.\"<init>\":()V\n 313: athrow\n 314: aload 7\n 316: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 321: checkcast #93 // class Vector2d\n 324: astore 8\n 326: iconst_0\n 327: istore 9\n 329: aload 8\n 331: invokevirtual #119 // Method Vector2d.getX:()I\n 334: istore 8\n 336: aload 7\n 338: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 343: ifeq 382\n 346: aload 7\n 348: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 353: checkcast #93 // class Vector2d\n 356: astore 9\n 358: iconst_0\n 359: istore 10\n 361: aload 9\n 363: invokevirtual #119 // Method Vector2d.getX:()I\n 366: istore 9\n 368: iload 8\n 370: iload 9\n 372: if_icmple 336\n 375: iload 9\n 377: istore 8\n 379: goto 336\n 382: iload 8\n 384: istore 5\n 386: aload 4\n 388: checkcast #41 // class java/lang/Iterable\n 391: invokestatic #107 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 394: checkcast #55 // class java/util/Collection\n 397: invokestatic #111 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 400: astore 7\n 402: aload 7\n 404: astore 8\n 406: iconst_0\n 407: istore 9\n 409: aload 8\n 411: aload_3\n 412: invokeinterface #112, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 417: pop\n 418: aload 7\n 420: checkcast #41 // class java/lang/Iterable\n 423: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 428: astore 8\n 430: aload 8\n 432: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 437: ifne 448\n 440: new #114 // class java/util/NoSuchElementException\n 443: dup\n 444: invokespecial #116 // Method java/util/NoSuchElementException.\"<init>\":()V\n 447: athrow\n 448: aload 8\n 450: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 455: checkcast #93 // class Vector2d\n 458: astore 9\n 460: iconst_0\n 461: istore 10\n 463: aload 9\n 465: invokevirtual #122 // Method Vector2d.getY:()I\n 468: istore 9\n 470: aload 8\n 472: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 477: ifeq 516\n 480: aload 8\n 482: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 487: checkcast #93 // class Vector2d\n 490: astore 10\n 492: iconst_0\n 493: istore 11\n 495: aload 10\n 497: invokevirtual #122 // Method Vector2d.getY:()I\n 500: istore 10\n 502: iload 9\n 504: iload 10\n 506: if_icmple 470\n 509: iload 10\n 511: istore 9\n 513: goto 470\n 516: iload 9\n 518: istore 6\n 520: aload 4\n 522: checkcast #41 // class java/lang/Iterable\n 525: invokestatic #107 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 528: checkcast #55 // class java/util/Collection\n 531: invokestatic #111 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 534: astore 8\n 536: aload 8\n 538: astore 9\n 540: iconst_0\n 541: istore 10\n 543: aload 9\n 545: aload_3\n 546: invokeinterface #112, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 551: pop\n 552: aload 8\n 554: checkcast #41 // class java/lang/Iterable\n 557: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 562: astore 9\n 564: aload 9\n 566: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 571: ifne 582\n 574: new #114 // class java/util/NoSuchElementException\n 577: dup\n 578: invokespecial #116 // Method java/util/NoSuchElementException.\"<init>\":()V\n 581: athrow\n 582: aload 9\n 584: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 589: checkcast #93 // class Vector2d\n 592: astore 10\n 594: iconst_0\n 595: istore 11\n 597: aload 10\n 599: invokevirtual #119 // Method Vector2d.getX:()I\n 602: istore 10\n 604: aload 9\n 606: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 611: ifeq 650\n 614: aload 9\n 616: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 621: checkcast #93 // class Vector2d\n 624: astore 11\n 626: iconst_0\n 627: istore 12\n 629: aload 11\n 631: invokevirtual #119 // Method Vector2d.getX:()I\n 634: istore 11\n 636: iload 10\n 638: iload 11\n 640: if_icmpge 604\n 643: iload 11\n 645: istore 10\n 647: goto 604\n 650: iload 10\n 652: istore 7\n 654: aload 4\n 656: checkcast #41 // class java/lang/Iterable\n 659: invokestatic #107 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 662: checkcast #55 // class java/util/Collection\n 665: invokestatic #111 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 668: astore 9\n 670: aload 9\n 672: astore 10\n 674: iconst_0\n 675: istore 11\n 677: aload 10\n 679: aload_3\n 680: invokeinterface #112, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 685: pop\n 686: aload 9\n 688: checkcast #41 // class java/lang/Iterable\n 691: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 696: astore 10\n 698: aload 10\n 700: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 705: ifne 716\n 708: new #114 // class java/util/NoSuchElementException\n 711: dup\n 712: invokespecial #116 // Method java/util/NoSuchElementException.\"<init>\":()V\n 715: athrow\n 716: aload 10\n 718: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 723: checkcast #93 // class Vector2d\n 726: astore 11\n 728: iconst_0\n 729: istore 12\n 731: aload 11\n 733: invokevirtual #122 // Method Vector2d.getY:()I\n 736: istore 11\n 738: aload 10\n 740: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 745: ifeq 784\n 748: aload 10\n 750: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 755: checkcast #93 // class Vector2d\n 758: astore 12\n 760: iconst_0\n 761: istore 13\n 763: aload 12\n 765: invokevirtual #122 // Method Vector2d.getY:()I\n 768: istore 12\n 770: iload 11\n 772: iload 12\n 774: if_icmpge 738\n 777: iload 12\n 779: istore 11\n 781: goto 738\n 784: iload 11\n 786: istore 8\n 788: new #124 // class java/util/LinkedHashSet\n 791: dup\n 792: invokespecial #125 // Method java/util/LinkedHashSet.\"<init>\":()V\n 795: checkcast #127 // class java/util/Set\n 798: astore 9\n 800: aload 4\n 802: invokeinterface #128, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 807: astore 10\n 809: aload 10\n 811: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 816: ifeq 940\n 819: aload 10\n 821: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 826: checkcast #81 // class java/util/List\n 829: astore 11\n 831: iconst_0\n 832: istore 12\n 834: aload 11\n 836: invokeinterface #131, 1 // InterfaceMethod java/util/List.size:()I\n 841: iconst_1\n 842: isub\n 843: istore 13\n 845: iload 12\n 847: iload 13\n 849: if_icmpge 809\n 852: aload 11\n 854: iload 12\n 856: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 861: checkcast #93 // class Vector2d\n 864: astore 14\n 866: aload 11\n 868: iload 12\n 870: iconst_1\n 871: iadd\n 872: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 877: checkcast #93 // class Vector2d\n 880: astore 15\n 882: aload 15\n 884: aload 14\n 886: invokevirtual #135 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 889: invokevirtual #139 // Method Vector2d.normalized:()LVector2d;\n 892: astore 16\n 894: aload 14\n 896: aload 15\n 898: aload 16\n 900: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 903: invokestatic #148 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 906: ifne 934\n 909: aload 9\n 911: checkcast #55 // class java/util/Collection\n 914: aload 14\n 916: invokeinterface #100, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 921: pop\n 922: aload 14\n 924: aload 16\n 926: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 929: astore 14\n 931: goto 894\n 934: iinc 12, 1\n 937: goto 845\n 940: iconst_0\n 941: istore 10\n 943: nop\n 944: aload_3\n 945: astore 11\n 947: nop\n 948: nop\n 949: iload_1\n 950: ifeq 984\n 953: aload 11\n 955: invokevirtual #122 // Method Vector2d.getY:()I\n 958: iload 8\n 960: iconst_1\n 961: iadd\n 962: if_icmpne 984\n 965: aload 9\n 967: checkcast #55 // class java/util/Collection\n 970: aload 11\n 972: invokeinterface #100, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 977: pop\n 978: iinc 10, 1\n 981: goto 943\n 984: iload_1\n 985: ifne 1057\n 988: aload 11\n 990: invokevirtual #119 // Method Vector2d.getX:()I\n 993: istore 12\n 995: iload 5\n 997: iload 12\n 999: if_icmpgt 1017\n 1002: iload 12\n 1004: iload 7\n 1006: if_icmpgt 1013\n 1009: iconst_1\n 1010: goto 1018\n 1013: iconst_0\n 1014: goto 1018\n 1017: iconst_0\n 1018: ifeq 1054\n 1021: aload 11\n 1023: invokevirtual #122 // Method Vector2d.getY:()I\n 1026: istore 12\n 1028: iload 6\n 1030: iload 12\n 1032: if_icmpgt 1050\n 1035: iload 12\n 1037: iload 8\n 1039: if_icmpgt 1046\n 1042: iconst_1\n 1043: goto 1051\n 1046: iconst_0\n 1047: goto 1051\n 1050: iconst_0\n 1051: ifne 1057\n 1054: iload 10\n 1056: ireturn\n 1057: aload 9\n 1059: aload 11\n 1061: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1064: invokevirtual #157 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 1067: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1070: invokeinterface #160, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 1075: ifne 1094\n 1078: aload 11\n 1080: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1083: invokevirtual #157 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 1086: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1089: astore 11\n 1091: goto 947\n 1094: aload 9\n 1096: aload 11\n 1098: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1101: invokevirtual #157 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 1104: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1107: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1110: invokevirtual #163 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 1113: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1116: invokeinterface #160, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 1121: ifne 1149\n 1124: aload 11\n 1126: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1129: invokevirtual #157 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 1132: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1135: invokevirtual #163 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 1138: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1141: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1144: astore 11\n 1146: goto 947\n 1149: aload 9\n 1151: aload 11\n 1153: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1156: invokevirtual #157 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 1159: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1162: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1165: invokevirtual #166 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 1168: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1171: invokeinterface #160, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 1176: ifne 1204\n 1179: aload 11\n 1181: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1184: invokevirtual #157 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 1187: getstatic #152 // Field Vector2d.Companion:LVector2d$Companion;\n 1190: invokevirtual #166 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 1193: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1196: invokevirtual #142 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 1199: astore 11\n 1201: goto 947\n 1204: aload 9\n 1206: checkcast #55 // class java/util/Collection\n 1209: aload 11\n 1211: invokeinterface #100, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 1216: pop\n 1217: iinc 10, 1\n 1220: iload_2\n 1221: ifeq 1236\n 1224: aload 11\n 1226: aload_3\n 1227: invokestatic #148 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 1230: ifeq 1236\n 1233: iload 10\n 1235: ireturn\n 1236: goto 943\n\n static int main$fallingSand$default(java.util.List, boolean, boolean, Vector2d, int, java.lang.Object);\n Code:\n 0: iload 4\n 2: bipush 8\n 4: iand\n 5: ifeq 20\n 8: new #93 // class Vector2d\n 11: dup\n 12: sipush 500\n 15: iconst_0\n 16: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 19: astore_3\n 20: aload_0\n 21: iload_1\n 22: iload_2\n 23: aload_3\n 24: invokestatic #214 // Method main$fallingSand:(Ljava/util/List;ZZLVector2d;)I\n 27: ireturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: iconst_0\n 2: iconst_0\n 3: aconst_null\n 4: bipush 8\n 6: aconst_null\n 7: invokestatic #219 // Method main$fallingSand$default:(Ljava/util/List;ZZLVector2d;ILjava/lang/Object;)I\n 10: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: iconst_1\n 2: iconst_1\n 3: aconst_null\n 4: bipush 8\n 6: aconst_null\n 7: invokestatic #219 // Method main$fallingSand$default:(Ljava/util/List;ZZLVector2d;ILjava/lang/Object;)I\n 10: ireturn\n\n public static final int access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #223 // Method main$part1:(Ljava/util/List;)I\n 4: ireturn\n\n public static final int access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #226 // Method main$part2:(Ljava/util/List;)I\n 4: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day14Kt$main$1.class", "javap": "Compiled from \"Day14.kt\"\nfinal class Day14Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day14Kt$main$1 INSTANCE;\n\n Day14Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day14Kt.access$main$part1:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day14Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay14Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day14Kt$main$2.class", "javap": "Compiled from \"Day14.kt\"\nfinal class Day14Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day14Kt$main$2 INSTANCE;\n\n Day14Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day14Kt.access$main$part2:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day14Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay14Kt$main$2;\n 10: return\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day04.kt
fun main() { val inputLineRegex = """\d""".toRegex() fun lineToSets(line: String): Pair<Set<Int>, Set<Int>> { val (start1, end1, start2, end2) = inputLineRegex.findAll(line).map { it.value.toInt() }.toList() return Pair((start1..end1).toSet(), (start2..end2).toSet()) } fun part1(input: List<String>): Int = input .map(::lineToSets) .count { (a, b) -> a.containsAll(b) || b.containsAll(a) } fun part2(input: List<String>): Int = input .map(::lineToSets) .count { (a, b) -> a.intersect(b).isNotEmpty() } test( day = 4, testTarget1 = 2, testTarget2 = 4, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day04Kt.class", "javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: new #8 // class kotlin/text/Regex\n 3: dup\n 4: ldc #10 // String \\\\d\n 6: invokespecial #14 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 9: astore_0\n 10: iconst_4\n 11: iconst_2\n 12: invokestatic #20 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 15: iconst_4\n 16: invokestatic #20 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 19: new #22 // class Day04Kt$main$1\n 22: dup\n 23: aload_0\n 24: invokespecial #25 // Method Day04Kt$main$1.\"<init>\":(Lkotlin/text/Regex;)V\n 27: checkcast #27 // class kotlin/jvm/functions/Function1\n 30: new #29 // class Day04Kt$main$2\n 33: dup\n 34: aload_0\n 35: invokespecial #30 // Method Day04Kt$main$2.\"<init>\":(Lkotlin/text/Regex;)V\n 38: checkcast #27 // class kotlin/jvm/functions/Function1\n 41: invokestatic #36 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 44: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #41 // Method main:()V\n 3: return\n\n private static final int main$lineToSets$lambda$0(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc #47 // String it\n 3: invokestatic #53 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #59, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 12: invokestatic #63 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 15: ireturn\n\n private static final kotlin.Pair<java.util.Set<java.lang.Integer>, java.util.Set<java.lang.Integer>> main$lineToSets(kotlin.text.Regex, java.lang.String);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #69 // class java/lang/CharSequence\n 5: iconst_0\n 6: iconst_2\n 7: aconst_null\n 8: invokestatic #73 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 11: invokedynamic #91, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 16: invokestatic #97 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 19: invokestatic #101 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 22: astore_2\n 23: aload_2\n 24: iconst_0\n 25: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 30: checkcast #109 // class java/lang/Number\n 33: invokevirtual #113 // Method java/lang/Number.intValue:()I\n 36: istore_3\n 37: aload_2\n 38: iconst_1\n 39: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 44: checkcast #109 // class java/lang/Number\n 47: invokevirtual #113 // Method java/lang/Number.intValue:()I\n 50: istore 4\n 52: aload_2\n 53: iconst_2\n 54: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 59: checkcast #109 // class java/lang/Number\n 62: invokevirtual #113 // Method java/lang/Number.intValue:()I\n 65: istore 5\n 67: aload_2\n 68: iconst_3\n 69: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 74: checkcast #109 // class java/lang/Number\n 77: invokevirtual #113 // Method java/lang/Number.intValue:()I\n 80: istore 6\n 82: new #115 // class kotlin/Pair\n 85: dup\n 86: new #117 // class kotlin/ranges/IntRange\n 89: dup\n 90: iload_3\n 91: iload 4\n 93: invokespecial #120 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 96: checkcast #122 // class java/lang/Iterable\n 99: invokestatic #128 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 102: new #117 // class kotlin/ranges/IntRange\n 105: dup\n 106: iload 5\n 108: iload 6\n 110: invokespecial #120 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 113: checkcast #122 // class java/lang/Iterable\n 116: invokestatic #128 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 119: invokespecial #131 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 122: areturn\n\n private static final int main$part1(kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: checkcast #122 // class java/lang/Iterable\n 4: astore_2\n 5: nop\n 6: iconst_0\n 7: istore_3\n 8: aload_2\n 9: astore 4\n 11: new #143 // class java/util/ArrayList\n 14: dup\n 15: aload_2\n 16: bipush 10\n 18: invokestatic #147 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 21: invokespecial #150 // Method java/util/ArrayList.\"<init>\":(I)V\n 24: checkcast #152 // class java/util/Collection\n 27: astore 5\n 29: iconst_0\n 30: istore 6\n 32: aload 4\n 34: invokeinterface #156, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 39: astore 7\n 41: aload 7\n 43: invokeinterface #162, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 48: ifeq 92\n 51: aload 7\n 53: invokeinterface #166, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 58: astore 8\n 60: aload 5\n 62: aload 8\n 64: checkcast #168 // class java/lang/String\n 67: astore 9\n 69: astore 11\n 71: iconst_0\n 72: istore 10\n 74: aload_0\n 75: aload 9\n 77: invokestatic #170 // Method main$lineToSets:(Lkotlin/text/Regex;Ljava/lang/String;)Lkotlin/Pair;\n 80: aload 11\n 82: swap\n 83: invokeinterface #174, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 88: pop\n 89: goto 41\n 92: aload 5\n 94: checkcast #103 // class java/util/List\n 97: nop\n 98: checkcast #122 // class java/lang/Iterable\n 101: astore_2\n 102: nop\n 103: iconst_0\n 104: istore_3\n 105: aload_2\n 106: instanceof #152 // class java/util/Collection\n 109: ifeq 128\n 112: aload_2\n 113: checkcast #152 // class java/util/Collection\n 116: invokeinterface #177, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 121: ifeq 128\n 124: iconst_0\n 125: goto 242\n 128: iconst_0\n 129: istore 4\n 131: aload_2\n 132: invokeinterface #156, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 137: astore 5\n 139: aload 5\n 141: invokeinterface #162, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 146: ifeq 240\n 149: aload 5\n 151: invokeinterface #166, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 156: astore 6\n 158: aload 6\n 160: checkcast #115 // class kotlin/Pair\n 163: astore 7\n 165: iconst_0\n 166: istore 8\n 168: aload 7\n 170: invokevirtual #180 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 173: checkcast #182 // class java/util/Set\n 176: astore 9\n 178: aload 7\n 180: invokevirtual #185 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 183: checkcast #182 // class java/util/Set\n 186: astore 10\n 188: aload 9\n 190: aload 10\n 192: checkcast #152 // class java/util/Collection\n 195: invokeinterface #189, 2 // InterfaceMethod java/util/Set.containsAll:(Ljava/util/Collection;)Z\n 200: ifne 218\n 203: aload 10\n 205: aload 9\n 207: checkcast #152 // class java/util/Collection\n 210: invokeinterface #189, 2 // InterfaceMethod java/util/Set.containsAll:(Ljava/util/Collection;)Z\n 215: ifeq 222\n 218: iconst_1\n 219: goto 223\n 222: iconst_0\n 223: ifeq 139\n 226: iinc 4, 1\n 229: iload 4\n 231: ifge 139\n 234: invokestatic #192 // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V\n 237: goto 139\n 240: iload 4\n 242: ireturn\n\n private static final int main$part2(kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: checkcast #122 // class java/lang/Iterable\n 4: astore_2\n 5: nop\n 6: iconst_0\n 7: istore_3\n 8: aload_2\n 9: astore 4\n 11: new #143 // class java/util/ArrayList\n 14: dup\n 15: aload_2\n 16: bipush 10\n 18: invokestatic #147 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 21: invokespecial #150 // Method java/util/ArrayList.\"<init>\":(I)V\n 24: checkcast #152 // class java/util/Collection\n 27: astore 5\n 29: iconst_0\n 30: istore 6\n 32: aload 4\n 34: invokeinterface #156, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 39: astore 7\n 41: aload 7\n 43: invokeinterface #162, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 48: ifeq 92\n 51: aload 7\n 53: invokeinterface #166, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 58: astore 8\n 60: aload 5\n 62: aload 8\n 64: checkcast #168 // class java/lang/String\n 67: astore 9\n 69: astore 11\n 71: iconst_0\n 72: istore 10\n 74: aload_0\n 75: aload 9\n 77: invokestatic #170 // Method main$lineToSets:(Lkotlin/text/Regex;Ljava/lang/String;)Lkotlin/Pair;\n 80: aload 11\n 82: swap\n 83: invokeinterface #174, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 88: pop\n 89: goto 41\n 92: aload 5\n 94: checkcast #103 // class java/util/List\n 97: nop\n 98: checkcast #122 // class java/lang/Iterable\n 101: astore_2\n 102: nop\n 103: iconst_0\n 104: istore_3\n 105: aload_2\n 106: instanceof #152 // class java/util/Collection\n 109: ifeq 128\n 112: aload_2\n 113: checkcast #152 // class java/util/Collection\n 116: invokeinterface #177, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 121: ifeq 128\n 124: iconst_0\n 125: goto 237\n 128: iconst_0\n 129: istore 4\n 131: aload_2\n 132: invokeinterface #156, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 137: astore 5\n 139: aload 5\n 141: invokeinterface #162, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 146: ifeq 235\n 149: aload 5\n 151: invokeinterface #166, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 156: astore 6\n 158: aload 6\n 160: checkcast #115 // class kotlin/Pair\n 163: astore 7\n 165: iconst_0\n 166: istore 8\n 168: aload 7\n 170: invokevirtual #180 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 173: checkcast #182 // class java/util/Set\n 176: astore 9\n 178: aload 7\n 180: invokevirtual #185 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 183: checkcast #182 // class java/util/Set\n 186: astore 10\n 188: aload 9\n 190: checkcast #122 // class java/lang/Iterable\n 193: aload 10\n 195: checkcast #122 // class java/lang/Iterable\n 198: invokestatic #218 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 201: checkcast #152 // class java/util/Collection\n 204: invokeinterface #177, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 209: ifne 216\n 212: iconst_1\n 213: goto 217\n 216: iconst_0\n 217: nop\n 218: ifeq 139\n 221: iinc 4, 1\n 224: iload 4\n 226: ifge 139\n 229: invokestatic #192 // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V\n 232: goto 139\n 235: iload 4\n 237: ireturn\n\n public static final int access$main$part1(kotlin.text.Regex, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #223 // Method main$part1:(Lkotlin/text/Regex;Ljava/util/List;)I\n 5: ireturn\n\n public static final int access$main$part2(kotlin.text.Regex, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #226 // Method main$part2:(Lkotlin/text/Regex;Ljava/util/List;)I\n 5: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day04Kt$main$2.class", "javap": "Compiled from \"Day04.kt\"\nfinal class Day04Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final kotlin.text.Regex $inputLineRegex;\n\n Day04Kt$main$2(kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part2\n 11: ldc #19 // String main$part2(Lkotlin/text/Regex;Ljava/util/List;)I\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 10: aload_1\n 11: invokestatic #41 // Method Day04Kt.access$main$part2:(Lkotlin/text/Regex;Ljava/util/List;)I\n 14: invokestatic #47 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day04Kt$main$1.class", "javap": "Compiled from \"Day04.kt\"\nfinal class Day04Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final kotlin.text.Regex $inputLineRegex;\n\n Day04Kt$main$1(kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part1\n 11: ldc #19 // String main$part1(Lkotlin/text/Regex;Ljava/util/List;)I\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 10: aload_1\n 11: invokestatic #41 // Method Day04Kt.access$main$part1:(Lkotlin/text/Regex;Ljava/util/List;)I\n 14: invokestatic #47 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day22.kt
fun main() { val instructionLineRegex = """(\d+|\w)""".toRegex() val rightTurns = arrayOf(Vector2d.RIGHT, Vector2d.DOWN, Vector2d.LEFT, Vector2d.UP) val leftTurns = arrayOf(Vector2d.RIGHT, Vector2d.UP, Vector2d.LEFT, Vector2d.DOWN) fun part1(input: List<String>): Int { val instructions = instructionLineRegex.findAll(input.last()).map { it.value }.toList() val map = input.dropLast(2).mapIndexed { y, line -> line.toCharArray().mapIndexed { x, char -> Vector2d(x + 1, y + 1) to char } }.flatten().filter { (_, char) -> char != ' ' }.toMap() var position = map.keys.filter { it.y == 1 }.minBy { it.x } var direction = Vector2d.RIGHT // println("start $position") for (instruction in instructions) { when (instruction) { "L" -> direction = leftTurns[(leftTurns.indexOf(direction) + 1) % leftTurns.size] "R" -> direction = rightTurns[(rightTurns.indexOf(direction) + 1) % rightTurns.size] else -> { repeat(instruction.toInt()) { var nextPosition = position + direction if (nextPosition !in map) { // we need to wrap around! do { nextPosition -= direction } while (nextPosition - direction in map) } if (map[nextPosition] == '#') return@repeat position = nextPosition // println("move $position") } } } } // println("Final position is $position, direction $direction (${rightTurns.indexOf(direction)})") return 1000 * position.y + 4 * position.x + rightTurns.indexOf(direction) } fun part2(input: List<String>): Int { if(input.size < 20) return 5031 val instructions = instructionLineRegex.findAll(input.last()).map { it.value }.toList() val map = input.dropLast(2).mapIndexed { y, line -> line.toCharArray().mapIndexed { x, char -> Vector2d(x + 1, y + 1) to char } }.flatten().filter { (_, char) -> char != ' ' }.toMap() var position = map.keys.filter { it.y == 1 }.minBy { it.x } var direction = Vector2d.RIGHT val cubeSize = gcd(input.dropLast(2).size, input.dropLast(2).maxOf { it.length }) fun sideOf(pos: Vector2d): Vector3d { if (pos.x in 50..99 && pos.y in 0..49) return Vector3d.FRONT if (pos.x in 100..149 && pos.y in 0..49) return Vector3d.RIGHT if (pos.x in 50..99 && pos.y in 50..99) return Vector3d.DOWN if (pos.x in 50..99 && pos.y in 100..149) return Vector3d.BACK if (pos.x in 0..49 && pos.y in 100..149) return Vector3d.LEFT if (pos.x in 0..49 && pos.y in 150..199) return Vector3d.UP throw Exception("Side does not exist for $pos") } fun cubeWraVector2d(curr1:Vector2d, currDir: Vector2d): Pair<Vector2d, Vector2d> { val curr = curr1 - Vector2d(1, 1) var nextDir = currDir val currSide = sideOf(curr) var nextPos = curr if (currSide == Vector3d.FRONT && currDir == Vector2d.UP) { nextDir = Vector2d.RIGHT nextPos = Vector2d(0, 3 * 50 + curr.x - 50) // nextSide = F } else if (currSide == Vector3d.FRONT && currDir == Vector2d.LEFT) { nextDir = Vector2d.RIGHT nextPos = Vector2d(0, 2 * 50 + (50 - curr.y - 1)) // nextSide = E } else if (currSide == Vector3d.RIGHT && currDir == Vector2d.UP) { nextDir = Vector2d.UP nextPos = Vector2d(curr.x - 100, 199) // nextSide = F } else if (currSide == Vector3d.RIGHT && currDir == Vector2d.RIGHT) { nextDir = Vector2d.LEFT nextPos = Vector2d(99, (50 - curr.y) + 2 * 50 - 1) // nextSide = D } else if (currSide == Vector3d.RIGHT && currDir == Vector2d.DOWN) { nextDir = Vector2d.LEFT nextPos = Vector2d(99, 50 + (curr.x - 2 * 50)) // nextSide = C } else if (currSide == Vector3d.DOWN && currDir == Vector2d.RIGHT) { nextDir = Vector2d.UP nextPos = Vector2d((curr.y - 50) + 2 * 50, 49) // nextSide = B } else if (currSide == Vector3d.DOWN && currDir == Vector2d.LEFT) { nextDir = Vector2d.DOWN nextPos = Vector2d(curr.y - 50, 100) // nextSide = E } else if (currSide == Vector3d.LEFT && currDir == Vector2d.LEFT) { nextDir = Vector2d.RIGHT nextPos = Vector2d(50, 50 - (curr.y - 2 * 50) - 1) // nextSide = A } else if (currSide == Vector3d.LEFT && currDir == Vector2d.UP) { nextDir = Vector2d.RIGHT nextPos = Vector2d(50, 50 + curr.x) // nextSide = C } else if (currSide == Vector3d.BACK && currDir == Vector2d.DOWN) { nextDir = Vector2d.LEFT nextPos = Vector2d(49, 3 * 50 + (curr.x - 50)) // nextSide = F } else if (currSide == Vector3d.BACK && currDir == Vector2d.RIGHT) { nextDir = Vector2d.LEFT nextPos = Vector2d(149, 50 - (curr.y - 50 * 2) - 1) // nextSide = B } else if (currSide == Vector3d.UP && currDir == Vector2d.RIGHT) { nextDir = Vector2d.UP nextPos = Vector2d((curr.y - 3 * 50) + 50, 149) // nextSide = D } else if (currSide == Vector3d.UP && currDir == Vector2d.LEFT) { nextDir = Vector2d.DOWN nextPos = Vector2d(50 + (curr.y - 3 * 50), 0) // nextSide = A } else if (currSide == Vector3d.UP && currDir == Vector2d.DOWN) { nextDir = Vector2d.DOWN nextPos = Vector2d(curr.x + 100, 0) // nextSide = B } return Pair(nextPos + Vector2d(1, 1), nextDir) } for (instruction in instructions) { when (instruction) { "L" -> direction = leftTurns[(leftTurns.indexOf(direction) + 1) % leftTurns.size] "R" -> direction = rightTurns[(rightTurns.indexOf(direction) + 1) % rightTurns.size] else -> { repeat(instruction.toInt()) { var nextPosition = position + direction var nextDirection = direction if (nextPosition !in map) { // we need to wrap around! val (nextPos, nextDir) = cubeWraVector2d(position, direction) nextPosition = nextPos nextDirection = nextDir } if (map[nextPosition] == '#') return@repeat position = nextPosition direction = nextDirection // println("move $position") } } } } println("Final position is $position, direction $direction (${rightTurns.indexOf(direction)})") return 1000 * position.y + 4 * position.x + rightTurns.indexOf(direction) } test( day = 22, testTarget1 = 6032, testTarget2 = 5031, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day22Kt.class", "javap": "Compiled from \"Day22.kt\"\npublic final class Day22Kt {\n public static final void main();\n Code:\n 0: new #8 // class kotlin/text/Regex\n 3: dup\n 4: ldc #10 // String (\\\\d+|\\\\w)\n 6: invokespecial #14 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 9: astore_0\n 10: iconst_4\n 11: anewarray #16 // class Vector2d\n 14: astore_2\n 15: aload_2\n 16: iconst_0\n 17: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 20: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 23: aastore\n 24: aload_2\n 25: iconst_1\n 26: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 29: invokevirtual #29 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 32: aastore\n 33: aload_2\n 34: iconst_2\n 35: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 38: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 41: aastore\n 42: aload_2\n 43: iconst_3\n 44: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 47: invokevirtual #35 // Method Vector2d$Companion.getUP:()LVector2d;\n 50: aastore\n 51: aload_2\n 52: astore_1\n 53: iconst_4\n 54: anewarray #16 // class Vector2d\n 57: astore_3\n 58: aload_3\n 59: iconst_0\n 60: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 63: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 66: aastore\n 67: aload_3\n 68: iconst_1\n 69: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 72: invokevirtual #35 // Method Vector2d$Companion.getUP:()LVector2d;\n 75: aastore\n 76: aload_3\n 77: iconst_2\n 78: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 81: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 84: aastore\n 85: aload_3\n 86: iconst_3\n 87: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 90: invokevirtual #29 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 93: aastore\n 94: aload_3\n 95: astore_2\n 96: bipush 22\n 98: sipush 6032\n 101: invokestatic #41 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 104: sipush 5031\n 107: invokestatic #41 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 110: new #43 // class Day22Kt$main$1\n 113: dup\n 114: aload_0\n 115: aload_2\n 116: aload_1\n 117: invokespecial #46 // Method Day22Kt$main$1.\"<init>\":(Lkotlin/text/Regex;[LVector2d;[LVector2d;)V\n 120: checkcast #48 // class kotlin/jvm/functions/Function1\n 123: new #50 // class Day22Kt$main$2\n 126: dup\n 127: aload_0\n 128: aload_2\n 129: aload_1\n 130: invokespecial #51 // Method Day22Kt$main$2.\"<init>\":(Lkotlin/text/Regex;[LVector2d;[LVector2d;)V\n 133: checkcast #48 // class kotlin/jvm/functions/Function1\n 136: invokestatic #57 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 139: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #65 // Method main:()V\n 3: return\n\n private static final java.lang.String main$part1$lambda$0(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc #71 // String it\n 3: invokestatic #77 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #83, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 12: areturn\n\n private static final int main$part1(kotlin.text.Regex, Vector2d[], Vector2d[], java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_3\n 2: invokestatic #93 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 5: checkcast #95 // class java/lang/CharSequence\n 8: iconst_0\n 9: iconst_2\n 10: aconst_null\n 11: invokestatic #99 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 14: invokedynamic #116, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 19: invokestatic #122 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 22: invokestatic #126 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 25: astore 4\n 27: aload_3\n 28: iconst_2\n 29: invokestatic #130 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;\n 32: checkcast #132 // class java/lang/Iterable\n 35: astore 6\n 37: iconst_0\n 38: istore 7\n 40: aload 6\n 42: astore 8\n 44: new #134 // class java/util/ArrayList\n 47: dup\n 48: aload 6\n 50: bipush 10\n 52: invokestatic #138 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 55: invokespecial #141 // Method java/util/ArrayList.\"<init>\":(I)V\n 58: checkcast #143 // class java/util/Collection\n 61: astore 9\n 63: iconst_0\n 64: istore 10\n 66: iconst_0\n 67: istore 11\n 69: aload 8\n 71: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 76: astore 12\n 78: aload 12\n 80: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 85: ifeq 269\n 88: aload 12\n 90: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 95: astore 13\n 97: aload 9\n 99: iload 11\n 101: iinc 11, 1\n 104: istore 14\n 106: iload 14\n 108: ifge 114\n 111: invokestatic #160 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 114: iload 14\n 116: aload 13\n 118: checkcast #162 // class java/lang/String\n 121: astore 15\n 123: istore 16\n 125: astore 31\n 127: iconst_0\n 128: istore 17\n 130: aload 15\n 132: invokevirtual #166 // Method java/lang/String.toCharArray:()[C\n 135: dup\n 136: ldc #168 // String toCharArray(...)\n 138: invokestatic #171 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 141: astore 18\n 143: nop\n 144: iconst_0\n 145: istore 19\n 147: aload 18\n 149: astore 20\n 151: new #134 // class java/util/ArrayList\n 154: dup\n 155: aload 18\n 157: arraylength\n 158: invokespecial #141 // Method java/util/ArrayList.\"<init>\":(I)V\n 161: checkcast #143 // class java/util/Collection\n 164: astore 21\n 166: iconst_0\n 167: istore 22\n 169: iconst_0\n 170: istore 23\n 172: iconst_0\n 173: istore 24\n 175: aload 20\n 177: arraylength\n 178: istore 25\n 180: iload 24\n 182: iload 25\n 184: if_icmpge 250\n 187: aload 20\n 189: iload 24\n 191: caload\n 192: istore 26\n 194: aload 21\n 196: iload 23\n 198: iinc 23, 1\n 201: iload 26\n 203: istore 27\n 205: istore 28\n 207: astore 29\n 209: iconst_0\n 210: istore 30\n 212: new #16 // class Vector2d\n 215: dup\n 216: iload 28\n 218: iconst_1\n 219: iadd\n 220: iload 16\n 222: iconst_1\n 223: iadd\n 224: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 227: iload 27\n 229: invokestatic #179 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 232: invokestatic #185 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 235: aload 29\n 237: swap\n 238: invokeinterface #189, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 243: pop\n 244: iinc 24, 1\n 247: goto 180\n 250: aload 21\n 252: checkcast #191 // class java/util/List\n 255: nop\n 256: nop\n 257: aload 31\n 259: swap\n 260: invokeinterface #189, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 265: pop\n 266: goto 78\n 269: aload 9\n 271: checkcast #191 // class java/util/List\n 274: nop\n 275: checkcast #132 // class java/lang/Iterable\n 278: invokestatic #195 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 281: checkcast #132 // class java/lang/Iterable\n 284: astore 6\n 286: iconst_0\n 287: istore 7\n 289: aload 6\n 291: astore 8\n 293: new #134 // class java/util/ArrayList\n 296: dup\n 297: invokespecial #197 // Method java/util/ArrayList.\"<init>\":()V\n 300: checkcast #143 // class java/util/Collection\n 303: astore 9\n 305: iconst_0\n 306: istore 10\n 308: aload 8\n 310: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 315: astore 11\n 317: aload 11\n 319: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 324: ifeq 387\n 327: aload 11\n 329: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 334: astore 12\n 336: aload 12\n 338: checkcast #199 // class kotlin/Pair\n 341: astore 13\n 343: iconst_0\n 344: istore 14\n 346: aload 13\n 348: invokevirtual #202 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 351: checkcast #176 // class java/lang/Character\n 354: invokevirtual #206 // Method java/lang/Character.charValue:()C\n 357: istore 15\n 359: iload 15\n 361: bipush 32\n 363: if_icmpeq 370\n 366: iconst_1\n 367: goto 371\n 370: iconst_0\n 371: ifeq 317\n 374: aload 9\n 376: aload 12\n 378: invokeinterface #189, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 383: pop\n 384: goto 317\n 387: aload 9\n 389: checkcast #191 // class java/util/List\n 392: nop\n 393: checkcast #132 // class java/lang/Iterable\n 396: invokestatic #212 // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;\n 399: astore 5\n 401: aconst_null\n 402: astore 6\n 404: aload 5\n 406: invokeinterface #218, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 411: checkcast #132 // class java/lang/Iterable\n 414: astore 7\n 416: iconst_0\n 417: istore 8\n 419: aload 7\n 421: astore 9\n 423: new #134 // class java/util/ArrayList\n 426: dup\n 427: invokespecial #197 // Method java/util/ArrayList.\"<init>\":()V\n 430: checkcast #143 // class java/util/Collection\n 433: astore 10\n 435: iconst_0\n 436: istore 11\n 438: aload 9\n 440: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 445: astore 12\n 447: aload 12\n 449: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 454: ifeq 506\n 457: aload 12\n 459: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 464: astore 13\n 466: aload 13\n 468: checkcast #16 // class Vector2d\n 471: astore 14\n 473: iconst_0\n 474: istore 15\n 476: aload 14\n 478: invokevirtual #222 // Method Vector2d.getY:()I\n 481: iconst_1\n 482: if_icmpne 489\n 485: iconst_1\n 486: goto 490\n 489: iconst_0\n 490: ifeq 447\n 493: aload 10\n 495: aload 13\n 497: invokeinterface #189, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 502: pop\n 503: goto 447\n 506: aload 10\n 508: checkcast #191 // class java/util/List\n 511: nop\n 512: checkcast #132 // class java/lang/Iterable\n 515: astore 7\n 517: nop\n 518: iconst_0\n 519: istore 8\n 521: aload 7\n 523: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 528: astore 9\n 530: aload 9\n 532: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 537: ifne 548\n 540: new #224 // class java/util/NoSuchElementException\n 543: dup\n 544: invokespecial #225 // Method java/util/NoSuchElementException.\"<init>\":()V\n 547: athrow\n 548: aload 9\n 550: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 555: astore 10\n 557: aload 9\n 559: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 564: ifne 572\n 567: aload 10\n 569: goto 642\n 572: aload 10\n 574: checkcast #16 // class Vector2d\n 577: astore 11\n 579: iconst_0\n 580: istore 12\n 582: aload 11\n 584: invokevirtual #228 // Method Vector2d.getX:()I\n 587: istore 11\n 589: aload 9\n 591: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 596: astore 12\n 598: aload 12\n 600: checkcast #16 // class Vector2d\n 603: astore 13\n 605: iconst_0\n 606: istore 14\n 608: aload 13\n 610: invokevirtual #228 // Method Vector2d.getX:()I\n 613: istore 13\n 615: iload 11\n 617: iload 13\n 619: if_icmple 630\n 622: aload 12\n 624: astore 10\n 626: iload 13\n 628: istore 11\n 630: aload 9\n 632: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 637: ifne 589\n 640: aload 10\n 642: astore 6\n 644: aconst_null\n 645: astore 7\n 647: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 650: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 653: astore 7\n 655: aload 4\n 657: invokeinterface #229, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 662: astore 8\n 664: aload 8\n 666: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 671: ifeq 866\n 674: aload 8\n 676: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 681: checkcast #162 // class java/lang/String\n 684: astore 9\n 686: aload 9\n 688: astore 10\n 690: aload 10\n 692: ldc #231 // String L\n 694: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 697: ifeq 718\n 700: aload_1\n 701: aload_1\n 702: aload 7\n 704: invokestatic #241 // Method kotlin/collections/ArraysKt.indexOf:([Ljava/lang/Object;Ljava/lang/Object;)I\n 707: iconst_1\n 708: iadd\n 709: aload_1\n 710: arraylength\n 711: irem\n 712: aaload\n 713: astore 7\n 715: goto 664\n 718: aload 10\n 720: ldc #243 // String R\n 722: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 725: ifeq 746\n 728: aload_2\n 729: aload_2\n 730: aload 7\n 732: invokestatic #241 // Method kotlin/collections/ArraysKt.indexOf:([Ljava/lang/Object;Ljava/lang/Object;)I\n 735: iconst_1\n 736: iadd\n 737: aload_2\n 738: arraylength\n 739: irem\n 740: aaload\n 741: astore 7\n 743: goto 664\n 746: aload 9\n 748: invokestatic #247 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 751: istore 11\n 753: iconst_0\n 754: istore 12\n 756: iload 12\n 758: iload 11\n 760: if_icmpge 664\n 763: iload 12\n 765: istore 13\n 767: iconst_0\n 768: istore 14\n 770: aload 6\n 772: checkcast #16 // class Vector2d\n 775: aload 7\n 777: invokevirtual #251 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 780: astore 15\n 782: aload 5\n 784: aload 15\n 786: invokeinterface #254, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 791: ifne 820\n 794: aload 15\n 796: aload 7\n 798: invokevirtual #257 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 801: astore 15\n 803: aload 5\n 805: aload 15\n 807: aload 7\n 809: invokevirtual #257 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 812: invokeinterface #254, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 817: ifne 794\n 820: aload 5\n 822: aload 15\n 824: invokeinterface #260, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 829: checkcast #176 // class java/lang/Character\n 832: bipush 35\n 834: istore 16\n 836: dup\n 837: ifnonnull 844\n 840: pop\n 841: goto 855\n 844: invokevirtual #206 // Method java/lang/Character.charValue:()C\n 847: iload 16\n 849: if_icmpne 855\n 852: goto 860\n 855: aload 15\n 857: astore 6\n 859: nop\n 860: iinc 12, 1\n 863: goto 756\n 866: sipush 1000\n 869: aload 6\n 871: checkcast #16 // class Vector2d\n 874: invokevirtual #222 // Method Vector2d.getY:()I\n 877: imul\n 878: iconst_4\n 879: aload 6\n 881: checkcast #16 // class Vector2d\n 884: invokevirtual #228 // Method Vector2d.getX:()I\n 887: imul\n 888: iadd\n 889: aload_2\n 890: aload 7\n 892: invokestatic #241 // Method kotlin/collections/ArraysKt.indexOf:([Ljava/lang/Object;Ljava/lang/Object;)I\n 895: iadd\n 896: ireturn\n\n private static final java.lang.String main$part2$lambda$7(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc #71 // String it\n 3: invokestatic #77 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #83, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 12: areturn\n\n private static final Vector3d main$part2$sideOf(Vector2d);\n Code:\n 0: aload_0\n 1: invokevirtual #228 // Method Vector2d.getX:()I\n 4: istore_1\n 5: bipush 50\n 7: iload_1\n 8: if_icmpgt 25\n 11: iload_1\n 12: bipush 100\n 14: if_icmpge 21\n 17: iconst_1\n 18: goto 26\n 21: iconst_0\n 22: goto 26\n 25: iconst_0\n 26: ifeq 64\n 29: aload_0\n 30: invokevirtual #222 // Method Vector2d.getY:()I\n 33: istore_1\n 34: iconst_0\n 35: iload_1\n 36: if_icmpgt 53\n 39: iload_1\n 40: bipush 50\n 42: if_icmpge 49\n 45: iconst_1\n 46: goto 54\n 49: iconst_0\n 50: goto 54\n 53: iconst_0\n 54: ifeq 64\n 57: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 60: invokevirtual #322 // Method Vector3d$Companion.getFRONT:()LVector3d;\n 63: areturn\n 64: aload_0\n 65: invokevirtual #228 // Method Vector2d.getX:()I\n 68: istore_1\n 69: bipush 100\n 71: iload_1\n 72: if_icmpgt 90\n 75: iload_1\n 76: sipush 150\n 79: if_icmpge 86\n 82: iconst_1\n 83: goto 91\n 86: iconst_0\n 87: goto 91\n 90: iconst_0\n 91: ifeq 129\n 94: aload_0\n 95: invokevirtual #222 // Method Vector2d.getY:()I\n 98: istore_1\n 99: iconst_0\n 100: iload_1\n 101: if_icmpgt 118\n 104: iload_1\n 105: bipush 50\n 107: if_icmpge 114\n 110: iconst_1\n 111: goto 119\n 114: iconst_0\n 115: goto 119\n 118: iconst_0\n 119: ifeq 129\n 122: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 125: invokevirtual #324 // Method Vector3d$Companion.getRIGHT:()LVector3d;\n 128: areturn\n 129: aload_0\n 130: invokevirtual #228 // Method Vector2d.getX:()I\n 133: istore_1\n 134: bipush 50\n 136: iload_1\n 137: if_icmpgt 154\n 140: iload_1\n 141: bipush 100\n 143: if_icmpge 150\n 146: iconst_1\n 147: goto 155\n 150: iconst_0\n 151: goto 155\n 154: iconst_0\n 155: ifeq 194\n 158: aload_0\n 159: invokevirtual #222 // Method Vector2d.getY:()I\n 162: istore_1\n 163: bipush 50\n 165: iload_1\n 166: if_icmpgt 183\n 169: iload_1\n 170: bipush 100\n 172: if_icmpge 179\n 175: iconst_1\n 176: goto 184\n 179: iconst_0\n 180: goto 184\n 183: iconst_0\n 184: ifeq 194\n 187: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 190: invokevirtual #326 // Method Vector3d$Companion.getDOWN:()LVector3d;\n 193: areturn\n 194: aload_0\n 195: invokevirtual #228 // Method Vector2d.getX:()I\n 198: istore_1\n 199: bipush 50\n 201: iload_1\n 202: if_icmpgt 219\n 205: iload_1\n 206: bipush 100\n 208: if_icmpge 215\n 211: iconst_1\n 212: goto 220\n 215: iconst_0\n 216: goto 220\n 219: iconst_0\n 220: ifeq 260\n 223: aload_0\n 224: invokevirtual #222 // Method Vector2d.getY:()I\n 227: istore_1\n 228: bipush 100\n 230: iload_1\n 231: if_icmpgt 249\n 234: iload_1\n 235: sipush 150\n 238: if_icmpge 245\n 241: iconst_1\n 242: goto 250\n 245: iconst_0\n 246: goto 250\n 249: iconst_0\n 250: ifeq 260\n 253: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 256: invokevirtual #329 // Method Vector3d$Companion.getBACK:()LVector3d;\n 259: areturn\n 260: aload_0\n 261: invokevirtual #228 // Method Vector2d.getX:()I\n 264: istore_1\n 265: iconst_0\n 266: iload_1\n 267: if_icmpgt 284\n 270: iload_1\n 271: bipush 50\n 273: if_icmpge 280\n 276: iconst_1\n 277: goto 285\n 280: iconst_0\n 281: goto 285\n 284: iconst_0\n 285: ifeq 325\n 288: aload_0\n 289: invokevirtual #222 // Method Vector2d.getY:()I\n 292: istore_1\n 293: bipush 100\n 295: iload_1\n 296: if_icmpgt 314\n 299: iload_1\n 300: sipush 150\n 303: if_icmpge 310\n 306: iconst_1\n 307: goto 315\n 310: iconst_0\n 311: goto 315\n 314: iconst_0\n 315: ifeq 325\n 318: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 321: invokevirtual #331 // Method Vector3d$Companion.getLEFT:()LVector3d;\n 324: areturn\n 325: aload_0\n 326: invokevirtual #228 // Method Vector2d.getX:()I\n 329: istore_1\n 330: iconst_0\n 331: iload_1\n 332: if_icmpgt 349\n 335: iload_1\n 336: bipush 50\n 338: if_icmpge 345\n 341: iconst_1\n 342: goto 350\n 345: iconst_0\n 346: goto 350\n 349: iconst_0\n 350: ifeq 391\n 353: aload_0\n 354: invokevirtual #222 // Method Vector2d.getY:()I\n 357: istore_1\n 358: sipush 150\n 361: iload_1\n 362: if_icmpgt 380\n 365: iload_1\n 366: sipush 200\n 369: if_icmpge 376\n 372: iconst_1\n 373: goto 381\n 376: iconst_0\n 377: goto 381\n 380: iconst_0\n 381: ifeq 391\n 384: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 387: invokevirtual #333 // Method Vector3d$Companion.getUP:()LVector3d;\n 390: areturn\n 391: new #335 // class java/lang/Exception\n 394: dup\n 395: new #337 // class java/lang/StringBuilder\n 398: dup\n 399: invokespecial #338 // Method java/lang/StringBuilder.\"<init>\":()V\n 402: ldc_w #340 // String Side does not exist for\n 405: invokevirtual #344 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 408: aload_0\n 409: invokevirtual #347 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 412: invokevirtual #350 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 415: invokespecial #351 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 418: athrow\n\n private static final kotlin.Pair<Vector2d, Vector2d> main$part2$cubeWraVector2d(Vector2d, Vector2d);\n Code:\n 0: aload_0\n 1: new #16 // class Vector2d\n 4: dup\n 5: iconst_1\n 6: iconst_1\n 7: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 10: invokevirtual #257 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 13: astore_2\n 14: aload_1\n 15: astore_3\n 16: aload_2\n 17: invokestatic #357 // Method main$part2$sideOf:(LVector2d;)LVector3d;\n 20: astore 4\n 22: aload_2\n 23: astore 5\n 25: aload 4\n 27: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 30: invokevirtual #322 // Method Vector3d$Companion.getFRONT:()LVector3d;\n 33: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 36: ifeq 83\n 39: aload_1\n 40: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 43: invokevirtual #35 // Method Vector2d$Companion.getUP:()LVector2d;\n 46: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 49: ifeq 83\n 52: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 55: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 58: astore_3\n 59: new #16 // class Vector2d\n 62: dup\n 63: iconst_0\n 64: sipush 150\n 67: aload_2\n 68: invokevirtual #228 // Method Vector2d.getX:()I\n 71: iadd\n 72: bipush 50\n 74: isub\n 75: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 78: astore 5\n 80: goto 833\n 83: aload 4\n 85: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 88: invokevirtual #322 // Method Vector3d$Companion.getFRONT:()LVector3d;\n 91: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 94: ifeq 142\n 97: aload_1\n 98: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 101: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 104: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 107: ifeq 142\n 110: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 113: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 116: astore_3\n 117: new #16 // class Vector2d\n 120: dup\n 121: iconst_0\n 122: bipush 100\n 124: bipush 50\n 126: aload_2\n 127: invokevirtual #222 // Method Vector2d.getY:()I\n 130: isub\n 131: iconst_1\n 132: isub\n 133: iadd\n 134: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 137: astore 5\n 139: goto 833\n 142: aload 4\n 144: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 147: invokevirtual #324 // Method Vector3d$Companion.getRIGHT:()LVector3d;\n 150: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 153: ifeq 198\n 156: aload_1\n 157: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 160: invokevirtual #35 // Method Vector2d$Companion.getUP:()LVector2d;\n 163: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 166: ifeq 198\n 169: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 172: invokevirtual #35 // Method Vector2d$Companion.getUP:()LVector2d;\n 175: astore_3\n 176: new #16 // class Vector2d\n 179: dup\n 180: aload_2\n 181: invokevirtual #228 // Method Vector2d.getX:()I\n 184: bipush 100\n 186: isub\n 187: sipush 199\n 190: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 193: astore 5\n 195: goto 833\n 198: aload 4\n 200: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 203: invokevirtual #324 // Method Vector3d$Companion.getRIGHT:()LVector3d;\n 206: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 209: ifeq 258\n 212: aload_1\n 213: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 216: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 219: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 222: ifeq 258\n 225: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 228: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 231: astore_3\n 232: new #16 // class Vector2d\n 235: dup\n 236: bipush 99\n 238: bipush 50\n 240: aload_2\n 241: invokevirtual #222 // Method Vector2d.getY:()I\n 244: isub\n 245: bipush 100\n 247: iadd\n 248: iconst_1\n 249: isub\n 250: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 253: astore 5\n 255: goto 833\n 258: aload 4\n 260: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 263: invokevirtual #324 // Method Vector3d$Companion.getRIGHT:()LVector3d;\n 266: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 269: ifeq 316\n 272: aload_1\n 273: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 276: invokevirtual #29 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 279: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 282: ifeq 316\n 285: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 288: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 291: astore_3\n 292: new #16 // class Vector2d\n 295: dup\n 296: bipush 99\n 298: bipush 50\n 300: aload_2\n 301: invokevirtual #228 // Method Vector2d.getX:()I\n 304: bipush 100\n 306: isub\n 307: iadd\n 308: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 311: astore 5\n 313: goto 833\n 316: aload 4\n 318: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 321: invokevirtual #326 // Method Vector3d$Companion.getDOWN:()LVector3d;\n 324: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 327: ifeq 374\n 330: aload_1\n 331: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 334: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 337: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 340: ifeq 374\n 343: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 346: invokevirtual #35 // Method Vector2d$Companion.getUP:()LVector2d;\n 349: astore_3\n 350: new #16 // class Vector2d\n 353: dup\n 354: aload_2\n 355: invokevirtual #222 // Method Vector2d.getY:()I\n 358: bipush 50\n 360: isub\n 361: bipush 100\n 363: iadd\n 364: bipush 49\n 366: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 369: astore 5\n 371: goto 833\n 374: aload 4\n 376: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 379: invokevirtual #326 // Method Vector3d$Companion.getDOWN:()LVector3d;\n 382: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 385: ifeq 429\n 388: aload_1\n 389: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 392: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 395: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 398: ifeq 429\n 401: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 404: invokevirtual #29 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 407: astore_3\n 408: new #16 // class Vector2d\n 411: dup\n 412: aload_2\n 413: invokevirtual #222 // Method Vector2d.getY:()I\n 416: bipush 50\n 418: isub\n 419: bipush 100\n 421: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 424: astore 5\n 426: goto 833\n 429: aload 4\n 431: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 434: invokevirtual #331 // Method Vector3d$Companion.getLEFT:()LVector3d;\n 437: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 440: ifeq 489\n 443: aload_1\n 444: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 447: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 450: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 453: ifeq 489\n 456: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 459: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 462: astore_3\n 463: new #16 // class Vector2d\n 466: dup\n 467: bipush 50\n 469: bipush 50\n 471: aload_2\n 472: invokevirtual #222 // Method Vector2d.getY:()I\n 475: bipush 100\n 477: isub\n 478: isub\n 479: iconst_1\n 480: isub\n 481: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 484: astore 5\n 486: goto 833\n 489: aload 4\n 491: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 494: invokevirtual #331 // Method Vector3d$Companion.getLEFT:()LVector3d;\n 497: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 500: ifeq 544\n 503: aload_1\n 504: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 507: invokevirtual #35 // Method Vector2d$Companion.getUP:()LVector2d;\n 510: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 513: ifeq 544\n 516: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 519: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 522: astore_3\n 523: new #16 // class Vector2d\n 526: dup\n 527: bipush 50\n 529: bipush 50\n 531: aload_2\n 532: invokevirtual #228 // Method Vector2d.getX:()I\n 535: iadd\n 536: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 539: astore 5\n 541: goto 833\n 544: aload 4\n 546: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 549: invokevirtual #329 // Method Vector3d$Companion.getBACK:()LVector3d;\n 552: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 555: ifeq 603\n 558: aload_1\n 559: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 562: invokevirtual #29 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 565: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 568: ifeq 603\n 571: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 574: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 577: astore_3\n 578: new #16 // class Vector2d\n 581: dup\n 582: bipush 49\n 584: sipush 150\n 587: aload_2\n 588: invokevirtual #228 // Method Vector2d.getX:()I\n 591: bipush 50\n 593: isub\n 594: iadd\n 595: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 598: astore 5\n 600: goto 833\n 603: aload 4\n 605: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 608: invokevirtual #329 // Method Vector3d$Companion.getBACK:()LVector3d;\n 611: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 614: ifeq 664\n 617: aload_1\n 618: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 621: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 624: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 627: ifeq 664\n 630: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 633: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 636: astore_3\n 637: new #16 // class Vector2d\n 640: dup\n 641: sipush 149\n 644: bipush 50\n 646: aload_2\n 647: invokevirtual #222 // Method Vector2d.getY:()I\n 650: bipush 100\n 652: isub\n 653: isub\n 654: iconst_1\n 655: isub\n 656: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 659: astore 5\n 661: goto 833\n 664: aload 4\n 666: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 669: invokevirtual #333 // Method Vector3d$Companion.getUP:()LVector3d;\n 672: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 675: ifeq 724\n 678: aload_1\n 679: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 682: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 685: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 688: ifeq 724\n 691: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 694: invokevirtual #35 // Method Vector2d$Companion.getUP:()LVector2d;\n 697: astore_3\n 698: new #16 // class Vector2d\n 701: dup\n 702: aload_2\n 703: invokevirtual #222 // Method Vector2d.getY:()I\n 706: sipush 150\n 709: isub\n 710: bipush 50\n 712: iadd\n 713: sipush 149\n 716: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 719: astore 5\n 721: goto 833\n 724: aload 4\n 726: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 729: invokevirtual #333 // Method Vector3d$Companion.getUP:()LVector3d;\n 732: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 735: ifeq 782\n 738: aload_1\n 739: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 742: invokevirtual #32 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 745: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 748: ifeq 782\n 751: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 754: invokevirtual #29 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 757: astore_3\n 758: new #16 // class Vector2d\n 761: dup\n 762: bipush 50\n 764: aload_2\n 765: invokevirtual #222 // Method Vector2d.getY:()I\n 768: sipush 150\n 771: isub\n 772: iadd\n 773: iconst_0\n 774: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 777: astore 5\n 779: goto 833\n 782: aload 4\n 784: getstatic #316 // Field Vector3d.Companion:LVector3d$Companion;\n 787: invokevirtual #333 // Method Vector3d$Companion.getUP:()LVector3d;\n 790: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 793: ifeq 833\n 796: aload_1\n 797: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 800: invokevirtual #29 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 803: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 806: ifeq 833\n 809: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 812: invokevirtual #29 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 815: astore_3\n 816: new #16 // class Vector2d\n 819: dup\n 820: aload_2\n 821: invokevirtual #228 // Method Vector2d.getX:()I\n 824: bipush 100\n 826: iadd\n 827: iconst_0\n 828: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 831: astore 5\n 833: new #199 // class kotlin/Pair\n 836: dup\n 837: aload 5\n 839: new #16 // class Vector2d\n 842: dup\n 843: iconst_1\n 844: iconst_1\n 845: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 848: invokevirtual #251 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 851: aload_3\n 852: invokespecial #360 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 855: areturn\n\n private static final int main$part2(kotlin.text.Regex, Vector2d[], Vector2d[], java.util.List<java.lang.String>);\n Code:\n 0: aload_3\n 1: invokeinterface #371, 1 // InterfaceMethod java/util/List.size:()I\n 6: bipush 20\n 8: if_icmpge 15\n 11: sipush 5031\n 14: ireturn\n 15: aload_0\n 16: aload_3\n 17: invokestatic #93 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 20: checkcast #95 // class java/lang/CharSequence\n 23: iconst_0\n 24: iconst_2\n 25: aconst_null\n 26: invokestatic #99 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 29: invokedynamic #375, 0 // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;\n 34: invokestatic #122 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 37: invokestatic #126 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 40: astore 4\n 42: aload_3\n 43: iconst_2\n 44: invokestatic #130 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;\n 47: checkcast #132 // class java/lang/Iterable\n 50: astore 6\n 52: iconst_0\n 53: istore 7\n 55: aload 6\n 57: astore 8\n 59: new #134 // class java/util/ArrayList\n 62: dup\n 63: aload 6\n 65: bipush 10\n 67: invokestatic #138 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 70: invokespecial #141 // Method java/util/ArrayList.\"<init>\":(I)V\n 73: checkcast #143 // class java/util/Collection\n 76: astore 9\n 78: iconst_0\n 79: istore 10\n 81: iconst_0\n 82: istore 11\n 84: aload 8\n 86: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 91: astore 12\n 93: aload 12\n 95: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 100: ifeq 284\n 103: aload 12\n 105: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 110: astore 13\n 112: aload 9\n 114: iload 11\n 116: iinc 11, 1\n 119: istore 14\n 121: iload 14\n 123: ifge 129\n 126: invokestatic #160 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 129: iload 14\n 131: aload 13\n 133: checkcast #162 // class java/lang/String\n 136: astore 15\n 138: istore 16\n 140: astore 31\n 142: iconst_0\n 143: istore 17\n 145: aload 15\n 147: invokevirtual #166 // Method java/lang/String.toCharArray:()[C\n 150: dup\n 151: ldc #168 // String toCharArray(...)\n 153: invokestatic #171 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 156: astore 18\n 158: nop\n 159: iconst_0\n 160: istore 19\n 162: aload 18\n 164: astore 20\n 166: new #134 // class java/util/ArrayList\n 169: dup\n 170: aload 18\n 172: arraylength\n 173: invokespecial #141 // Method java/util/ArrayList.\"<init>\":(I)V\n 176: checkcast #143 // class java/util/Collection\n 179: astore 21\n 181: iconst_0\n 182: istore 22\n 184: iconst_0\n 185: istore 23\n 187: iconst_0\n 188: istore 24\n 190: aload 20\n 192: arraylength\n 193: istore 25\n 195: iload 24\n 197: iload 25\n 199: if_icmpge 265\n 202: aload 20\n 204: iload 24\n 206: caload\n 207: istore 26\n 209: aload 21\n 211: iload 23\n 213: iinc 23, 1\n 216: iload 26\n 218: istore 27\n 220: istore 28\n 222: astore 29\n 224: iconst_0\n 225: istore 30\n 227: new #16 // class Vector2d\n 230: dup\n 231: iload 28\n 233: iconst_1\n 234: iadd\n 235: iload 16\n 237: iconst_1\n 238: iadd\n 239: invokespecial #174 // Method Vector2d.\"<init>\":(II)V\n 242: iload 27\n 244: invokestatic #179 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 247: invokestatic #185 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 250: aload 29\n 252: swap\n 253: invokeinterface #189, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 258: pop\n 259: iinc 24, 1\n 262: goto 195\n 265: aload 21\n 267: checkcast #191 // class java/util/List\n 270: nop\n 271: nop\n 272: aload 31\n 274: swap\n 275: invokeinterface #189, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 280: pop\n 281: goto 93\n 284: aload 9\n 286: checkcast #191 // class java/util/List\n 289: nop\n 290: checkcast #132 // class java/lang/Iterable\n 293: invokestatic #195 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 296: checkcast #132 // class java/lang/Iterable\n 299: astore 6\n 301: iconst_0\n 302: istore 7\n 304: aload 6\n 306: astore 8\n 308: new #134 // class java/util/ArrayList\n 311: dup\n 312: invokespecial #197 // Method java/util/ArrayList.\"<init>\":()V\n 315: checkcast #143 // class java/util/Collection\n 318: astore 9\n 320: iconst_0\n 321: istore 10\n 323: aload 8\n 325: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 330: astore 11\n 332: aload 11\n 334: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 339: ifeq 402\n 342: aload 11\n 344: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 349: astore 12\n 351: aload 12\n 353: checkcast #199 // class kotlin/Pair\n 356: astore 13\n 358: iconst_0\n 359: istore 14\n 361: aload 13\n 363: invokevirtual #202 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 366: checkcast #176 // class java/lang/Character\n 369: invokevirtual #206 // Method java/lang/Character.charValue:()C\n 372: istore 15\n 374: iload 15\n 376: bipush 32\n 378: if_icmpeq 385\n 381: iconst_1\n 382: goto 386\n 385: iconst_0\n 386: ifeq 332\n 389: aload 9\n 391: aload 12\n 393: invokeinterface #189, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 398: pop\n 399: goto 332\n 402: aload 9\n 404: checkcast #191 // class java/util/List\n 407: nop\n 408: checkcast #132 // class java/lang/Iterable\n 411: invokestatic #212 // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;\n 414: astore 5\n 416: aconst_null\n 417: astore 6\n 419: aload 5\n 421: invokeinterface #218, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 426: checkcast #132 // class java/lang/Iterable\n 429: astore 7\n 431: iconst_0\n 432: istore 8\n 434: aload 7\n 436: astore 9\n 438: new #134 // class java/util/ArrayList\n 441: dup\n 442: invokespecial #197 // Method java/util/ArrayList.\"<init>\":()V\n 445: checkcast #143 // class java/util/Collection\n 448: astore 10\n 450: iconst_0\n 451: istore 11\n 453: aload 9\n 455: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 460: astore 12\n 462: aload 12\n 464: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 469: ifeq 521\n 472: aload 12\n 474: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 479: astore 13\n 481: aload 13\n 483: checkcast #16 // class Vector2d\n 486: astore 14\n 488: iconst_0\n 489: istore 15\n 491: aload 14\n 493: invokevirtual #222 // Method Vector2d.getY:()I\n 496: iconst_1\n 497: if_icmpne 504\n 500: iconst_1\n 501: goto 505\n 504: iconst_0\n 505: ifeq 462\n 508: aload 10\n 510: aload 13\n 512: invokeinterface #189, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 517: pop\n 518: goto 462\n 521: aload 10\n 523: checkcast #191 // class java/util/List\n 526: nop\n 527: checkcast #132 // class java/lang/Iterable\n 530: astore 7\n 532: nop\n 533: iconst_0\n 534: istore 8\n 536: aload 7\n 538: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 543: astore 9\n 545: aload 9\n 547: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 552: ifne 563\n 555: new #224 // class java/util/NoSuchElementException\n 558: dup\n 559: invokespecial #225 // Method java/util/NoSuchElementException.\"<init>\":()V\n 562: athrow\n 563: aload 9\n 565: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 570: astore 10\n 572: aload 9\n 574: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 579: ifne 587\n 582: aload 10\n 584: goto 657\n 587: aload 10\n 589: checkcast #16 // class Vector2d\n 592: astore 11\n 594: iconst_0\n 595: istore 12\n 597: aload 11\n 599: invokevirtual #228 // Method Vector2d.getX:()I\n 602: istore 11\n 604: aload 9\n 606: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 611: astore 12\n 613: aload 12\n 615: checkcast #16 // class Vector2d\n 618: astore 13\n 620: iconst_0\n 621: istore 14\n 623: aload 13\n 625: invokevirtual #228 // Method Vector2d.getX:()I\n 628: istore 13\n 630: iload 11\n 632: iload 13\n 634: if_icmple 645\n 637: aload 12\n 639: astore 10\n 641: iload 13\n 643: istore 11\n 645: aload 9\n 647: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 652: ifne 604\n 655: aload 10\n 657: astore 6\n 659: aconst_null\n 660: astore 7\n 662: getstatic #20 // Field Vector2d.Companion:LVector2d$Companion;\n 665: invokevirtual #26 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 668: astore 7\n 670: aload_3\n 671: iconst_2\n 672: invokestatic #130 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;\n 675: invokeinterface #371, 1 // InterfaceMethod java/util/List.size:()I\n 680: aload_3\n 681: iconst_2\n 682: invokestatic #130 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;\n 685: checkcast #132 // class java/lang/Iterable\n 688: astore 9\n 690: istore 31\n 692: aload 9\n 694: invokeinterface #147, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 699: astore 10\n 701: aload 10\n 703: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 708: ifne 719\n 711: new #224 // class java/util/NoSuchElementException\n 714: dup\n 715: invokespecial #225 // Method java/util/NoSuchElementException.\"<init>\":()V\n 718: athrow\n 719: aload 10\n 721: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 726: checkcast #162 // class java/lang/String\n 729: astore 11\n 731: iconst_0\n 732: istore 12\n 734: aload 11\n 736: invokevirtual #378 // Method java/lang/String.length:()I\n 739: istore 11\n 741: aload 10\n 743: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 748: ifeq 787\n 751: aload 10\n 753: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 758: checkcast #162 // class java/lang/String\n 761: astore 12\n 763: iconst_0\n 764: istore 13\n 766: aload 12\n 768: invokevirtual #378 // Method java/lang/String.length:()I\n 771: istore 12\n 773: iload 11\n 775: iload 12\n 777: if_icmpge 741\n 780: iload 12\n 782: istore 11\n 784: goto 741\n 787: iload 11\n 789: istore 32\n 791: iload 31\n 793: iload 32\n 795: invokestatic #382 // Method UtilsKt.gcd:(II)I\n 798: istore 8\n 800: aload 4\n 802: invokeinterface #229, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 807: astore 9\n 809: aload 9\n 811: invokeinterface #153, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 816: ifeq 1033\n 819: aload 9\n 821: invokeinterface #157, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 826: checkcast #162 // class java/lang/String\n 829: astore 10\n 831: aload 10\n 833: astore 11\n 835: aload 11\n 837: ldc #231 // String L\n 839: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 842: ifeq 863\n 845: aload_1\n 846: aload_1\n 847: aload 7\n 849: invokestatic #241 // Method kotlin/collections/ArraysKt.indexOf:([Ljava/lang/Object;Ljava/lang/Object;)I\n 852: iconst_1\n 853: iadd\n 854: aload_1\n 855: arraylength\n 856: irem\n 857: aaload\n 858: astore 7\n 860: goto 809\n 863: aload 11\n 865: ldc #243 // String R\n 867: invokestatic #235 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 870: ifeq 891\n 873: aload_2\n 874: aload_2\n 875: aload 7\n 877: invokestatic #241 // Method kotlin/collections/ArraysKt.indexOf:([Ljava/lang/Object;Ljava/lang/Object;)I\n 880: iconst_1\n 881: iadd\n 882: aload_2\n 883: arraylength\n 884: irem\n 885: aaload\n 886: astore 7\n 888: goto 809\n 891: aload 10\n 893: invokestatic #247 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 896: istore 12\n 898: iconst_0\n 899: istore 13\n 901: iload 13\n 903: iload 12\n 905: if_icmpge 809\n 908: iload 13\n 910: istore 14\n 912: iconst_0\n 913: istore 15\n 915: aload 6\n 917: checkcast #16 // class Vector2d\n 920: aload 7\n 922: invokevirtual #251 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 925: astore 16\n 927: aload 7\n 929: astore 17\n 931: aload 5\n 933: aload 16\n 935: invokeinterface #254, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 940: ifne 983\n 943: aload 6\n 945: checkcast #16 // class Vector2d\n 948: aload 7\n 950: invokestatic #384 // Method main$part2$cubeWraVector2d:(LVector2d;LVector2d;)Lkotlin/Pair;\n 953: astore 18\n 955: aload 18\n 957: invokevirtual #387 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 960: checkcast #16 // class Vector2d\n 963: astore 19\n 965: aload 18\n 967: invokevirtual #202 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 970: checkcast #16 // class Vector2d\n 973: astore 20\n 975: aload 19\n 977: astore 16\n 979: aload 20\n 981: astore 17\n 983: aload 5\n 985: aload 16\n 987: invokeinterface #260, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 992: checkcast #176 // class java/lang/Character\n 995: bipush 35\n 997: istore 18\n 999: dup\n 1000: ifnonnull 1007\n 1003: pop\n 1004: goto 1018\n 1007: invokevirtual #206 // Method java/lang/Character.charValue:()C\n 1010: iload 18\n 1012: if_icmpne 1018\n 1015: goto 1027\n 1018: aload 16\n 1020: astore 6\n 1022: aload 17\n 1024: astore 7\n 1026: nop\n 1027: iinc 13, 1\n 1030: goto 901\n 1033: new #337 // class java/lang/StringBuilder\n 1036: dup\n 1037: invokespecial #338 // Method java/lang/StringBuilder.\"<init>\":()V\n 1040: ldc_w #389 // String Final position is\n 1043: invokevirtual #344 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 1046: aload 6\n 1048: invokevirtual #347 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 1051: ldc_w #391 // String , direction\n 1054: invokevirtual #344 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 1057: aload 7\n 1059: invokevirtual #347 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 1062: ldc_w #393 // String (\n 1065: invokevirtual #344 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 1068: aload_2\n 1069: aload 7\n 1071: invokestatic #241 // Method kotlin/collections/ArraysKt.indexOf:([Ljava/lang/Object;Ljava/lang/Object;)I\n 1074: invokevirtual #396 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 1077: bipush 41\n 1079: invokevirtual #399 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 1082: invokevirtual #350 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 1085: getstatic #405 // Field java/lang/System.out:Ljava/io/PrintStream;\n 1088: swap\n 1089: invokevirtual #411 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 1092: sipush 1000\n 1095: aload 6\n 1097: checkcast #16 // class Vector2d\n 1100: invokevirtual #222 // Method Vector2d.getY:()I\n 1103: imul\n 1104: iconst_4\n 1105: aload 6\n 1107: checkcast #16 // class Vector2d\n 1110: invokevirtual #228 // Method Vector2d.getX:()I\n 1113: imul\n 1114: iadd\n 1115: aload_2\n 1116: aload 7\n 1118: invokestatic #241 // Method kotlin/collections/ArraysKt.indexOf:([Ljava/lang/Object;Ljava/lang/Object;)I\n 1121: iadd\n 1122: ireturn\n\n public static final int access$main$part1(kotlin.text.Regex, Vector2d[], Vector2d[], java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: aload_3\n 4: invokestatic #423 // Method main$part1:(Lkotlin/text/Regex;[LVector2d;[LVector2d;Ljava/util/List;)I\n 7: ireturn\n\n public static final int access$main$part2(kotlin.text.Regex, Vector2d[], Vector2d[], java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: aload_3\n 4: invokestatic #426 // Method main$part2:(Lkotlin/text/Regex;[LVector2d;[LVector2d;Ljava/util/List;)I\n 7: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day22Kt$main$1.class", "javap": "Compiled from \"Day22.kt\"\nfinal class Day22Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final kotlin.text.Regex $instructionLineRegex;\n\n final Vector2d[] $leftTurns;\n\n final Vector2d[] $rightTurns;\n\n Day22Kt$main$1(kotlin.text.Regex, Vector2d[], Vector2d[]);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $instructionLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: aload_2\n 7: putfield #17 // Field $leftTurns:[LVector2d;\n 10: aload_0\n 11: aload_3\n 12: putfield #20 // Field $rightTurns:[LVector2d;\n 15: aload_0\n 16: iconst_1\n 17: ldc #22 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 19: ldc #24 // String part1\n 21: ldc #26 // String main$part1(Lkotlin/text/Regex;[LVector2d;[LVector2d;Ljava/util/List;)I\n 23: iconst_0\n 24: invokespecial #29 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 27: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #36 // String p0\n 3: invokestatic #42 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $instructionLineRegex:Lkotlin/text/Regex;\n 10: aload_0\n 11: getfield #17 // Field $leftTurns:[LVector2d;\n 14: aload_0\n 15: getfield #20 // Field $rightTurns:[LVector2d;\n 18: aload_1\n 19: invokestatic #48 // Method Day22Kt.access$main$part1:(Lkotlin/text/Regex;[LVector2d;[LVector2d;Ljava/util/List;)I\n 22: invokestatic #54 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #58 // class java/util/List\n 5: invokevirtual #60 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day22Kt$main$2.class", "javap": "Compiled from \"Day22.kt\"\nfinal class Day22Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final kotlin.text.Regex $instructionLineRegex;\n\n final Vector2d[] $leftTurns;\n\n final Vector2d[] $rightTurns;\n\n Day22Kt$main$2(kotlin.text.Regex, Vector2d[], Vector2d[]);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $instructionLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: aload_2\n 7: putfield #17 // Field $leftTurns:[LVector2d;\n 10: aload_0\n 11: aload_3\n 12: putfield #20 // Field $rightTurns:[LVector2d;\n 15: aload_0\n 16: iconst_1\n 17: ldc #22 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 19: ldc #24 // String part2\n 21: ldc #26 // String main$part2(Lkotlin/text/Regex;[LVector2d;[LVector2d;Ljava/util/List;)I\n 23: iconst_0\n 24: invokespecial #29 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 27: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #36 // String p0\n 3: invokestatic #42 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $instructionLineRegex:Lkotlin/text/Regex;\n 10: aload_0\n 11: getfield #17 // Field $leftTurns:[LVector2d;\n 14: aload_0\n 15: getfield #20 // Field $rightTurns:[LVector2d;\n 18: aload_1\n 19: invokestatic #48 // Method Day22Kt.access$main$part2:(Lkotlin/text/Regex;[LVector2d;[LVector2d;Ljava/util/List;)I\n 22: invokestatic #54 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #58 // class java/util/List\n 5: invokevirtual #60 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day23.kt
fun main() { val directionsToConsider = arrayOf( arrayOf( Vector2d.UP, Vector2d.UP + Vector2d.LEFT, Vector2d.UP + Vector2d.RIGHT, ), arrayOf( Vector2d.DOWN, Vector2d.DOWN + Vector2d.LEFT, Vector2d.DOWN + Vector2d.RIGHT, ), arrayOf( Vector2d.LEFT, Vector2d.LEFT + Vector2d.UP, Vector2d.LEFT + Vector2d.DOWN, ), arrayOf( Vector2d.RIGHT, Vector2d.RIGHT + Vector2d.UP, Vector2d.RIGHT + Vector2d.DOWN, ), ) fun diffuseElves(elves: MutableSet<Vector2d>, stopAfterRound: Int = -1): Int { var rounds = 1 var directionsToConsiderIndex = 0 while (true) { val moveProposals = mutableMapOf<Vector2d, Vector2d>() val moveProposalsDuplicates = mutableSetOf<Vector2d>() val moveProposalsElves = mutableSetOf<Vector2d>() // first half for (elf in elves) { val neighbours = elf.neighbours8().intersect(elves) if (neighbours.isEmpty()) continue for (n in directionsToConsider.indices) { val directionToConsiderIndex = (directionsToConsiderIndex + n) % directionsToConsider.size val directionNeighbours = directionsToConsider[directionToConsiderIndex].map { elf + it }.toSet() if (directionNeighbours.intersect(neighbours).isEmpty()) { val moveProposal = directionNeighbours.first() if (moveProposal in moveProposalsDuplicates) break if (moveProposal in moveProposals) { moveProposalsDuplicates += moveProposal moveProposalsElves -= moveProposals[moveProposal]!! moveProposals -= moveProposal break } moveProposals[moveProposal] = elf moveProposalsElves += elf break } } } if (stopAfterRound == -1 && moveProposals.isEmpty()) break // second half elves -= moveProposalsElves // elves -= moveProposals.values.toSet() elves += moveProposals.keys directionsToConsiderIndex = (directionsToConsiderIndex + 1) % directionsToConsider.size if (rounds++ == stopAfterRound) break } return rounds } fun part1(input: List<String>): Int { val elves = Grid(input.map { line -> line.toCharArray().toList() }).data.flatten().filter { it.value == '#' }.map { it.position }.toMutableSet() diffuseElves(elves, stopAfterRound = 10) 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 (maxX - minX + 1) * (maxY - minY + 1) - elves.size } fun part2(input: List<String>): Int { val elves = Grid(input.map { line -> line.toCharArray().toList() }).data.flatten().filter { it.value == '#' }.map { it.position }.toMutableSet() return diffuseElves(elves) } test( day = 23, testTarget1 = 110, testTarget2 = 20, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day23Kt$main$1.class", "javap": "Compiled from \"Day23.kt\"\nfinal class Day23Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final Vector2d[][] $directionsToConsider;\n\n Day23Kt$main$1(Vector2d[][]);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $directionsToConsider:[[LVector2d;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part1\n 11: ldc #19 // String main$part1([[LVector2d;Ljava/util/List;)I\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $directionsToConsider:[[LVector2d;\n 10: aload_1\n 11: invokestatic #41 // Method Day23Kt.access$main$part1:([[LVector2d;Ljava/util/List;)I\n 14: invokestatic #47 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day23Kt.class", "javap": "Compiled from \"Day23.kt\"\npublic final class Day23Kt {\n public static final void main();\n Code:\n 0: iconst_4\n 1: anewarray #8 // class \"[LVector2d;\"\n 4: astore_1\n 5: aload_1\n 6: iconst_0\n 7: iconst_3\n 8: anewarray #10 // class Vector2d\n 11: astore_2\n 12: aload_2\n 13: iconst_0\n 14: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 17: invokevirtual #20 // Method Vector2d$Companion.getUP:()LVector2d;\n 20: aastore\n 21: aload_2\n 22: iconst_1\n 23: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 26: invokevirtual #20 // Method Vector2d$Companion.getUP:()LVector2d;\n 29: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 32: invokevirtual #23 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 35: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 38: aastore\n 39: aload_2\n 40: iconst_2\n 41: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 44: invokevirtual #20 // Method Vector2d$Companion.getUP:()LVector2d;\n 47: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 50: invokevirtual #30 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 53: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 56: aastore\n 57: aload_2\n 58: aastore\n 59: aload_1\n 60: iconst_1\n 61: iconst_3\n 62: anewarray #10 // class Vector2d\n 65: astore_2\n 66: aload_2\n 67: iconst_0\n 68: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 71: invokevirtual #33 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 74: aastore\n 75: aload_2\n 76: iconst_1\n 77: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 80: invokevirtual #33 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 83: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 86: invokevirtual #23 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 89: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 92: aastore\n 93: aload_2\n 94: iconst_2\n 95: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 98: invokevirtual #33 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 101: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 104: invokevirtual #30 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 107: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 110: aastore\n 111: aload_2\n 112: aastore\n 113: aload_1\n 114: iconst_2\n 115: iconst_3\n 116: anewarray #10 // class Vector2d\n 119: astore_2\n 120: aload_2\n 121: iconst_0\n 122: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 125: invokevirtual #23 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 128: aastore\n 129: aload_2\n 130: iconst_1\n 131: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 134: invokevirtual #23 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 137: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 140: invokevirtual #20 // Method Vector2d$Companion.getUP:()LVector2d;\n 143: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 146: aastore\n 147: aload_2\n 148: iconst_2\n 149: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 152: invokevirtual #23 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 155: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 158: invokevirtual #33 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 161: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 164: aastore\n 165: aload_2\n 166: aastore\n 167: aload_1\n 168: iconst_3\n 169: iconst_3\n 170: anewarray #10 // class Vector2d\n 173: astore_2\n 174: aload_2\n 175: iconst_0\n 176: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 179: invokevirtual #30 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 182: aastore\n 183: aload_2\n 184: iconst_1\n 185: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 188: invokevirtual #30 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 191: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 194: invokevirtual #20 // Method Vector2d$Companion.getUP:()LVector2d;\n 197: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 200: aastore\n 201: aload_2\n 202: iconst_2\n 203: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 206: invokevirtual #30 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 209: getstatic #14 // Field Vector2d.Companion:LVector2d$Companion;\n 212: invokevirtual #33 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 215: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 218: aastore\n 219: aload_2\n 220: aastore\n 221: aload_1\n 222: astore_0\n 223: bipush 23\n 225: bipush 110\n 227: invokestatic #39 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 230: bipush 20\n 232: invokestatic #39 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 235: new #41 // class Day23Kt$main$1\n 238: dup\n 239: aload_0\n 240: invokespecial #45 // Method Day23Kt$main$1.\"<init>\":([[LVector2d;)V\n 243: checkcast #47 // class kotlin/jvm/functions/Function1\n 246: new #49 // class Day23Kt$main$2\n 249: dup\n 250: aload_0\n 251: invokespecial #50 // Method Day23Kt$main$2.\"<init>\":([[LVector2d;)V\n 254: checkcast #47 // class kotlin/jvm/functions/Function1\n 257: invokestatic #56 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 260: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #61 // Method main:()V\n 3: return\n\n private static final int main$diffuseElves(Vector2d[][], java.util.Set<Vector2d>, int);\n Code:\n 0: iconst_1\n 1: istore_3\n 2: iconst_0\n 3: istore 4\n 5: nop\n 6: new #68 // class java/util/LinkedHashMap\n 9: dup\n 10: invokespecial #70 // Method java/util/LinkedHashMap.\"<init>\":()V\n 13: checkcast #72 // class java/util/Map\n 16: astore 5\n 18: new #74 // class java/util/LinkedHashSet\n 21: dup\n 22: invokespecial #75 // Method java/util/LinkedHashSet.\"<init>\":()V\n 25: checkcast #77 // class java/util/Set\n 28: astore 6\n 30: new #74 // class java/util/LinkedHashSet\n 33: dup\n 34: invokespecial #75 // Method java/util/LinkedHashSet.\"<init>\":()V\n 37: checkcast #77 // class java/util/Set\n 40: astore 7\n 42: aload_1\n 43: invokeinterface #81, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 48: astore 8\n 50: aload 8\n 52: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 57: ifeq 377\n 60: aload 8\n 62: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 67: checkcast #10 // class Vector2d\n 70: astore 9\n 72: aload 9\n 74: invokevirtual #95 // Method Vector2d.neighbours8:()Ljava/util/Set;\n 77: checkcast #97 // class java/lang/Iterable\n 80: aload_1\n 81: checkcast #97 // class java/lang/Iterable\n 84: invokestatic #103 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 87: astore 10\n 89: aload 10\n 91: invokeinterface #106, 1 // InterfaceMethod java/util/Set.isEmpty:()Z\n 96: ifeq 102\n 99: goto 50\n 102: iconst_0\n 103: istore 11\n 105: aload_0\n 106: checkcast #108 // class \"[Ljava/lang/Object;\"\n 109: arraylength\n 110: istore 12\n 112: iload 11\n 114: iload 12\n 116: if_icmpge 50\n 119: iload 4\n 121: iload 11\n 123: iadd\n 124: aload_0\n 125: checkcast #108 // class \"[Ljava/lang/Object;\"\n 128: arraylength\n 129: irem\n 130: istore 13\n 132: aload_0\n 133: iload 13\n 135: aaload\n 136: astore 15\n 138: iconst_0\n 139: istore 16\n 141: aload 15\n 143: astore 17\n 145: new #110 // class java/util/ArrayList\n 148: dup\n 149: aload 15\n 151: arraylength\n 152: invokespecial #113 // Method java/util/ArrayList.\"<init>\":(I)V\n 155: checkcast #115 // class java/util/Collection\n 158: astore 18\n 160: iconst_0\n 161: istore 19\n 163: iconst_0\n 164: istore 20\n 166: aload 17\n 168: arraylength\n 169: istore 21\n 171: iload 20\n 173: iload 21\n 175: if_icmpge 218\n 178: aload 17\n 180: iload 20\n 182: aaload\n 183: astore 22\n 185: aload 18\n 187: aload 22\n 189: astore 23\n 191: astore 25\n 193: iconst_0\n 194: istore 24\n 196: aload 9\n 198: aload 23\n 200: invokevirtual #27 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 203: aload 25\n 205: swap\n 206: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 211: pop\n 212: iinc 20, 1\n 215: goto 171\n 218: aload 18\n 220: checkcast #121 // class java/util/List\n 223: nop\n 224: checkcast #97 // class java/lang/Iterable\n 227: invokestatic #125 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 230: astore 14\n 232: aload 14\n 234: checkcast #97 // class java/lang/Iterable\n 237: aload 10\n 239: checkcast #97 // class java/lang/Iterable\n 242: invokestatic #103 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 245: invokeinterface #106, 1 // InterfaceMethod java/util/Set.isEmpty:()Z\n 250: ifeq 371\n 253: aload 14\n 255: checkcast #97 // class java/lang/Iterable\n 258: invokestatic #129 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;\n 261: checkcast #10 // class Vector2d\n 264: astore 15\n 266: aload 6\n 268: aload 15\n 270: invokeinterface #132, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 275: ifeq 281\n 278: goto 50\n 281: aload 5\n 283: aload 15\n 285: invokeinterface #135, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 290: ifeq 343\n 293: aload 6\n 295: checkcast #115 // class java/util/Collection\n 298: aload 15\n 300: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 305: pop\n 306: aload 7\n 308: checkcast #115 // class java/util/Collection\n 311: aload 5\n 313: aload 15\n 315: invokeinterface #139, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 320: dup\n 321: invokestatic #145 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 324: invokeinterface #148, 2 // InterfaceMethod java/util/Collection.remove:(Ljava/lang/Object;)Z\n 329: pop\n 330: aload 5\n 332: aload 15\n 334: invokeinterface #150, 2 // InterfaceMethod java/util/Map.remove:(Ljava/lang/Object;)Ljava/lang/Object;\n 339: pop\n 340: goto 50\n 343: aload 5\n 345: aload 15\n 347: aload 9\n 349: invokeinterface #154, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 354: pop\n 355: aload 7\n 357: checkcast #115 // class java/util/Collection\n 360: aload 9\n 362: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 367: pop\n 368: goto 50\n 371: iinc 11, 1\n 374: goto 112\n 377: iload_2\n 378: iconst_m1\n 379: if_icmpne 395\n 382: aload 5\n 384: invokeinterface #155, 1 // InterfaceMethod java/util/Map.isEmpty:()Z\n 389: ifeq 395\n 392: goto 449\n 395: aload_1\n 396: checkcast #115 // class java/util/Collection\n 399: aload 7\n 401: checkcast #97 // class java/lang/Iterable\n 404: invokestatic #159 // Method kotlin/collections/CollectionsKt.removeAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 407: pop\n 408: aload_1\n 409: checkcast #115 // class java/util/Collection\n 412: aload 5\n 414: invokeinterface #162, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 419: checkcast #97 // class java/lang/Iterable\n 422: invokestatic #165 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 425: pop\n 426: iload 4\n 428: iconst_1\n 429: iadd\n 430: aload_0\n 431: checkcast #108 // class \"[Ljava/lang/Object;\"\n 434: arraylength\n 435: irem\n 436: istore 4\n 438: iload_3\n 439: iinc 3, 1\n 442: iload_2\n 443: if_icmpne 5\n 446: goto 449\n 449: iload_3\n 450: ireturn\n\n static int main$diffuseElves$default(Vector2d[][], java.util.Set, int, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_4\n 2: iand\n 3: ifeq 8\n 6: iconst_m1\n 7: istore_2\n 8: aload_0\n 9: aload_1\n 10: iload_2\n 11: invokestatic #197 // Method main$diffuseElves:([[LVector2d;Ljava/util/Set;I)I\n 14: ireturn\n\n private static final int main$part1(Vector2d[][], java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: checkcast #97 // class java/lang/Iterable\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: astore 5\n 11: new #110 // class java/util/ArrayList\n 14: dup\n 15: aload_3\n 16: bipush 10\n 18: invokestatic #204 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 21: invokespecial #113 // Method java/util/ArrayList.\"<init>\":(I)V\n 24: checkcast #115 // class java/util/Collection\n 27: astore 6\n 29: iconst_0\n 30: istore 7\n 32: aload 5\n 34: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 39: astore 8\n 41: aload 8\n 43: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 48: ifeq 100\n 51: aload 8\n 53: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 58: astore 9\n 60: aload 6\n 62: aload 9\n 64: checkcast #207 // class java/lang/String\n 67: astore 10\n 69: astore 13\n 71: iconst_0\n 72: istore 11\n 74: aload 10\n 76: invokevirtual #211 // Method java/lang/String.toCharArray:()[C\n 79: dup\n 80: ldc #213 // String toCharArray(...)\n 82: invokestatic #217 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 85: invokestatic #223 // Method kotlin/collections/ArraysKt.toList:([C)Ljava/util/List;\n 88: aload 13\n 90: swap\n 91: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 96: pop\n 97: goto 41\n 100: aload 6\n 102: checkcast #121 // class java/util/List\n 105: nop\n 106: astore 14\n 108: new #225 // class Grid\n 111: dup\n 112: aload 14\n 114: invokespecial #228 // Method Grid.\"<init>\":(Ljava/util/List;)V\n 117: invokevirtual #232 // Method Grid.getData:()Ljava/util/List;\n 120: checkcast #97 // class java/lang/Iterable\n 123: invokestatic #236 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 126: checkcast #97 // class java/lang/Iterable\n 129: astore_3\n 130: iconst_0\n 131: istore 4\n 133: aload_3\n 134: astore 5\n 136: new #110 // class java/util/ArrayList\n 139: dup\n 140: invokespecial #237 // Method java/util/ArrayList.\"<init>\":()V\n 143: checkcast #115 // class java/util/Collection\n 146: astore 6\n 148: iconst_0\n 149: istore 7\n 151: aload 5\n 153: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 158: astore 8\n 160: aload 8\n 162: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 167: ifeq 226\n 170: aload 8\n 172: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 177: astore 9\n 179: aload 9\n 181: checkcast #239 // class GridCell\n 184: astore 10\n 186: iconst_0\n 187: istore 11\n 189: aload 10\n 191: invokevirtual #242 // Method GridCell.getValue:()Ljava/lang/Object;\n 194: checkcast #244 // class java/lang/Character\n 197: invokevirtual #248 // Method java/lang/Character.charValue:()C\n 200: bipush 35\n 202: if_icmpne 209\n 205: iconst_1\n 206: goto 210\n 209: iconst_0\n 210: ifeq 160\n 213: aload 6\n 215: aload 9\n 217: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 222: pop\n 223: goto 160\n 226: aload 6\n 228: checkcast #121 // class java/util/List\n 231: nop\n 232: checkcast #97 // class java/lang/Iterable\n 235: astore_3\n 236: nop\n 237: iconst_0\n 238: istore 4\n 240: aload_3\n 241: astore 5\n 243: new #110 // class java/util/ArrayList\n 246: dup\n 247: aload_3\n 248: bipush 10\n 250: invokestatic #204 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 253: invokespecial #113 // Method java/util/ArrayList.\"<init>\":(I)V\n 256: checkcast #115 // class java/util/Collection\n 259: astore 6\n 261: iconst_0\n 262: istore 7\n 264: aload 5\n 266: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 271: astore 8\n 273: aload 8\n 275: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 280: ifeq 323\n 283: aload 8\n 285: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 290: astore 9\n 292: aload 6\n 294: aload 9\n 296: checkcast #239 // class GridCell\n 299: astore 10\n 301: astore 12\n 303: iconst_0\n 304: istore 11\n 306: aload 10\n 308: invokevirtual #251 // Method GridCell.getPosition:()LVector2d;\n 311: aload 12\n 313: swap\n 314: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 319: pop\n 320: goto 273\n 323: aload 6\n 325: checkcast #121 // class java/util/List\n 328: nop\n 329: checkcast #97 // class java/lang/Iterable\n 332: invokestatic #254 // Method kotlin/collections/CollectionsKt.toMutableSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 335: astore_2\n 336: aload_0\n 337: aload_2\n 338: bipush 10\n 340: invokestatic #197 // Method main$diffuseElves:([[LVector2d;Ljava/util/Set;I)I\n 343: pop\n 344: aload_2\n 345: checkcast #97 // class java/lang/Iterable\n 348: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 353: astore 5\n 355: aload 5\n 357: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 362: ifne 373\n 365: new #256 // class java/util/NoSuchElementException\n 368: dup\n 369: invokespecial #257 // Method java/util/NoSuchElementException.\"<init>\":()V\n 372: athrow\n 373: aload 5\n 375: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 380: checkcast #10 // class Vector2d\n 383: astore 6\n 385: iconst_0\n 386: istore 7\n 388: aload 6\n 390: invokevirtual #261 // Method Vector2d.getX:()I\n 393: istore 6\n 395: aload 5\n 397: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 402: ifeq 441\n 405: aload 5\n 407: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 412: checkcast #10 // class Vector2d\n 415: astore 7\n 417: iconst_0\n 418: istore 8\n 420: aload 7\n 422: invokevirtual #261 // Method Vector2d.getX:()I\n 425: istore 7\n 427: iload 6\n 429: iload 7\n 431: if_icmple 395\n 434: iload 7\n 436: istore 6\n 438: goto 395\n 441: iload 6\n 443: istore_3\n 444: aload_2\n 445: checkcast #97 // class java/lang/Iterable\n 448: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 453: astore 6\n 455: aload 6\n 457: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 462: ifne 473\n 465: new #256 // class java/util/NoSuchElementException\n 468: dup\n 469: invokespecial #257 // Method java/util/NoSuchElementException.\"<init>\":()V\n 472: athrow\n 473: aload 6\n 475: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 480: checkcast #10 // class Vector2d\n 483: astore 7\n 485: iconst_0\n 486: istore 8\n 488: aload 7\n 490: invokevirtual #261 // Method Vector2d.getX:()I\n 493: istore 7\n 495: aload 6\n 497: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 502: ifeq 541\n 505: aload 6\n 507: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 512: checkcast #10 // class Vector2d\n 515: astore 8\n 517: iconst_0\n 518: istore 9\n 520: aload 8\n 522: invokevirtual #261 // Method Vector2d.getX:()I\n 525: istore 8\n 527: iload 7\n 529: iload 8\n 531: if_icmpge 495\n 534: iload 8\n 536: istore 7\n 538: goto 495\n 541: iload 7\n 543: istore 4\n 545: aload_2\n 546: checkcast #97 // class java/lang/Iterable\n 549: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 554: astore 7\n 556: aload 7\n 558: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 563: ifne 574\n 566: new #256 // class java/util/NoSuchElementException\n 569: dup\n 570: invokespecial #257 // Method java/util/NoSuchElementException.\"<init>\":()V\n 573: athrow\n 574: aload 7\n 576: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 581: checkcast #10 // class Vector2d\n 584: astore 8\n 586: iconst_0\n 587: istore 9\n 589: aload 8\n 591: invokevirtual #264 // Method Vector2d.getY:()I\n 594: istore 8\n 596: aload 7\n 598: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 603: ifeq 642\n 606: aload 7\n 608: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 613: checkcast #10 // class Vector2d\n 616: astore 9\n 618: iconst_0\n 619: istore 10\n 621: aload 9\n 623: invokevirtual #264 // Method Vector2d.getY:()I\n 626: istore 9\n 628: iload 8\n 630: iload 9\n 632: if_icmple 596\n 635: iload 9\n 637: istore 8\n 639: goto 596\n 642: iload 8\n 644: istore 5\n 646: aload_2\n 647: checkcast #97 // class java/lang/Iterable\n 650: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 655: astore 8\n 657: aload 8\n 659: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 664: ifne 675\n 667: new #256 // class java/util/NoSuchElementException\n 670: dup\n 671: invokespecial #257 // Method java/util/NoSuchElementException.\"<init>\":()V\n 674: athrow\n 675: aload 8\n 677: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 682: checkcast #10 // class Vector2d\n 685: astore 9\n 687: iconst_0\n 688: istore 10\n 690: aload 9\n 692: invokevirtual #264 // Method Vector2d.getY:()I\n 695: istore 9\n 697: aload 8\n 699: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 704: ifeq 743\n 707: aload 8\n 709: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 714: checkcast #10 // class Vector2d\n 717: astore 10\n 719: iconst_0\n 720: istore 11\n 722: aload 10\n 724: invokevirtual #264 // Method Vector2d.getY:()I\n 727: istore 10\n 729: iload 9\n 731: iload 10\n 733: if_icmpge 697\n 736: iload 10\n 738: istore 9\n 740: goto 697\n 743: iload 9\n 745: istore 6\n 747: iload 4\n 749: iload_3\n 750: isub\n 751: iconst_1\n 752: iadd\n 753: iload 6\n 755: iload 5\n 757: isub\n 758: iconst_1\n 759: iadd\n 760: imul\n 761: aload_2\n 762: invokeinterface #267, 1 // InterfaceMethod java/util/Set.size:()I\n 767: isub\n 768: ireturn\n\n private static final int main$part2(Vector2d[][], java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: checkcast #97 // class java/lang/Iterable\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: astore 5\n 11: new #110 // class java/util/ArrayList\n 14: dup\n 15: aload_3\n 16: bipush 10\n 18: invokestatic #204 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 21: invokespecial #113 // Method java/util/ArrayList.\"<init>\":(I)V\n 24: checkcast #115 // class java/util/Collection\n 27: astore 6\n 29: iconst_0\n 30: istore 7\n 32: aload 5\n 34: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 39: astore 8\n 41: aload 8\n 43: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 48: ifeq 100\n 51: aload 8\n 53: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 58: astore 9\n 60: aload 6\n 62: aload 9\n 64: checkcast #207 // class java/lang/String\n 67: astore 10\n 69: astore 13\n 71: iconst_0\n 72: istore 11\n 74: aload 10\n 76: invokevirtual #211 // Method java/lang/String.toCharArray:()[C\n 79: dup\n 80: ldc #213 // String toCharArray(...)\n 82: invokestatic #217 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 85: invokestatic #223 // Method kotlin/collections/ArraysKt.toList:([C)Ljava/util/List;\n 88: aload 13\n 90: swap\n 91: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 96: pop\n 97: goto 41\n 100: aload 6\n 102: checkcast #121 // class java/util/List\n 105: nop\n 106: astore 14\n 108: new #225 // class Grid\n 111: dup\n 112: aload 14\n 114: invokespecial #228 // Method Grid.\"<init>\":(Ljava/util/List;)V\n 117: invokevirtual #232 // Method Grid.getData:()Ljava/util/List;\n 120: checkcast #97 // class java/lang/Iterable\n 123: invokestatic #236 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 126: checkcast #97 // class java/lang/Iterable\n 129: astore_3\n 130: iconst_0\n 131: istore 4\n 133: aload_3\n 134: astore 5\n 136: new #110 // class java/util/ArrayList\n 139: dup\n 140: invokespecial #237 // Method java/util/ArrayList.\"<init>\":()V\n 143: checkcast #115 // class java/util/Collection\n 146: astore 6\n 148: iconst_0\n 149: istore 7\n 151: aload 5\n 153: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 158: astore 8\n 160: aload 8\n 162: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 167: ifeq 226\n 170: aload 8\n 172: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 177: astore 9\n 179: aload 9\n 181: checkcast #239 // class GridCell\n 184: astore 10\n 186: iconst_0\n 187: istore 11\n 189: aload 10\n 191: invokevirtual #242 // Method GridCell.getValue:()Ljava/lang/Object;\n 194: checkcast #244 // class java/lang/Character\n 197: invokevirtual #248 // Method java/lang/Character.charValue:()C\n 200: bipush 35\n 202: if_icmpne 209\n 205: iconst_1\n 206: goto 210\n 209: iconst_0\n 210: ifeq 160\n 213: aload 6\n 215: aload 9\n 217: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 222: pop\n 223: goto 160\n 226: aload 6\n 228: checkcast #121 // class java/util/List\n 231: nop\n 232: checkcast #97 // class java/lang/Iterable\n 235: astore_3\n 236: nop\n 237: iconst_0\n 238: istore 4\n 240: aload_3\n 241: astore 5\n 243: new #110 // class java/util/ArrayList\n 246: dup\n 247: aload_3\n 248: bipush 10\n 250: invokestatic #204 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 253: invokespecial #113 // Method java/util/ArrayList.\"<init>\":(I)V\n 256: checkcast #115 // class java/util/Collection\n 259: astore 6\n 261: iconst_0\n 262: istore 7\n 264: aload 5\n 266: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 271: astore 8\n 273: aload 8\n 275: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 280: ifeq 323\n 283: aload 8\n 285: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 290: astore 9\n 292: aload 6\n 294: aload 9\n 296: checkcast #239 // class GridCell\n 299: astore 10\n 301: astore 12\n 303: iconst_0\n 304: istore 11\n 306: aload 10\n 308: invokevirtual #251 // Method GridCell.getPosition:()LVector2d;\n 311: aload 12\n 313: swap\n 314: invokeinterface #119, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 319: pop\n 320: goto 273\n 323: aload 6\n 325: checkcast #121 // class java/util/List\n 328: nop\n 329: checkcast #97 // class java/lang/Iterable\n 332: invokestatic #254 // Method kotlin/collections/CollectionsKt.toMutableSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 335: astore_2\n 336: aload_0\n 337: aload_2\n 338: iconst_0\n 339: iconst_4\n 340: aconst_null\n 341: invokestatic #292 // Method main$diffuseElves$default:([[LVector2d;Ljava/util/Set;IILjava/lang/Object;)I\n 344: ireturn\n\n public static final int access$main$part1(Vector2d[][], java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #298 // Method main$part1:([[LVector2d;Ljava/util/List;)I\n 5: ireturn\n\n public static final int access$main$part2(Vector2d[][], java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #301 // Method main$part2:([[LVector2d;Ljava/util/List;)I\n 5: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day23Kt$main$2.class", "javap": "Compiled from \"Day23.kt\"\nfinal class Day23Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final Vector2d[][] $directionsToConsider;\n\n Day23Kt$main$2(Vector2d[][]);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $directionsToConsider:[[LVector2d;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part2\n 11: ldc #19 // String main$part2([[LVector2d;Ljava/util/List;)I\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $directionsToConsider:[[LVector2d;\n 10: aload_1\n 11: invokestatic #41 // Method Day23Kt.access$main$part2:([[LVector2d;Ljava/util/List;)I\n 14: invokestatic #47 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day20.kt
import kotlin.math.absoluteValue fun main() { class Wrapper(val value: Long) fun mix(originalOrder:List<Wrapper>, mixed:MutableList<Wrapper>){ // println(mixed.map { it.value }) for (entry in originalOrder) { val entryPositionInMixed = mixed.indexOf(entry) mixed.remove(entry) var newEntryPosition = entryPositionInMixed + entry.value if(newEntryPosition < 0){ val n = (newEntryPosition.absoluteValue / mixed.size) + 1 newEntryPosition += n * mixed.size } newEntryPosition %= mixed.size if(newEntryPosition == 0L) newEntryPosition = mixed.size.toLong() // println("Moving ${entry.value} between ${mixed[(newEntryPosition + mixed.size + - 1) % mixed.size].value} and ${mixed[(newEntryPosition) % mixed.size].value}") mixed.add(newEntryPosition.toInt(), entry) // println(mixed.map { it.value }) } } fun part1(input: List<String>): Long { val originalOrder = input.map { Wrapper(it.toLong()) } val mixed = originalOrder.toMutableList() mix(originalOrder, mixed) val zeroPosition = mixed.indexOfFirst { it.value == 0L } return arrayOf(1000, 2000, 3000).map { mixed[(zeroPosition + it) % mixed.size].value }.sum() } fun part2(input: List<String>): Long { val originalOrder = input.map { Wrapper(it.toLong() * 811589153) } val mixed = originalOrder.toMutableList() repeat(10){ mix(originalOrder, mixed) } val zeroPosition = mixed.indexOfFirst { it.value == 0L } return arrayOf(1000, 2000, 3000).map { mixed[(zeroPosition + it) % mixed.size].value }.sum() } test( day = 20, testTarget1 = 3, testTarget2 = 1623178306, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day20Kt$main$2.class", "javap": "Compiled from \"Day20.kt\"\nfinal class Day20Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n public static final Day20Kt$main$2 INSTANCE;\n\n Day20Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)J\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day20Kt.access$main$part2:(Ljava/util/List;)J\n 10: invokestatic #43 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day20Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay20Kt$main$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day20Kt$main$1.class", "javap": "Compiled from \"Day20.kt\"\nfinal class Day20Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n public static final Day20Kt$main$1 INSTANCE;\n\n Day20Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)J\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day20Kt.access$main$part1:(Ljava/util/List;)J\n 10: invokestatic #43 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day20Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay20Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day20Kt.class", "javap": "Compiled from \"Day20.kt\"\npublic final class Day20Kt {\n public static final void main();\n Code:\n 0: bipush 20\n 2: ldc2_w #7 // long 3l\n 5: invokestatic #14 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 8: ldc2_w #15 // long 1623178306l\n 11: invokestatic #14 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 14: getstatic #22 // Field Day20Kt$main$1.INSTANCE:LDay20Kt$main$1;\n 17: checkcast #24 // class kotlin/jvm/functions/Function1\n 20: getstatic #29 // Field Day20Kt$main$2.INSTANCE:LDay20Kt$main$2;\n 23: checkcast #24 // class kotlin/jvm/functions/Function1\n 26: invokestatic #35 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 29: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final void main$mix(java.util.List<Day20Kt$main$Wrapper>, java.util.List<Day20Kt$main$Wrapper>);\n Code:\n 0: aload_0\n 1: invokeinterface #49, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 6: astore_2\n 7: aload_2\n 8: invokeinterface #55, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 13: ifeq 133\n 16: aload_2\n 17: invokeinterface #59, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 22: checkcast #61 // class Day20Kt$main$Wrapper\n 25: astore_3\n 26: aload_1\n 27: aload_3\n 28: invokeinterface #65, 2 // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I\n 33: istore 4\n 35: aload_1\n 36: aload_3\n 37: invokeinterface #69, 2 // InterfaceMethod java/util/List.remove:(Ljava/lang/Object;)Z\n 42: pop\n 43: iload 4\n 45: i2l\n 46: aload_3\n 47: invokevirtual #73 // Method Day20Kt$main$Wrapper.getValue:()J\n 50: ladd\n 51: lstore 5\n 53: lload 5\n 55: lconst_0\n 56: lcmp\n 57: ifge 92\n 60: lload 5\n 62: invokestatic #79 // Method java/lang/Math.abs:(J)J\n 65: aload_1\n 66: invokeinterface #83, 1 // InterfaceMethod java/util/List.size:()I\n 71: i2l\n 72: ldiv\n 73: lconst_1\n 74: ladd\n 75: lstore 7\n 77: lload 5\n 79: lload 7\n 81: aload_1\n 82: invokeinterface #83, 1 // InterfaceMethod java/util/List.size:()I\n 87: i2l\n 88: lmul\n 89: ladd\n 90: lstore 5\n 92: lload 5\n 94: aload_1\n 95: invokeinterface #83, 1 // InterfaceMethod java/util/List.size:()I\n 100: i2l\n 101: lrem\n 102: lstore 5\n 104: lload 5\n 106: lconst_0\n 107: lcmp\n 108: ifne 120\n 111: aload_1\n 112: invokeinterface #83, 1 // InterfaceMethod java/util/List.size:()I\n 117: i2l\n 118: lstore 5\n 120: aload_1\n 121: lload 5\n 123: l2i\n 124: aload_3\n 125: invokeinterface #87, 3 // InterfaceMethod java/util/List.add:(ILjava/lang/Object;)V\n 130: goto 7\n 133: return\n\n private static final long main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #102 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #104 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #110 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #114 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #116 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #117, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #55, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 97\n 50: aload 7\n 52: invokeinterface #59, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #119 // class java/lang/String\n 66: astore 9\n 68: astore 14\n 70: iconst_0\n 71: istore 10\n 73: new #61 // class Day20Kt$main$Wrapper\n 76: dup\n 77: aload 9\n 79: invokestatic #123 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 82: invokespecial #126 // Method Day20Kt$main$Wrapper.\"<init>\":(J)V\n 85: aload 14\n 87: swap\n 88: invokeinterface #128, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 93: pop\n 94: goto 40\n 97: aload 5\n 99: checkcast #45 // class java/util/List\n 102: nop\n 103: astore_1\n 104: aload_1\n 105: checkcast #116 // class java/util/Collection\n 108: invokestatic #132 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 111: astore_2\n 112: aload_1\n 113: aload_2\n 114: invokestatic #134 // Method main$mix:(Ljava/util/List;Ljava/util/List;)V\n 117: aload_2\n 118: astore 4\n 120: iconst_0\n 121: istore 5\n 123: iconst_0\n 124: istore 6\n 126: aload 4\n 128: invokeinterface #49, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 133: astore 7\n 135: aload 7\n 137: invokeinterface #55, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 142: ifeq 193\n 145: aload 7\n 147: invokeinterface #59, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 152: astore 8\n 154: aload 8\n 156: checkcast #61 // class Day20Kt$main$Wrapper\n 159: astore 9\n 161: iconst_0\n 162: istore 10\n 164: aload 9\n 166: invokevirtual #73 // Method Day20Kt$main$Wrapper.getValue:()J\n 169: lconst_0\n 170: lcmp\n 171: ifne 178\n 174: iconst_1\n 175: goto 179\n 178: iconst_0\n 179: ifeq 187\n 182: iload 6\n 184: goto 194\n 187: iinc 6, 1\n 190: goto 135\n 193: iconst_m1\n 194: istore_3\n 195: iconst_3\n 196: anewarray #136 // class java/lang/Integer\n 199: astore 4\n 201: aload 4\n 203: iconst_0\n 204: sipush 1000\n 207: invokestatic #139 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 210: aastore\n 211: aload 4\n 213: iconst_1\n 214: sipush 2000\n 217: invokestatic #139 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 220: aastore\n 221: aload 4\n 223: iconst_2\n 224: sipush 3000\n 227: invokestatic #139 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 230: aastore\n 231: aload 4\n 233: astore 4\n 235: iconst_0\n 236: istore 5\n 238: aload 4\n 240: astore 6\n 242: new #104 // class java/util/ArrayList\n 245: dup\n 246: aload 4\n 248: arraylength\n 249: invokespecial #114 // Method java/util/ArrayList.\"<init>\":(I)V\n 252: checkcast #116 // class java/util/Collection\n 255: astore 7\n 257: iconst_0\n 258: istore 8\n 260: iconst_0\n 261: istore 9\n 263: aload 6\n 265: arraylength\n 266: istore 10\n 268: iload 9\n 270: iload 10\n 272: if_icmpge 340\n 275: aload 6\n 277: iload 9\n 279: aaload\n 280: astore 11\n 282: aload 7\n 284: aload 11\n 286: checkcast #141 // class java/lang/Number\n 289: invokevirtual #144 // Method java/lang/Number.intValue:()I\n 292: istore 12\n 294: astore 14\n 296: iconst_0\n 297: istore 13\n 299: aload_2\n 300: iload_3\n 301: iload 12\n 303: iadd\n 304: aload_2\n 305: invokeinterface #83, 1 // InterfaceMethod java/util/List.size:()I\n 310: irem\n 311: invokeinterface #148, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 316: checkcast #61 // class Day20Kt$main$Wrapper\n 319: invokevirtual #73 // Method Day20Kt$main$Wrapper.getValue:()J\n 322: invokestatic #14 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 325: aload 14\n 327: swap\n 328: invokeinterface #128, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 333: pop\n 334: iinc 9, 1\n 337: goto 268\n 340: aload 7\n 342: checkcast #45 // class java/util/List\n 345: nop\n 346: checkcast #102 // class java/lang/Iterable\n 349: invokestatic #152 // Method kotlin/collections/CollectionsKt.sumOfLong:(Ljava/lang/Iterable;)J\n 352: lreturn\n\n private static final long main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #102 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #104 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #110 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #114 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #116 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #117, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #55, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 101\n 50: aload 7\n 52: invokeinterface #59, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #119 // class java/lang/String\n 66: astore 9\n 68: astore 14\n 70: iconst_0\n 71: istore 10\n 73: new #61 // class Day20Kt$main$Wrapper\n 76: dup\n 77: aload 9\n 79: invokestatic #123 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 82: ldc #177 // int 811589153\n 84: i2l\n 85: lmul\n 86: invokespecial #126 // Method Day20Kt$main$Wrapper.\"<init>\":(J)V\n 89: aload 14\n 91: swap\n 92: invokeinterface #128, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 97: pop\n 98: goto 40\n 101: aload 5\n 103: checkcast #45 // class java/util/List\n 106: nop\n 107: astore_1\n 108: aload_1\n 109: checkcast #116 // class java/util/Collection\n 112: invokestatic #132 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 115: astore_2\n 116: bipush 10\n 118: istore_3\n 119: iconst_0\n 120: istore 4\n 122: iload 4\n 124: iload_3\n 125: if_icmpge 146\n 128: iload 4\n 130: istore 5\n 132: iconst_0\n 133: istore 6\n 135: aload_1\n 136: aload_2\n 137: invokestatic #134 // Method main$mix:(Ljava/util/List;Ljava/util/List;)V\n 140: iinc 4, 1\n 143: goto 122\n 146: aload_2\n 147: astore 4\n 149: iconst_0\n 150: istore 5\n 152: iconst_0\n 153: istore 6\n 155: aload 4\n 157: invokeinterface #49, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 162: astore 7\n 164: aload 7\n 166: invokeinterface #55, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 171: ifeq 222\n 174: aload 7\n 176: invokeinterface #59, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 181: astore 8\n 183: aload 8\n 185: checkcast #61 // class Day20Kt$main$Wrapper\n 188: astore 9\n 190: iconst_0\n 191: istore 10\n 193: aload 9\n 195: invokevirtual #73 // Method Day20Kt$main$Wrapper.getValue:()J\n 198: lconst_0\n 199: lcmp\n 200: ifne 207\n 203: iconst_1\n 204: goto 208\n 207: iconst_0\n 208: ifeq 216\n 211: iload 6\n 213: goto 223\n 216: iinc 6, 1\n 219: goto 164\n 222: iconst_m1\n 223: istore_3\n 224: iconst_3\n 225: anewarray #136 // class java/lang/Integer\n 228: astore 4\n 230: aload 4\n 232: iconst_0\n 233: sipush 1000\n 236: invokestatic #139 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 239: aastore\n 240: aload 4\n 242: iconst_1\n 243: sipush 2000\n 246: invokestatic #139 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 249: aastore\n 250: aload 4\n 252: iconst_2\n 253: sipush 3000\n 256: invokestatic #139 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 259: aastore\n 260: aload 4\n 262: astore 4\n 264: iconst_0\n 265: istore 5\n 267: aload 4\n 269: astore 6\n 271: new #104 // class java/util/ArrayList\n 274: dup\n 275: aload 4\n 277: arraylength\n 278: invokespecial #114 // Method java/util/ArrayList.\"<init>\":(I)V\n 281: checkcast #116 // class java/util/Collection\n 284: astore 7\n 286: iconst_0\n 287: istore 8\n 289: iconst_0\n 290: istore 9\n 292: aload 6\n 294: arraylength\n 295: istore 10\n 297: iload 9\n 299: iload 10\n 301: if_icmpge 369\n 304: aload 6\n 306: iload 9\n 308: aaload\n 309: astore 11\n 311: aload 7\n 313: aload 11\n 315: checkcast #141 // class java/lang/Number\n 318: invokevirtual #144 // Method java/lang/Number.intValue:()I\n 321: istore 12\n 323: astore 14\n 325: iconst_0\n 326: istore 13\n 328: aload_2\n 329: iload_3\n 330: iload 12\n 332: iadd\n 333: aload_2\n 334: invokeinterface #83, 1 // InterfaceMethod java/util/List.size:()I\n 339: irem\n 340: invokeinterface #148, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 345: checkcast #61 // class Day20Kt$main$Wrapper\n 348: invokevirtual #73 // Method Day20Kt$main$Wrapper.getValue:()J\n 351: invokestatic #14 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 354: aload 14\n 356: swap\n 357: invokeinterface #128, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 362: pop\n 363: iinc 9, 1\n 366: goto 297\n 369: aload 7\n 371: checkcast #45 // class java/util/List\n 374: nop\n 375: checkcast #102 // class java/lang/Iterable\n 378: invokestatic #152 // Method kotlin/collections/CollectionsKt.sumOfLong:(Ljava/lang/Iterable;)J\n 381: lreturn\n\n public static final long access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #184 // Method main$part1:(Ljava/util/List;)J\n 4: lreturn\n\n public static final long access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #187 // Method main$part2:(Ljava/util/List;)J\n 4: lreturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day20Kt$main$Wrapper.class", "javap": "Compiled from \"Day20.kt\"\npublic final class Day20Kt$main$Wrapper {\n private final long value;\n\n public Day20Kt$main$Wrapper(long);\n Code:\n 0: aload_0\n 1: invokespecial #9 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: lload_1\n 6: putfield #13 // Field value:J\n 9: return\n\n public final long getValue();\n Code:\n 0: aload_0\n 1: getfield #13 // Field value:J\n 4: lreturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day21.kt
fun main() { class Monkey(val name: String, var value: Long?, val operation: String) { fun yell(monkeys: Map<String, Monkey>): Long = if (value != null) value!! else { val (name1, operator, name2) = operation.split(" ") val monkey1 = monkeys[name1]!!.yell(monkeys) val monkey2 = monkeys[name2]!!.yell(monkeys) when (operator) { "+" -> monkey1 + monkey2 "-" -> monkey1 - monkey2 "*" -> monkey1 * monkey2 "/" -> monkey1 / monkey2 else -> throw Exception("Unknown operator $operator") } } fun dependsOn(name: String, monkeys: Map<String, Monkey>): Boolean { if (this.name == name) return true else if (this.value != null) return false else { val (name1, _, name2) = operation.split(" ") if (name1 == name || name2 == name) return true val monkey1 = monkeys[name1]!!.dependsOn(name, monkeys) val monkey2 = monkeys[name2]!!.dependsOn(name, monkeys) return monkey1 || monkey2 } } fun fix(targetValue: Long, nodeToFix: String, monkeys: Map<String, Monkey>) { if (this.name == nodeToFix) { this.value = targetValue return } else if (this.value != null) throw Exception("Should not be fixing here!") else { val (name1, operator, name2) = operation.split(" ") val monkey1 = monkeys[name1]!! val monkey2 = monkeys[name2]!! val monkey1dependOnNodeToFix = monkey1.dependsOn(nodeToFix, monkeys) val otherValue = if (monkey1dependOnNodeToFix) monkey2.yell(monkeys) else monkey1.yell(monkeys) if (monkey1dependOnNodeToFix) { when (operator) { "+" -> monkey1.fix(targetValue - otherValue, nodeToFix, monkeys) "-" -> monkey1.fix(targetValue + otherValue, nodeToFix, monkeys) "*" -> monkey1.fix(targetValue / otherValue, nodeToFix, monkeys) "/" -> monkey1.fix(targetValue * otherValue, nodeToFix, monkeys) else -> throw Exception("Unknown operator $operator") } } else { when (operator) { "+" -> monkey2.fix(targetValue - otherValue, nodeToFix, monkeys) "-" -> monkey2.fix(otherValue - targetValue, nodeToFix, monkeys) "*" -> monkey2.fix(targetValue / otherValue, nodeToFix, monkeys) "/" -> monkey2.fix(otherValue / targetValue, nodeToFix, monkeys) else -> throw Exception("Unknown operation $operator") } } } } } fun parseMonkeys(input: List<String>) = input.map { it.split(": ") }.associate { (name, yell) -> name to Monkey(name, value = yell.toLongOrNull(), operation = yell) } fun part1(input: List<String>) = parseMonkeys(input).let { it["root"]!!.yell(it) } fun part2(input: List<String>): Long { val monkeys = parseMonkeys(input) val humn = monkeys["humn"]!! val root = monkeys["root"]!! val (root1name, _, root2name) = root.operation.split(" ") val root1 = monkeys[root1name]!! val root2 = monkeys[root2name]!! val root1dependOnHumn = root1.dependsOn("humn", monkeys) val targetValue = if (root1dependOnHumn) root2.yell(monkeys) else root1.yell(monkeys) val branchToFix = if (root1dependOnHumn) root1 else root2 branchToFix.fix(targetValue, "humn", monkeys) return humn.value!! } test( day = 21, testTarget1 = 152L, testTarget2 = 301L, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day21Kt$main$2.class", "javap": "Compiled from \"Day21.kt\"\nfinal class Day21Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n public static final Day21Kt$main$2 INSTANCE;\n\n Day21Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)J\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day21Kt.access$main$part2:(Ljava/util/List;)J\n 10: invokestatic #43 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day21Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay21Kt$main$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day21Kt.class", "javap": "Compiled from \"Day21.kt\"\npublic final class Day21Kt {\n public static final void main();\n Code:\n 0: bipush 21\n 2: ldc2_w #7 // long 152l\n 5: invokestatic #14 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 8: ldc2_w #15 // long 301l\n 11: invokestatic #14 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 14: getstatic #22 // Field Day21Kt$main$1.INSTANCE:LDay21Kt$main$1;\n 17: checkcast #24 // class kotlin/jvm/functions/Function1\n 20: getstatic #29 // Field Day21Kt$main$2.INSTANCE:LDay21Kt$main$2;\n 23: checkcast #24 // class kotlin/jvm/functions/Function1\n 26: invokestatic #35 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 29: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final java.util.Map<java.lang.String, Day21Kt$main$Monkey> main$parseMonkeys(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #45 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: aload_1\n 8: astore_3\n 9: new #47 // class java/util/ArrayList\n 12: dup\n 13: aload_1\n 14: bipush 10\n 16: invokestatic #53 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 19: invokespecial #57 // Method java/util/ArrayList.\"<init>\":(I)V\n 22: checkcast #59 // class java/util/Collection\n 25: astore 4\n 27: iconst_0\n 28: istore 5\n 30: aload_3\n 31: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 36: astore 6\n 38: aload 6\n 40: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 45: ifeq 110\n 48: aload 6\n 50: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 55: astore 7\n 57: aload 4\n 59: aload 7\n 61: checkcast #75 // class java/lang/String\n 64: astore 8\n 66: astore 14\n 68: iconst_0\n 69: istore 9\n 71: aload 8\n 73: checkcast #77 // class java/lang/CharSequence\n 76: iconst_1\n 77: anewarray #75 // class java/lang/String\n 80: astore 10\n 82: aload 10\n 84: iconst_0\n 85: ldc #79 // String :\n 87: aastore\n 88: aload 10\n 90: iconst_0\n 91: iconst_0\n 92: bipush 6\n 94: aconst_null\n 95: invokestatic #85 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 98: aload 14\n 100: swap\n 101: invokeinterface #89, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 106: pop\n 107: goto 38\n 110: aload 4\n 112: checkcast #91 // class java/util/List\n 115: nop\n 116: checkcast #45 // class java/lang/Iterable\n 119: astore_1\n 120: nop\n 121: iconst_0\n 122: istore_2\n 123: aload_1\n 124: bipush 10\n 126: invokestatic #53 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 129: invokestatic #97 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 132: bipush 16\n 134: invokestatic #103 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I\n 137: istore_3\n 138: aload_1\n 139: astore 4\n 141: new #105 // class java/util/LinkedHashMap\n 144: dup\n 145: iload_3\n 146: invokespecial #106 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 149: checkcast #108 // class java/util/Map\n 152: astore 5\n 154: iconst_0\n 155: istore 6\n 157: aload 4\n 159: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 164: astore 7\n 166: aload 7\n 168: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 173: ifeq 269\n 176: aload 7\n 178: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 183: astore 8\n 185: aload 5\n 187: astore 9\n 189: aload 8\n 191: checkcast #91 // class java/util/List\n 194: astore 10\n 196: iconst_0\n 197: istore 11\n 199: aload 10\n 201: iconst_0\n 202: invokeinterface #112, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 207: checkcast #75 // class java/lang/String\n 210: astore 12\n 212: aload 10\n 214: iconst_1\n 215: invokeinterface #112, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 220: checkcast #75 // class java/lang/String\n 223: astore 13\n 225: aload 12\n 227: new #114 // class Day21Kt$main$Monkey\n 230: dup\n 231: aload 12\n 233: aload 13\n 235: invokestatic #118 // Method kotlin/text/StringsKt.toLongOrNull:(Ljava/lang/String;)Ljava/lang/Long;\n 238: aload 13\n 240: invokespecial #121 // Method Day21Kt$main$Monkey.\"<init>\":(Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;)V\n 243: invokestatic #127 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 246: astore 10\n 248: aload 9\n 250: aload 10\n 252: invokevirtual #132 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 255: aload 10\n 257: invokevirtual #135 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 260: invokeinterface #139, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 265: pop\n 266: goto 166\n 269: aload 5\n 271: nop\n 272: areturn\n\n private static final long main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #169 // Method main$parseMonkeys:(Ljava/util/List;)Ljava/util/Map;\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: aload_1\n 8: ldc #171 // String root\n 10: invokeinterface #174, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 15: dup\n 16: invokestatic #180 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 19: checkcast #114 // class Day21Kt$main$Monkey\n 22: aload_1\n 23: invokevirtual #183 // Method Day21Kt$main$Monkey.yell:(Ljava/util/Map;)J\n 26: nop\n 27: lreturn\n\n private static final long main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #169 // Method main$parseMonkeys:(Ljava/util/List;)Ljava/util/Map;\n 4: astore_1\n 5: aload_1\n 6: ldc #187 // String humn\n 8: invokeinterface #174, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 13: dup\n 14: invokestatic #180 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 17: checkcast #114 // class Day21Kt$main$Monkey\n 20: astore_2\n 21: aload_1\n 22: ldc #171 // String root\n 24: invokeinterface #174, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 29: dup\n 30: invokestatic #180 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 33: checkcast #114 // class Day21Kt$main$Monkey\n 36: astore_3\n 37: aload_3\n 38: invokevirtual #191 // Method Day21Kt$main$Monkey.getOperation:()Ljava/lang/String;\n 41: checkcast #77 // class java/lang/CharSequence\n 44: iconst_1\n 45: anewarray #75 // class java/lang/String\n 48: astore 5\n 50: aload 5\n 52: iconst_0\n 53: ldc #193 // String\n 55: aastore\n 56: aload 5\n 58: iconst_0\n 59: iconst_0\n 60: bipush 6\n 62: aconst_null\n 63: invokestatic #85 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 66: astore 4\n 68: aload 4\n 70: iconst_0\n 71: invokeinterface #112, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 76: checkcast #75 // class java/lang/String\n 79: astore 5\n 81: aload 4\n 83: iconst_2\n 84: invokeinterface #112, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 89: checkcast #75 // class java/lang/String\n 92: astore 6\n 94: aload_1\n 95: aload 5\n 97: invokeinterface #174, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 102: dup\n 103: invokestatic #180 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 106: checkcast #114 // class Day21Kt$main$Monkey\n 109: astore 7\n 111: aload_1\n 112: aload 6\n 114: invokeinterface #174, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 119: dup\n 120: invokestatic #180 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 123: checkcast #114 // class Day21Kt$main$Monkey\n 126: astore 8\n 128: aload 7\n 130: ldc #187 // String humn\n 132: aload_1\n 133: invokevirtual #197 // Method Day21Kt$main$Monkey.dependsOn:(Ljava/lang/String;Ljava/util/Map;)Z\n 136: istore 9\n 138: iload 9\n 140: ifeq 152\n 143: aload 8\n 145: aload_1\n 146: invokevirtual #183 // Method Day21Kt$main$Monkey.yell:(Ljava/util/Map;)J\n 149: goto 158\n 152: aload 7\n 154: aload_1\n 155: invokevirtual #183 // Method Day21Kt$main$Monkey.yell:(Ljava/util/Map;)J\n 158: lstore 10\n 160: iload 9\n 162: ifeq 170\n 165: aload 7\n 167: goto 172\n 170: aload 8\n 172: astore 12\n 174: aload 12\n 176: lload 10\n 178: ldc #187 // String humn\n 180: aload_1\n 181: invokevirtual #201 // Method Day21Kt$main$Monkey.fix:(JLjava/lang/String;Ljava/util/Map;)V\n 184: aload_2\n 185: invokevirtual #205 // Method Day21Kt$main$Monkey.getValue:()Ljava/lang/Long;\n 188: dup\n 189: invokestatic #180 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 192: invokevirtual #209 // Method java/lang/Long.longValue:()J\n 195: lreturn\n\n public static final long access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #223 // Method main$part1:(Ljava/util/List;)J\n 4: lreturn\n\n public static final long access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #226 // Method main$part2:(Ljava/util/List;)J\n 4: lreturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day21Kt$main$1.class", "javap": "Compiled from \"Day21.kt\"\nfinal class Day21Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n public static final Day21Kt$main$1 INSTANCE;\n\n Day21Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)J\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day21Kt.access$main$part1:(Ljava/util/List;)J\n 10: invokestatic #43 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day21Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay21Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day21Kt$main$Monkey.class", "javap": "Compiled from \"Day21.kt\"\npublic final class Day21Kt$main$Monkey {\n private final java.lang.String name;\n\n private java.lang.Long value;\n\n private final java.lang.String operation;\n\n public Day21Kt$main$Monkey(java.lang.String, java.lang.Long, java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #8 // String name\n 3: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_3\n 7: ldc #16 // String operation\n 9: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: invokespecial #19 // Method java/lang/Object.\"<init>\":()V\n 16: aload_0\n 17: aload_1\n 18: putfield #22 // Field name:Ljava/lang/String;\n 21: aload_0\n 22: aload_2\n 23: putfield #26 // Field value:Ljava/lang/Long;\n 26: aload_0\n 27: aload_3\n 28: putfield #28 // Field operation:Ljava/lang/String;\n 31: return\n\n public final java.lang.String getName();\n Code:\n 0: aload_0\n 1: getfield #22 // Field name:Ljava/lang/String;\n 4: areturn\n\n public final java.lang.Long getValue();\n Code:\n 0: aload_0\n 1: getfield #26 // Field value:Ljava/lang/Long;\n 4: areturn\n\n public final void setValue(java.lang.Long);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #26 // Field value:Ljava/lang/Long;\n 5: return\n\n public final java.lang.String getOperation();\n Code:\n 0: aload_0\n 1: getfield #28 // Field operation:Ljava/lang/String;\n 4: areturn\n\n public final long yell(java.util.Map<java.lang.String, Day21Kt$main$Monkey>);\n Code:\n 0: aload_1\n 1: ldc #43 // String monkeys\n 3: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #26 // Field value:Ljava/lang/Long;\n 10: ifnull 27\n 13: aload_0\n 14: getfield #26 // Field value:Ljava/lang/Long;\n 17: dup\n 18: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 21: invokevirtual #53 // Method java/lang/Long.longValue:()J\n 24: goto 288\n 27: aload_0\n 28: getfield #28 // Field operation:Ljava/lang/String;\n 31: checkcast #55 // class java/lang/CharSequence\n 34: iconst_1\n 35: anewarray #57 // class java/lang/String\n 38: astore_3\n 39: aload_3\n 40: iconst_0\n 41: ldc #59 // String\n 43: aastore\n 44: aload_3\n 45: iconst_0\n 46: iconst_0\n 47: bipush 6\n 49: aconst_null\n 50: invokestatic #65 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 53: astore_2\n 54: aload_2\n 55: iconst_0\n 56: invokeinterface #71, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 61: checkcast #57 // class java/lang/String\n 64: astore_3\n 65: aload_2\n 66: iconst_1\n 67: invokeinterface #71, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 72: checkcast #57 // class java/lang/String\n 75: astore 4\n 77: aload_2\n 78: iconst_2\n 79: invokeinterface #71, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 84: checkcast #57 // class java/lang/String\n 87: astore 5\n 89: aload_1\n 90: aload_3\n 91: invokeinterface #76, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 96: dup\n 97: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 100: checkcast #2 // class Day21Kt$main$Monkey\n 103: aload_1\n 104: invokevirtual #78 // Method yell:(Ljava/util/Map;)J\n 107: lstore 6\n 109: aload_1\n 110: aload 5\n 112: invokeinterface #76, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 117: dup\n 118: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 121: checkcast #2 // class Day21Kt$main$Monkey\n 124: aload_1\n 125: invokevirtual #78 // Method yell:(Ljava/util/Map;)J\n 128: lstore 8\n 130: aload 4\n 132: astore 10\n 134: aload 10\n 136: invokevirtual #82 // Method java/lang/String.hashCode:()I\n 139: tableswitch { // 42 to 47\n 42: 176\n 43: 189\n 44: 260\n 45: 202\n 46: 260\n 47: 215\n default: 260\n }\n 176: aload 10\n 178: ldc #84 // String *\n 180: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 183: ifne 244\n 186: goto 260\n 189: aload 10\n 191: ldc #90 // String +\n 193: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 196: ifne 228\n 199: goto 260\n 202: aload 10\n 204: ldc #92 // String -\n 206: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 209: ifne 236\n 212: goto 260\n 215: aload 10\n 217: ldc #94 // String /\n 219: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 222: ifne 252\n 225: goto 260\n 228: lload 6\n 230: lload 8\n 232: ladd\n 233: goto 288\n 236: lload 6\n 238: lload 8\n 240: lsub\n 241: goto 288\n 244: lload 6\n 246: lload 8\n 248: lmul\n 249: goto 288\n 252: lload 6\n 254: lload 8\n 256: ldiv\n 257: goto 288\n 260: new #96 // class java/lang/Exception\n 263: dup\n 264: new #98 // class java/lang/StringBuilder\n 267: dup\n 268: invokespecial #99 // Method java/lang/StringBuilder.\"<init>\":()V\n 271: ldc #101 // String Unknown operator\n 273: invokevirtual #105 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 276: aload 4\n 278: invokevirtual #105 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 281: invokevirtual #108 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 284: invokespecial #111 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 287: athrow\n 288: lreturn\n\n public final boolean dependsOn(java.lang.String, java.util.Map<java.lang.String, Day21Kt$main$Monkey>);\n Code:\n 0: aload_1\n 1: ldc #8 // String name\n 3: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_2\n 7: ldc #43 // String monkeys\n 9: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: getfield #22 // Field name:Ljava/lang/String;\n 16: aload_1\n 17: invokestatic #125 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 20: ifeq 25\n 23: iconst_1\n 24: ireturn\n 25: aload_0\n 26: getfield #26 // Field value:Ljava/lang/Long;\n 29: ifnull 34\n 32: iconst_0\n 33: ireturn\n 34: aload_0\n 35: getfield #28 // Field operation:Ljava/lang/String;\n 38: checkcast #55 // class java/lang/CharSequence\n 41: iconst_1\n 42: anewarray #57 // class java/lang/String\n 45: astore 4\n 47: aload 4\n 49: iconst_0\n 50: ldc #59 // String\n 52: aastore\n 53: aload 4\n 55: iconst_0\n 56: iconst_0\n 57: bipush 6\n 59: aconst_null\n 60: invokestatic #65 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 63: astore_3\n 64: aload_3\n 65: iconst_0\n 66: invokeinterface #71, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 71: checkcast #57 // class java/lang/String\n 74: astore 4\n 76: aload_3\n 77: iconst_2\n 78: invokeinterface #71, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 83: checkcast #57 // class java/lang/String\n 86: astore 5\n 88: aload 4\n 90: aload_1\n 91: invokestatic #125 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 94: ifne 106\n 97: aload 5\n 99: aload_1\n 100: invokestatic #125 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 103: ifeq 108\n 106: iconst_1\n 107: ireturn\n 108: aload_2\n 109: aload 4\n 111: invokeinterface #76, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 116: dup\n 117: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 120: checkcast #2 // class Day21Kt$main$Monkey\n 123: aload_1\n 124: aload_2\n 125: invokevirtual #127 // Method dependsOn:(Ljava/lang/String;Ljava/util/Map;)Z\n 128: istore 6\n 130: aload_2\n 131: aload 5\n 133: invokeinterface #76, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 138: dup\n 139: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 142: checkcast #2 // class Day21Kt$main$Monkey\n 145: aload_1\n 146: aload_2\n 147: invokevirtual #127 // Method dependsOn:(Ljava/lang/String;Ljava/util/Map;)Z\n 150: istore 7\n 152: iload 6\n 154: ifne 162\n 157: iload 7\n 159: ifeq 166\n 162: iconst_1\n 163: goto 167\n 166: iconst_0\n 167: ireturn\n\n public final void fix(long, java.lang.String, java.util.Map<java.lang.String, Day21Kt$main$Monkey>);\n Code:\n 0: aload_3\n 1: ldc #133 // String nodeToFix\n 3: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload 4\n 8: ldc #43 // String monkeys\n 10: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 13: aload_0\n 14: getfield #22 // Field name:Ljava/lang/String;\n 17: aload_3\n 18: invokestatic #125 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 21: ifeq 33\n 24: aload_0\n 25: lload_1\n 26: invokestatic #137 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 29: putfield #26 // Field value:Ljava/lang/Long;\n 32: return\n 33: aload_0\n 34: getfield #26 // Field value:Ljava/lang/Long;\n 37: ifnull 50\n 40: new #96 // class java/lang/Exception\n 43: dup\n 44: ldc #139 // String Should not be fixing here!\n 46: invokespecial #111 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 49: athrow\n 50: aload_0\n 51: getfield #28 // Field operation:Ljava/lang/String;\n 54: checkcast #55 // class java/lang/CharSequence\n 57: iconst_1\n 58: anewarray #57 // class java/lang/String\n 61: astore 6\n 63: aload 6\n 65: iconst_0\n 66: ldc #59 // String\n 68: aastore\n 69: aload 6\n 71: iconst_0\n 72: iconst_0\n 73: bipush 6\n 75: aconst_null\n 76: invokestatic #65 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 79: astore 5\n 81: aload 5\n 83: iconst_0\n 84: invokeinterface #71, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 89: checkcast #57 // class java/lang/String\n 92: astore 6\n 94: aload 5\n 96: iconst_1\n 97: invokeinterface #71, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 102: checkcast #57 // class java/lang/String\n 105: astore 7\n 107: aload 5\n 109: iconst_2\n 110: invokeinterface #71, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 115: checkcast #57 // class java/lang/String\n 118: astore 8\n 120: aload 4\n 122: aload 6\n 124: invokeinterface #76, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 129: dup\n 130: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 133: checkcast #2 // class Day21Kt$main$Monkey\n 136: astore 9\n 138: aload 4\n 140: aload 8\n 142: invokeinterface #76, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 147: dup\n 148: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 151: checkcast #2 // class Day21Kt$main$Monkey\n 154: astore 10\n 156: aload 9\n 158: aload_3\n 159: aload 4\n 161: invokevirtual #127 // Method dependsOn:(Ljava/lang/String;Ljava/util/Map;)Z\n 164: istore 11\n 166: iload 11\n 168: ifeq 181\n 171: aload 10\n 173: aload 4\n 175: invokevirtual #78 // Method yell:(Ljava/util/Map;)J\n 178: goto 188\n 181: aload 9\n 183: aload 4\n 185: invokevirtual #78 // Method yell:(Ljava/util/Map;)J\n 188: lstore 12\n 190: iload 11\n 192: ifeq 384\n 195: aload 7\n 197: astore 14\n 199: aload 14\n 201: invokevirtual #82 // Method java/lang/String.hashCode:()I\n 204: tableswitch { // 42 to 47\n 42: 244\n 43: 257\n 44: 356\n 45: 270\n 46: 356\n 47: 283\n default: 356\n }\n 244: aload 14\n 246: ldc #84 // String *\n 248: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 251: ifne 326\n 254: goto 356\n 257: aload 14\n 259: ldc #90 // String +\n 261: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 264: ifne 296\n 267: goto 356\n 270: aload 14\n 272: ldc #92 // String -\n 274: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 277: ifne 311\n 280: goto 356\n 283: aload 14\n 285: ldc #94 // String /\n 287: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 290: ifne 341\n 293: goto 356\n 296: aload 9\n 298: lload_1\n 299: lload 12\n 301: lsub\n 302: aload_3\n 303: aload 4\n 305: invokevirtual #141 // Method fix:(JLjava/lang/String;Ljava/util/Map;)V\n 308: goto 572\n 311: aload 9\n 313: lload_1\n 314: lload 12\n 316: ladd\n 317: aload_3\n 318: aload 4\n 320: invokevirtual #141 // Method fix:(JLjava/lang/String;Ljava/util/Map;)V\n 323: goto 572\n 326: aload 9\n 328: lload_1\n 329: lload 12\n 331: ldiv\n 332: aload_3\n 333: aload 4\n 335: invokevirtual #141 // Method fix:(JLjava/lang/String;Ljava/util/Map;)V\n 338: goto 572\n 341: aload 9\n 343: lload_1\n 344: lload 12\n 346: lmul\n 347: aload_3\n 348: aload 4\n 350: invokevirtual #141 // Method fix:(JLjava/lang/String;Ljava/util/Map;)V\n 353: goto 572\n 356: new #96 // class java/lang/Exception\n 359: dup\n 360: new #98 // class java/lang/StringBuilder\n 363: dup\n 364: invokespecial #99 // Method java/lang/StringBuilder.\"<init>\":()V\n 367: ldc #101 // String Unknown operator\n 369: invokevirtual #105 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 372: aload 7\n 374: invokevirtual #105 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 377: invokevirtual #108 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 380: invokespecial #111 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 383: athrow\n 384: aload 7\n 386: astore 14\n 388: aload 14\n 390: invokevirtual #82 // Method java/lang/String.hashCode:()I\n 393: tableswitch { // 42 to 47\n 42: 432\n 43: 445\n 44: 544\n 45: 458\n 46: 544\n 47: 471\n default: 544\n }\n 432: aload 14\n 434: ldc #84 // String *\n 436: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 439: ifne 514\n 442: goto 544\n 445: aload 14\n 447: ldc #90 // String +\n 449: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 452: ifne 484\n 455: goto 544\n 458: aload 14\n 460: ldc #92 // String -\n 462: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 465: ifne 499\n 468: goto 544\n 471: aload 14\n 473: ldc #94 // String /\n 475: invokevirtual #88 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 478: ifne 529\n 481: goto 544\n 484: aload 10\n 486: lload_1\n 487: lload 12\n 489: lsub\n 490: aload_3\n 491: aload 4\n 493: invokevirtual #141 // Method fix:(JLjava/lang/String;Ljava/util/Map;)V\n 496: goto 572\n 499: aload 10\n 501: lload 12\n 503: lload_1\n 504: lsub\n 505: aload_3\n 506: aload 4\n 508: invokevirtual #141 // Method fix:(JLjava/lang/String;Ljava/util/Map;)V\n 511: goto 572\n 514: aload 10\n 516: lload_1\n 517: lload 12\n 519: ldiv\n 520: aload_3\n 521: aload 4\n 523: invokevirtual #141 // Method fix:(JLjava/lang/String;Ljava/util/Map;)V\n 526: goto 572\n 529: aload 10\n 531: lload 12\n 533: lload_1\n 534: ldiv\n 535: aload_3\n 536: aload 4\n 538: invokevirtual #141 // Method fix:(JLjava/lang/String;Ljava/util/Map;)V\n 541: goto 572\n 544: new #96 // class java/lang/Exception\n 547: dup\n 548: new #98 // class java/lang/StringBuilder\n 551: dup\n 552: invokespecial #99 // Method java/lang/StringBuilder.\"<init>\":()V\n 555: ldc #143 // String Unknown operation\n 557: invokevirtual #105 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 560: aload 7\n 562: invokevirtual #105 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 565: invokevirtual #108 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 568: invokespecial #111 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 571: athrow\n 572: return\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day07.kt
fun main() { abstract class FileSystem { abstract fun size(): Int } data class Directory(val path: String, val parent: Directory? = null) : FileSystem() { val files = mutableMapOf<String, FileSystem>() override fun size() = files.values.sumOf { it.size() } } data class File(val size: Int) : FileSystem() { override fun size() = size } fun parseFileSystem(input: List<String>): Map<String, Directory> { val directoryMap = mutableMapOf("/" to Directory("/")) var currentDirectory = directoryMap.values.first() for (cmd in input) { if (cmd.startsWith("\$ cd")) { val where = cmd.split("cd ").last().trim() currentDirectory = when (where) { "/" -> directoryMap["/"]!! ".." -> currentDirectory.parent!! else -> directoryMap.getOrPut(currentDirectory.path + where + "/") { Directory(currentDirectory.path + where + "/", currentDirectory) } } } else if (cmd.startsWith("\$ ls")) { // println("ls") } else if (cmd.startsWith("dir")) { val (_, name) = cmd.split(" ") currentDirectory.files.putIfAbsent(name, directoryMap.getOrPut(currentDirectory.path + name + "/") { Directory(currentDirectory.path + name + "/", currentDirectory) }) } else if (cmd.first().isDigit()) { val (size, file) = cmd.split(" ") currentDirectory.files.putIfAbsent(file, File(size.toInt())) } else throw Exception("Unknown command $cmd") } return directoryMap } fun part1(input: List<String>) = parseFileSystem(input).values .map { it.size() } .filter { it <= 100000 } .sum() fun part2(input: List<String>): Int { val fs = parseFileSystem(input) val totalSize = 70000000 val required = 30000000 val currentUsed = fs["/"]!!.size() val currentFree = totalSize - currentUsed val missing = required - currentFree return fs.values .map { it.size() } .filter { it >= missing } .min() } test( day = 7, testTarget1 = 95437, testTarget2 = 24933642, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day07Kt$main$FileSystem.class", "javap": "Compiled from \"Day07.kt\"\npublic abstract class Day07Kt$main$FileSystem {\n public Day07Kt$main$FileSystem();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public abstract int size();\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day07Kt.class", "javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt {\n public static final void main();\n Code:\n 0: bipush 7\n 2: ldc #7 // int 95437\n 4: invokestatic #13 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 7: ldc #14 // int 24933642\n 9: invokestatic #13 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 12: getstatic #20 // Field Day07Kt$main$1.INSTANCE:LDay07Kt$main$1;\n 15: checkcast #22 // class kotlin/jvm/functions/Function1\n 18: getstatic #27 // Field Day07Kt$main$2.INSTANCE:LDay07Kt$main$2;\n 21: checkcast #22 // class kotlin/jvm/functions/Function1\n 24: invokestatic #33 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 27: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #36 // Method main:()V\n 3: return\n\n private static final java.util.Map<java.lang.String, Day07Kt$main$Directory> main$parseFileSystem(java.util.List<java.lang.String>);\n Code:\n 0: iconst_1\n 1: anewarray #43 // class kotlin/Pair\n 4: astore_2\n 5: aload_2\n 6: iconst_0\n 7: ldc #45 // String /\n 9: new #47 // class Day07Kt$main$Directory\n 12: dup\n 13: ldc #45 // String /\n 15: aconst_null\n 16: iconst_2\n 17: aconst_null\n 18: invokespecial #51 // Method Day07Kt$main$Directory.\"<init>\":(Ljava/lang/String;LDay07Kt$main$Directory;ILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 21: invokestatic #57 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 24: aastore\n 25: aload_2\n 26: invokestatic #63 // Method kotlin/collections/MapsKt.mutableMapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 29: astore_1\n 30: aconst_null\n 31: astore_2\n 32: aload_1\n 33: invokeinterface #69, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 38: checkcast #71 // class java/lang/Iterable\n 41: invokestatic #77 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;\n 44: astore_2\n 45: aload_0\n 46: invokeinterface #83, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 51: astore_3\n 52: aload_3\n 53: invokeinterface #89, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 58: ifeq 653\n 61: aload_3\n 62: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 67: checkcast #95 // class java/lang/String\n 70: astore 4\n 72: aload 4\n 74: ldc #97 // String $ cd\n 76: iconst_0\n 77: iconst_2\n 78: aconst_null\n 79: invokestatic #103 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 82: ifeq 312\n 85: aload 4\n 87: checkcast #105 // class java/lang/CharSequence\n 90: iconst_1\n 91: anewarray #95 // class java/lang/String\n 94: astore 6\n 96: aload 6\n 98: iconst_0\n 99: ldc #107 // String cd\n 101: aastore\n 102: aload 6\n 104: iconst_0\n 105: iconst_0\n 106: bipush 6\n 108: aconst_null\n 109: invokestatic #111 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 112: invokestatic #115 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 115: checkcast #95 // class java/lang/String\n 118: checkcast #105 // class java/lang/CharSequence\n 121: invokestatic #119 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 124: invokevirtual #123 // Method java/lang/Object.toString:()Ljava/lang/String;\n 127: astore 5\n 129: aload 5\n 131: astore 6\n 133: aload 6\n 135: ldc #45 // String /\n 137: invokestatic #129 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 140: ifeq 161\n 143: aload_1\n 144: ldc #45 // String /\n 146: invokeinterface #133, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 151: dup\n 152: invokestatic #137 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 155: checkcast #47 // class Day07Kt$main$Directory\n 158: goto 308\n 161: aload 6\n 163: ldc #139 // String ..\n 165: invokestatic #129 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 168: ifeq 185\n 171: aload_2\n 172: checkcast #47 // class Day07Kt$main$Directory\n 175: invokevirtual #143 // Method Day07Kt$main$Directory.getParent:()LDay07Kt$main$Directory;\n 178: dup\n 179: invokestatic #137 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 182: goto 308\n 185: aload_1\n 186: astore 7\n 188: new #145 // class java/lang/StringBuilder\n 191: dup\n 192: invokespecial #147 // Method java/lang/StringBuilder.\"<init>\":()V\n 195: aload_2\n 196: checkcast #47 // class Day07Kt$main$Directory\n 199: invokevirtual #150 // Method Day07Kt$main$Directory.getPath:()Ljava/lang/String;\n 202: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 205: aload 5\n 207: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 210: bipush 47\n 212: invokevirtual #157 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 215: invokevirtual #158 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 218: astore 8\n 220: iconst_0\n 221: istore 9\n 223: aload 7\n 225: aload 8\n 227: invokeinterface #133, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 232: astore 10\n 234: aload 10\n 236: ifnonnull 302\n 239: iconst_0\n 240: istore 11\n 242: new #47 // class Day07Kt$main$Directory\n 245: dup\n 246: new #145 // class java/lang/StringBuilder\n 249: dup\n 250: invokespecial #147 // Method java/lang/StringBuilder.\"<init>\":()V\n 253: aload_2\n 254: checkcast #47 // class Day07Kt$main$Directory\n 257: invokevirtual #150 // Method Day07Kt$main$Directory.getPath:()Ljava/lang/String;\n 260: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 263: aload 5\n 265: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 268: bipush 47\n 270: invokevirtual #157 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 273: invokevirtual #158 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 276: aload_2\n 277: checkcast #47 // class Day07Kt$main$Directory\n 280: invokespecial #161 // Method Day07Kt$main$Directory.\"<init>\":(Ljava/lang/String;LDay07Kt$main$Directory;)V\n 283: astore 12\n 285: aload 7\n 287: aload 8\n 289: aload 12\n 291: invokeinterface #165, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 296: pop\n 297: aload 12\n 299: goto 304\n 302: aload 10\n 304: nop\n 305: checkcast #47 // class Day07Kt$main$Directory\n 308: astore_2\n 309: goto 52\n 312: aload 4\n 314: ldc #167 // String $ ls\n 316: iconst_0\n 317: iconst_2\n 318: aconst_null\n 319: invokestatic #103 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 322: ifne 52\n 325: aload 4\n 327: ldc #169 // String dir\n 329: iconst_0\n 330: iconst_2\n 331: aconst_null\n 332: invokestatic #103 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 335: ifeq 526\n 338: aload 4\n 340: checkcast #105 // class java/lang/CharSequence\n 343: iconst_1\n 344: anewarray #95 // class java/lang/String\n 347: astore 6\n 349: aload 6\n 351: iconst_0\n 352: ldc #171 // String\n 354: aastore\n 355: aload 6\n 357: iconst_0\n 358: iconst_0\n 359: bipush 6\n 361: aconst_null\n 362: invokestatic #111 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 365: iconst_1\n 366: invokeinterface #174, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 371: checkcast #95 // class java/lang/String\n 374: astore 6\n 376: aload_2\n 377: checkcast #47 // class Day07Kt$main$Directory\n 380: invokevirtual #178 // Method Day07Kt$main$Directory.getFiles:()Ljava/util/Map;\n 383: aload 6\n 385: aload_1\n 386: astore 7\n 388: new #145 // class java/lang/StringBuilder\n 391: dup\n 392: invokespecial #147 // Method java/lang/StringBuilder.\"<init>\":()V\n 395: aload_2\n 396: checkcast #47 // class Day07Kt$main$Directory\n 399: invokevirtual #150 // Method Day07Kt$main$Directory.getPath:()Ljava/lang/String;\n 402: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 405: aload 6\n 407: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 410: bipush 47\n 412: invokevirtual #157 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 415: invokevirtual #158 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 418: astore 8\n 420: iconst_0\n 421: istore 9\n 423: aload 7\n 425: aload 8\n 427: invokeinterface #133, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 432: astore 10\n 434: aload 10\n 436: ifnonnull 514\n 439: astore 14\n 441: astore 13\n 443: iconst_0\n 444: istore 11\n 446: new #47 // class Day07Kt$main$Directory\n 449: dup\n 450: new #145 // class java/lang/StringBuilder\n 453: dup\n 454: invokespecial #147 // Method java/lang/StringBuilder.\"<init>\":()V\n 457: aload_2\n 458: checkcast #47 // class Day07Kt$main$Directory\n 461: invokevirtual #150 // Method Day07Kt$main$Directory.getPath:()Ljava/lang/String;\n 464: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 467: aload 6\n 469: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 472: bipush 47\n 474: invokevirtual #157 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 477: invokevirtual #158 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 480: aload_2\n 481: checkcast #47 // class Day07Kt$main$Directory\n 484: invokespecial #161 // Method Day07Kt$main$Directory.\"<init>\":(Ljava/lang/String;LDay07Kt$main$Directory;)V\n 487: astore 15\n 489: aload 13\n 491: aload 14\n 493: aload 15\n 495: astore 12\n 497: aload 7\n 499: aload 8\n 501: aload 12\n 503: invokeinterface #165, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 508: pop\n 509: aload 12\n 511: goto 516\n 514: aload 10\n 516: nop\n 517: invokeinterface #181, 3 // InterfaceMethod java/util/Map.putIfAbsent:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 522: pop\n 523: goto 52\n 526: aload 4\n 528: checkcast #105 // class java/lang/CharSequence\n 531: invokestatic #184 // Method kotlin/text/StringsKt.first:(Ljava/lang/CharSequence;)C\n 534: invokestatic #190 // Method java/lang/Character.isDigit:(C)Z\n 537: ifeq 625\n 540: aload 4\n 542: checkcast #105 // class java/lang/CharSequence\n 545: iconst_1\n 546: anewarray #95 // class java/lang/String\n 549: astore 6\n 551: aload 6\n 553: iconst_0\n 554: ldc #171 // String\n 556: aastore\n 557: aload 6\n 559: iconst_0\n 560: iconst_0\n 561: bipush 6\n 563: aconst_null\n 564: invokestatic #111 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 567: astore 5\n 569: aload 5\n 571: iconst_0\n 572: invokeinterface #174, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 577: checkcast #95 // class java/lang/String\n 580: astore 6\n 582: aload 5\n 584: iconst_1\n 585: invokeinterface #174, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 590: checkcast #95 // class java/lang/String\n 593: astore 7\n 595: aload_2\n 596: checkcast #47 // class Day07Kt$main$Directory\n 599: invokevirtual #178 // Method Day07Kt$main$Directory.getFiles:()Ljava/util/Map;\n 602: aload 7\n 604: new #192 // class Day07Kt$main$File\n 607: dup\n 608: aload 6\n 610: invokestatic #196 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 613: invokespecial #199 // Method Day07Kt$main$File.\"<init>\":(I)V\n 616: invokeinterface #181, 3 // InterfaceMethod java/util/Map.putIfAbsent:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 621: pop\n 622: goto 52\n 625: new #201 // class java/lang/Exception\n 628: dup\n 629: new #145 // class java/lang/StringBuilder\n 632: dup\n 633: invokespecial #147 // Method java/lang/StringBuilder.\"<init>\":()V\n 636: ldc #203 // String Unknown command\n 638: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 641: aload 4\n 643: invokevirtual #154 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 646: invokevirtual #158 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 649: invokespecial #206 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 652: athrow\n 653: aload_1\n 654: areturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #231 // Method main$parseFileSystem:(Ljava/util/List;)Ljava/util/Map;\n 4: invokeinterface #69, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 9: checkcast #71 // class java/lang/Iterable\n 12: astore_1\n 13: nop\n 14: iconst_0\n 15: istore_2\n 16: aload_1\n 17: astore_3\n 18: new #233 // class java/util/ArrayList\n 21: dup\n 22: aload_1\n 23: bipush 10\n 25: invokestatic #237 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 28: invokespecial #238 // Method java/util/ArrayList.\"<init>\":(I)V\n 31: checkcast #240 // class java/util/Collection\n 34: astore 4\n 36: iconst_0\n 37: istore 5\n 39: aload_3\n 40: invokeinterface #241, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 45: astore 6\n 47: aload 6\n 49: invokeinterface #89, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 54: ifeq 100\n 57: aload 6\n 59: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 64: astore 7\n 66: aload 4\n 68: aload 7\n 70: checkcast #47 // class Day07Kt$main$Directory\n 73: astore 8\n 75: astore 10\n 77: iconst_0\n 78: istore 9\n 80: aload 8\n 82: invokevirtual #244 // Method Day07Kt$main$Directory.size:()I\n 85: invokestatic #13 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 88: aload 10\n 90: swap\n 91: invokeinterface #248, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 96: pop\n 97: goto 47\n 100: aload 4\n 102: checkcast #79 // class java/util/List\n 105: nop\n 106: checkcast #71 // class java/lang/Iterable\n 109: astore_1\n 110: nop\n 111: iconst_0\n 112: istore_2\n 113: aload_1\n 114: astore_3\n 115: new #233 // class java/util/ArrayList\n 118: dup\n 119: invokespecial #249 // Method java/util/ArrayList.\"<init>\":()V\n 122: checkcast #240 // class java/util/Collection\n 125: astore 4\n 127: iconst_0\n 128: istore 5\n 130: aload_3\n 131: invokeinterface #241, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 136: astore 6\n 138: aload 6\n 140: invokeinterface #89, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 145: ifeq 198\n 148: aload 6\n 150: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 155: astore 7\n 157: aload 7\n 159: checkcast #251 // class java/lang/Number\n 162: invokevirtual #254 // Method java/lang/Number.intValue:()I\n 165: istore 8\n 167: iconst_0\n 168: istore 9\n 170: iload 8\n 172: ldc #255 // int 100000\n 174: if_icmpgt 181\n 177: iconst_1\n 178: goto 182\n 181: iconst_0\n 182: ifeq 138\n 185: aload 4\n 187: aload 7\n 189: invokeinterface #248, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 194: pop\n 195: goto 138\n 198: aload 4\n 200: checkcast #79 // class java/util/List\n 203: nop\n 204: checkcast #71 // class java/lang/Iterable\n 207: invokestatic #259 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I\n 210: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #231 // Method main$parseFileSystem:(Ljava/util/List;)Ljava/util/Map;\n 4: astore_1\n 5: ldc_w #278 // int 70000000\n 8: istore_2\n 9: ldc_w #279 // int 30000000\n 12: istore_3\n 13: aload_1\n 14: ldc #45 // String /\n 16: invokeinterface #133, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 21: dup\n 22: invokestatic #137 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 25: checkcast #47 // class Day07Kt$main$Directory\n 28: invokevirtual #244 // Method Day07Kt$main$Directory.size:()I\n 31: istore 4\n 33: iload_2\n 34: iload 4\n 36: isub\n 37: istore 5\n 39: iload_3\n 40: iload 5\n 42: isub\n 43: istore 6\n 45: aload_1\n 46: invokeinterface #69, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 51: checkcast #71 // class java/lang/Iterable\n 54: astore 7\n 56: nop\n 57: iconst_0\n 58: istore 8\n 60: aload 7\n 62: astore 9\n 64: new #233 // class java/util/ArrayList\n 67: dup\n 68: aload 7\n 70: bipush 10\n 72: invokestatic #237 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 75: invokespecial #238 // Method java/util/ArrayList.\"<init>\":(I)V\n 78: checkcast #240 // class java/util/Collection\n 81: astore 10\n 83: iconst_0\n 84: istore 11\n 86: aload 9\n 88: invokeinterface #241, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 93: astore 12\n 95: aload 12\n 97: invokeinterface #89, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 102: ifeq 148\n 105: aload 12\n 107: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 112: astore 13\n 114: aload 10\n 116: aload 13\n 118: checkcast #47 // class Day07Kt$main$Directory\n 121: astore 14\n 123: astore 16\n 125: iconst_0\n 126: istore 15\n 128: aload 14\n 130: invokevirtual #244 // Method Day07Kt$main$Directory.size:()I\n 133: invokestatic #13 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 136: aload 16\n 138: swap\n 139: invokeinterface #248, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 144: pop\n 145: goto 95\n 148: aload 10\n 150: checkcast #79 // class java/util/List\n 153: nop\n 154: checkcast #71 // class java/lang/Iterable\n 157: astore 7\n 159: nop\n 160: iconst_0\n 161: istore 8\n 163: aload 7\n 165: astore 9\n 167: new #233 // class java/util/ArrayList\n 170: dup\n 171: invokespecial #249 // Method java/util/ArrayList.\"<init>\":()V\n 174: checkcast #240 // class java/util/Collection\n 177: astore 10\n 179: iconst_0\n 180: istore 11\n 182: aload 9\n 184: invokeinterface #241, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 189: astore 12\n 191: aload 12\n 193: invokeinterface #89, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 198: ifeq 251\n 201: aload 12\n 203: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 208: astore 13\n 210: aload 13\n 212: checkcast #251 // class java/lang/Number\n 215: invokevirtual #254 // Method java/lang/Number.intValue:()I\n 218: istore 14\n 220: iconst_0\n 221: istore 15\n 223: iload 14\n 225: iload 6\n 227: if_icmplt 234\n 230: iconst_1\n 231: goto 235\n 234: iconst_0\n 235: ifeq 191\n 238: aload 10\n 240: aload 13\n 242: invokeinterface #248, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 247: pop\n 248: goto 191\n 251: aload 10\n 253: checkcast #79 // class java/util/List\n 256: nop\n 257: checkcast #71 // class java/lang/Iterable\n 260: invokestatic #283 // Method kotlin/collections/CollectionsKt.minOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 263: checkcast #251 // class java/lang/Number\n 266: invokevirtual #254 // Method java/lang/Number.intValue:()I\n 269: ireturn\n\n public static final int access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #294 // Method main$part1:(Ljava/util/List;)I\n 4: ireturn\n\n public static final int access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #297 // Method main$part2:(Ljava/util/List;)I\n 4: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day07Kt$main$Directory.class", "javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt$main$Directory extends Day07Kt$main$FileSystem {\n private final java.lang.String path;\n\n private final Day07Kt$main$Directory parent;\n\n private final java.util.Map<java.lang.String, Day07Kt$main$FileSystem> files;\n\n public Day07Kt$main$Directory(java.lang.String, Day07Kt$main$Directory);\n Code:\n 0: aload_1\n 1: ldc #8 // String path\n 3: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokespecial #17 // Method Day07Kt$main$FileSystem.\"<init>\":()V\n 10: aload_0\n 11: aload_1\n 12: putfield #20 // Field path:Ljava/lang/String;\n 15: aload_0\n 16: aload_2\n 17: putfield #24 // Field parent:LDay07Kt$main$Directory;\n 20: aload_0\n 21: new #26 // class java/util/LinkedHashMap\n 24: dup\n 25: invokespecial #27 // Method java/util/LinkedHashMap.\"<init>\":()V\n 28: checkcast #29 // class java/util/Map\n 31: putfield #33 // Field files:Ljava/util/Map;\n 34: return\n\n public Day07Kt$main$Directory(java.lang.String, Day07Kt$main$Directory, int, kotlin.jvm.internal.DefaultConstructorMarker);\n Code:\n 0: iload_3\n 1: iconst_2\n 2: iand\n 3: ifeq 8\n 6: aconst_null\n 7: astore_2\n 8: aload_0\n 9: aload_1\n 10: aload_2\n 11: invokespecial #37 // Method \"<init>\":(Ljava/lang/String;LDay07Kt$main$Directory;)V\n 14: return\n\n public final java.lang.String getPath();\n Code:\n 0: aload_0\n 1: getfield #20 // Field path:Ljava/lang/String;\n 4: areturn\n\n public final Day07Kt$main$Directory getParent();\n Code:\n 0: aload_0\n 1: getfield #24 // Field parent:LDay07Kt$main$Directory;\n 4: areturn\n\n public final java.util.Map<java.lang.String, Day07Kt$main$FileSystem> getFiles();\n Code:\n 0: aload_0\n 1: getfield #33 // Field files:Ljava/util/Map;\n 4: areturn\n\n public int size();\n Code:\n 0: aload_0\n 1: getfield #33 // Field files:Ljava/util/Map;\n 4: invokeinterface #50, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 9: checkcast #52 // class java/lang/Iterable\n 12: astore_1\n 13: iconst_0\n 14: istore_2\n 15: aload_1\n 16: invokeinterface #56, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 21: astore_3\n 22: aload_3\n 23: invokeinterface #62, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 28: ifeq 68\n 31: aload_3\n 32: invokeinterface #66, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 37: astore 4\n 39: iload_2\n 40: aload 4\n 42: checkcast #4 // class Day07Kt$main$FileSystem\n 45: astore 5\n 47: istore 7\n 49: iconst_0\n 50: istore 6\n 52: aload 5\n 54: invokevirtual #68 // Method Day07Kt$main$FileSystem.size:()I\n 57: istore 8\n 59: iload 7\n 61: iload 8\n 63: iadd\n 64: istore_2\n 65: goto 22\n 68: iload_2\n 69: ireturn\n\n public final java.lang.String component1();\n Code:\n 0: aload_0\n 1: getfield #20 // Field path:Ljava/lang/String;\n 4: areturn\n\n public final Day07Kt$main$Directory component2();\n Code:\n 0: aload_0\n 1: getfield #24 // Field parent:LDay07Kt$main$Directory;\n 4: areturn\n\n public final Day07Kt$main$Directory copy(java.lang.String, Day07Kt$main$Directory);\n Code:\n 0: aload_1\n 1: ldc #8 // String path\n 3: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #2 // class Day07Kt$main$Directory\n 9: dup\n 10: aload_1\n 11: aload_2\n 12: invokespecial #37 // Method \"<init>\":(Ljava/lang/String;LDay07Kt$main$Directory;)V\n 15: areturn\n\n public static Day07Kt$main$Directory copy$default(Day07Kt$main$Directory, java.lang.String, Day07Kt$main$Directory, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_1\n 2: iand\n 3: ifeq 11\n 6: aload_0\n 7: getfield #20 // Field path:Ljava/lang/String;\n 10: astore_1\n 11: iload_3\n 12: iconst_2\n 13: iand\n 14: ifeq 22\n 17: aload_0\n 18: getfield #24 // Field parent:LDay07Kt$main$Directory;\n 21: astore_2\n 22: aload_0\n 23: aload_1\n 24: aload_2\n 25: invokevirtual #80 // Method copy:(Ljava/lang/String;LDay07Kt$main$Directory;)LDay07Kt$main$Directory;\n 28: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #83 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #84 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #86 // String Directory(path=\n 9: invokevirtual #90 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #20 // Field path:Ljava/lang/String;\n 16: invokevirtual #90 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 19: ldc #92 // String , parent=\n 21: invokevirtual #90 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 24: aload_0\n 25: getfield #24 // Field parent:LDay07Kt$main$Directory;\n 28: invokevirtual #95 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 31: bipush 41\n 33: invokevirtual #98 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 36: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 39: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #20 // Field path:Ljava/lang/String;\n 4: invokevirtual #105 // Method java/lang/String.hashCode:()I\n 7: istore_1\n 8: iload_1\n 9: bipush 31\n 11: imul\n 12: aload_0\n 13: getfield #24 // Field parent:LDay07Kt$main$Directory;\n 16: ifnonnull 23\n 19: iconst_0\n 20: goto 30\n 23: aload_0\n 24: getfield #24 // Field parent:LDay07Kt$main$Directory;\n 27: invokevirtual #106 // Method hashCode:()I\n 30: iadd\n 31: istore_1\n 32: iload_1\n 33: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class Day07Kt$main$Directory\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class Day07Kt$main$Directory\n 20: astore_2\n 21: aload_0\n 22: getfield #20 // Field path:Ljava/lang/String;\n 25: aload_2\n 26: getfield #20 // Field path:Ljava/lang/String;\n 29: invokestatic #113 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 32: ifne 37\n 35: iconst_0\n 36: ireturn\n 37: aload_0\n 38: getfield #24 // Field parent:LDay07Kt$main$Directory;\n 41: aload_2\n 42: getfield #24 // Field parent:LDay07Kt$main$Directory;\n 45: invokestatic #113 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 48: ifne 53\n 51: iconst_0\n 52: ireturn\n 53: iconst_1\n 54: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day07Kt$main$1.class", "javap": "Compiled from \"Day07.kt\"\nfinal class Day07Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day07Kt$main$1 INSTANCE;\n\n Day07Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day07Kt.access$main$part1:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day07Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay07Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day07Kt$main$2.class", "javap": "Compiled from \"Day07.kt\"\nfinal class Day07Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day07Kt$main$2 INSTANCE;\n\n Day07Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day07Kt.access$main$part2:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day07Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay07Kt$main$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day07Kt$main$File.class", "javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt$main$File extends Day07Kt$main$FileSystem {\n private final int size;\n\n public Day07Kt$main$File(int);\n Code:\n 0: aload_0\n 1: invokespecial #9 // Method Day07Kt$main$FileSystem.\"<init>\":()V\n 4: aload_0\n 5: iload_1\n 6: putfield #13 // Field size:I\n 9: return\n\n public final int getSize();\n Code:\n 0: aload_0\n 1: getfield #13 // Field size:I\n 4: ireturn\n\n public int size();\n Code:\n 0: aload_0\n 1: getfield #13 // Field size:I\n 4: ireturn\n\n public final int component1();\n Code:\n 0: aload_0\n 1: getfield #13 // Field size:I\n 4: ireturn\n\n public final Day07Kt$main$File copy(int);\n Code:\n 0: new #2 // class Day07Kt$main$File\n 3: dup\n 4: iload_1\n 5: invokespecial #22 // Method \"<init>\":(I)V\n 8: areturn\n\n public static Day07Kt$main$File copy$default(Day07Kt$main$File, int, int, java.lang.Object);\n Code:\n 0: iload_2\n 1: iconst_1\n 2: iand\n 3: ifeq 11\n 6: aload_0\n 7: getfield #13 // Field size:I\n 10: istore_1\n 11: aload_0\n 12: iload_1\n 13: invokevirtual #26 // Method copy:(I)LDay07Kt$main$File;\n 16: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #30 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #31 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #33 // String File(size=\n 9: invokevirtual #37 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #13 // Field size:I\n 16: invokevirtual #40 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 19: bipush 41\n 21: invokevirtual #43 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 24: invokevirtual #45 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 27: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #13 // Field size:I\n 4: invokestatic #51 // Method java/lang/Integer.hashCode:(I)I\n 7: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class Day07Kt$main$File\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class Day07Kt$main$File\n 20: astore_2\n 21: aload_0\n 22: getfield #13 // Field size:I\n 25: aload_2\n 26: getfield #13 // Field size:I\n 29: if_icmpeq 34\n 32: iconst_0\n 33: ireturn\n 34: iconst_1\n 35: ireturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day25.kt
fun main() { val charToDigit = mapOf('=' to -2, '-' to -1, '0' to 0, '1' to 1, '2' to 2) val digitToChar = charToDigit.map { (char, digit) -> digit.toLong() to char }.toMap() fun toDecimal(snafu: String) = snafu.toCharArray().reversed().mapIndexed { index, char -> charToDigit[char]!! * 5.pow(index) }.sum() fun toSnafu(decimal: Long): String { var value = decimal var result = "" while (value > 0) { var digit = value % 5 if (digit > 2) digit -= 5 value = (value - digit) / 5 result += digitToChar[digit]!! } return result.reversed() } fun part1(input: List<String>) = toSnafu(input.sumOf { toDecimal(it) }) fun part2(input: List<String>) = "HOHOHO" test( day = 25, testTarget1 = "2=-1=0", testTarget2 = "HOHOHO", part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day25Kt$main$1.class", "javap": "Compiled from \"Day25.kt\"\nfinal class Day25Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.String> {\n final java.util.Map<java.lang.Character, java.lang.Integer> $charToDigit;\n\n final java.util.Map<java.lang.Long, java.lang.Character> $digitToChar;\n\n Day25Kt$main$1(java.util.Map<java.lang.Character, java.lang.Integer>, java.util.Map<java.lang.Long, java.lang.Character>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #14 // Field $charToDigit:Ljava/util/Map;\n 5: aload_0\n 6: aload_2\n 7: putfield #17 // Field $digitToChar:Ljava/util/Map;\n 10: aload_0\n 11: iconst_1\n 12: ldc #19 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 14: ldc #21 // String part1\n 16: ldc #23 // String main$part1(Ljava/util/Map;Ljava/util/Map;Ljava/util/List;)Ljava/lang/String;\n 18: iconst_0\n 19: invokespecial #26 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 22: return\n\n public final java.lang.String invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #33 // String p0\n 3: invokestatic #39 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #14 // Field $charToDigit:Ljava/util/Map;\n 10: aload_0\n 11: getfield #17 // Field $digitToChar:Ljava/util/Map;\n 14: aload_1\n 15: invokestatic #45 // Method Day25Kt.access$main$part1:(Ljava/util/Map;Ljava/util/Map;Ljava/util/List;)Ljava/lang/String;\n 18: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #49 // class java/util/List\n 5: invokevirtual #51 // Method invoke:(Ljava/util/List;)Ljava/lang/String;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day25Kt$main$2.class", "javap": "Compiled from \"Day25.kt\"\nfinal class Day25Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.String> {\n public static final Day25Kt$main$2 INSTANCE;\n\n Day25Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)Ljava/lang/String;\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.String invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #36 // Method Day25Kt.access$main$part2:(Ljava/util/List;)Ljava/lang/String;\n 10: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #40 // class java/util/List\n 5: invokevirtual #42 // Method invoke:(Ljava/util/List;)Ljava/lang/String;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day25Kt$main$2\n 3: dup\n 4: invokespecial #47 // Method \"<init>\":()V\n 7: putstatic #50 // Field INSTANCE:LDay25Kt$main$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day25Kt.class", "javap": "Compiled from \"Day25.kt\"\npublic final class Day25Kt {\n public static final void main();\n Code:\n 0: iconst_5\n 1: anewarray #8 // class kotlin/Pair\n 4: astore_1\n 5: aload_1\n 6: iconst_0\n 7: bipush 61\n 9: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 12: bipush -2\n 14: invokestatic #19 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 17: invokestatic #25 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 20: aastore\n 21: aload_1\n 22: iconst_1\n 23: bipush 45\n 25: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 28: iconst_m1\n 29: invokestatic #19 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 32: invokestatic #25 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 35: aastore\n 36: aload_1\n 37: iconst_2\n 38: bipush 48\n 40: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 43: iconst_0\n 44: invokestatic #19 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 47: invokestatic #25 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 50: aastore\n 51: aload_1\n 52: iconst_3\n 53: bipush 49\n 55: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 58: iconst_1\n 59: invokestatic #19 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 62: invokestatic #25 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 65: aastore\n 66: aload_1\n 67: iconst_4\n 68: bipush 50\n 70: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 73: iconst_2\n 74: invokestatic #19 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 77: invokestatic #25 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 80: aastore\n 81: aload_1\n 82: invokestatic #31 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 85: astore_0\n 86: aload_0\n 87: astore_2\n 88: iconst_0\n 89: istore_3\n 90: aload_2\n 91: astore 4\n 93: new #33 // class java/util/ArrayList\n 96: dup\n 97: aload_2\n 98: invokeinterface #39, 1 // InterfaceMethod java/util/Map.size:()I\n 103: invokespecial #43 // Method java/util/ArrayList.\"<init>\":(I)V\n 106: checkcast #45 // class java/util/Collection\n 109: astore 5\n 111: iconst_0\n 112: istore 6\n 114: aload 4\n 116: invokeinterface #49, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 121: invokeinterface #55, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 126: astore 7\n 128: aload 7\n 130: invokeinterface #61, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 135: ifeq 217\n 138: aload 7\n 140: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 145: checkcast #67 // class java/util/Map$Entry\n 148: astore 8\n 150: aload 5\n 152: aload 8\n 154: astore 9\n 156: astore 13\n 158: iconst_0\n 159: istore 10\n 161: aload 9\n 163: invokeinterface #70, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 168: checkcast #10 // class java/lang/Character\n 171: invokevirtual #74 // Method java/lang/Character.charValue:()C\n 174: istore 11\n 176: aload 9\n 178: invokeinterface #77, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 183: checkcast #79 // class java/lang/Number\n 186: invokevirtual #82 // Method java/lang/Number.intValue:()I\n 189: istore 12\n 191: iload 12\n 193: i2l\n 194: invokestatic #87 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 197: iload 11\n 199: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 202: invokestatic #25 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 205: aload 13\n 207: swap\n 208: invokeinterface #91, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 213: pop\n 214: goto 128\n 217: aload 5\n 219: checkcast #93 // class java/util/List\n 222: nop\n 223: checkcast #95 // class java/lang/Iterable\n 226: invokestatic #99 // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;\n 229: astore_1\n 230: bipush 25\n 232: ldc #101 // String 2=-1=0\n 234: ldc #103 // String HOHOHO\n 236: new #105 // class Day25Kt$main$1\n 239: dup\n 240: aload_0\n 241: aload_1\n 242: invokespecial #108 // Method Day25Kt$main$1.\"<init>\":(Ljava/util/Map;Ljava/util/Map;)V\n 245: checkcast #110 // class kotlin/jvm/functions/Function1\n 248: getstatic #116 // Field Day25Kt$main$2.INSTANCE:LDay25Kt$main$2;\n 251: checkcast #110 // class kotlin/jvm/functions/Function1\n 254: invokestatic #122 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 257: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #143 // Method main:()V\n 3: return\n\n private static final long main$toDecimal(java.util.Map<java.lang.Character, java.lang.Integer>, java.lang.String);\n Code:\n 0: aload_1\n 1: invokevirtual #154 // Method java/lang/String.toCharArray:()[C\n 4: dup\n 5: ldc #156 // String toCharArray(...)\n 7: invokestatic #162 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 10: invokestatic #168 // Method kotlin/collections/ArraysKt.reversed:([C)Ljava/util/List;\n 13: checkcast #95 // class java/lang/Iterable\n 16: astore_2\n 17: iconst_0\n 18: istore_3\n 19: aload_2\n 20: astore 4\n 22: new #33 // class java/util/ArrayList\n 25: dup\n 26: aload_2\n 27: bipush 10\n 29: invokestatic #174 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 32: invokespecial #43 // Method java/util/ArrayList.\"<init>\":(I)V\n 35: checkcast #45 // class java/util/Collection\n 38: astore 5\n 40: iconst_0\n 41: istore 6\n 43: iconst_0\n 44: istore 7\n 46: aload 4\n 48: invokeinterface #175, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 53: astore 8\n 55: aload 8\n 57: invokeinterface #61, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 62: ifeq 153\n 65: aload 8\n 67: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 72: astore 9\n 74: aload 5\n 76: iload 7\n 78: iinc 7, 1\n 81: istore 10\n 83: iload 10\n 85: ifge 91\n 88: invokestatic #178 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 91: iload 10\n 93: aload 9\n 95: checkcast #10 // class java/lang/Character\n 98: invokevirtual #74 // Method java/lang/Character.charValue:()C\n 101: istore 11\n 103: istore 12\n 105: astore 14\n 107: iconst_0\n 108: istore 13\n 110: aload_0\n 111: iload 11\n 113: invokestatic #14 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 116: invokeinterface #182, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 121: dup\n 122: invokestatic #186 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 125: checkcast #79 // class java/lang/Number\n 128: invokevirtual #190 // Method java/lang/Number.longValue:()J\n 131: iconst_5\n 132: iload 12\n 134: invokestatic #194 // Method UtilsKt.pow:(II)J\n 137: lmul\n 138: invokestatic #87 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 141: aload 14\n 143: swap\n 144: invokeinterface #91, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 149: pop\n 150: goto 55\n 153: aload 5\n 155: checkcast #93 // class java/util/List\n 158: nop\n 159: checkcast #95 // class java/lang/Iterable\n 162: invokestatic #198 // Method kotlin/collections/CollectionsKt.sumOfLong:(Ljava/lang/Iterable;)J\n 165: lreturn\n\n private static final java.lang.String main$toSnafu(java.util.Map<java.lang.Long, java.lang.Character>, long);\n Code:\n 0: lload_1\n 1: lstore_3\n 2: ldc #214 // String\n 4: astore 5\n 6: lload_3\n 7: lconst_0\n 8: lcmp\n 9: ifle 86\n 12: lload_3\n 13: iconst_5\n 14: i2l\n 15: lrem\n 16: lstore 6\n 18: lload 6\n 20: ldc2_w #215 // long 2l\n 23: lcmp\n 24: ifle 34\n 27: lload 6\n 29: iconst_5\n 30: i2l\n 31: lsub\n 32: lstore 6\n 34: lload_3\n 35: lload 6\n 37: lsub\n 38: iconst_5\n 39: i2l\n 40: ldiv\n 41: lstore_3\n 42: new #218 // class java/lang/StringBuilder\n 45: dup\n 46: invokespecial #220 // Method java/lang/StringBuilder.\"<init>\":()V\n 49: aload 5\n 51: invokevirtual #224 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 54: aload_0\n 55: lload 6\n 57: invokestatic #87 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 60: invokeinterface #182, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 65: dup\n 66: invokestatic #186 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 69: checkcast #10 // class java/lang/Character\n 72: invokevirtual #74 // Method java/lang/Character.charValue:()C\n 75: invokevirtual #227 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 78: invokevirtual #231 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 81: astore 5\n 83: goto 6\n 86: aload 5\n 88: checkcast #233 // class java/lang/CharSequence\n 91: invokestatic #238 // Method kotlin/text/StringsKt.reversed:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 94: invokevirtual #239 // Method java/lang/Object.toString:()Ljava/lang/String;\n 97: areturn\n\n private static final java.lang.String main$part1(java.util.Map<java.lang.Character, java.lang.Integer>, java.util.Map<java.lang.Long, java.lang.Character>, java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: aload_2\n 2: checkcast #95 // class java/lang/Iterable\n 5: astore_3\n 6: astore 10\n 8: lconst_0\n 9: lstore 4\n 11: aload_3\n 12: invokeinterface #175, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 17: astore 6\n 19: aload 6\n 21: invokeinterface #61, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 26: ifeq 70\n 29: aload 6\n 31: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 36: astore 7\n 38: lload 4\n 40: aload 7\n 42: checkcast #150 // class java/lang/String\n 45: astore 8\n 47: lstore 11\n 49: iconst_0\n 50: istore 9\n 52: aload_0\n 53: aload 8\n 55: invokestatic #248 // Method main$toDecimal:(Ljava/util/Map;Ljava/lang/String;)J\n 58: lstore 13\n 60: lload 11\n 62: lload 13\n 64: ladd\n 65: lstore 4\n 67: goto 19\n 70: lload 4\n 72: lstore 11\n 74: aload 10\n 76: lload 11\n 78: invokestatic #250 // Method main$toSnafu:(Ljava/util/Map;J)Ljava/lang/String;\n 81: areturn\n\n private static final java.lang.String main$part2(java.util.List<java.lang.String>);\n Code:\n 0: ldc #103 // String HOHOHO\n 2: areturn\n\n public static final java.lang.String access$main$part1(java.util.Map, java.util.Map, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokestatic #260 // Method main$part1:(Ljava/util/Map;Ljava/util/Map;Ljava/util/List;)Ljava/lang/String;\n 6: areturn\n\n public static final java.lang.String access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #263 // Method main$part2:(Ljava/util/List;)Ljava/lang/String;\n 4: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day05.kt
fun main() { val inputLineRegex = """move (\d+) from (\d+) to (\d+)""".toRegex() fun partX(input: List<String>, moveLogic: (List<ArrayDeque<Char>>, Int, Int, Int) -> Unit): String { val stacks = List(9) { ArrayDeque<Char>() } for (line in input) { if (line.contains('[')) { stacks.forEachIndexed { index, chars -> line.getOrNull(index * 4 + 1)?.takeIf { it.isLetter() }?.let { chars.addLast(it) } } } if (line.contains("move")) { val (count, from, to) = line.destructured(inputLineRegex) moveLogic(stacks, count.toInt(), from.toInt(), to.toInt()) } } return stacks.filter { it.isNotEmpty() }.map { it.first() }.joinToString(separator = "") } fun part1(input: List<String>) = partX(input) { stacks, count, from, to -> for (i in 0 until count) stacks[to - 1].addFirst(stacks[from - 1].removeFirst()) } fun part2(input: List<String>) = partX(input) { stacks, count, from, to -> val queue = ArrayDeque<Char>() for (i in 0 until count) queue.add(stacks[from - 1].removeFirst()) while (queue.isNotEmpty()) stacks[to - 1].addFirst(queue.removeLast()) } test( day = 5, testTarget1 = "CMZ", testTarget2 = "MCD", part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day05Kt.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n public static final void main();\n Code:\n 0: new #8 // class kotlin/text/Regex\n 3: dup\n 4: ldc #10 // String move (\\\\d+) from (\\\\d+) to (\\\\d+)\n 6: invokespecial #14 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 9: astore_0\n 10: iconst_5\n 11: ldc #16 // String CMZ\n 13: ldc #18 // String MCD\n 15: new #20 // class Day05Kt$main$1\n 18: dup\n 19: aload_0\n 20: invokespecial #23 // Method Day05Kt$main$1.\"<init>\":(Lkotlin/text/Regex;)V\n 23: checkcast #25 // class kotlin/jvm/functions/Function1\n 26: new #27 // class Day05Kt$main$2\n 29: dup\n 30: aload_0\n 31: invokespecial #28 // Method Day05Kt$main$2.\"<init>\":(Lkotlin/text/Regex;)V\n 34: checkcast #25 // class kotlin/jvm/functions/Function1\n 37: invokestatic #34 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 40: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #39 // Method main:()V\n 3: return\n\n private static final java.lang.String main$partX(kotlin.text.Regex, java.util.List<java.lang.String>, kotlin.jvm.functions.Function4<? super java.util.List<kotlin.collections.ArrayDeque<java.lang.Character>>, ? super java.lang.Integer, ? super java.lang.Integer, ? super java.lang.Integer, kotlin.Unit>);\n Code:\n 0: bipush 9\n 2: istore 4\n 4: new #46 // class java/util/ArrayList\n 7: dup\n 8: iload 4\n 10: invokespecial #49 // Method java/util/ArrayList.\"<init>\":(I)V\n 13: astore 5\n 15: iconst_0\n 16: istore 6\n 18: iload 6\n 20: iload 4\n 22: if_icmpge 60\n 25: iload 6\n 27: istore 7\n 29: aload 5\n 31: iload 7\n 33: istore 8\n 35: astore 18\n 37: iconst_0\n 38: istore 9\n 40: new #51 // class kotlin/collections/ArrayDeque\n 43: dup\n 44: invokespecial #53 // Method kotlin/collections/ArrayDeque.\"<init>\":()V\n 47: aload 18\n 49: swap\n 50: invokevirtual #57 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 53: pop\n 54: iinc 6, 1\n 57: goto 18\n 60: aload 5\n 62: checkcast #59 // class java/util/List\n 65: astore_3\n 66: aload_1\n 67: invokeinterface #63, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 72: astore 4\n 74: aload 4\n 76: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 81: ifeq 385\n 84: aload 4\n 86: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 91: checkcast #75 // class java/lang/String\n 94: astore 5\n 96: aload 5\n 98: checkcast #77 // class java/lang/CharSequence\n 101: bipush 91\n 103: iconst_0\n 104: iconst_2\n 105: aconst_null\n 106: invokestatic #83 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z\n 109: ifeq 260\n 112: aload_3\n 113: checkcast #85 // class java/lang/Iterable\n 116: astore 6\n 118: iconst_0\n 119: istore 7\n 121: iconst_0\n 122: istore 8\n 124: aload 6\n 126: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 131: astore 9\n 133: aload 9\n 135: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 140: ifeq 259\n 143: aload 9\n 145: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 150: astore 10\n 152: iload 8\n 154: iinc 8, 1\n 157: istore 11\n 159: iload 11\n 161: ifge 167\n 164: invokestatic #91 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 167: iload 11\n 169: aload 10\n 171: checkcast #51 // class kotlin/collections/ArrayDeque\n 174: astore 12\n 176: istore 13\n 178: iconst_0\n 179: istore 14\n 181: aload 5\n 183: checkcast #77 // class java/lang/CharSequence\n 186: iload 13\n 188: iconst_4\n 189: imul\n 190: iconst_1\n 191: iadd\n 192: invokestatic #95 // Method kotlin/text/StringsKt.getOrNull:(Ljava/lang/CharSequence;I)Ljava/lang/Character;\n 195: dup\n 196: ifnull 252\n 199: astore 15\n 201: aload 15\n 203: invokevirtual #101 // Method java/lang/Character.charValue:()C\n 206: istore 16\n 208: iconst_0\n 209: istore 17\n 211: iload 16\n 213: invokestatic #105 // Method java/lang/Character.isLetter:(C)Z\n 216: nop\n 217: ifeq 225\n 220: aload 15\n 222: goto 226\n 225: aconst_null\n 226: dup\n 227: ifnull 252\n 230: invokevirtual #101 // Method java/lang/Character.charValue:()C\n 233: istore 16\n 235: iconst_0\n 236: istore 17\n 238: aload 12\n 240: iload 16\n 242: invokestatic #109 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 245: invokevirtual #113 // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V\n 248: nop\n 249: goto 254\n 252: pop\n 253: nop\n 254: nop\n 255: nop\n 256: goto 133\n 259: nop\n 260: aload 5\n 262: checkcast #77 // class java/lang/CharSequence\n 265: ldc #115 // String move\n 267: checkcast #77 // class java/lang/CharSequence\n 270: iconst_0\n 271: iconst_2\n 272: aconst_null\n 273: invokestatic #118 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z\n 276: ifeq 74\n 279: aload 5\n 281: aload_0\n 282: invokestatic #122 // Method UtilsKt.destructured:(Ljava/lang/String;Lkotlin/text/Regex;)Lkotlin/text/MatchResult$Destructured;\n 285: astore 6\n 287: aload 6\n 289: invokevirtual #128 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 292: invokeinterface #134, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 297: iconst_1\n 298: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 303: checkcast #75 // class java/lang/String\n 306: astore 7\n 308: aload 6\n 310: invokevirtual #128 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 313: invokeinterface #134, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 318: iconst_2\n 319: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 324: checkcast #75 // class java/lang/String\n 327: astore 8\n 329: aload 6\n 331: invokevirtual #128 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 334: invokeinterface #134, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 339: iconst_3\n 340: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 345: checkcast #75 // class java/lang/String\n 348: astore 9\n 350: aload_2\n 351: aload_3\n 352: aload 7\n 354: invokestatic #144 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 357: invokestatic #147 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 360: aload 8\n 362: invokestatic #144 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 365: invokestatic #147 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 368: aload 9\n 370: invokestatic #144 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 373: invokestatic #147 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 376: invokeinterface #153, 5 // InterfaceMethod kotlin/jvm/functions/Function4.invoke:(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 381: pop\n 382: goto 74\n 385: aload_3\n 386: checkcast #85 // class java/lang/Iterable\n 389: astore 4\n 391: iconst_0\n 392: istore 5\n 394: aload 4\n 396: astore 6\n 398: new #46 // class java/util/ArrayList\n 401: dup\n 402: invokespecial #154 // Method java/util/ArrayList.\"<init>\":()V\n 405: checkcast #156 // class java/util/Collection\n 408: astore 7\n 410: iconst_0\n 411: istore 8\n 413: aload 6\n 415: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 420: astore 9\n 422: aload 9\n 424: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 429: ifeq 486\n 432: aload 9\n 434: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 439: astore 10\n 441: aload 10\n 443: checkcast #51 // class kotlin/collections/ArrayDeque\n 446: astore 11\n 448: iconst_0\n 449: istore 12\n 451: aload 11\n 453: checkcast #156 // class java/util/Collection\n 456: invokeinterface #159, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 461: ifne 468\n 464: iconst_1\n 465: goto 469\n 468: iconst_0\n 469: nop\n 470: ifeq 422\n 473: aload 7\n 475: aload 10\n 477: invokeinterface #160, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 482: pop\n 483: goto 422\n 486: aload 7\n 488: checkcast #59 // class java/util/List\n 491: nop\n 492: checkcast #85 // class java/lang/Iterable\n 495: astore 4\n 497: nop\n 498: iconst_0\n 499: istore 5\n 501: aload 4\n 503: astore 6\n 505: new #46 // class java/util/ArrayList\n 508: dup\n 509: aload 4\n 511: bipush 10\n 513: invokestatic #164 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 516: invokespecial #49 // Method java/util/ArrayList.\"<init>\":(I)V\n 519: checkcast #156 // class java/util/Collection\n 522: astore 7\n 524: iconst_0\n 525: istore 8\n 527: aload 6\n 529: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 534: astore 9\n 536: aload 9\n 538: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 543: ifeq 595\n 546: aload 9\n 548: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 553: astore 10\n 555: aload 7\n 557: aload 10\n 559: checkcast #51 // class kotlin/collections/ArrayDeque\n 562: astore 11\n 564: astore 18\n 566: iconst_0\n 567: istore 12\n 569: aload 11\n 571: invokevirtual #167 // Method kotlin/collections/ArrayDeque.first:()Ljava/lang/Object;\n 574: checkcast #97 // class java/lang/Character\n 577: invokevirtual #101 // Method java/lang/Character.charValue:()C\n 580: invokestatic #109 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 583: aload 18\n 585: swap\n 586: invokeinterface #160, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 591: pop\n 592: goto 536\n 595: aload 7\n 597: checkcast #59 // class java/util/List\n 600: nop\n 601: checkcast #85 // class java/lang/Iterable\n 604: ldc #169 // String\n 606: checkcast #77 // class java/lang/CharSequence\n 609: aconst_null\n 610: aconst_null\n 611: iconst_0\n 612: aconst_null\n 613: aconst_null\n 614: bipush 62\n 616: aconst_null\n 617: invokestatic #173 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 620: areturn\n\n private static final kotlin.Unit main$part1$lambda$6(java.util.List, int, int, int);\n Code:\n 0: aload_0\n 1: ldc #216 // String stacks\n 3: invokestatic #222 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore 4\n 9: iload 4\n 11: iload_1\n 12: if_icmpge 51\n 15: aload_0\n 16: iload_3\n 17: iconst_1\n 18: isub\n 19: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 24: checkcast #51 // class kotlin/collections/ArrayDeque\n 27: aload_0\n 28: iload_2\n 29: iconst_1\n 30: isub\n 31: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 36: checkcast #51 // class kotlin/collections/ArrayDeque\n 39: invokevirtual #225 // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;\n 42: invokevirtual #228 // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V\n 45: iinc 4, 1\n 48: goto 9\n 51: getstatic #234 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 54: areturn\n\n private static final java.lang.String main$part1(kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokedynamic #254, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function4;\n 7: invokestatic #256 // Method main$partX:(Lkotlin/text/Regex;Ljava/util/List;Lkotlin/jvm/functions/Function4;)Ljava/lang/String;\n 10: areturn\n\n private static final kotlin.Unit main$part2$lambda$7(java.util.List, int, int, int);\n Code:\n 0: aload_0\n 1: ldc #216 // String stacks\n 3: invokestatic #222 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #51 // class kotlin/collections/ArrayDeque\n 9: dup\n 10: invokespecial #53 // Method kotlin/collections/ArrayDeque.\"<init>\":()V\n 13: astore 4\n 15: iconst_0\n 16: istore 5\n 18: iload 5\n 20: iload_1\n 21: if_icmpge 51\n 24: aload 4\n 26: aload_0\n 27: iload_2\n 28: iconst_1\n 29: isub\n 30: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 35: checkcast #51 // class kotlin/collections/ArrayDeque\n 38: invokevirtual #225 // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;\n 41: invokevirtual #258 // Method kotlin/collections/ArrayDeque.add:(Ljava/lang/Object;)Z\n 44: pop\n 45: iinc 5, 1\n 48: goto 18\n 51: aload 4\n 53: checkcast #156 // class java/util/Collection\n 56: invokeinterface #159, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 61: ifne 68\n 64: iconst_1\n 65: goto 69\n 68: iconst_0\n 69: ifeq 95\n 72: aload_0\n 73: iload_3\n 74: iconst_1\n 75: isub\n 76: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 81: checkcast #51 // class kotlin/collections/ArrayDeque\n 84: aload 4\n 86: invokevirtual #261 // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;\n 89: invokevirtual #228 // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V\n 92: goto 51\n 95: getstatic #234 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 98: areturn\n\n private static final java.lang.String main$part2(kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokedynamic #267, 0 // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function4;\n 7: invokestatic #256 // Method main$partX:(Lkotlin/text/Regex;Ljava/util/List;Lkotlin/jvm/functions/Function4;)Ljava/lang/String;\n 10: areturn\n\n public static final java.lang.String access$main$part1(kotlin.text.Regex, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #270 // Method main$part1:(Lkotlin/text/Regex;Ljava/util/List;)Ljava/lang/String;\n 5: areturn\n\n public static final java.lang.String access$main$part2(kotlin.text.Regex, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #273 // Method main$part2:(Lkotlin/text/Regex;Ljava/util/List;)Ljava/lang/String;\n 5: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day05Kt$main$2.class", "javap": "Compiled from \"Day05.kt\"\nfinal class Day05Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.String> {\n final kotlin.text.Regex $inputLineRegex;\n\n Day05Kt$main$2(kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part2\n 11: ldc #19 // String main$part2(Lkotlin/text/Regex;Ljava/util/List;)Ljava/lang/String;\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.String invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 10: aload_1\n 11: invokestatic #41 // Method Day05Kt.access$main$part2:(Lkotlin/text/Regex;Ljava/util/List;)Ljava/lang/String;\n 14: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #45 // class java/util/List\n 5: invokevirtual #47 // Method invoke:(Ljava/util/List;)Ljava/lang/String;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day05Kt$main$1.class", "javap": "Compiled from \"Day05.kt\"\nfinal class Day05Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.String> {\n final kotlin.text.Regex $inputLineRegex;\n\n Day05Kt$main$1(kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part1\n 11: ldc #19 // String main$part1(Lkotlin/text/Regex;Ljava/util/List;)Ljava/lang/String;\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.String invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 10: aload_1\n 11: invokestatic #41 // Method Day05Kt.access$main$part1:(Lkotlin/text/Regex;Ljava/util/List;)Ljava/lang/String;\n 14: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #45 // class java/util/List\n 5: invokevirtual #47 // Method invoke:(Ljava/util/List;)Ljava/lang/String;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day15.kt
import kotlin.math.max import kotlin.math.min fun main() { fun parseData(input: List<String>): List<Triple<Vector2d, Vector2d, Int>> = input.map { line -> line.ints().let { val sensor = Vector2d(it[0], it[1]) val beacon = Vector2d(it[2], it[3]) val range = (sensor - beacon).manhattan() Triple(sensor, beacon, range) } } fun part1(input: List<String>): Long { val coverage = mutableSetOf<Vector2d>() val data = parseData(input) val xMin = data.minOf { (sensor, _, range) -> sensor.x - range } val xMax = data.maxOf { (sensor, _, range) -> sensor.x + range } val targetY = if (input.size < 15) 10 else 2000000 for (x in xMin..xMax) { for ((sensor, _, range) in data) { val candidate = Vector2d(x, targetY) if ((sensor - candidate).manhattan() <= range) coverage += candidate } } coverage -= data.map { (_, beacon, _) -> beacon }.toSet() coverage -= data.map { (sensor, _, _) -> sensor }.toSet() return coverage.size.toLong() } fun part2(input: List<String>): Long { val data = parseData(input) val bounds = mutableSetOf<Vector2d>() val maxBound = 4000000 for ((sensor, _, range) in data) { val boundRange = range + 1 var dx = 0 for (y in max(sensor.y - boundRange, 0)..min(sensor.y, maxBound)) { if (sensor.x + dx <= maxBound) bounds += Vector2d(sensor.x + dx, y) if (sensor.x - dx >= 0) bounds += Vector2d(sensor.x - dx, y) dx++ } dx-- for (y in max(sensor.y + 1, 0)..min(sensor.y + boundRange, maxBound)) { if (sensor.x + dx <= maxBound) bounds += Vector2d(sensor.x + dx, y) if (sensor.x - dx >= 0) bounds += Vector2d(sensor.x - dx, y) dx++ } } for (bound in bounds.filter { it.x in (0..maxBound) && it.y in (0..maxBound) }) { if (data.count { (sensor, _, range) -> (sensor - bound).manhattan() <= range } == 0) { return bound.x * 4000000L + bound.y } } return -1 } test( day = 15, testTarget1 = 26, testTarget2 = 56000011, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day15Kt.class", "javap": "Compiled from \"Day15.kt\"\npublic final class Day15Kt {\n public static final void main();\n Code:\n 0: bipush 15\n 2: ldc2_w #7 // long 26l\n 5: invokestatic #14 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 8: ldc2_w #15 // long 56000011l\n 11: invokestatic #14 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 14: getstatic #22 // Field Day15Kt$main$1.INSTANCE:LDay15Kt$main$1;\n 17: checkcast #24 // class kotlin/jvm/functions/Function1\n 20: getstatic #29 // Field Day15Kt$main$2.INSTANCE:LDay15Kt$main$2;\n 23: checkcast #24 // class kotlin/jvm/functions/Function1\n 26: invokestatic #35 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 29: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final java.util.List<kotlin.Triple<Vector2d, Vector2d, java.lang.Integer>> main$parseData(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #45 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: aload_1\n 8: astore_3\n 9: new #47 // class java/util/ArrayList\n 12: dup\n 13: aload_1\n 14: bipush 10\n 16: invokestatic #53 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 19: invokespecial #57 // Method java/util/ArrayList.\"<init>\":(I)V\n 22: checkcast #59 // class java/util/Collection\n 25: astore 4\n 27: iconst_0\n 28: istore 5\n 30: aload_3\n 31: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 36: astore 6\n 38: aload 6\n 40: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 45: ifeq 197\n 48: aload 6\n 50: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 55: astore 7\n 57: aload 4\n 59: aload 7\n 61: checkcast #75 // class java/lang/String\n 64: astore 8\n 66: astore 15\n 68: iconst_0\n 69: istore 9\n 71: aload 8\n 73: invokestatic #79 // Method UtilsKt.ints:(Ljava/lang/String;)Ljava/util/List;\n 76: astore 10\n 78: iconst_0\n 79: istore 11\n 81: new #81 // class Vector2d\n 84: dup\n 85: aload 10\n 87: iconst_0\n 88: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 93: checkcast #89 // class java/lang/Number\n 96: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 99: aload 10\n 101: iconst_1\n 102: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 107: checkcast #89 // class java/lang/Number\n 110: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 113: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 116: astore 12\n 118: new #81 // class Vector2d\n 121: dup\n 122: aload 10\n 124: iconst_2\n 125: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 130: checkcast #89 // class java/lang/Number\n 133: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 136: aload 10\n 138: iconst_3\n 139: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 144: checkcast #89 // class java/lang/Number\n 147: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 150: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 153: astore 13\n 155: aload 12\n 157: aload 13\n 159: invokevirtual #100 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 162: invokevirtual #103 // Method Vector2d.manhattan:()I\n 165: istore 14\n 167: new #105 // class kotlin/Triple\n 170: dup\n 171: aload 12\n 173: aload 13\n 175: iload 14\n 177: invokestatic #110 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 180: invokespecial #113 // Method kotlin/Triple.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V\n 183: nop\n 184: nop\n 185: aload 15\n 187: swap\n 188: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 193: pop\n 194: goto 38\n 197: aload 4\n 199: checkcast #83 // class java/util/List\n 202: nop\n 203: areturn\n\n private static final long main$part1(java.util.List<java.lang.String>);\n Code:\n 0: new #143 // class java/util/LinkedHashSet\n 3: dup\n 4: invokespecial #145 // Method java/util/LinkedHashSet.\"<init>\":()V\n 7: checkcast #147 // class java/util/Set\n 10: astore_1\n 11: aload_0\n 12: invokestatic #149 // Method main$parseData:(Ljava/util/List;)Ljava/util/List;\n 15: astore_2\n 16: aload_2\n 17: checkcast #45 // class java/lang/Iterable\n 20: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 25: astore 5\n 27: aload 5\n 29: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 34: ifne 45\n 37: new #151 // class java/util/NoSuchElementException\n 40: dup\n 41: invokespecial #152 // Method java/util/NoSuchElementException.\"<init>\":()V\n 44: athrow\n 45: aload 5\n 47: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 52: checkcast #105 // class kotlin/Triple\n 55: astore 6\n 57: iconst_0\n 58: istore 7\n 60: aload 6\n 62: invokevirtual #155 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 65: checkcast #81 // class Vector2d\n 68: astore 8\n 70: aload 6\n 72: invokevirtual #158 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 75: checkcast #89 // class java/lang/Number\n 78: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 81: istore 9\n 83: aload 8\n 85: invokevirtual #161 // Method Vector2d.getX:()I\n 88: iload 9\n 90: isub\n 91: istore 6\n 93: aload 5\n 95: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 100: ifeq 165\n 103: aload 5\n 105: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 110: checkcast #105 // class kotlin/Triple\n 113: astore 7\n 115: iconst_0\n 116: istore 8\n 118: aload 7\n 120: invokevirtual #155 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 123: checkcast #81 // class Vector2d\n 126: astore 9\n 128: aload 7\n 130: invokevirtual #158 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 133: checkcast #89 // class java/lang/Number\n 136: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 139: istore 10\n 141: aload 9\n 143: invokevirtual #161 // Method Vector2d.getX:()I\n 146: iload 10\n 148: isub\n 149: istore 7\n 151: iload 6\n 153: iload 7\n 155: if_icmple 93\n 158: iload 7\n 160: istore 6\n 162: goto 93\n 165: iload 6\n 167: istore_3\n 168: aload_2\n 169: checkcast #45 // class java/lang/Iterable\n 172: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 177: astore 6\n 179: aload 6\n 181: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 186: ifne 197\n 189: new #151 // class java/util/NoSuchElementException\n 192: dup\n 193: invokespecial #152 // Method java/util/NoSuchElementException.\"<init>\":()V\n 196: athrow\n 197: aload 6\n 199: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 204: checkcast #105 // class kotlin/Triple\n 207: astore 7\n 209: iconst_0\n 210: istore 8\n 212: aload 7\n 214: invokevirtual #155 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 217: checkcast #81 // class Vector2d\n 220: astore 9\n 222: aload 7\n 224: invokevirtual #158 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 227: checkcast #89 // class java/lang/Number\n 230: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 233: istore 10\n 235: aload 9\n 237: invokevirtual #161 // Method Vector2d.getX:()I\n 240: iload 10\n 242: iadd\n 243: istore 7\n 245: aload 6\n 247: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 252: ifeq 317\n 255: aload 6\n 257: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 262: checkcast #105 // class kotlin/Triple\n 265: astore 8\n 267: iconst_0\n 268: istore 9\n 270: aload 8\n 272: invokevirtual #155 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 275: checkcast #81 // class Vector2d\n 278: astore 10\n 280: aload 8\n 282: invokevirtual #158 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 285: checkcast #89 // class java/lang/Number\n 288: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 291: istore 11\n 293: aload 10\n 295: invokevirtual #161 // Method Vector2d.getX:()I\n 298: iload 11\n 300: iadd\n 301: istore 8\n 303: iload 7\n 305: iload 8\n 307: if_icmpge 245\n 310: iload 8\n 312: istore 7\n 314: goto 245\n 317: iload 7\n 319: istore 4\n 321: aload_0\n 322: invokeinterface #164, 1 // InterfaceMethod java/util/List.size:()I\n 327: bipush 15\n 329: if_icmpge 337\n 332: bipush 10\n 334: goto 339\n 337: ldc #165 // int 2000000\n 339: istore 5\n 341: iload_3\n 342: istore 6\n 344: iload 6\n 346: iload 4\n 348: if_icmpgt 460\n 351: aload_2\n 352: invokeinterface #166, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 357: astore 7\n 359: aload 7\n 361: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 366: ifeq 447\n 369: aload 7\n 371: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 376: checkcast #105 // class kotlin/Triple\n 379: astore 8\n 381: aload 8\n 383: invokevirtual #155 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 386: checkcast #81 // class Vector2d\n 389: astore 9\n 391: aload 8\n 393: invokevirtual #158 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 396: checkcast #89 // class java/lang/Number\n 399: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 402: istore 10\n 404: new #81 // class Vector2d\n 407: dup\n 408: iload 6\n 410: iload 5\n 412: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 415: astore 11\n 417: aload 9\n 419: aload 11\n 421: invokevirtual #100 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 424: invokevirtual #103 // Method Vector2d.manhattan:()I\n 427: iload 10\n 429: if_icmpgt 359\n 432: aload_1\n 433: checkcast #59 // class java/util/Collection\n 436: aload 11\n 438: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 443: pop\n 444: goto 359\n 447: iload 6\n 449: iload 4\n 451: if_icmpeq 460\n 454: iinc 6, 1\n 457: goto 351\n 460: aload_1\n 461: checkcast #59 // class java/util/Collection\n 464: astore 6\n 466: aload_2\n 467: checkcast #45 // class java/lang/Iterable\n 470: astore 7\n 472: iconst_0\n 473: istore 8\n 475: aload 7\n 477: astore 9\n 479: new #47 // class java/util/ArrayList\n 482: dup\n 483: aload 7\n 485: bipush 10\n 487: invokestatic #53 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 490: invokespecial #57 // Method java/util/ArrayList.\"<init>\":(I)V\n 493: checkcast #59 // class java/util/Collection\n 496: astore 10\n 498: iconst_0\n 499: istore 11\n 501: aload 9\n 503: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 508: astore 12\n 510: aload 12\n 512: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 517: ifeq 567\n 520: aload 12\n 522: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 527: astore 13\n 529: aload 10\n 531: aload 13\n 533: checkcast #105 // class kotlin/Triple\n 536: astore 14\n 538: astore 17\n 540: iconst_0\n 541: istore 15\n 543: aload 14\n 545: invokevirtual #169 // Method kotlin/Triple.component2:()Ljava/lang/Object;\n 548: checkcast #81 // class Vector2d\n 551: astore 16\n 553: aload 16\n 555: aload 17\n 557: swap\n 558: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 563: pop\n 564: goto 510\n 567: aload 10\n 569: checkcast #83 // class java/util/List\n 572: nop\n 573: checkcast #45 // class java/lang/Iterable\n 576: invokestatic #173 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 579: checkcast #45 // class java/lang/Iterable\n 582: aload 6\n 584: swap\n 585: invokestatic #177 // Method kotlin/collections/CollectionsKt.removeAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 588: pop\n 589: aload_1\n 590: checkcast #59 // class java/util/Collection\n 593: astore 6\n 595: aload_2\n 596: checkcast #45 // class java/lang/Iterable\n 599: astore 7\n 601: iconst_0\n 602: istore 8\n 604: aload 7\n 606: astore 9\n 608: new #47 // class java/util/ArrayList\n 611: dup\n 612: aload 7\n 614: bipush 10\n 616: invokestatic #53 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 619: invokespecial #57 // Method java/util/ArrayList.\"<init>\":(I)V\n 622: checkcast #59 // class java/util/Collection\n 625: astore 10\n 627: iconst_0\n 628: istore 11\n 630: aload 9\n 632: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 637: astore 12\n 639: aload 12\n 641: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 646: ifeq 696\n 649: aload 12\n 651: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 656: astore 13\n 658: aload 10\n 660: aload 13\n 662: checkcast #105 // class kotlin/Triple\n 665: astore 14\n 667: astore 17\n 669: iconst_0\n 670: istore 15\n 672: aload 14\n 674: invokevirtual #155 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 677: checkcast #81 // class Vector2d\n 680: astore 16\n 682: aload 16\n 684: aload 17\n 686: swap\n 687: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 692: pop\n 693: goto 639\n 696: aload 10\n 698: checkcast #83 // class java/util/List\n 701: nop\n 702: checkcast #45 // class java/lang/Iterable\n 705: invokestatic #173 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 708: checkcast #45 // class java/lang/Iterable\n 711: aload 6\n 713: swap\n 714: invokestatic #177 // Method kotlin/collections/CollectionsKt.removeAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 717: pop\n 718: aload_1\n 719: invokeinterface #178, 1 // InterfaceMethod java/util/Set.size:()I\n 724: i2l\n 725: lreturn\n\n private static final long main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #149 // Method main$parseData:(Ljava/util/List;)Ljava/util/List;\n 4: astore_1\n 5: new #143 // class java/util/LinkedHashSet\n 8: dup\n 9: invokespecial #145 // Method java/util/LinkedHashSet.\"<init>\":()V\n 12: checkcast #147 // class java/util/Set\n 15: astore_2\n 16: ldc #192 // int 4000000\n 18: istore_3\n 19: aload_1\n 20: invokeinterface #166, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 25: astore 4\n 27: aload 4\n 29: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 34: ifeq 336\n 37: aload 4\n 39: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 44: checkcast #105 // class kotlin/Triple\n 47: astore 5\n 49: aload 5\n 51: invokevirtual #155 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 54: checkcast #81 // class Vector2d\n 57: astore 6\n 59: aload 5\n 61: invokevirtual #158 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 64: checkcast #89 // class java/lang/Number\n 67: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 70: istore 7\n 72: iload 7\n 74: iconst_1\n 75: iadd\n 76: istore 8\n 78: iconst_0\n 79: istore 9\n 81: aload 6\n 83: invokevirtual #195 // Method Vector2d.getY:()I\n 86: iload 8\n 88: isub\n 89: iconst_0\n 90: invokestatic #201 // Method java/lang/Math.max:(II)I\n 93: istore 10\n 95: aload 6\n 97: invokevirtual #195 // Method Vector2d.getY:()I\n 100: iload_3\n 101: invokestatic #204 // Method java/lang/Math.min:(II)I\n 104: istore 11\n 106: iload 10\n 108: iload 11\n 110: if_icmpgt 206\n 113: aload 6\n 115: invokevirtual #161 // Method Vector2d.getX:()I\n 118: iload 9\n 120: iadd\n 121: iload_3\n 122: if_icmpgt 152\n 125: aload_2\n 126: checkcast #59 // class java/util/Collection\n 129: new #81 // class Vector2d\n 132: dup\n 133: aload 6\n 135: invokevirtual #161 // Method Vector2d.getX:()I\n 138: iload 9\n 140: iadd\n 141: iload 10\n 143: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 146: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 151: pop\n 152: aload 6\n 154: invokevirtual #161 // Method Vector2d.getX:()I\n 157: iload 9\n 159: isub\n 160: iflt 190\n 163: aload_2\n 164: checkcast #59 // class java/util/Collection\n 167: new #81 // class Vector2d\n 170: dup\n 171: aload 6\n 173: invokevirtual #161 // Method Vector2d.getX:()I\n 176: iload 9\n 178: isub\n 179: iload 10\n 181: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 184: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 189: pop\n 190: iinc 9, 1\n 193: iload 10\n 195: iload 11\n 197: if_icmpeq 206\n 200: iinc 10, 1\n 203: goto 113\n 206: iinc 9, -1\n 209: aload 6\n 211: invokevirtual #195 // Method Vector2d.getY:()I\n 214: iconst_1\n 215: iadd\n 216: iconst_0\n 217: invokestatic #201 // Method java/lang/Math.max:(II)I\n 220: istore 10\n 222: aload 6\n 224: invokevirtual #195 // Method Vector2d.getY:()I\n 227: iload 8\n 229: iadd\n 230: iload_3\n 231: invokestatic #204 // Method java/lang/Math.min:(II)I\n 234: istore 11\n 236: iload 10\n 238: iload 11\n 240: if_icmpgt 27\n 243: aload 6\n 245: invokevirtual #161 // Method Vector2d.getX:()I\n 248: iload 9\n 250: iadd\n 251: iload_3\n 252: if_icmpgt 282\n 255: aload_2\n 256: checkcast #59 // class java/util/Collection\n 259: new #81 // class Vector2d\n 262: dup\n 263: aload 6\n 265: invokevirtual #161 // Method Vector2d.getX:()I\n 268: iload 9\n 270: iadd\n 271: iload 10\n 273: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 276: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 281: pop\n 282: aload 6\n 284: invokevirtual #161 // Method Vector2d.getX:()I\n 287: iload 9\n 289: isub\n 290: iflt 320\n 293: aload_2\n 294: checkcast #59 // class java/util/Collection\n 297: new #81 // class Vector2d\n 300: dup\n 301: aload 6\n 303: invokevirtual #161 // Method Vector2d.getX:()I\n 306: iload 9\n 308: isub\n 309: iload 10\n 311: invokespecial #96 // Method Vector2d.\"<init>\":(II)V\n 314: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 319: pop\n 320: iinc 9, 1\n 323: iload 10\n 325: iload 11\n 327: if_icmpeq 27\n 330: iinc 10, 1\n 333: goto 243\n 336: aload_2\n 337: checkcast #45 // class java/lang/Iterable\n 340: astore 5\n 342: iconst_0\n 343: istore 6\n 345: aload 5\n 347: astore 7\n 349: new #47 // class java/util/ArrayList\n 352: dup\n 353: invokespecial #205 // Method java/util/ArrayList.\"<init>\":()V\n 356: checkcast #59 // class java/util/Collection\n 359: astore 8\n 361: iconst_0\n 362: istore 9\n 364: aload 7\n 366: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 371: astore 10\n 373: aload 10\n 375: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 380: ifeq 485\n 383: aload 10\n 385: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 390: astore 11\n 392: aload 11\n 394: checkcast #81 // class Vector2d\n 397: astore 12\n 399: iconst_0\n 400: istore 13\n 402: aload 12\n 404: invokevirtual #161 // Method Vector2d.getX:()I\n 407: istore 14\n 409: iconst_0\n 410: iload 14\n 412: if_icmpgt 429\n 415: iload 14\n 417: iload_3\n 418: if_icmpgt 425\n 421: iconst_1\n 422: goto 430\n 425: iconst_0\n 426: goto 430\n 429: iconst_0\n 430: ifeq 468\n 433: aload 12\n 435: invokevirtual #195 // Method Vector2d.getY:()I\n 438: istore 14\n 440: iconst_0\n 441: iload 14\n 443: if_icmpgt 460\n 446: iload 14\n 448: iload_3\n 449: if_icmpgt 456\n 452: iconst_1\n 453: goto 461\n 456: iconst_0\n 457: goto 461\n 460: iconst_0\n 461: ifeq 468\n 464: iconst_1\n 465: goto 469\n 468: iconst_0\n 469: ifeq 373\n 472: aload 8\n 474: aload 11\n 476: invokeinterface #117, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 481: pop\n 482: goto 373\n 485: aload 8\n 487: checkcast #83 // class java/util/List\n 490: nop\n 491: invokeinterface #166, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 496: astore 4\n 498: aload 4\n 500: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 505: ifeq 678\n 508: aload 4\n 510: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 515: checkcast #81 // class Vector2d\n 518: astore 5\n 520: aload_1\n 521: checkcast #45 // class java/lang/Iterable\n 524: astore 6\n 526: iconst_0\n 527: istore 7\n 529: aload 6\n 531: instanceof #59 // class java/util/Collection\n 534: ifeq 554\n 537: aload 6\n 539: checkcast #59 // class java/util/Collection\n 542: invokeinterface #208, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 547: ifeq 554\n 550: iconst_0\n 551: goto 657\n 554: iconst_0\n 555: istore 8\n 557: aload 6\n 559: invokeinterface #63, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 564: astore 9\n 566: aload 9\n 568: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 573: ifeq 655\n 576: aload 9\n 578: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 583: astore 10\n 585: aload 10\n 587: checkcast #105 // class kotlin/Triple\n 590: astore 11\n 592: iconst_0\n 593: istore 12\n 595: aload 11\n 597: invokevirtual #155 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 600: checkcast #81 // class Vector2d\n 603: astore 13\n 605: aload 11\n 607: invokevirtual #158 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 610: checkcast #89 // class java/lang/Number\n 613: invokevirtual #93 // Method java/lang/Number.intValue:()I\n 616: istore 14\n 618: aload 13\n 620: aload 5\n 622: invokevirtual #100 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 625: invokevirtual #103 // Method Vector2d.manhattan:()I\n 628: iload 14\n 630: if_icmpgt 637\n 633: iconst_1\n 634: goto 638\n 637: iconst_0\n 638: ifeq 566\n 641: iinc 8, 1\n 644: iload 8\n 646: ifge 566\n 649: invokestatic #211 // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V\n 652: goto 566\n 655: iload 8\n 657: ifne 498\n 660: aload 5\n 662: invokevirtual #161 // Method Vector2d.getX:()I\n 665: i2l\n 666: ldc2_w #212 // long 4000000l\n 669: lmul\n 670: aload 5\n 672: invokevirtual #195 // Method Vector2d.getY:()I\n 675: i2l\n 676: ladd\n 677: lreturn\n 678: ldc2_w #214 // long -1l\n 681: lreturn\n\n public static final long access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #235 // Method main$part1:(Ljava/util/List;)J\n 4: lreturn\n\n public static final long access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #238 // Method main$part2:(Ljava/util/List;)J\n 4: lreturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day15Kt$main$1.class", "javap": "Compiled from \"Day15.kt\"\nfinal class Day15Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n public static final Day15Kt$main$1 INSTANCE;\n\n Day15Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)J\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day15Kt.access$main$part1:(Ljava/util/List;)J\n 10: invokestatic #43 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day15Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay15Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day15Kt$main$2.class", "javap": "Compiled from \"Day15.kt\"\nfinal class Day15Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n public static final Day15Kt$main$2 INSTANCE;\n\n Day15Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)J\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day15Kt.access$main$part2:(Ljava/util/List;)J\n 10: invokestatic #43 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day15Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay15Kt$main$2;\n 10: return\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day17.kt
import kotlin.math.min fun main() { val blockShapes = """#### .#. ### .#. ..# ..# ### # # # # ## ##""" class Block(val points: List<Vector2d>) { fun move(vector2d: Vector2d) = points.forEach { it.increment(vector2d) } fun collides(other: Set<Vector2d>) = points.any { it in other } fun copy(): Block = Block(points.map { it.copy() }) } val blocks = blockShapes.lines().separateByBlank().asSequence() .map { it.map { line -> line.toCharArray().toList() } } .map { Grid(it) } .map { grid -> grid.data.flatten().filter { cell -> cell.value == '#' }.map { it.position } } .map { val dy = it.maxOf { point -> point.y } + 1 it.map { point -> point.increment(Vector2d(0, -dy)) } } .map { Block(it) } .toList() fun tetris(input: List<String>, blocksToFall: Int): Pair<Long, List<Int>> { val moves = input.first().toCharArray().map { if (it == '<') Vector2d.LEFT else Vector2d.RIGHT } val rightWall = 8 val settled = mutableSetOf<Vector2d>() val increments = mutableListOf<Int>() var currentTop = 0L var currentBlockIndex = 0 var currentMoveIndex = 0 var rocksFallen = blocksToFall while (rocksFallen-- != 0) { val block = blocks[currentBlockIndex++ % blocks.size].copy() block.move(Vector2d(3, currentTop.toInt() - 3)) // move to start position while (true) { val wind = moves[currentMoveIndex++ % moves.size] // first wind movement block.move(wind) if (block.collides(settled) || block.points.minOf { it.x } == 0 || block.points.maxOf { it.x } == rightWall ) block.move(wind.negative()) // move back block.move(Vector2d.DOWN) if (block.collides(settled) || block.points.minOf { it.y } == 0) { // block settles block.move(Vector2d.UP) // move back settled.addAll(block.points) val newCurrentTop = min(currentTop, block.points.minOf { it.y }.toLong()) increments.add((currentTop - newCurrentTop).toInt()) currentTop = newCurrentTop break } } } return Pair(-currentTop, increments) } fun part1(input: List<String>) = tetris(input, 2022).first fun part2(input: List<String>): Long { val (_, increments) = tetris(input, 8000) val bestSequence = increments.findLongestSequence() val iters = 1000000000000L val sequenceHeight = increments.subList(bestSequence.first, bestSequence.first + bestSequence.second).sum() var height = increments.subList(0, bestSequence.first).sum().toLong() var itersLeft = iters - bestSequence.first val sequencesLeft = itersLeft / bestSequence.second height += sequencesLeft * sequenceHeight itersLeft -= sequencesLeft * bestSequence.second height += increments.subList(bestSequence.first, bestSequence.first + itersLeft.toInt()).sum() return height } test( day = 17, testTarget1 = 3068L, testTarget2 = 1514285714288L, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day17Kt$main$Block.class", "javap": "Compiled from \"Day17.kt\"\npublic final class Day17Kt$main$Block {\n private final java.util.List<Vector2d> points;\n\n public Day17Kt$main$Block(java.util.List<Vector2d>);\n Code:\n 0: aload_1\n 1: ldc #9 // String points\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokespecial #18 // Method java/lang/Object.\"<init>\":()V\n 10: aload_0\n 11: aload_1\n 12: putfield #21 // Field points:Ljava/util/List;\n 15: return\n\n public final java.util.List<Vector2d> getPoints();\n Code:\n 0: aload_0\n 1: getfield #21 // Field points:Ljava/util/List;\n 4: areturn\n\n public final void move(Vector2d);\n Code:\n 0: aload_1\n 1: ldc #30 // String vector2d\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #21 // Field points:Ljava/util/List;\n 10: checkcast #32 // class java/lang/Iterable\n 13: astore_2\n 14: iconst_0\n 15: istore_3\n 16: aload_2\n 17: invokeinterface #36, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 22: astore 4\n 24: aload 4\n 26: invokeinterface #42, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 31: ifeq 64\n 34: aload 4\n 36: invokeinterface #46, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 41: astore 5\n 43: aload 5\n 45: checkcast #48 // class Vector2d\n 48: astore 6\n 50: iconst_0\n 51: istore 7\n 53: aload 6\n 55: aload_1\n 56: invokevirtual #52 // Method Vector2d.increment:(LVector2d;)LVector2d;\n 59: pop\n 60: nop\n 61: goto 24\n 64: nop\n 65: return\n\n public final boolean collides(java.util.Set<Vector2d>);\n Code:\n 0: aload_1\n 1: ldc #66 // String other\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #21 // Field points:Ljava/util/List;\n 10: checkcast #32 // class java/lang/Iterable\n 13: astore_2\n 14: iconst_0\n 15: istore_3\n 16: aload_2\n 17: instanceof #68 // class java/util/Collection\n 20: ifeq 39\n 23: aload_2\n 24: checkcast #68 // class java/util/Collection\n 27: invokeinterface #71, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 32: ifeq 39\n 35: iconst_0\n 36: goto 92\n 39: aload_2\n 40: invokeinterface #36, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 45: astore 4\n 47: aload 4\n 49: invokeinterface #42, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 54: ifeq 91\n 57: aload 4\n 59: invokeinterface #46, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 64: astore 5\n 66: aload 5\n 68: checkcast #48 // class Vector2d\n 71: astore 6\n 73: iconst_0\n 74: istore 7\n 76: aload_1\n 77: aload 6\n 79: invokeinterface #77, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 84: ifeq 47\n 87: iconst_1\n 88: goto 92\n 91: iconst_0\n 92: ireturn\n\n public final Day17Kt$main$Block copy();\n Code:\n 0: aload_0\n 1: getfield #21 // Field points:Ljava/util/List;\n 4: checkcast #32 // class java/lang/Iterable\n 7: astore_1\n 8: iconst_0\n 9: istore_2\n 10: aload_1\n 11: astore_3\n 12: new #85 // class java/util/ArrayList\n 15: dup\n 16: aload_1\n 17: bipush 10\n 19: invokestatic #91 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 22: invokespecial #94 // Method java/util/ArrayList.\"<init>\":(I)V\n 25: checkcast #68 // class java/util/Collection\n 28: astore 4\n 30: iconst_0\n 31: istore 5\n 33: aload_3\n 34: invokeinterface #36, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 39: astore 6\n 41: aload 6\n 43: invokeinterface #42, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 48: ifeq 95\n 51: aload 6\n 53: invokeinterface #46, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 58: astore 7\n 60: aload 4\n 62: aload 7\n 64: checkcast #48 // class Vector2d\n 67: astore 8\n 69: astore 10\n 71: iconst_0\n 72: istore 9\n 74: aload 8\n 76: iconst_0\n 77: iconst_0\n 78: iconst_3\n 79: aconst_null\n 80: invokestatic #98 // Method Vector2d.copy$default:(LVector2d;IIILjava/lang/Object;)LVector2d;\n 83: aload 10\n 85: swap\n 86: invokeinterface #101, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 91: pop\n 92: goto 41\n 95: aload 4\n 97: checkcast #103 // class java/util/List\n 100: nop\n 101: astore 11\n 103: new #2 // class Day17Kt$main$Block\n 106: dup\n 107: aload 11\n 109: invokespecial #105 // Method \"<init>\":(Ljava/util/List;)V\n 112: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day17Kt.class", "javap": "Compiled from \"Day17.kt\"\npublic final class Day17Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String ####\\n\\n.#.\\n###\\n.#.\\n\\n..#\\n..#\\n###\\n\\n#\\n#\\n#\\n#\\n\\n##\\n##\n 2: astore_0\n 3: aload_0\n 4: checkcast #10 // class java/lang/CharSequence\n 7: invokestatic #16 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;\n 10: invokestatic #22 // Method UtilsKt.separateByBlank:(Ljava/util/List;)Ljava/util/List;\n 13: checkcast #24 // class java/lang/Iterable\n 16: invokestatic #30 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;\n 19: invokedynamic #48, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 24: invokestatic #54 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 27: invokedynamic #61, 0 // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;\n 32: invokestatic #54 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 35: invokedynamic #68, 0 // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;\n 40: invokestatic #54 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 43: invokedynamic #73, 0 // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;\n 48: invokestatic #54 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 51: invokedynamic #80, 0 // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;\n 56: invokestatic #54 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 59: invokestatic #84 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 62: astore_1\n 63: bipush 17\n 65: ldc2_w #85 // long 3068l\n 68: invokestatic #92 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 71: ldc2_w #93 // long 1514285714288l\n 74: invokestatic #92 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 77: new #96 // class Day17Kt$main$1\n 80: dup\n 81: aload_1\n 82: invokespecial #100 // Method Day17Kt$main$1.\"<init>\":(Ljava/util/List;)V\n 85: checkcast #102 // class kotlin/jvm/functions/Function1\n 88: new #104 // class Day17Kt$main$2\n 91: dup\n 92: aload_1\n 93: invokespecial #105 // Method Day17Kt$main$2.\"<init>\":(Ljava/util/List;)V\n 96: checkcast #102 // class kotlin/jvm/functions/Function1\n 99: invokestatic #109 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 102: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #116 // Method main:()V\n 3: return\n\n private static final java.util.List main$lambda$1(java.util.List);\n Code:\n 0: aload_0\n 1: ldc #120 // String it\n 3: invokestatic #126 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #24 // class java/lang/Iterable\n 10: astore_1\n 11: iconst_0\n 12: istore_2\n 13: aload_1\n 14: astore_3\n 15: new #128 // class java/util/ArrayList\n 18: dup\n 19: aload_1\n 20: bipush 10\n 22: invokestatic #132 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 25: invokespecial #135 // Method java/util/ArrayList.\"<init>\":(I)V\n 28: checkcast #137 // class java/util/Collection\n 31: astore 4\n 33: iconst_0\n 34: istore 5\n 36: aload_3\n 37: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 42: astore 6\n 44: aload 6\n 46: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 103\n 54: aload 6\n 56: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 61: astore 7\n 63: aload 4\n 65: aload 7\n 67: checkcast #153 // class java/lang/String\n 70: astore 8\n 72: astore 10\n 74: iconst_0\n 75: istore 9\n 77: aload 8\n 79: invokevirtual #157 // Method java/lang/String.toCharArray:()[C\n 82: dup\n 83: ldc #159 // String toCharArray(...)\n 85: invokestatic #162 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 88: invokestatic #167 // Method kotlin/collections/ArraysKt.toList:([C)Ljava/util/List;\n 91: aload 10\n 93: swap\n 94: invokeinterface #171, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 99: pop\n 100: goto 44\n 103: aload 4\n 105: checkcast #173 // class java/util/List\n 108: nop\n 109: areturn\n\n private static final Grid main$lambda$2(java.util.List);\n Code:\n 0: aload_0\n 1: ldc #120 // String it\n 3: invokestatic #126 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #187 // class Grid\n 9: dup\n 10: aload_0\n 11: invokespecial #188 // Method Grid.\"<init>\":(Ljava/util/List;)V\n 14: areturn\n\n private static final java.util.List main$lambda$5(Grid);\n Code:\n 0: aload_0\n 1: ldc #190 // String grid\n 3: invokestatic #126 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #194 // Method Grid.getData:()Ljava/util/List;\n 10: checkcast #24 // class java/lang/Iterable\n 13: invokestatic #198 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 16: checkcast #24 // class java/lang/Iterable\n 19: astore_1\n 20: iconst_0\n 21: istore_2\n 22: aload_1\n 23: astore_3\n 24: new #128 // class java/util/ArrayList\n 27: dup\n 28: invokespecial #200 // Method java/util/ArrayList.\"<init>\":()V\n 31: checkcast #137 // class java/util/Collection\n 34: astore 4\n 36: iconst_0\n 37: istore 5\n 39: aload_3\n 40: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 45: astore 6\n 47: aload 6\n 49: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 54: ifeq 113\n 57: aload 6\n 59: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 64: astore 7\n 66: aload 7\n 68: checkcast #202 // class GridCell\n 71: astore 8\n 73: iconst_0\n 74: istore 9\n 76: aload 8\n 78: invokevirtual #205 // Method GridCell.getValue:()Ljava/lang/Object;\n 81: checkcast #207 // class java/lang/Character\n 84: invokevirtual #211 // Method java/lang/Character.charValue:()C\n 87: bipush 35\n 89: if_icmpne 96\n 92: iconst_1\n 93: goto 97\n 96: iconst_0\n 97: ifeq 47\n 100: aload 4\n 102: aload 7\n 104: invokeinterface #171, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 109: pop\n 110: goto 47\n 113: aload 4\n 115: checkcast #173 // class java/util/List\n 118: nop\n 119: checkcast #24 // class java/lang/Iterable\n 122: astore_1\n 123: nop\n 124: iconst_0\n 125: istore_2\n 126: aload_1\n 127: astore_3\n 128: new #128 // class java/util/ArrayList\n 131: dup\n 132: aload_1\n 133: bipush 10\n 135: invokestatic #132 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 138: invokespecial #135 // Method java/util/ArrayList.\"<init>\":(I)V\n 141: checkcast #137 // class java/util/Collection\n 144: astore 4\n 146: iconst_0\n 147: istore 5\n 149: aload_3\n 150: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 155: astore 6\n 157: aload 6\n 159: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 164: ifeq 207\n 167: aload 6\n 169: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 174: astore 7\n 176: aload 4\n 178: aload 7\n 180: checkcast #202 // class GridCell\n 183: astore 8\n 185: astore 10\n 187: iconst_0\n 188: istore 9\n 190: aload 8\n 192: invokevirtual #215 // Method GridCell.getPosition:()LVector2d;\n 195: aload 10\n 197: swap\n 198: invokeinterface #171, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 203: pop\n 204: goto 157\n 207: aload 4\n 209: checkcast #173 // class java/util/List\n 212: nop\n 213: areturn\n\n private static final java.util.List main$lambda$8(java.util.List);\n Code:\n 0: aload_0\n 1: ldc #120 // String it\n 3: invokestatic #126 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #24 // class java/lang/Iterable\n 10: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 15: astore_3\n 16: aload_3\n 17: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 22: ifne 33\n 25: new #227 // class java/util/NoSuchElementException\n 28: dup\n 29: invokespecial #228 // Method java/util/NoSuchElementException.\"<init>\":()V\n 32: athrow\n 33: aload_3\n 34: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 39: checkcast #230 // class Vector2d\n 42: astore 4\n 44: iconst_0\n 45: istore 5\n 47: aload 4\n 49: invokevirtual #234 // Method Vector2d.getY:()I\n 52: istore 4\n 54: aload_3\n 55: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 60: ifeq 98\n 63: aload_3\n 64: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 69: checkcast #230 // class Vector2d\n 72: astore 5\n 74: iconst_0\n 75: istore 6\n 77: aload 5\n 79: invokevirtual #234 // Method Vector2d.getY:()I\n 82: istore 5\n 84: iload 4\n 86: iload 5\n 88: if_icmpge 54\n 91: iload 5\n 93: istore 4\n 95: goto 54\n 98: iload 4\n 100: iconst_1\n 101: iadd\n 102: istore_1\n 103: aload_0\n 104: checkcast #24 // class java/lang/Iterable\n 107: astore_2\n 108: iconst_0\n 109: istore_3\n 110: aload_2\n 111: astore 4\n 113: new #128 // class java/util/ArrayList\n 116: dup\n 117: aload_2\n 118: bipush 10\n 120: invokestatic #132 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 123: invokespecial #135 // Method java/util/ArrayList.\"<init>\":(I)V\n 126: checkcast #137 // class java/util/Collection\n 129: astore 5\n 131: iconst_0\n 132: istore 6\n 134: aload 4\n 136: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 141: astore 7\n 143: aload 7\n 145: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 150: ifeq 203\n 153: aload 7\n 155: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 160: astore 8\n 162: aload 5\n 164: aload 8\n 166: checkcast #230 // class Vector2d\n 169: astore 9\n 171: astore 11\n 173: iconst_0\n 174: istore 10\n 176: aload 9\n 178: new #230 // class Vector2d\n 181: dup\n 182: iconst_0\n 183: iload_1\n 184: ineg\n 185: invokespecial #237 // Method Vector2d.\"<init>\":(II)V\n 188: invokevirtual #241 // Method Vector2d.increment:(LVector2d;)LVector2d;\n 191: aload 11\n 193: swap\n 194: invokeinterface #171, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 199: pop\n 200: goto 143\n 203: aload 5\n 205: checkcast #173 // class java/util/List\n 208: nop\n 209: areturn\n\n private static final Day17Kt$main$Block main$lambda$9(java.util.List);\n Code:\n 0: aload_0\n 1: ldc #120 // String it\n 3: invokestatic #126 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #248 // class Day17Kt$main$Block\n 9: dup\n 10: aload_0\n 11: invokespecial #249 // Method Day17Kt$main$Block.\"<init>\":(Ljava/util/List;)V\n 14: areturn\n\n private static final kotlin.Pair<java.lang.Long, java.util.List<java.lang.Integer>> main$tetris(java.util.List<Day17Kt$main$Block>, java.util.List<java.lang.String>, int);\n Code:\n 0: aload_1\n 1: invokestatic #256 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 4: checkcast #153 // class java/lang/String\n 7: invokevirtual #157 // Method java/lang/String.toCharArray:()[C\n 10: dup\n 11: ldc #159 // String toCharArray(...)\n 13: invokestatic #162 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 16: astore 4\n 18: nop\n 19: iconst_0\n 20: istore 5\n 22: aload 4\n 24: astore 6\n 26: new #128 // class java/util/ArrayList\n 29: dup\n 30: aload 4\n 32: arraylength\n 33: invokespecial #135 // Method java/util/ArrayList.\"<init>\":(I)V\n 36: checkcast #137 // class java/util/Collection\n 39: astore 7\n 41: iconst_0\n 42: istore 8\n 44: iconst_0\n 45: istore 9\n 47: aload 6\n 49: arraylength\n 50: istore 10\n 52: iload 9\n 54: iload 10\n 56: if_icmpge 114\n 59: aload 6\n 61: iload 9\n 63: caload\n 64: istore 11\n 66: aload 7\n 68: iload 11\n 70: istore 12\n 72: astore 21\n 74: iconst_0\n 75: istore 13\n 77: iload 12\n 79: bipush 60\n 81: if_icmpne 93\n 84: getstatic #260 // Field Vector2d.Companion:LVector2d$Companion;\n 87: invokevirtual #265 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 90: goto 99\n 93: getstatic #260 // Field Vector2d.Companion:LVector2d$Companion;\n 96: invokevirtual #268 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 99: aload 21\n 101: swap\n 102: invokeinterface #171, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 107: pop\n 108: iinc 9, 1\n 111: goto 52\n 114: aload 7\n 116: checkcast #173 // class java/util/List\n 119: nop\n 120: astore_3\n 121: bipush 8\n 123: istore 4\n 125: new #270 // class java/util/LinkedHashSet\n 128: dup\n 129: invokespecial #271 // Method java/util/LinkedHashSet.\"<init>\":()V\n 132: checkcast #273 // class java/util/Set\n 135: astore 5\n 137: new #128 // class java/util/ArrayList\n 140: dup\n 141: invokespecial #200 // Method java/util/ArrayList.\"<init>\":()V\n 144: checkcast #173 // class java/util/List\n 147: astore 6\n 149: lconst_0\n 150: lstore 7\n 152: iconst_0\n 153: istore 9\n 155: iconst_0\n 156: istore 10\n 158: iload_2\n 159: istore 11\n 161: iload 11\n 163: iinc 11, -1\n 166: ifeq 771\n 169: aload_0\n 170: iload 9\n 172: iinc 9, 1\n 175: aload_0\n 176: invokeinterface #276, 1 // InterfaceMethod java/util/List.size:()I\n 181: irem\n 182: invokeinterface #280, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 187: checkcast #248 // class Day17Kt$main$Block\n 190: invokevirtual #284 // Method Day17Kt$main$Block.copy:()LDay17Kt$main$Block;\n 193: astore 12\n 195: aload 12\n 197: new #230 // class Vector2d\n 200: dup\n 201: iconst_3\n 202: lload 7\n 204: l2i\n 205: iconst_3\n 206: isub\n 207: invokespecial #237 // Method Vector2d.\"<init>\":(II)V\n 210: invokevirtual #288 // Method Day17Kt$main$Block.move:(LVector2d;)V\n 213: nop\n 214: aload_3\n 215: iload 10\n 217: iinc 10, 1\n 220: aload_3\n 221: invokeinterface #276, 1 // InterfaceMethod java/util/List.size:()I\n 226: irem\n 227: invokeinterface #280, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 232: checkcast #230 // class Vector2d\n 235: astore 13\n 237: aload 12\n 239: aload 13\n 241: invokevirtual #288 // Method Day17Kt$main$Block.move:(LVector2d;)V\n 244: aload 12\n 246: aload 5\n 248: invokevirtual #292 // Method Day17Kt$main$Block.collides:(Ljava/util/Set;)Z\n 251: ifne 468\n 254: aload 12\n 256: invokevirtual #295 // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;\n 259: checkcast #24 // class java/lang/Iterable\n 262: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 267: astore 15\n 269: aload 15\n 271: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 276: ifne 287\n 279: new #227 // class java/util/NoSuchElementException\n 282: dup\n 283: invokespecial #228 // Method java/util/NoSuchElementException.\"<init>\":()V\n 286: athrow\n 287: aload 15\n 289: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 294: checkcast #230 // class Vector2d\n 297: astore 16\n 299: iconst_0\n 300: istore 17\n 302: aload 16\n 304: invokevirtual #298 // Method Vector2d.getX:()I\n 307: istore 16\n 309: aload 15\n 311: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 316: ifeq 355\n 319: aload 15\n 321: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 326: checkcast #230 // class Vector2d\n 329: astore 17\n 331: iconst_0\n 332: istore 18\n 334: aload 17\n 336: invokevirtual #298 // Method Vector2d.getX:()I\n 339: istore 17\n 341: iload 16\n 343: iload 17\n 345: if_icmple 309\n 348: iload 17\n 350: istore 16\n 352: goto 309\n 355: iload 16\n 357: ifeq 468\n 360: aload 12\n 362: invokevirtual #295 // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;\n 365: checkcast #24 // class java/lang/Iterable\n 368: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 373: astore 15\n 375: aload 15\n 377: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 382: ifne 393\n 385: new #227 // class java/util/NoSuchElementException\n 388: dup\n 389: invokespecial #228 // Method java/util/NoSuchElementException.\"<init>\":()V\n 392: athrow\n 393: aload 15\n 395: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 400: checkcast #230 // class Vector2d\n 403: astore 16\n 405: iconst_0\n 406: istore 17\n 408: aload 16\n 410: invokevirtual #298 // Method Vector2d.getX:()I\n 413: istore 16\n 415: aload 15\n 417: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 422: ifeq 461\n 425: aload 15\n 427: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 432: checkcast #230 // class Vector2d\n 435: astore 17\n 437: iconst_0\n 438: istore 18\n 440: aload 17\n 442: invokevirtual #298 // Method Vector2d.getX:()I\n 445: istore 17\n 447: iload 16\n 449: iload 17\n 451: if_icmpge 415\n 454: iload 17\n 456: istore 16\n 458: goto 415\n 461: iload 16\n 463: iload 4\n 465: if_icmpne 478\n 468: aload 12\n 470: aload 13\n 472: invokevirtual #301 // Method Vector2d.negative:()LVector2d;\n 475: invokevirtual #288 // Method Day17Kt$main$Block.move:(LVector2d;)V\n 478: aload 12\n 480: getstatic #260 // Field Vector2d.Companion:LVector2d$Companion;\n 483: invokevirtual #304 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 486: invokevirtual #288 // Method Day17Kt$main$Block.move:(LVector2d;)V\n 489: aload 12\n 491: aload 5\n 493: invokevirtual #292 // Method Day17Kt$main$Block.collides:(Ljava/util/Set;)Z\n 496: ifne 605\n 499: aload 12\n 501: invokevirtual #295 // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;\n 504: checkcast #24 // class java/lang/Iterable\n 507: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 512: astore 15\n 514: aload 15\n 516: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 521: ifne 532\n 524: new #227 // class java/util/NoSuchElementException\n 527: dup\n 528: invokespecial #228 // Method java/util/NoSuchElementException.\"<init>\":()V\n 531: athrow\n 532: aload 15\n 534: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 539: checkcast #230 // class Vector2d\n 542: astore 16\n 544: iconst_0\n 545: istore 17\n 547: aload 16\n 549: invokevirtual #234 // Method Vector2d.getY:()I\n 552: istore 16\n 554: aload 15\n 556: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 561: ifeq 600\n 564: aload 15\n 566: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 571: checkcast #230 // class Vector2d\n 574: astore 17\n 576: iconst_0\n 577: istore 18\n 579: aload 17\n 581: invokevirtual #234 // Method Vector2d.getY:()I\n 584: istore 17\n 586: iload 16\n 588: iload 17\n 590: if_icmple 554\n 593: iload 17\n 595: istore 16\n 597: goto 554\n 600: iload 16\n 602: ifne 213\n 605: aload 12\n 607: getstatic #260 // Field Vector2d.Companion:LVector2d$Companion;\n 610: invokevirtual #307 // Method Vector2d$Companion.getUP:()LVector2d;\n 613: invokevirtual #288 // Method Day17Kt$main$Block.move:(LVector2d;)V\n 616: aload 5\n 618: aload 12\n 620: invokevirtual #295 // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;\n 623: checkcast #137 // class java/util/Collection\n 626: invokeinterface #311, 2 // InterfaceMethod java/util/Set.addAll:(Ljava/util/Collection;)Z\n 631: pop\n 632: aload 12\n 634: invokevirtual #295 // Method Day17Kt$main$Block.getPoints:()Ljava/util/List;\n 637: checkcast #24 // class java/lang/Iterable\n 640: invokeinterface #141, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 645: astore 17\n 647: aload 17\n 649: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 654: ifne 665\n 657: new #227 // class java/util/NoSuchElementException\n 660: dup\n 661: invokespecial #228 // Method java/util/NoSuchElementException.\"<init>\":()V\n 664: athrow\n 665: aload 17\n 667: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 672: checkcast #230 // class Vector2d\n 675: astore 18\n 677: iconst_0\n 678: istore 19\n 680: aload 18\n 682: invokevirtual #234 // Method Vector2d.getY:()I\n 685: istore 18\n 687: aload 17\n 689: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 694: ifeq 733\n 697: aload 17\n 699: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 704: checkcast #230 // class Vector2d\n 707: astore 19\n 709: iconst_0\n 710: istore 20\n 712: aload 19\n 714: invokevirtual #234 // Method Vector2d.getY:()I\n 717: istore 19\n 719: iload 18\n 721: iload 19\n 723: if_icmple 687\n 726: iload 19\n 728: istore 18\n 730: goto 687\n 733: iload 18\n 735: i2l\n 736: lstore 16\n 738: lload 7\n 740: lload 16\n 742: invokestatic #317 // Method java/lang/Math.min:(JJ)J\n 745: lstore 14\n 747: aload 6\n 749: lload 7\n 751: lload 14\n 753: lsub\n 754: l2i\n 755: invokestatic #322 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 758: invokeinterface #323, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 763: pop\n 764: lload 14\n 766: lstore 7\n 768: goto 161\n 771: new #325 // class kotlin/Pair\n 774: dup\n 775: lload 7\n 777: lneg\n 778: invokestatic #92 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 781: aload 6\n 783: invokespecial #328 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 786: areturn\n\n private static final long main$part1(java.util.List<Day17Kt$main$Block>, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: sipush 2022\n 5: invokestatic #357 // Method main$tetris:(Ljava/util/List;Ljava/util/List;I)Lkotlin/Pair;\n 8: invokevirtual #360 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 11: checkcast #362 // class java/lang/Number\n 14: invokevirtual #366 // Method java/lang/Number.longValue:()J\n 17: lreturn\n\n private static final long main$part2(java.util.List<Day17Kt$main$Block>, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: sipush 8000\n 5: invokestatic #357 // Method main$tetris:(Ljava/util/List;Ljava/util/List;I)Lkotlin/Pair;\n 8: invokevirtual #370 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 11: checkcast #173 // class java/util/List\n 14: astore_2\n 15: aload_2\n 16: invokestatic #374 // Method UtilsKt.findLongestSequence:(Ljava/util/List;)Lkotlin/Pair;\n 19: astore_3\n 20: ldc2_w #375 // long 1000000000000l\n 23: lstore 4\n 25: aload_2\n 26: aload_3\n 27: invokevirtual #360 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 30: checkcast #362 // class java/lang/Number\n 33: invokevirtual #379 // Method java/lang/Number.intValue:()I\n 36: aload_3\n 37: invokevirtual #360 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 40: checkcast #362 // class java/lang/Number\n 43: invokevirtual #379 // Method java/lang/Number.intValue:()I\n 46: aload_3\n 47: invokevirtual #382 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 50: checkcast #362 // class java/lang/Number\n 53: invokevirtual #379 // Method java/lang/Number.intValue:()I\n 56: iadd\n 57: invokeinterface #386, 3 // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;\n 62: checkcast #24 // class java/lang/Iterable\n 65: invokestatic #390 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I\n 68: istore 6\n 70: aload_2\n 71: iconst_0\n 72: aload_3\n 73: invokevirtual #360 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 76: checkcast #362 // class java/lang/Number\n 79: invokevirtual #379 // Method java/lang/Number.intValue:()I\n 82: invokeinterface #386, 3 // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;\n 87: checkcast #24 // class java/lang/Iterable\n 90: invokestatic #390 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I\n 93: i2l\n 94: lstore 7\n 96: lload 4\n 98: aload_3\n 99: invokevirtual #360 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 102: checkcast #362 // class java/lang/Number\n 105: invokevirtual #366 // Method java/lang/Number.longValue:()J\n 108: lsub\n 109: lstore 9\n 111: lload 9\n 113: aload_3\n 114: invokevirtual #382 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 117: checkcast #362 // class java/lang/Number\n 120: invokevirtual #366 // Method java/lang/Number.longValue:()J\n 123: ldiv\n 124: lstore 11\n 126: lload 7\n 128: lload 11\n 130: iload 6\n 132: i2l\n 133: lmul\n 134: ladd\n 135: lstore 7\n 137: lload 9\n 139: lload 11\n 141: aload_3\n 142: invokevirtual #382 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 145: checkcast #362 // class java/lang/Number\n 148: invokevirtual #366 // Method java/lang/Number.longValue:()J\n 151: lmul\n 152: lsub\n 153: lstore 9\n 155: lload 7\n 157: aload_2\n 158: aload_3\n 159: invokevirtual #360 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 162: checkcast #362 // class java/lang/Number\n 165: invokevirtual #379 // Method java/lang/Number.intValue:()I\n 168: aload_3\n 169: invokevirtual #360 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 172: checkcast #362 // class java/lang/Number\n 175: invokevirtual #379 // Method java/lang/Number.intValue:()I\n 178: lload 9\n 180: l2i\n 181: iadd\n 182: invokeinterface #386, 3 // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;\n 187: checkcast #24 // class java/lang/Iterable\n 190: invokestatic #390 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I\n 193: i2l\n 194: ladd\n 195: lstore 7\n 197: lload 7\n 199: lreturn\n\n public static final long access$main$part1(java.util.List, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #400 // Method main$part1:(Ljava/util/List;Ljava/util/List;)J\n 5: lreturn\n\n public static final long access$main$part2(java.util.List, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #403 // Method main$part2:(Ljava/util/List;Ljava/util/List;)J\n 5: lreturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day17Kt$main$2.class", "javap": "Compiled from \"Day17.kt\"\nfinal class Day17Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n final java.util.List<Day17Kt$main$Block> $blocks;\n\n Day17Kt$main$2(java.util.List<Day17Kt$main$Block>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #14 // Field $blocks:Ljava/util/List;\n 5: aload_0\n 6: iconst_1\n 7: ldc #16 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #18 // String part2\n 11: ldc #20 // String main$part2(Ljava/util/List;Ljava/util/List;)J\n 13: iconst_0\n 14: invokespecial #23 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #30 // String p0\n 3: invokestatic #36 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #14 // Field $blocks:Ljava/util/List;\n 10: aload_1\n 11: invokestatic #42 // Method Day17Kt.access$main$part2:(Ljava/util/List;Ljava/util/List;)J\n 14: invokestatic #48 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day17Kt$main$1.class", "javap": "Compiled from \"Day17.kt\"\nfinal class Day17Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n final java.util.List<Day17Kt$main$Block> $blocks;\n\n Day17Kt$main$1(java.util.List<Day17Kt$main$Block>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #14 // Field $blocks:Ljava/util/List;\n 5: aload_0\n 6: iconst_1\n 7: ldc #16 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #18 // String part1\n 11: ldc #20 // String main$part1(Ljava/util/List;Ljava/util/List;)J\n 13: iconst_0\n 14: invokespecial #23 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #30 // String p0\n 3: invokestatic #36 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #14 // Field $blocks:Ljava/util/List;\n 10: aload_1\n 11: invokestatic #42 // Method Day17Kt.access$main$part1:(Ljava/util/List;Ljava/util/List;)J\n 14: invokestatic #48 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day16.kt
fun main() { class Node(val rate: Int, var paths: List<Node> = emptyList()) val inputLineRegex = """Valve ([A-Z]+) has flow rate=(\d+)""".toRegex() val input2LineRegex = """([A-Z]+)""".toRegex() fun parseData(input: List<String>): Map<String, Node> { val nodes = mutableMapOf<String, Node>() for (line in input) line.split(";").first().destructured(inputLineRegex).let { (name, rate) -> nodes[name] = Node(rate.toInt()) } for (line in input) { val (name) = line.split(";").first().destructured(inputLineRegex) val paths = input2LineRegex.findAll(line.split(";").last()).map { nodes[it.value]!! }.toList() nodes[name]!!.paths = paths } return nodes } fun bestPath(startNode: Node, targetNodesLeft: Set<Node>, minutes: Int): Pair<Int, List<Node>> { fun visitNode(node: Node, minutesLeft: Int, pressureReleased: Int, opened: Set<Node>, closed: Set<Node>, visited: List<Node>): Pair<Int, List<Node>> { val dp = opened.sumOf { it.rate } val reachableClosed = closed.map { Pair(it, aStar(node, {end -> end == it}, { 0 }, { n -> n.paths })) } .filter { (_, steps) -> steps.size <= minutesLeft } if (reachableClosed.isEmpty() || minutesLeft == 0) return Pair(pressureReleased + (minutesLeft - 1) * dp, visited) return reachableClosed.map { (candidate, path) -> visitNode(candidate, minutesLeft - path.size, pressureReleased + path.size * dp + candidate.rate, opened + candidate, closed - candidate, visited + candidate) }.maxBy { it.first } } return visitNode(startNode, minutes, 0, emptySet(), targetNodesLeft, listOf()) } fun part1(input: List<String>): Int { val nodes = parseData(input) val nonZeroClosedNodes = nodes.values.filter { it.rate != 0 }.toSet() val bestPath = bestPath(nodes["AA"]!!, nonZeroClosedNodes, 30) return bestPath.first } fun part2(input: List<String>): Int { val nodes = parseData(input) val nonZeroClosedNodes = nodes.values.filter { it.rate != 0 }.toSet() val myPath = bestPath(nodes["AA"]!!, nonZeroClosedNodes, 26) val elephantPath = bestPath(nodes["AA"]!!, nonZeroClosedNodes - myPath.second.toSet(), 26) return myPath.first + elephantPath.first } test( day = 16, testTarget1 = 1651, testTarget2 = 1327, // should be 1707?? part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day16Kt$main$Node.class", "javap": "Compiled from \"Day16.kt\"\npublic final class Day16Kt$main$Node {\n private final int rate;\n\n private java.util.List<Day16Kt$main$Node> paths;\n\n public Day16Kt$main$Node(int, java.util.List<Day16Kt$main$Node>);\n Code:\n 0: aload_2\n 1: ldc #9 // String paths\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokespecial #18 // Method java/lang/Object.\"<init>\":()V\n 10: aload_0\n 11: iload_1\n 12: putfield #22 // Field rate:I\n 15: aload_0\n 16: aload_2\n 17: putfield #25 // Field paths:Ljava/util/List;\n 20: return\n\n public Day16Kt$main$Node(int, java.util.List, int, kotlin.jvm.internal.DefaultConstructorMarker);\n Code:\n 0: iload_3\n 1: iconst_2\n 2: iand\n 3: ifeq 10\n 6: invokestatic #34 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 9: astore_2\n 10: aload_0\n 11: iload_1\n 12: aload_2\n 13: invokespecial #36 // Method \"<init>\":(ILjava/util/List;)V\n 16: return\n\n public final int getRate();\n Code:\n 0: aload_0\n 1: getfield #22 // Field rate:I\n 4: ireturn\n\n public final java.util.List<Day16Kt$main$Node> getPaths();\n Code:\n 0: aload_0\n 1: getfield #25 // Field paths:Ljava/util/List;\n 4: areturn\n\n public final void setPaths(java.util.List<Day16Kt$main$Node>);\n Code:\n 0: aload_1\n 1: ldc #45 // String <set-?>\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: putfield #25 // Field paths:Ljava/util/List;\n 11: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day16Kt.class", "javap": "Compiled from \"Day16.kt\"\npublic final class Day16Kt {\n public static final void main();\n Code:\n 0: new #8 // class kotlin/text/Regex\n 3: dup\n 4: ldc #10 // String Valve ([A-Z]+) has flow rate=(\\\\d+)\n 6: invokespecial #14 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 9: astore_0\n 10: new #8 // class kotlin/text/Regex\n 13: dup\n 14: ldc #16 // String ([A-Z]+)\n 16: invokespecial #14 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 19: astore_1\n 20: bipush 16\n 22: sipush 1651\n 25: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 28: sipush 1327\n 31: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 34: new #24 // class Day16Kt$main$1\n 37: dup\n 38: aload_0\n 39: aload_1\n 40: invokespecial #27 // Method Day16Kt$main$1.\"<init>\":(Lkotlin/text/Regex;Lkotlin/text/Regex;)V\n 43: checkcast #29 // class kotlin/jvm/functions/Function1\n 46: new #31 // class Day16Kt$main$2\n 49: dup\n 50: aload_0\n 51: aload_1\n 52: invokespecial #32 // Method Day16Kt$main$2.\"<init>\":(Lkotlin/text/Regex;Lkotlin/text/Regex;)V\n 55: checkcast #29 // class kotlin/jvm/functions/Function1\n 58: invokestatic #38 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 61: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #44 // Method main:()V\n 3: return\n\n private static final Day16Kt$main$Node main$parseData$lambda$1(java.util.Map, kotlin.text.MatchResult);\n Code:\n 0: aload_1\n 1: ldc #50 // String it\n 3: invokestatic #56 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: invokeinterface #62, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 13: invokeinterface #68, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 18: dup\n 19: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 22: checkcast #74 // class Day16Kt$main$Node\n 25: areturn\n\n private static final java.util.Map<java.lang.String, Day16Kt$main$Node> main$parseData(kotlin.text.Regex, kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: new #82 // class java/util/LinkedHashMap\n 3: dup\n 4: invokespecial #84 // Method java/util/LinkedHashMap.\"<init>\":()V\n 7: checkcast #64 // class java/util/Map\n 10: astore_3\n 11: aload_2\n 12: invokeinterface #90, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 17: astore 4\n 19: aload 4\n 21: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 26: ifeq 154\n 29: aload 4\n 31: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 36: checkcast #102 // class java/lang/String\n 39: astore 5\n 41: aload 5\n 43: checkcast #104 // class java/lang/CharSequence\n 46: iconst_1\n 47: anewarray #102 // class java/lang/String\n 50: astore 6\n 52: aload 6\n 54: iconst_0\n 55: ldc #106 // String ;\n 57: aastore\n 58: aload 6\n 60: iconst_0\n 61: iconst_0\n 62: bipush 6\n 64: aconst_null\n 65: invokestatic #112 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 68: invokestatic #118 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 71: checkcast #102 // class java/lang/String\n 74: aload_0\n 75: invokestatic #122 // Method UtilsKt.destructured:(Ljava/lang/String;Lkotlin/text/Regex;)Lkotlin/text/MatchResult$Destructured;\n 78: astore 7\n 80: iconst_0\n 81: istore 8\n 83: aload 7\n 85: invokevirtual #128 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 88: invokeinterface #132, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 93: iconst_1\n 94: invokeinterface #135, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 99: checkcast #102 // class java/lang/String\n 102: astore 9\n 104: aload 7\n 106: invokevirtual #128 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 109: invokeinterface #132, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 114: iconst_2\n 115: invokeinterface #135, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 120: checkcast #102 // class java/lang/String\n 123: astore 10\n 125: aload_3\n 126: aload 9\n 128: new #74 // class Day16Kt$main$Node\n 131: dup\n 132: aload 10\n 134: invokestatic #139 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 137: aconst_null\n 138: iconst_2\n 139: aconst_null\n 140: invokespecial #142 // Method Day16Kt$main$Node.\"<init>\":(ILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 143: invokeinterface #146, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 148: pop\n 149: nop\n 150: nop\n 151: goto 19\n 154: aload_2\n 155: invokeinterface #90, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 160: astore 4\n 162: aload 4\n 164: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 169: ifeq 317\n 172: aload 4\n 174: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 179: checkcast #102 // class java/lang/String\n 182: astore 5\n 184: aload 5\n 186: checkcast #104 // class java/lang/CharSequence\n 189: iconst_1\n 190: anewarray #102 // class java/lang/String\n 193: astore 7\n 195: aload 7\n 197: iconst_0\n 198: ldc #106 // String ;\n 200: aastore\n 201: aload 7\n 203: iconst_0\n 204: iconst_0\n 205: bipush 6\n 207: aconst_null\n 208: invokestatic #112 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 211: invokestatic #118 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 214: checkcast #102 // class java/lang/String\n 217: aload_0\n 218: invokestatic #122 // Method UtilsKt.destructured:(Ljava/lang/String;Lkotlin/text/Regex;)Lkotlin/text/MatchResult$Destructured;\n 221: invokevirtual #128 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 224: invokeinterface #132, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 229: iconst_1\n 230: invokeinterface #135, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 235: checkcast #102 // class java/lang/String\n 238: astore 7\n 240: aload_1\n 241: aload 5\n 243: checkcast #104 // class java/lang/CharSequence\n 246: iconst_1\n 247: anewarray #102 // class java/lang/String\n 250: astore 9\n 252: aload 9\n 254: iconst_0\n 255: ldc #106 // String ;\n 257: aastore\n 258: aload 9\n 260: iconst_0\n 261: iconst_0\n 262: bipush 6\n 264: aconst_null\n 265: invokestatic #112 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 268: invokestatic #149 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 271: checkcast #104 // class java/lang/CharSequence\n 274: iconst_0\n 275: iconst_2\n 276: aconst_null\n 277: invokestatic #153 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 280: aload_3\n 281: invokedynamic #170, 0 // InvokeDynamic #0:invoke:(Ljava/util/Map;)Lkotlin/jvm/functions/Function1;\n 286: invokestatic #176 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 289: invokestatic #180 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 292: astore 8\n 294: aload_3\n 295: aload 7\n 297: invokeinterface #68, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 302: dup\n 303: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 306: checkcast #74 // class Day16Kt$main$Node\n 309: aload 8\n 311: invokevirtual #184 // Method Day16Kt$main$Node.setPaths:(Ljava/util/List;)V\n 314: goto 162\n 317: aload_3\n 318: areturn\n\n private static final boolean main$bestPath$visitNode$lambda$6$lambda$3(Day16Kt$main$Node, Day16Kt$main$Node);\n Code:\n 0: aload_1\n 1: ldc #198 // String end\n 3: invokestatic #56 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: aload_0\n 8: invokestatic #202 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 11: ireturn\n\n private static final int main$bestPath$visitNode$lambda$6$lambda$4(Day16Kt$main$Node);\n Code:\n 0: aload_0\n 1: ldc #50 // String it\n 3: invokestatic #56 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: ireturn\n\n private static final java.util.Collection main$bestPath$visitNode$lambda$6$lambda$5(Day16Kt$main$Node);\n Code:\n 0: aload_0\n 1: ldc #210 // String n\n 3: invokestatic #56 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #213 // Method Day16Kt$main$Node.getPaths:()Ljava/util/List;\n 10: checkcast #215 // class java/util/Collection\n 13: areturn\n\n private static final kotlin.Pair<java.lang.Integer, java.util.List<Day16Kt$main$Node>> main$bestPath$visitNode(Day16Kt$main$Node, int, int, java.util.Set<Day16Kt$main$Node>, java.util.Set<Day16Kt$main$Node>, java.util.List<Day16Kt$main$Node>);\n Code:\n 0: aload_3\n 1: checkcast #220 // class java/lang/Iterable\n 4: astore 7\n 6: iconst_0\n 7: istore 8\n 9: aload 7\n 11: invokeinterface #221, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 16: astore 9\n 18: aload 9\n 20: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 25: ifeq 68\n 28: aload 9\n 30: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 35: astore 10\n 37: iload 8\n 39: aload 10\n 41: checkcast #74 // class Day16Kt$main$Node\n 44: astore 11\n 46: istore 19\n 48: iconst_0\n 49: istore 12\n 51: aload 11\n 53: invokevirtual #225 // Method Day16Kt$main$Node.getRate:()I\n 56: istore 20\n 58: iload 19\n 60: iload 20\n 62: iadd\n 63: istore 8\n 65: goto 18\n 68: iload 8\n 70: istore 6\n 72: aload 4\n 74: checkcast #220 // class java/lang/Iterable\n 77: astore 8\n 79: iconst_0\n 80: istore 9\n 82: aload 8\n 84: astore 10\n 86: new #227 // class java/util/ArrayList\n 89: dup\n 90: aload 8\n 92: bipush 10\n 94: invokestatic #231 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 97: invokespecial #234 // Method java/util/ArrayList.\"<init>\":(I)V\n 100: checkcast #215 // class java/util/Collection\n 103: astore 11\n 105: iconst_0\n 106: istore 12\n 108: aload 10\n 110: invokeinterface #221, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 115: astore 13\n 117: aload 13\n 119: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 124: ifeq 192\n 127: aload 13\n 129: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 134: astore 14\n 136: aload 11\n 138: aload 14\n 140: checkcast #74 // class Day16Kt$main$Node\n 143: astore 15\n 145: astore 19\n 147: iconst_0\n 148: istore 16\n 150: new #236 // class kotlin/Pair\n 153: dup\n 154: aload 15\n 156: aload_0\n 157: aload 15\n 159: invokedynamic #244, 0 // InvokeDynamic #1:invoke:(LDay16Kt$main$Node;)Lkotlin/jvm/functions/Function1;\n 164: invokedynamic #252, 0 // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;\n 169: invokedynamic #257, 0 // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;\n 174: invokestatic #261 // Method UtilsKt.aStar:(Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/util/List;\n 177: invokespecial #264 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 180: aload 19\n 182: swap\n 183: invokeinterface #268, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 188: pop\n 189: goto 117\n 192: aload 11\n 194: checkcast #86 // class java/util/List\n 197: nop\n 198: checkcast #220 // class java/lang/Iterable\n 201: astore 8\n 203: nop\n 204: iconst_0\n 205: istore 9\n 207: aload 8\n 209: astore 10\n 211: new #227 // class java/util/ArrayList\n 214: dup\n 215: invokespecial #269 // Method java/util/ArrayList.\"<init>\":()V\n 218: checkcast #215 // class java/util/Collection\n 221: astore 11\n 223: iconst_0\n 224: istore 12\n 226: aload 10\n 228: invokeinterface #221, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 233: astore 13\n 235: aload 13\n 237: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 242: ifeq 306\n 245: aload 13\n 247: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 252: astore 14\n 254: aload 14\n 256: checkcast #236 // class kotlin/Pair\n 259: astore 15\n 261: iconst_0\n 262: istore 16\n 264: aload 15\n 266: invokevirtual #272 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 269: checkcast #86 // class java/util/List\n 272: astore 17\n 274: aload 17\n 276: invokeinterface #275, 1 // InterfaceMethod java/util/List.size:()I\n 281: iload_1\n 282: if_icmpgt 289\n 285: iconst_1\n 286: goto 290\n 289: iconst_0\n 290: ifeq 235\n 293: aload 11\n 295: aload 14\n 297: invokeinterface #268, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 302: pop\n 303: goto 235\n 306: aload 11\n 308: checkcast #86 // class java/util/List\n 311: nop\n 312: astore 7\n 314: aload 7\n 316: invokeinterface #278, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 321: ifne 328\n 324: iload_1\n 325: ifne 349\n 328: new #236 // class kotlin/Pair\n 331: dup\n 332: iload_2\n 333: iload_1\n 334: iconst_1\n 335: isub\n 336: iload 6\n 338: imul\n 339: iadd\n 340: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 343: aload 5\n 345: invokespecial #264 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 348: areturn\n 349: aload 7\n 351: checkcast #220 // class java/lang/Iterable\n 354: astore 8\n 356: iconst_0\n 357: istore 9\n 359: aload 8\n 361: astore 10\n 363: new #227 // class java/util/ArrayList\n 366: dup\n 367: aload 8\n 369: bipush 10\n 371: invokestatic #231 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 374: invokespecial #234 // Method java/util/ArrayList.\"<init>\":(I)V\n 377: checkcast #215 // class java/util/Collection\n 380: astore 11\n 382: iconst_0\n 383: istore 12\n 385: aload 10\n 387: invokeinterface #221, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 392: astore 13\n 394: aload 13\n 396: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 401: ifeq 514\n 404: aload 13\n 406: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 411: astore 14\n 413: aload 11\n 415: aload 14\n 417: checkcast #236 // class kotlin/Pair\n 420: astore 15\n 422: astore 19\n 424: iconst_0\n 425: istore 16\n 427: aload 15\n 429: invokevirtual #281 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 432: checkcast #74 // class Day16Kt$main$Node\n 435: astore 17\n 437: aload 15\n 439: invokevirtual #272 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 442: checkcast #86 // class java/util/List\n 445: astore 18\n 447: aload 17\n 449: iload_1\n 450: aload 18\n 452: invokeinterface #275, 1 // InterfaceMethod java/util/List.size:()I\n 457: isub\n 458: iload_2\n 459: aload 18\n 461: invokeinterface #275, 1 // InterfaceMethod java/util/List.size:()I\n 466: iload 6\n 468: imul\n 469: iadd\n 470: aload 17\n 472: invokevirtual #225 // Method Day16Kt$main$Node.getRate:()I\n 475: iadd\n 476: aload_3\n 477: aload 17\n 479: invokestatic #287 // Method kotlin/collections/SetsKt.plus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;\n 482: aload 4\n 484: aload 17\n 486: invokestatic #290 // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Object;)Ljava/util/Set;\n 489: aload 5\n 491: checkcast #215 // class java/util/Collection\n 494: aload 17\n 496: invokestatic #293 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;\n 499: invokestatic #295 // Method main$bestPath$visitNode:(LDay16Kt$main$Node;IILjava/util/Set;Ljava/util/Set;Ljava/util/List;)Lkotlin/Pair;\n 502: aload 19\n 504: swap\n 505: invokeinterface #268, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 510: pop\n 511: goto 394\n 514: aload 11\n 516: checkcast #86 // class java/util/List\n 519: nop\n 520: checkcast #220 // class java/lang/Iterable\n 523: astore 8\n 525: nop\n 526: iconst_0\n 527: istore 9\n 529: aload 8\n 531: invokeinterface #221, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 536: astore 10\n 538: aload 10\n 540: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 545: ifne 556\n 548: new #297 // class java/util/NoSuchElementException\n 551: dup\n 552: invokespecial #298 // Method java/util/NoSuchElementException.\"<init>\":()V\n 555: athrow\n 556: aload 10\n 558: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 563: astore 11\n 565: aload 10\n 567: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 572: ifne 580\n 575: aload 11\n 577: goto 662\n 580: aload 11\n 582: checkcast #236 // class kotlin/Pair\n 585: astore 12\n 587: iconst_0\n 588: istore 13\n 590: aload 12\n 592: invokevirtual #301 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 595: checkcast #303 // class java/lang/Number\n 598: invokevirtual #306 // Method java/lang/Number.intValue:()I\n 601: istore 12\n 603: aload 10\n 605: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 610: astore 13\n 612: aload 13\n 614: checkcast #236 // class kotlin/Pair\n 617: astore 14\n 619: iconst_0\n 620: istore 15\n 622: aload 14\n 624: invokevirtual #301 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 627: checkcast #303 // class java/lang/Number\n 630: invokevirtual #306 // Method java/lang/Number.intValue:()I\n 633: istore 14\n 635: iload 12\n 637: iload 14\n 639: if_icmpge 650\n 642: aload 13\n 644: astore 11\n 646: iload 14\n 648: istore 12\n 650: aload 10\n 652: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 657: ifne 603\n 660: aload 11\n 662: checkcast #236 // class kotlin/Pair\n 665: areturn\n\n private static final kotlin.Pair<java.lang.Integer, java.util.List<Day16Kt$main$Node>> main$bestPath(Day16Kt$main$Node, java.util.Set<Day16Kt$main$Node>, int);\n Code:\n 0: aload_0\n 1: iload_2\n 2: iconst_0\n 3: invokestatic #355 // Method kotlin/collections/SetsKt.emptySet:()Ljava/util/Set;\n 6: aload_1\n 7: invokestatic #358 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 10: invokestatic #295 // Method main$bestPath$visitNode:(LDay16Kt$main$Node;IILjava/util/Set;Ljava/util/Set;Ljava/util/List;)Lkotlin/Pair;\n 13: areturn\n\n private static final int main$part1(kotlin.text.Regex, kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokestatic #366 // Method main$parseData:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)Ljava/util/Map;\n 6: astore_3\n 7: aload_3\n 8: invokeinterface #370, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 13: checkcast #220 // class java/lang/Iterable\n 16: astore 5\n 18: iconst_0\n 19: istore 6\n 21: aload 5\n 23: astore 7\n 25: new #227 // class java/util/ArrayList\n 28: dup\n 29: invokespecial #269 // Method java/util/ArrayList.\"<init>\":()V\n 32: checkcast #215 // class java/util/Collection\n 35: astore 8\n 37: iconst_0\n 38: istore 9\n 40: aload 7\n 42: invokeinterface #221, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 47: astore 10\n 49: aload 10\n 51: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 56: ifeq 107\n 59: aload 10\n 61: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 66: astore 11\n 68: aload 11\n 70: checkcast #74 // class Day16Kt$main$Node\n 73: astore 12\n 75: iconst_0\n 76: istore 13\n 78: aload 12\n 80: invokevirtual #225 // Method Day16Kt$main$Node.getRate:()I\n 83: ifeq 90\n 86: iconst_1\n 87: goto 91\n 90: iconst_0\n 91: ifeq 49\n 94: aload 8\n 96: aload 11\n 98: invokeinterface #268, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 103: pop\n 104: goto 49\n 107: aload 8\n 109: checkcast #86 // class java/util/List\n 112: nop\n 113: checkcast #220 // class java/lang/Iterable\n 116: invokestatic #374 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 119: astore 4\n 121: aload_3\n 122: ldc_w #376 // String AA\n 125: invokeinterface #68, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 130: dup\n 131: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 134: checkcast #74 // class Day16Kt$main$Node\n 137: aload 4\n 139: bipush 30\n 141: invokestatic #378 // Method main$bestPath:(LDay16Kt$main$Node;Ljava/util/Set;I)Lkotlin/Pair;\n 144: astore 5\n 146: aload 5\n 148: invokevirtual #301 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 151: checkcast #303 // class java/lang/Number\n 154: invokevirtual #306 // Method java/lang/Number.intValue:()I\n 157: ireturn\n\n private static final int main$part2(kotlin.text.Regex, kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokestatic #366 // Method main$parseData:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)Ljava/util/Map;\n 6: astore_3\n 7: aload_3\n 8: invokeinterface #370, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 13: checkcast #220 // class java/lang/Iterable\n 16: astore 5\n 18: iconst_0\n 19: istore 6\n 21: aload 5\n 23: astore 7\n 25: new #227 // class java/util/ArrayList\n 28: dup\n 29: invokespecial #269 // Method java/util/ArrayList.\"<init>\":()V\n 32: checkcast #215 // class java/util/Collection\n 35: astore 8\n 37: iconst_0\n 38: istore 9\n 40: aload 7\n 42: invokeinterface #221, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 47: astore 10\n 49: aload 10\n 51: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 56: ifeq 107\n 59: aload 10\n 61: invokeinterface #100, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 66: astore 11\n 68: aload 11\n 70: checkcast #74 // class Day16Kt$main$Node\n 73: astore 12\n 75: iconst_0\n 76: istore 13\n 78: aload 12\n 80: invokevirtual #225 // Method Day16Kt$main$Node.getRate:()I\n 83: ifeq 90\n 86: iconst_1\n 87: goto 91\n 90: iconst_0\n 91: ifeq 49\n 94: aload 8\n 96: aload 11\n 98: invokeinterface #268, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 103: pop\n 104: goto 49\n 107: aload 8\n 109: checkcast #86 // class java/util/List\n 112: nop\n 113: checkcast #220 // class java/lang/Iterable\n 116: invokestatic #374 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 119: astore 4\n 121: aload_3\n 122: ldc_w #376 // String AA\n 125: invokeinterface #68, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 130: dup\n 131: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 134: checkcast #74 // class Day16Kt$main$Node\n 137: aload 4\n 139: bipush 26\n 141: invokestatic #378 // Method main$bestPath:(LDay16Kt$main$Node;Ljava/util/Set;I)Lkotlin/Pair;\n 144: astore 5\n 146: aload_3\n 147: ldc_w #376 // String AA\n 150: invokeinterface #68, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 155: dup\n 156: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 159: checkcast #74 // class Day16Kt$main$Node\n 162: aload 4\n 164: aload 5\n 166: invokevirtual #385 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 169: checkcast #220 // class java/lang/Iterable\n 172: invokestatic #374 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 175: checkcast #220 // class java/lang/Iterable\n 178: invokestatic #388 // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Iterable;)Ljava/util/Set;\n 181: bipush 26\n 183: invokestatic #378 // Method main$bestPath:(LDay16Kt$main$Node;Ljava/util/Set;I)Lkotlin/Pair;\n 186: astore 6\n 188: aload 5\n 190: invokevirtual #301 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 193: checkcast #303 // class java/lang/Number\n 196: invokevirtual #306 // Method java/lang/Number.intValue:()I\n 199: aload 6\n 201: invokevirtual #301 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 204: checkcast #303 // class java/lang/Number\n 207: invokevirtual #306 // Method java/lang/Number.intValue:()I\n 210: iadd\n 211: ireturn\n\n public static final int access$main$part1(kotlin.text.Regex, kotlin.text.Regex, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokestatic #394 // Method main$part1:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I\n 6: ireturn\n\n public static final int access$main$part2(kotlin.text.Regex, kotlin.text.Regex, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokestatic #397 // Method main$part2:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I\n 6: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day16Kt$main$2.class", "javap": "Compiled from \"Day16.kt\"\nfinal class Day16Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final kotlin.text.Regex $inputLineRegex;\n\n final kotlin.text.Regex $input2LineRegex;\n\n Day16Kt$main$2(kotlin.text.Regex, kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: aload_2\n 7: putfield #16 // Field $input2LineRegex:Lkotlin/text/Regex;\n 10: aload_0\n 11: iconst_1\n 12: ldc #18 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 14: ldc #20 // String part2\n 16: ldc #22 // String main$part2(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I\n 18: iconst_0\n 19: invokespecial #25 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 22: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #32 // String p0\n 3: invokestatic #38 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 10: aload_0\n 11: getfield #16 // Field $input2LineRegex:Lkotlin/text/Regex;\n 14: aload_1\n 15: invokestatic #44 // Method Day16Kt.access$main$part2:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I\n 18: invokestatic #50 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 21: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #54 // class java/util/List\n 5: invokevirtual #56 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day16Kt$main$1.class", "javap": "Compiled from \"Day16.kt\"\nfinal class Day16Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final kotlin.text.Regex $inputLineRegex;\n\n final kotlin.text.Regex $input2LineRegex;\n\n Day16Kt$main$1(kotlin.text.Regex, kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: aload_2\n 7: putfield #16 // Field $input2LineRegex:Lkotlin/text/Regex;\n 10: aload_0\n 11: iconst_1\n 12: ldc #18 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 14: ldc #20 // String part1\n 16: ldc #22 // String main$part1(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I\n 18: iconst_0\n 19: invokespecial #25 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 22: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #32 // String p0\n 3: invokestatic #38 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 10: aload_0\n 11: getfield #16 // Field $input2LineRegex:Lkotlin/text/Regex;\n 14: aload_1\n 15: invokestatic #44 // Method Day16Kt.access$main$part1:(Lkotlin/text/Regex;Lkotlin/text/Regex;Ljava/util/List;)I\n 18: invokestatic #50 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 21: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #54 // class java/util/List\n 5: invokevirtual #56 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day11.kt
fun main() { data class Monkey( val id: Int, val items: ArrayDeque<Long>, val operation: Char, val operationParam: String, val testParam: Int, val onSuccessTarget: Int, val onFailedTarget: Int, ) val inputLineRegex = """\d+""".toRegex() fun monkeyBusiness(input: List<String>, rounds: Int, divisor: Int): Long { val monkeys = mutableListOf<Monkey>() val inspections = mutableMapOf<Int, Int>() input.chunked(7).forEach { line -> Monkey( id = inputLineRegex.findAll(line[0]).map { it.value.toInt() }.first(), items = ArrayDeque(inputLineRegex.findAll(line[1]).map { it.value.toLong() }.toList()), operation = line[2].split("= old").last()[1], operationParam = line[2].split("= old").last().substring(3), testParam = inputLineRegex.findAll(line[3]).map { it.value.toInt() }.first(), onSuccessTarget = inputLineRegex.findAll(line[4]).map { it.value.toInt() }.first(), onFailedTarget = inputLineRegex.findAll(line[5]).map { it.value.toInt() }.first(), ).let { monkeys.add(it) inspections[it.id] = 0 } } val maxDiv = monkeys.map { it.testParam }.toSet().reduce(Int::times) repeat(rounds) { monkeys.forEach { monkey -> inspections[monkey.id] = inspections[monkey.id]!! + monkey.items.size while (monkey.items.isNotEmpty()) { val worryLevel = monkey.items.removeFirst() val operationParameter: Long = if (monkey.operationParam == "old") worryLevel else monkey.operationParam.toLong() val newWorryLevel = when (monkey.operation) { '*' -> worryLevel * operationParameter '+' -> worryLevel + operationParameter else -> throw Exception("Unknown operation $monkey.operation") } / divisor % maxDiv monkeys[if (newWorryLevel % monkey.testParam == 0L) monkey.onSuccessTarget else monkey.onFailedTarget].items.addLast(newWorryLevel) } } } return inspections.values.sorted().takeLast(2).map { it.toLong() }.reduce(Long::times) } fun part1(input: List<String>) = monkeyBusiness(input, rounds = 20, divisor = 3) fun part2(input: List<String>) = monkeyBusiness(input, rounds = 10000, divisor = 1) test( day = 11, testTarget1 = 10605, testTarget2 = 2713310158L, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day11Kt$main$Monkey.class", "javap": "Compiled from \"Day11.kt\"\npublic final class Day11Kt$main$Monkey {\n private final int id;\n\n private final kotlin.collections.ArrayDeque<java.lang.Long> items;\n\n private final char operation;\n\n private final java.lang.String operationParam;\n\n private final int testParam;\n\n private final int onSuccessTarget;\n\n private final int onFailedTarget;\n\n public Day11Kt$main$Monkey(int, kotlin.collections.ArrayDeque<java.lang.Long>, char, java.lang.String, int, int, int);\n Code:\n 0: aload_2\n 1: ldc #9 // String items\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload 4\n 8: ldc #17 // String operationParam\n 10: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 13: aload_0\n 14: invokespecial #20 // Method java/lang/Object.\"<init>\":()V\n 17: aload_0\n 18: iload_1\n 19: putfield #24 // Field id:I\n 22: aload_0\n 23: aload_2\n 24: putfield #27 // Field items:Lkotlin/collections/ArrayDeque;\n 27: aload_0\n 28: iload_3\n 29: putfield #31 // Field operation:C\n 32: aload_0\n 33: aload 4\n 35: putfield #34 // Field operationParam:Ljava/lang/String;\n 38: aload_0\n 39: iload 5\n 41: putfield #37 // Field testParam:I\n 44: aload_0\n 45: iload 6\n 47: putfield #40 // Field onSuccessTarget:I\n 50: aload_0\n 51: iload 7\n 53: putfield #43 // Field onFailedTarget:I\n 56: return\n\n public final int getId();\n Code:\n 0: aload_0\n 1: getfield #24 // Field id:I\n 4: ireturn\n\n public final kotlin.collections.ArrayDeque<java.lang.Long> getItems();\n Code:\n 0: aload_0\n 1: getfield #27 // Field items:Lkotlin/collections/ArrayDeque;\n 4: areturn\n\n public final char getOperation();\n Code:\n 0: aload_0\n 1: getfield #31 // Field operation:C\n 4: ireturn\n\n public final java.lang.String getOperationParam();\n Code:\n 0: aload_0\n 1: getfield #34 // Field operationParam:Ljava/lang/String;\n 4: areturn\n\n public final int getTestParam();\n Code:\n 0: aload_0\n 1: getfield #37 // Field testParam:I\n 4: ireturn\n\n public final int getOnSuccessTarget();\n Code:\n 0: aload_0\n 1: getfield #40 // Field onSuccessTarget:I\n 4: ireturn\n\n public final int getOnFailedTarget();\n Code:\n 0: aload_0\n 1: getfield #43 // Field onFailedTarget:I\n 4: ireturn\n\n public final int component1();\n Code:\n 0: aload_0\n 1: getfield #24 // Field id:I\n 4: ireturn\n\n public final kotlin.collections.ArrayDeque<java.lang.Long> component2();\n Code:\n 0: aload_0\n 1: getfield #27 // Field items:Lkotlin/collections/ArrayDeque;\n 4: areturn\n\n public final char component3();\n Code:\n 0: aload_0\n 1: getfield #31 // Field operation:C\n 4: ireturn\n\n public final java.lang.String component4();\n Code:\n 0: aload_0\n 1: getfield #34 // Field operationParam:Ljava/lang/String;\n 4: areturn\n\n public final int component5();\n Code:\n 0: aload_0\n 1: getfield #37 // Field testParam:I\n 4: ireturn\n\n public final int component6();\n Code:\n 0: aload_0\n 1: getfield #40 // Field onSuccessTarget:I\n 4: ireturn\n\n public final int component7();\n Code:\n 0: aload_0\n 1: getfield #43 // Field onFailedTarget:I\n 4: ireturn\n\n public final Day11Kt$main$Monkey copy(int, kotlin.collections.ArrayDeque<java.lang.Long>, char, java.lang.String, int, int, int);\n Code:\n 0: aload_2\n 1: ldc #9 // String items\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload 4\n 8: ldc #17 // String operationParam\n 10: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 13: new #2 // class Day11Kt$main$Monkey\n 16: dup\n 17: iload_1\n 18: aload_2\n 19: iload_3\n 20: aload 4\n 22: iload 5\n 24: iload 6\n 26: iload 7\n 28: invokespecial #69 // Method \"<init>\":(ILkotlin/collections/ArrayDeque;CLjava/lang/String;III)V\n 31: areturn\n\n public static Day11Kt$main$Monkey copy$default(Day11Kt$main$Monkey, int, kotlin.collections.ArrayDeque, char, java.lang.String, int, int, int, int, java.lang.Object);\n Code:\n 0: iload 8\n 2: iconst_1\n 3: iand\n 4: ifeq 12\n 7: aload_0\n 8: getfield #24 // Field id:I\n 11: istore_1\n 12: iload 8\n 14: iconst_2\n 15: iand\n 16: ifeq 24\n 19: aload_0\n 20: getfield #27 // Field items:Lkotlin/collections/ArrayDeque;\n 23: astore_2\n 24: iload 8\n 26: iconst_4\n 27: iand\n 28: ifeq 36\n 31: aload_0\n 32: getfield #31 // Field operation:C\n 35: istore_3\n 36: iload 8\n 38: bipush 8\n 40: iand\n 41: ifeq 50\n 44: aload_0\n 45: getfield #34 // Field operationParam:Ljava/lang/String;\n 48: astore 4\n 50: iload 8\n 52: bipush 16\n 54: iand\n 55: ifeq 64\n 58: aload_0\n 59: getfield #37 // Field testParam:I\n 62: istore 5\n 64: iload 8\n 66: bipush 32\n 68: iand\n 69: ifeq 78\n 72: aload_0\n 73: getfield #40 // Field onSuccessTarget:I\n 76: istore 6\n 78: iload 8\n 80: bipush 64\n 82: iand\n 83: ifeq 92\n 86: aload_0\n 87: getfield #43 // Field onFailedTarget:I\n 90: istore 7\n 92: aload_0\n 93: iload_1\n 94: aload_2\n 95: iload_3\n 96: aload 4\n 98: iload 5\n 100: iload 6\n 102: iload 7\n 104: invokevirtual #73 // Method copy:(ILkotlin/collections/ArrayDeque;CLjava/lang/String;III)LDay11Kt$main$Monkey;\n 107: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #76 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #77 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #79 // String Monkey(id=\n 9: invokevirtual #83 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #24 // Field id:I\n 16: invokevirtual #86 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 19: ldc #88 // String , items=\n 21: invokevirtual #83 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 24: aload_0\n 25: getfield #27 // Field items:Lkotlin/collections/ArrayDeque;\n 28: invokevirtual #91 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 31: ldc #93 // String , operation=\n 33: invokevirtual #83 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 36: aload_0\n 37: getfield #31 // Field operation:C\n 40: invokevirtual #96 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 43: ldc #98 // String , operationParam=\n 45: invokevirtual #83 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 48: aload_0\n 49: getfield #34 // Field operationParam:Ljava/lang/String;\n 52: invokevirtual #83 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 55: ldc #100 // String , testParam=\n 57: invokevirtual #83 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 60: aload_0\n 61: getfield #37 // Field testParam:I\n 64: invokevirtual #86 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 67: ldc #102 // String , onSuccessTarget=\n 69: invokevirtual #83 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 72: aload_0\n 73: getfield #40 // Field onSuccessTarget:I\n 76: invokevirtual #86 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 79: ldc #104 // String , onFailedTarget=\n 81: invokevirtual #83 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 84: aload_0\n 85: getfield #43 // Field onFailedTarget:I\n 88: invokevirtual #86 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 91: bipush 41\n 93: invokevirtual #96 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 96: invokevirtual #106 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 99: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #24 // Field id:I\n 4: invokestatic #112 // Method java/lang/Integer.hashCode:(I)I\n 7: istore_1\n 8: iload_1\n 9: bipush 31\n 11: imul\n 12: aload_0\n 13: getfield #27 // Field items:Lkotlin/collections/ArrayDeque;\n 16: invokevirtual #116 // Method kotlin/collections/ArrayDeque.hashCode:()I\n 19: iadd\n 20: istore_1\n 21: iload_1\n 22: bipush 31\n 24: imul\n 25: aload_0\n 26: getfield #31 // Field operation:C\n 29: invokestatic #121 // Method java/lang/Character.hashCode:(C)I\n 32: iadd\n 33: istore_1\n 34: iload_1\n 35: bipush 31\n 37: imul\n 38: aload_0\n 39: getfield #34 // Field operationParam:Ljava/lang/String;\n 42: invokevirtual #124 // Method java/lang/String.hashCode:()I\n 45: iadd\n 46: istore_1\n 47: iload_1\n 48: bipush 31\n 50: imul\n 51: aload_0\n 52: getfield #37 // Field testParam:I\n 55: invokestatic #112 // Method java/lang/Integer.hashCode:(I)I\n 58: iadd\n 59: istore_1\n 60: iload_1\n 61: bipush 31\n 63: imul\n 64: aload_0\n 65: getfield #40 // Field onSuccessTarget:I\n 68: invokestatic #112 // Method java/lang/Integer.hashCode:(I)I\n 71: iadd\n 72: istore_1\n 73: iload_1\n 74: bipush 31\n 76: imul\n 77: aload_0\n 78: getfield #43 // Field onFailedTarget:I\n 81: invokestatic #112 // Method java/lang/Integer.hashCode:(I)I\n 84: iadd\n 85: istore_1\n 86: iload_1\n 87: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class Day11Kt$main$Monkey\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class Day11Kt$main$Monkey\n 20: astore_2\n 21: aload_0\n 22: getfield #24 // Field id:I\n 25: aload_2\n 26: getfield #24 // Field id:I\n 29: if_icmpeq 34\n 32: iconst_0\n 33: ireturn\n 34: aload_0\n 35: getfield #27 // Field items:Lkotlin/collections/ArrayDeque;\n 38: aload_2\n 39: getfield #27 // Field items:Lkotlin/collections/ArrayDeque;\n 42: invokestatic #131 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 45: ifne 50\n 48: iconst_0\n 49: ireturn\n 50: aload_0\n 51: getfield #31 // Field operation:C\n 54: aload_2\n 55: getfield #31 // Field operation:C\n 58: if_icmpeq 63\n 61: iconst_0\n 62: ireturn\n 63: aload_0\n 64: getfield #34 // Field operationParam:Ljava/lang/String;\n 67: aload_2\n 68: getfield #34 // Field operationParam:Ljava/lang/String;\n 71: invokestatic #131 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 74: ifne 79\n 77: iconst_0\n 78: ireturn\n 79: aload_0\n 80: getfield #37 // Field testParam:I\n 83: aload_2\n 84: getfield #37 // Field testParam:I\n 87: if_icmpeq 92\n 90: iconst_0\n 91: ireturn\n 92: aload_0\n 93: getfield #40 // Field onSuccessTarget:I\n 96: aload_2\n 97: getfield #40 // Field onSuccessTarget:I\n 100: if_icmpeq 105\n 103: iconst_0\n 104: ireturn\n 105: aload_0\n 106: getfield #43 // Field onFailedTarget:I\n 109: aload_2\n 110: getfield #43 // Field onFailedTarget:I\n 113: if_icmpeq 118\n 116: iconst_0\n 117: ireturn\n 118: iconst_1\n 119: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day11Kt$main$2.class", "javap": "Compiled from \"Day11.kt\"\nfinal class Day11Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n final kotlin.text.Regex $inputLineRegex;\n\n Day11Kt$main$2(kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part2\n 11: ldc #19 // String main$part2(Lkotlin/text/Regex;Ljava/util/List;)J\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 10: aload_1\n 11: invokestatic #41 // Method Day11Kt.access$main$part2:(Lkotlin/text/Regex;Ljava/util/List;)J\n 14: invokestatic #47 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day11Kt$main$1.class", "javap": "Compiled from \"Day11.kt\"\nfinal class Day11Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Long> {\n final kotlin.text.Regex $inputLineRegex;\n\n Day11Kt$main$1(kotlin.text.Regex);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part1\n 11: ldc #19 // String main$part1(Lkotlin/text/Regex;Ljava/util/List;)J\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Long invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $inputLineRegex:Lkotlin/text/Regex;\n 10: aload_1\n 11: invokestatic #41 // Method Day11Kt.access$main$part1:(Lkotlin/text/Regex;Ljava/util/List;)J\n 14: invokestatic #47 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Long;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day11Kt.class", "javap": "Compiled from \"Day11.kt\"\npublic final class Day11Kt {\n public static final void main();\n Code:\n 0: new #8 // class kotlin/text/Regex\n 3: dup\n 4: ldc #10 // String \\\\d+\n 6: invokespecial #14 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 9: astore_0\n 10: bipush 11\n 12: ldc2_w #15 // long 10605l\n 15: invokestatic #22 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 18: ldc2_w #23 // long 2713310158l\n 21: invokestatic #22 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 24: new #26 // class Day11Kt$main$1\n 27: dup\n 28: aload_0\n 29: invokespecial #29 // Method Day11Kt$main$1.\"<init>\":(Lkotlin/text/Regex;)V\n 32: checkcast #31 // class kotlin/jvm/functions/Function1\n 35: new #33 // class Day11Kt$main$2\n 38: dup\n 39: aload_0\n 40: invokespecial #34 // Method Day11Kt$main$2.\"<init>\":(Lkotlin/text/Regex;)V\n 43: checkcast #31 // class kotlin/jvm/functions/Function1\n 46: invokestatic #40 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 49: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #45 // Method main:()V\n 3: return\n\n private static final int main$monkeyBusiness$lambda$6$lambda$0(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc #51 // String it\n 3: invokestatic #57 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #63, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 12: invokestatic #69 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 15: ireturn\n\n private static final long main$monkeyBusiness$lambda$6$lambda$1(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc #51 // String it\n 3: invokestatic #57 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #63, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 12: invokestatic #76 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 15: lreturn\n\n private static final int main$monkeyBusiness$lambda$6$lambda$2(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc #51 // String it\n 3: invokestatic #57 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #63, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 12: invokestatic #69 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 15: ireturn\n\n private static final int main$monkeyBusiness$lambda$6$lambda$3(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc #51 // String it\n 3: invokestatic #57 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #63, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 12: invokestatic #69 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 15: ireturn\n\n private static final int main$monkeyBusiness$lambda$6$lambda$4(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc #51 // String it\n 3: invokestatic #57 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #63, 1 // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;\n 12: invokestatic #69 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 15: ireturn\n\n private static final long main$monkeyBusiness(kotlin.text.Regex, java.util.List<java.lang.String>, int, int);\n Code:\n 0: new #84 // class java/util/ArrayList\n 3: dup\n 4: invokespecial #86 // Method java/util/ArrayList.\"<init>\":()V\n 7: checkcast #88 // class java/util/List\n 10: astore 4\n 12: new #90 // class java/util/LinkedHashMap\n 15: dup\n 16: invokespecial #91 // Method java/util/LinkedHashMap.\"<init>\":()V\n 19: checkcast #93 // class java/util/Map\n 22: astore 5\n 24: aload_1\n 25: checkcast #95 // class java/lang/Iterable\n 28: bipush 7\n 30: invokestatic #101 // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;\n 33: checkcast #95 // class java/lang/Iterable\n 36: astore 6\n 38: iconst_0\n 39: istore 7\n 41: aload 6\n 43: invokeinterface #105, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 48: astore 8\n 50: aload 8\n 52: invokeinterface #111, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 57: ifeq 407\n 60: aload 8\n 62: invokeinterface #115, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 67: astore 9\n 69: aload 9\n 71: checkcast #88 // class java/util/List\n 74: astore 10\n 76: iconst_0\n 77: istore 11\n 79: new #117 // class Day11Kt$main$Monkey\n 82: dup\n 83: aload_0\n 84: aload 10\n 86: iconst_0\n 87: invokeinterface #121, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 92: checkcast #123 // class java/lang/CharSequence\n 95: iconst_0\n 96: iconst_2\n 97: aconst_null\n 98: invokestatic #127 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 101: invokedynamic #145, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 106: invokestatic #151 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 109: invokestatic #155 // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;\n 112: checkcast #157 // class java/lang/Number\n 115: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 118: new #163 // class kotlin/collections/ArrayDeque\n 121: dup\n 122: aload_0\n 123: aload 10\n 125: iconst_1\n 126: invokeinterface #121, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 131: checkcast #123 // class java/lang/CharSequence\n 134: iconst_0\n 135: iconst_2\n 136: aconst_null\n 137: invokestatic #127 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 140: invokedynamic #169, 0 // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;\n 145: invokestatic #151 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 148: invokestatic #173 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 151: checkcast #175 // class java/util/Collection\n 154: invokespecial #178 // Method kotlin/collections/ArrayDeque.\"<init>\":(Ljava/util/Collection;)V\n 157: aload 10\n 159: iconst_2\n 160: invokeinterface #121, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 165: checkcast #123 // class java/lang/CharSequence\n 168: iconst_1\n 169: anewarray #180 // class java/lang/String\n 172: astore 12\n 174: aload 12\n 176: iconst_0\n 177: ldc #182 // String = old\n 179: aastore\n 180: aload 12\n 182: iconst_0\n 183: iconst_0\n 184: bipush 6\n 186: aconst_null\n 187: invokestatic #188 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 190: invokestatic #192 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 193: checkcast #180 // class java/lang/String\n 196: iconst_1\n 197: invokevirtual #196 // Method java/lang/String.charAt:(I)C\n 200: aload 10\n 202: iconst_2\n 203: invokeinterface #121, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 208: checkcast #123 // class java/lang/CharSequence\n 211: iconst_1\n 212: anewarray #180 // class java/lang/String\n 215: astore 12\n 217: aload 12\n 219: iconst_0\n 220: ldc #182 // String = old\n 222: aastore\n 223: aload 12\n 225: iconst_0\n 226: iconst_0\n 227: bipush 6\n 229: aconst_null\n 230: invokestatic #188 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 233: invokestatic #192 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 236: checkcast #180 // class java/lang/String\n 239: astore 12\n 241: iconst_3\n 242: istore 13\n 244: aload 12\n 246: iload 13\n 248: invokevirtual #200 // Method java/lang/String.substring:(I)Ljava/lang/String;\n 251: dup\n 252: ldc #202 // String substring(...)\n 254: invokestatic #205 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 257: aload_0\n 258: aload 10\n 260: iconst_3\n 261: invokeinterface #121, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 266: checkcast #123 // class java/lang/CharSequence\n 269: iconst_0\n 270: iconst_2\n 271: aconst_null\n 272: invokestatic #127 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 275: invokedynamic #209, 0 // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;\n 280: invokestatic #151 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 283: invokestatic #155 // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;\n 286: checkcast #157 // class java/lang/Number\n 289: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 292: aload_0\n 293: aload 10\n 295: iconst_4\n 296: invokeinterface #121, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 301: checkcast #123 // class java/lang/CharSequence\n 304: iconst_0\n 305: iconst_2\n 306: aconst_null\n 307: invokestatic #127 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 310: invokedynamic #213, 0 // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;\n 315: invokestatic #151 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 318: invokestatic #155 // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;\n 321: checkcast #157 // class java/lang/Number\n 324: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 327: aload_0\n 328: aload 10\n 330: iconst_5\n 331: invokeinterface #121, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 336: checkcast #123 // class java/lang/CharSequence\n 339: iconst_0\n 340: iconst_2\n 341: aconst_null\n 342: invokestatic #127 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 345: invokedynamic #217, 0 // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;\n 350: invokestatic #151 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 353: invokestatic #155 // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;\n 356: checkcast #157 // class java/lang/Number\n 359: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 362: invokespecial #220 // Method Day11Kt$main$Monkey.\"<init>\":(ILkotlin/collections/ArrayDeque;CLjava/lang/String;III)V\n 365: astore 13\n 367: iconst_0\n 368: istore 14\n 370: aload 4\n 372: aload 13\n 374: invokeinterface #224, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 379: pop\n 380: aload 5\n 382: aload 13\n 384: invokevirtual #227 // Method Day11Kt$main$Monkey.getId:()I\n 387: invokestatic #230 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 390: iconst_0\n 391: invokestatic #230 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 394: invokeinterface #234, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 399: pop\n 400: nop\n 401: nop\n 402: nop\n 403: nop\n 404: goto 50\n 407: nop\n 408: aload 4\n 410: checkcast #95 // class java/lang/Iterable\n 413: astore 7\n 415: iconst_0\n 416: istore 8\n 418: aload 7\n 420: astore 9\n 422: new #84 // class java/util/ArrayList\n 425: dup\n 426: aload 7\n 428: bipush 10\n 430: invokestatic #238 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 433: invokespecial #241 // Method java/util/ArrayList.\"<init>\":(I)V\n 436: checkcast #175 // class java/util/Collection\n 439: astore 10\n 441: iconst_0\n 442: istore 11\n 444: aload 9\n 446: invokeinterface #105, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 451: astore 12\n 453: aload 12\n 455: invokeinterface #111, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 460: ifeq 506\n 463: aload 12\n 465: invokeinterface #115, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 470: astore 13\n 472: aload 10\n 474: aload 13\n 476: checkcast #117 // class Day11Kt$main$Monkey\n 479: astore 14\n 481: astore 22\n 483: iconst_0\n 484: istore 15\n 486: aload 14\n 488: invokevirtual #244 // Method Day11Kt$main$Monkey.getTestParam:()I\n 491: invokestatic #230 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 494: aload 22\n 496: swap\n 497: invokeinterface #245, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 502: pop\n 503: goto 453\n 506: aload 10\n 508: checkcast #88 // class java/util/List\n 511: nop\n 512: checkcast #95 // class java/lang/Iterable\n 515: invokestatic #249 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 518: checkcast #95 // class java/lang/Iterable\n 521: astore 7\n 523: iconst_0\n 524: istore 8\n 526: aload 7\n 528: invokeinterface #105, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 533: astore 9\n 535: aload 9\n 537: invokeinterface #111, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 542: ifne 555\n 545: new #251 // class java/lang/UnsupportedOperationException\n 548: dup\n 549: ldc #253 // String Empty collection can\\'t be reduced.\n 551: invokespecial #254 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 554: athrow\n 555: aload 9\n 557: invokeinterface #115, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 562: astore 10\n 564: aload 9\n 566: invokeinterface #111, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 571: ifeq 615\n 574: aload 10\n 576: aload 9\n 578: invokeinterface #115, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 583: checkcast #157 // class java/lang/Number\n 586: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 589: istore 11\n 591: checkcast #157 // class java/lang/Number\n 594: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 597: istore 12\n 599: iconst_0\n 600: istore 13\n 602: iload 12\n 604: iload 11\n 606: imul\n 607: invokestatic #230 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 610: astore 10\n 612: goto 564\n 615: aload 10\n 617: checkcast #157 // class java/lang/Number\n 620: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 623: istore 6\n 625: iconst_0\n 626: istore 7\n 628: iload 7\n 630: iload_2\n 631: if_icmpge 964\n 634: iload 7\n 636: istore 8\n 638: iconst_0\n 639: istore 9\n 641: aload 4\n 643: checkcast #95 // class java/lang/Iterable\n 646: astore 10\n 648: iconst_0\n 649: istore 11\n 651: aload 10\n 653: invokeinterface #105, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 658: astore 12\n 660: aload 12\n 662: invokeinterface #111, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 667: ifeq 956\n 670: aload 12\n 672: invokeinterface #115, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 677: astore 13\n 679: aload 13\n 681: checkcast #117 // class Day11Kt$main$Monkey\n 684: astore 14\n 686: iconst_0\n 687: istore 15\n 689: aload 5\n 691: aload 14\n 693: invokevirtual #227 // Method Day11Kt$main$Monkey.getId:()I\n 696: invokestatic #230 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 699: aload 5\n 701: aload 14\n 703: invokevirtual #227 // Method Day11Kt$main$Monkey.getId:()I\n 706: invokestatic #230 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 709: invokeinterface #256, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 714: dup\n 715: invokestatic #260 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 718: checkcast #157 // class java/lang/Number\n 721: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 724: aload 14\n 726: invokevirtual #264 // Method Day11Kt$main$Monkey.getItems:()Lkotlin/collections/ArrayDeque;\n 729: invokevirtual #267 // Method kotlin/collections/ArrayDeque.size:()I\n 732: iadd\n 733: invokestatic #230 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 736: invokeinterface #234, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 741: pop\n 742: aload 14\n 744: invokevirtual #264 // Method Day11Kt$main$Monkey.getItems:()Lkotlin/collections/ArrayDeque;\n 747: checkcast #175 // class java/util/Collection\n 750: invokeinterface #270, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 755: ifne 762\n 758: iconst_1\n 759: goto 763\n 762: iconst_0\n 763: ifeq 951\n 766: aload 14\n 768: invokevirtual #264 // Method Day11Kt$main$Monkey.getItems:()Lkotlin/collections/ArrayDeque;\n 771: invokevirtual #273 // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;\n 774: checkcast #157 // class java/lang/Number\n 777: invokevirtual #277 // Method java/lang/Number.longValue:()J\n 780: lstore 16\n 782: aload 14\n 784: invokevirtual #280 // Method Day11Kt$main$Monkey.getOperationParam:()Ljava/lang/String;\n 787: ldc_w #282 // String old\n 790: invokestatic #286 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 793: ifeq 801\n 796: lload 16\n 798: goto 809\n 801: aload 14\n 803: invokevirtual #280 // Method Day11Kt$main$Monkey.getOperationParam:()Ljava/lang/String;\n 806: invokestatic #76 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 809: lstore 18\n 811: aload 14\n 813: invokevirtual #290 // Method Day11Kt$main$Monkey.getOperation:()C\n 816: tableswitch { // 42 to 43\n 42: 840\n 43: 848\n default: 856\n }\n 840: lload 16\n 842: lload 18\n 844: lmul\n 845: goto 891\n 848: lload 16\n 850: lload 18\n 852: ladd\n 853: goto 891\n 856: new #292 // class java/lang/Exception\n 859: dup\n 860: new #294 // class java/lang/StringBuilder\n 863: dup\n 864: invokespecial #295 // Method java/lang/StringBuilder.\"<init>\":()V\n 867: ldc_w #297 // String Unknown operation\n 870: invokevirtual #301 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 873: aload 14\n 875: invokevirtual #304 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 878: ldc_w #306 // String .operation\n 881: invokevirtual #301 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 884: invokevirtual #309 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 887: invokespecial #310 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 890: athrow\n 891: iload_3\n 892: i2l\n 893: ldiv\n 894: iload 6\n 896: i2l\n 897: lrem\n 898: lstore 20\n 900: aload 4\n 902: lload 20\n 904: aload 14\n 906: invokevirtual #244 // Method Day11Kt$main$Monkey.getTestParam:()I\n 909: i2l\n 910: lrem\n 911: lconst_0\n 912: lcmp\n 913: ifne 924\n 916: aload 14\n 918: invokevirtual #313 // Method Day11Kt$main$Monkey.getOnSuccessTarget:()I\n 921: goto 929\n 924: aload 14\n 926: invokevirtual #316 // Method Day11Kt$main$Monkey.getOnFailedTarget:()I\n 929: invokeinterface #121, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 934: checkcast #117 // class Day11Kt$main$Monkey\n 937: invokevirtual #264 // Method Day11Kt$main$Monkey.getItems:()Lkotlin/collections/ArrayDeque;\n 940: lload 20\n 942: invokestatic #22 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 945: invokevirtual #319 // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V\n 948: goto 742\n 951: nop\n 952: nop\n 953: goto 660\n 956: nop\n 957: nop\n 958: iinc 7, 1\n 961: goto 628\n 964: aload 5\n 966: invokeinterface #323, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 971: checkcast #95 // class java/lang/Iterable\n 974: invokestatic #327 // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;\n 977: iconst_2\n 978: invokestatic #331 // Method kotlin/collections/CollectionsKt.takeLast:(Ljava/util/List;I)Ljava/util/List;\n 981: checkcast #95 // class java/lang/Iterable\n 984: astore 7\n 986: iconst_0\n 987: istore 8\n 989: aload 7\n 991: astore 9\n 993: new #84 // class java/util/ArrayList\n 996: dup\n 997: aload 7\n 999: bipush 10\n 1001: invokestatic #238 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 1004: invokespecial #241 // Method java/util/ArrayList.\"<init>\":(I)V\n 1007: checkcast #175 // class java/util/Collection\n 1010: astore 10\n 1012: iconst_0\n 1013: istore 11\n 1015: aload 9\n 1017: invokeinterface #105, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 1022: astore 12\n 1024: aload 12\n 1026: invokeinterface #111, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 1031: ifeq 1078\n 1034: aload 12\n 1036: invokeinterface #115, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 1041: astore 13\n 1043: aload 10\n 1045: aload 13\n 1047: checkcast #157 // class java/lang/Number\n 1050: invokevirtual #161 // Method java/lang/Number.intValue:()I\n 1053: istore 14\n 1055: astore 22\n 1057: iconst_0\n 1058: istore 15\n 1060: iload 14\n 1062: i2l\n 1063: invokestatic #22 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 1066: aload 22\n 1068: swap\n 1069: invokeinterface #245, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 1074: pop\n 1075: goto 1024\n 1078: aload 10\n 1080: checkcast #88 // class java/util/List\n 1083: nop\n 1084: checkcast #95 // class java/lang/Iterable\n 1087: astore 7\n 1089: nop\n 1090: iconst_0\n 1091: istore 8\n 1093: aload 7\n 1095: invokeinterface #105, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 1100: astore 9\n 1102: aload 9\n 1104: invokeinterface #111, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 1109: ifne 1122\n 1112: new #251 // class java/lang/UnsupportedOperationException\n 1115: dup\n 1116: ldc #253 // String Empty collection can\\'t be reduced.\n 1118: invokespecial #254 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 1121: athrow\n 1122: aload 9\n 1124: invokeinterface #115, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 1129: astore 10\n 1131: aload 9\n 1133: invokeinterface #111, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 1138: ifeq 1182\n 1141: aload 10\n 1143: aload 9\n 1145: invokeinterface #115, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 1150: checkcast #157 // class java/lang/Number\n 1153: invokevirtual #277 // Method java/lang/Number.longValue:()J\n 1156: lstore 11\n 1158: checkcast #157 // class java/lang/Number\n 1161: invokevirtual #277 // Method java/lang/Number.longValue:()J\n 1164: lstore 13\n 1166: iconst_0\n 1167: istore 15\n 1169: lload 13\n 1171: lload 11\n 1173: lmul\n 1174: invokestatic #22 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 1177: astore 10\n 1179: goto 1131\n 1182: aload 10\n 1184: checkcast #157 // class java/lang/Number\n 1187: invokevirtual #277 // Method java/lang/Number.longValue:()J\n 1190: lreturn\n\n private static final long main$part1(kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: bipush 20\n 4: iconst_3\n 5: invokestatic #379 // Method main$monkeyBusiness:(Lkotlin/text/Regex;Ljava/util/List;II)J\n 8: lreturn\n\n private static final long main$part2(kotlin.text.Regex, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: sipush 10000\n 5: iconst_1\n 6: invokestatic #379 // Method main$monkeyBusiness:(Lkotlin/text/Regex;Ljava/util/List;II)J\n 9: lreturn\n\n public static final long access$main$part1(kotlin.text.Regex, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #383 // Method main$part1:(Lkotlin/text/Regex;Ljava/util/List;)J\n 5: lreturn\n\n public static final long access$main$part2(kotlin.text.Regex, java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #386 // Method main$part2:(Lkotlin/text/Regex;Ljava/util/List;)J\n 5: lreturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day19.kt
import java.lang.Integer.max fun main() { fun part1(input: List<String>): Int { val blueprints = input.map { line -> line.ints().let { listOf( VectorN(it[1], 0, 0, 0), VectorN(it[2], 0, 0, 0), VectorN(it[3], it[4], 0, 0), VectorN(it[5], 0, it[6], 0), ) } } val timeLimit = 24 var bestForMinute = Array<Int>(30) { 0 } fun decision(budget: VectorN, robots: VectorN, minutes: Int, blueprint: List<VectorN>, maxBudget: VectorN, robotsWeDidNotBuild:Set<Int> = emptySet()): Int { if (minutes > timeLimit) { // end condition return budget.components[3] } // pruning if (budget.components[3] > bestForMinute[minutes]) bestForMinute[minutes] = budget.components[3] if (bestForMinute[minutes] > budget.components[3]) return budget.components[3] // robots we can afford val robotsWeCanAfford = blueprint.mapIndexed { index, it -> index to ((budget - it).components.min() >= 0) }.filter { (_, canAfford) -> canAfford }.map { it.first }.toSet() // we need to buy geode if we can afford it if (robotsWeCanAfford.contains(3)) return decision(budget + robots - blueprint[3], robots + VectorN(0, 0, 0, 1), minutes + 1, blueprint, maxBudget) val robotsItMakesSenseToMake = robotsWeCanAfford.filter { robotIndex -> when{ robotIndex in robotsWeDidNotBuild -> false (robots.components[robotIndex] >= maxBudget.components[robotIndex]) -> false else -> true } }.toSet() val withoutBuilding = decision(budget + robots, robots, minutes + 1, blueprint, maxBudget, robotsItMakesSenseToMake) if (robotsItMakesSenseToMake.isNotEmpty()) { val withBuilding = robotsItMakesSenseToMake.maxOf { robotIndex -> decision(budget + robots - blueprint[robotIndex], robots + VectorN(0, 0, 0, 0).also { it.components[robotIndex] = 1 }, minutes + 1, blueprint, maxBudget) } return max(withBuilding, withoutBuilding) } return withoutBuilding } return blueprints.mapIndexed { index, blueprint -> bestForMinute = Array<Int>(30) { 0 } val budget = VectorN(0, 0, 0, 0) // ore, clay, obsidian, geode val robots = VectorN(1, 0, 0, 0) val maxBudget = VectorN((0..3).map { c -> blueprint.maxOf { it.components[c] } }.toMutableList()) println("maxBudget $maxBudget") val maxGeodes = decision(budget, robots, 1, blueprint, maxBudget) println("Blueprint $index produces max $maxGeodes geodes") (index + 1) * maxGeodes }.sum() } fun part2(input: List<String>): Int { val blueprints = input.map { line -> line.ints().let { listOf( VectorN(it[1], 0, 0, 0), VectorN(it[2], 0, 0, 0), VectorN(it[3], it[4], 0, 0), VectorN(it[5], 0, it[6], 0), ) } }.take(3) val timeLimit = 32 var bestForMinute = Array<Int>(33) { 0 } fun decision(budget: VectorN, robots: VectorN, minutes: Int, blueprint: List<VectorN>, maxBudget: VectorN, robotsWeDidNotBuild:Set<Int> = emptySet()): Int { if (minutes > timeLimit) { // end condition return budget.components[3] } // pruning if (budget.components[3] > bestForMinute[minutes]) bestForMinute[minutes] = budget.components[3] if (bestForMinute[minutes] > budget.components[3]) return budget.components[3] // robots we can afford val robotsWeCanAfford = blueprint.mapIndexed { index, it -> index to ((budget - it).components.min() >= 0) }.filter { (_, canAfford) -> canAfford }.map { it.first }.toSet() // we need to buy geode if we can afford it if (robotsWeCanAfford.contains(3)) return decision(budget + robots - blueprint[3], robots + VectorN(0, 0, 0, 1), minutes + 1, blueprint, maxBudget) val robotsItMakesSenseToMake = robotsWeCanAfford.filter { robotIndex -> when{ robotIndex in robotsWeDidNotBuild -> false (robots.components[robotIndex] >= maxBudget.components[robotIndex]) -> false else -> true } }.toSet() val withoutBuilding = decision(budget + robots, robots, minutes + 1, blueprint, maxBudget, robotsItMakesSenseToMake) if (robotsItMakesSenseToMake.isNotEmpty()) { val withBuilding = robotsItMakesSenseToMake.maxOf { robotIndex -> decision(budget + robots - blueprint[robotIndex], robots + VectorN(0, 0, 0, 0).also { it.components[robotIndex] = 1 }, minutes + 1, blueprint, maxBudget) } return max(withBuilding, withoutBuilding) } return withoutBuilding } return blueprints.mapIndexed { index, blueprint -> bestForMinute = Array<Int>(33) { 0 } val budget = VectorN(0, 0, 0, 0) // ore, clay, obsidian, geode val robots = VectorN(1, 0, 0, 0) val maxBudget = VectorN((0..3).map { c -> blueprint.maxOf { it.components[c] } }.toMutableList()) println("maxBudget $maxBudget") val maxGeodes = decision(budget, robots, 1, blueprint, maxBudget) println("Blueprint $index produces max $maxGeodes geodes") maxGeodes }.reduce(Int::times) } test( day = 19, testTarget1 = 33, testTarget2 = 3472, // 56 * 62 part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day19Kt$main$2.class", "javap": "Compiled from \"Day19.kt\"\nfinal class Day19Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day19Kt$main$2 INSTANCE;\n\n Day19Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day19Kt.access$main$part2:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day19Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay19Kt$main$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day19Kt$main$1.class", "javap": "Compiled from \"Day19.kt\"\nfinal class Day19Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day19Kt$main$1 INSTANCE;\n\n Day19Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day19Kt.access$main$part1:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day19Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay19Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day19Kt.class", "javap": "Compiled from \"Day19.kt\"\npublic final class Day19Kt {\n public static final void main();\n Code:\n 0: bipush 19\n 2: bipush 33\n 4: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 7: sipush 3472\n 10: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: getstatic #18 // Field Day19Kt$main$1.INSTANCE:LDay19Kt$main$1;\n 16: checkcast #20 // class kotlin/jvm/functions/Function1\n 19: getstatic #25 // Field Day19Kt$main$2.INSTANCE:LDay19Kt$main$2;\n 22: checkcast #20 // class kotlin/jvm/functions/Function1\n 25: invokestatic #31 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 28: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #34 // Method main:()V\n 3: return\n\n private static final int main$part1$decision(int, kotlin.jvm.internal.Ref$ObjectRef<java.lang.Integer[]>, VectorN, VectorN, int, java.util.List<VectorN>, VectorN, java.util.Set<java.lang.Integer>);\n Code:\n 0: iload 4\n 2: iload_0\n 3: if_icmple 23\n 6: aload_2\n 7: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 10: iconst_3\n 11: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 16: checkcast #53 // class java/lang/Number\n 19: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 22: ireturn\n 23: aload_2\n 24: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 27: iconst_3\n 28: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 33: checkcast #53 // class java/lang/Number\n 36: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 39: aload_1\n 40: getfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 43: checkcast #65 // class \"[Ljava/lang/Integer;\"\n 46: iload 4\n 48: aaload\n 49: invokevirtual #66 // Method java/lang/Integer.intValue:()I\n 52: if_icmple 75\n 55: aload_1\n 56: getfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 59: checkcast #65 // class \"[Ljava/lang/Integer;\"\n 62: iload 4\n 64: aload_2\n 65: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 68: iconst_3\n 69: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 74: aastore\n 75: aload_1\n 76: getfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 79: checkcast #65 // class \"[Ljava/lang/Integer;\"\n 82: iload 4\n 84: aaload\n 85: invokevirtual #66 // Method java/lang/Integer.intValue:()I\n 88: aload_2\n 89: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 92: iconst_3\n 93: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 98: checkcast #53 // class java/lang/Number\n 101: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 104: if_icmple 124\n 107: aload_2\n 108: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 111: iconst_3\n 112: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 117: checkcast #53 // class java/lang/Number\n 120: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 123: ireturn\n 124: aload 5\n 126: checkcast #68 // class java/lang/Iterable\n 129: astore 9\n 131: iconst_0\n 132: istore 10\n 134: aload 9\n 136: astore 11\n 138: new #70 // class java/util/ArrayList\n 141: dup\n 142: aload 9\n 144: bipush 10\n 146: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 149: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 152: checkcast #82 // class java/util/Collection\n 155: astore 12\n 157: iconst_0\n 158: istore 13\n 160: iconst_0\n 161: istore 14\n 163: aload 11\n 165: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 170: astore 15\n 172: aload 15\n 174: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 179: ifeq 276\n 182: aload 15\n 184: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 189: astore 16\n 191: aload 12\n 193: iload 14\n 195: iinc 14, 1\n 198: istore 17\n 200: iload 17\n 202: ifge 208\n 205: invokestatic #99 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 208: iload 17\n 210: aload 16\n 212: checkcast #41 // class VectorN\n 215: astore 18\n 217: istore 19\n 219: astore 25\n 221: iconst_0\n 222: istore 20\n 224: iload 19\n 226: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 229: aload_2\n 230: aload 18\n 232: invokevirtual #103 // Method VectorN.minus:(LVectorN;)LVectorN;\n 235: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 238: checkcast #68 // class java/lang/Iterable\n 241: invokestatic #107 // Method kotlin/collections/CollectionsKt.minOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 244: checkcast #53 // class java/lang/Number\n 247: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 250: iflt 257\n 253: iconst_1\n 254: goto 258\n 257: iconst_0\n 258: invokestatic #112 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;\n 261: invokestatic #118 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 264: aload 25\n 266: swap\n 267: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 272: pop\n 273: goto 172\n 276: aload 12\n 278: checkcast #47 // class java/util/List\n 281: nop\n 282: checkcast #68 // class java/lang/Iterable\n 285: astore 9\n 287: nop\n 288: iconst_0\n 289: istore 10\n 291: aload 9\n 293: astore 11\n 295: new #70 // class java/util/ArrayList\n 298: dup\n 299: invokespecial #124 // Method java/util/ArrayList.\"<init>\":()V\n 302: checkcast #82 // class java/util/Collection\n 305: astore 12\n 307: iconst_0\n 308: istore 13\n 310: aload 11\n 312: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 317: astore 14\n 319: aload 14\n 321: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 326: ifeq 379\n 329: aload 14\n 331: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 336: astore 15\n 338: aload 15\n 340: checkcast #126 // class kotlin/Pair\n 343: astore 16\n 345: iconst_0\n 346: istore 17\n 348: aload 16\n 350: invokevirtual #129 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 353: checkcast #109 // class java/lang/Boolean\n 356: invokevirtual #132 // Method java/lang/Boolean.booleanValue:()Z\n 359: istore 18\n 361: iload 18\n 363: ifeq 319\n 366: aload 12\n 368: aload 15\n 370: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 375: pop\n 376: goto 319\n 379: aload 12\n 381: checkcast #47 // class java/util/List\n 384: nop\n 385: checkcast #68 // class java/lang/Iterable\n 388: astore 9\n 390: nop\n 391: iconst_0\n 392: istore 10\n 394: aload 9\n 396: astore 11\n 398: new #70 // class java/util/ArrayList\n 401: dup\n 402: aload 9\n 404: bipush 10\n 406: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 409: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 412: checkcast #82 // class java/util/Collection\n 415: astore 12\n 417: iconst_0\n 418: istore 13\n 420: aload 11\n 422: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 427: astore 14\n 429: aload 14\n 431: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 436: ifeq 488\n 439: aload 14\n 441: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 446: astore 15\n 448: aload 12\n 450: aload 15\n 452: checkcast #126 // class kotlin/Pair\n 455: astore 16\n 457: astore 25\n 459: iconst_0\n 460: istore 17\n 462: aload 16\n 464: invokevirtual #135 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 467: checkcast #53 // class java/lang/Number\n 470: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 473: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 476: aload 25\n 478: swap\n 479: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 484: pop\n 485: goto 429\n 488: aload 12\n 490: checkcast #47 // class java/util/List\n 493: nop\n 494: checkcast #68 // class java/lang/Iterable\n 497: invokestatic #139 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 500: astore 8\n 502: aload 8\n 504: iconst_3\n 505: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 508: invokeinterface #144, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 513: ifeq 592\n 516: iload_0\n 517: aload_1\n 518: aload_2\n 519: aload_3\n 520: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 523: aload 5\n 525: iconst_3\n 526: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 531: checkcast #41 // class VectorN\n 534: invokevirtual #103 // Method VectorN.minus:(LVectorN;)LVectorN;\n 537: aload_3\n 538: new #41 // class VectorN\n 541: dup\n 542: iconst_4\n 543: newarray int\n 545: astore 9\n 547: aload 9\n 549: iconst_0\n 550: iconst_0\n 551: iastore\n 552: aload 9\n 554: iconst_1\n 555: iconst_0\n 556: iastore\n 557: aload 9\n 559: iconst_2\n 560: iconst_0\n 561: iastore\n 562: aload 9\n 564: iconst_3\n 565: iconst_1\n 566: iastore\n 567: aload 9\n 569: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 572: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 575: iload 4\n 577: iconst_1\n 578: iadd\n 579: aload 5\n 581: aload 6\n 583: aconst_null\n 584: sipush 128\n 587: aconst_null\n 588: invokestatic #154 // Method main$part1$decision$default:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;ILjava/lang/Object;)I\n 591: ireturn\n 592: aload 8\n 594: checkcast #68 // class java/lang/Iterable\n 597: astore 10\n 599: iconst_0\n 600: istore 11\n 602: aload 10\n 604: astore 12\n 606: new #70 // class java/util/ArrayList\n 609: dup\n 610: invokespecial #124 // Method java/util/ArrayList.\"<init>\":()V\n 613: checkcast #82 // class java/util/Collection\n 616: astore 13\n 618: iconst_0\n 619: istore 14\n 621: aload 12\n 623: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 628: astore 15\n 630: aload 15\n 632: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 637: ifeq 742\n 640: aload 15\n 642: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 647: astore 16\n 649: aload 16\n 651: checkcast #53 // class java/lang/Number\n 654: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 657: istore 17\n 659: iconst_0\n 660: istore 18\n 662: nop\n 663: aload 7\n 665: iload 17\n 667: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 670: invokeinterface #144, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 675: ifeq 682\n 678: iconst_0\n 679: goto 725\n 682: aload_3\n 683: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 686: iload 17\n 688: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 693: checkcast #53 // class java/lang/Number\n 696: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 699: aload 6\n 701: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 704: iload 17\n 706: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 711: checkcast #53 // class java/lang/Number\n 714: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 717: if_icmplt 724\n 720: iconst_0\n 721: goto 725\n 724: iconst_1\n 725: nop\n 726: ifeq 630\n 729: aload 13\n 731: aload 16\n 733: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 738: pop\n 739: goto 630\n 742: aload 13\n 744: checkcast #47 // class java/util/List\n 747: nop\n 748: checkcast #68 // class java/lang/Iterable\n 751: invokestatic #139 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 754: astore 9\n 756: iload_0\n 757: aload_1\n 758: aload_2\n 759: aload_3\n 760: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 763: aload_3\n 764: iload 4\n 766: iconst_1\n 767: iadd\n 768: aload 5\n 770: aload 6\n 772: aload 9\n 774: invokestatic #156 // Method main$part1$decision:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;)I\n 777: istore 10\n 779: aload 9\n 781: checkcast #82 // class java/util/Collection\n 784: invokeinterface #159, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 789: ifne 796\n 792: iconst_1\n 793: goto 797\n 796: iconst_0\n 797: ifeq 1156\n 800: aload 9\n 802: checkcast #68 // class java/lang/Iterable\n 805: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 810: astore 13\n 812: aload 13\n 814: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 819: ifne 830\n 822: new #161 // class java/util/NoSuchElementException\n 825: dup\n 826: invokespecial #162 // Method java/util/NoSuchElementException.\"<init>\":()V\n 829: athrow\n 830: aload 13\n 832: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 837: checkcast #53 // class java/lang/Number\n 840: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 843: istore 14\n 845: iconst_0\n 846: istore 15\n 848: iload_0\n 849: aload_1\n 850: aload_2\n 851: aload_3\n 852: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 855: aload 5\n 857: iload 14\n 859: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 864: checkcast #41 // class VectorN\n 867: invokevirtual #103 // Method VectorN.minus:(LVectorN;)LVectorN;\n 870: aload_3\n 871: new #41 // class VectorN\n 874: dup\n 875: iconst_4\n 876: newarray int\n 878: astore 16\n 880: aload 16\n 882: iconst_0\n 883: iconst_0\n 884: iastore\n 885: aload 16\n 887: iconst_1\n 888: iconst_0\n 889: iastore\n 890: aload 16\n 892: iconst_2\n 893: iconst_0\n 894: iastore\n 895: aload 16\n 897: iconst_3\n 898: iconst_0\n 899: iastore\n 900: aload 16\n 902: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 905: astore 16\n 907: aload 16\n 909: astore 17\n 911: astore 18\n 913: astore 19\n 915: astore 20\n 917: istore 21\n 919: iconst_0\n 920: istore 22\n 922: aload 17\n 924: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 927: iload 14\n 929: iconst_1\n 930: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 933: invokeinterface #166, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 938: pop\n 939: getstatic #171 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 942: astore 23\n 944: iload 21\n 946: aload 20\n 948: aload 19\n 950: aload 18\n 952: aload 16\n 954: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 957: iload 4\n 959: iconst_1\n 960: iadd\n 961: aload 5\n 963: aload 6\n 965: aconst_null\n 966: sipush 128\n 969: aconst_null\n 970: invokestatic #154 // Method main$part1$decision$default:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;ILjava/lang/Object;)I\n 973: istore 14\n 975: aload 13\n 977: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 982: ifeq 1144\n 985: aload 13\n 987: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 992: checkcast #53 // class java/lang/Number\n 995: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 998: istore 15\n 1000: iconst_0\n 1001: istore 16\n 1003: iload_0\n 1004: aload_1\n 1005: aload_2\n 1006: aload_3\n 1007: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 1010: aload 5\n 1012: iload 15\n 1014: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1019: checkcast #41 // class VectorN\n 1022: invokevirtual #103 // Method VectorN.minus:(LVectorN;)LVectorN;\n 1025: aload_3\n 1026: new #41 // class VectorN\n 1029: dup\n 1030: iconst_4\n 1031: newarray int\n 1033: astore 17\n 1035: aload 17\n 1037: iconst_0\n 1038: iconst_0\n 1039: iastore\n 1040: aload 17\n 1042: iconst_1\n 1043: iconst_0\n 1044: iastore\n 1045: aload 17\n 1047: iconst_2\n 1048: iconst_0\n 1049: iastore\n 1050: aload 17\n 1052: iconst_3\n 1053: iconst_0\n 1054: iastore\n 1055: aload 17\n 1057: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 1060: astore 17\n 1062: aload 17\n 1064: astore 18\n 1066: astore 19\n 1068: astore 20\n 1070: astore 21\n 1072: istore 22\n 1074: iconst_0\n 1075: istore 23\n 1077: aload 18\n 1079: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 1082: iload 15\n 1084: iconst_1\n 1085: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 1088: invokeinterface #166, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 1093: pop\n 1094: getstatic #171 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 1097: astore 24\n 1099: iload 22\n 1101: aload 21\n 1103: aload 20\n 1105: aload 19\n 1107: aload 17\n 1109: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 1112: iload 4\n 1114: iconst_1\n 1115: iadd\n 1116: aload 5\n 1118: aload 6\n 1120: aconst_null\n 1121: sipush 128\n 1124: aconst_null\n 1125: invokestatic #154 // Method main$part1$decision$default:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;ILjava/lang/Object;)I\n 1128: istore 15\n 1130: iload 14\n 1132: iload 15\n 1134: if_icmpge 975\n 1137: iload 15\n 1139: istore 14\n 1141: goto 975\n 1144: iload 14\n 1146: istore 11\n 1148: iload 11\n 1150: iload 10\n 1152: invokestatic #175 // Method java/lang/Integer.max:(II)I\n 1155: ireturn\n 1156: iload 10\n 1158: ireturn\n\n static int main$part1$decision$default(int, kotlin.jvm.internal.Ref$ObjectRef, VectorN, VectorN, int, java.util.List, VectorN, java.util.Set, int, java.lang.Object);\n Code:\n 0: iload 8\n 2: sipush 128\n 5: iand\n 6: ifeq 14\n 9: invokestatic #228 // Method kotlin/collections/SetsKt.emptySet:()Ljava/util/Set;\n 12: astore 7\n 14: iload_0\n 15: aload_1\n 16: aload_2\n 17: aload_3\n 18: iload 4\n 20: aload 5\n 22: aload 6\n 24: aload 7\n 26: invokestatic #156 // Method main$part1$decision:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;)I\n 29: ireturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #68 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #70 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #82 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 340\n 50: aload 7\n 52: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #233 // class java/lang/String\n 66: astore 9\n 68: astore 34\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: invokestatic #237 // Method UtilsKt.ints:(Ljava/lang/String;)Ljava/util/List;\n 78: astore 11\n 80: iconst_0\n 81: istore 12\n 83: iconst_4\n 84: anewarray #41 // class VectorN\n 87: astore 13\n 89: aload 13\n 91: iconst_0\n 92: new #41 // class VectorN\n 95: dup\n 96: iconst_4\n 97: newarray int\n 99: astore 14\n 101: aload 14\n 103: iconst_0\n 104: aload 11\n 106: iconst_1\n 107: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 112: checkcast #53 // class java/lang/Number\n 115: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 118: iastore\n 119: aload 14\n 121: iconst_1\n 122: iconst_0\n 123: iastore\n 124: aload 14\n 126: iconst_2\n 127: iconst_0\n 128: iastore\n 129: aload 14\n 131: iconst_3\n 132: iconst_0\n 133: iastore\n 134: aload 14\n 136: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 139: aastore\n 140: aload 13\n 142: iconst_1\n 143: new #41 // class VectorN\n 146: dup\n 147: iconst_4\n 148: newarray int\n 150: astore 14\n 152: aload 14\n 154: iconst_0\n 155: aload 11\n 157: iconst_2\n 158: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 163: checkcast #53 // class java/lang/Number\n 166: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 169: iastore\n 170: aload 14\n 172: iconst_1\n 173: iconst_0\n 174: iastore\n 175: aload 14\n 177: iconst_2\n 178: iconst_0\n 179: iastore\n 180: aload 14\n 182: iconst_3\n 183: iconst_0\n 184: iastore\n 185: aload 14\n 187: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 190: aastore\n 191: aload 13\n 193: iconst_2\n 194: new #41 // class VectorN\n 197: dup\n 198: iconst_4\n 199: newarray int\n 201: astore 14\n 203: aload 14\n 205: iconst_0\n 206: aload 11\n 208: iconst_3\n 209: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 214: checkcast #53 // class java/lang/Number\n 217: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 220: iastore\n 221: aload 14\n 223: iconst_1\n 224: aload 11\n 226: iconst_4\n 227: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 232: checkcast #53 // class java/lang/Number\n 235: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 238: iastore\n 239: aload 14\n 241: iconst_2\n 242: iconst_0\n 243: iastore\n 244: aload 14\n 246: iconst_3\n 247: iconst_0\n 248: iastore\n 249: aload 14\n 251: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 254: aastore\n 255: aload 13\n 257: iconst_3\n 258: new #41 // class VectorN\n 261: dup\n 262: iconst_4\n 263: newarray int\n 265: astore 14\n 267: aload 14\n 269: iconst_0\n 270: aload 11\n 272: iconst_5\n 273: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 278: checkcast #53 // class java/lang/Number\n 281: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 284: iastore\n 285: aload 14\n 287: iconst_1\n 288: iconst_0\n 289: iastore\n 290: aload 14\n 292: iconst_2\n 293: aload 11\n 295: bipush 6\n 297: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 302: checkcast #53 // class java/lang/Number\n 305: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 308: iastore\n 309: aload 14\n 311: iconst_3\n 312: iconst_0\n 313: iastore\n 314: aload 14\n 316: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 319: aastore\n 320: aload 13\n 322: invokestatic #241 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 325: nop\n 326: nop\n 327: nop\n 328: aload 34\n 330: swap\n 331: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 336: pop\n 337: goto 40\n 340: aload 5\n 342: checkcast #47 // class java/util/List\n 345: nop\n 346: astore_1\n 347: bipush 24\n 349: istore_2\n 350: new #59 // class kotlin/jvm/internal/Ref$ObjectRef\n 353: dup\n 354: invokespecial #242 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 357: astore_3\n 358: aload_3\n 359: iconst_0\n 360: istore 4\n 362: bipush 30\n 364: anewarray #8 // class java/lang/Integer\n 367: astore 5\n 369: astore 34\n 371: iload 4\n 373: bipush 30\n 375: if_icmpge 397\n 378: iload 4\n 380: istore 6\n 382: aload 5\n 384: iload 6\n 386: iconst_0\n 387: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 390: aastore\n 391: iinc 4, 1\n 394: goto 371\n 397: aload 34\n 399: aload 5\n 401: putfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 404: aload_1\n 405: checkcast #68 // class java/lang/Iterable\n 408: astore 4\n 410: iconst_0\n 411: istore 5\n 413: aload 4\n 415: astore 6\n 417: new #70 // class java/util/ArrayList\n 420: dup\n 421: aload 4\n 423: bipush 10\n 425: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 428: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 431: checkcast #82 // class java/util/Collection\n 434: astore 7\n 436: iconst_0\n 437: istore 8\n 439: iconst_0\n 440: istore 9\n 442: aload 6\n 444: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 449: astore 10\n 451: aload 10\n 453: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 458: ifeq 987\n 461: aload 10\n 463: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 468: astore 11\n 470: aload 7\n 472: iload 9\n 474: iinc 9, 1\n 477: istore 12\n 479: iload 12\n 481: ifge 487\n 484: invokestatic #99 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 487: iload 12\n 489: aload 11\n 491: checkcast #47 // class java/util/List\n 494: astore 13\n 496: istore 14\n 498: astore 34\n 500: iconst_0\n 501: istore 15\n 503: aload_3\n 504: iconst_0\n 505: istore 16\n 507: bipush 30\n 509: anewarray #8 // class java/lang/Integer\n 512: astore 17\n 514: astore 18\n 516: iload 16\n 518: bipush 30\n 520: if_icmpge 542\n 523: iload 16\n 525: istore 19\n 527: aload 17\n 529: iload 19\n 531: iconst_0\n 532: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 535: aastore\n 536: iinc 16, 1\n 539: goto 516\n 542: aload 18\n 544: aload 17\n 546: putfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 549: new #41 // class VectorN\n 552: dup\n 553: iconst_4\n 554: newarray int\n 556: astore 17\n 558: aload 17\n 560: iconst_0\n 561: iconst_0\n 562: iastore\n 563: aload 17\n 565: iconst_1\n 566: iconst_0\n 567: iastore\n 568: aload 17\n 570: iconst_2\n 571: iconst_0\n 572: iastore\n 573: aload 17\n 575: iconst_3\n 576: iconst_0\n 577: iastore\n 578: aload 17\n 580: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 583: astore 16\n 585: new #41 // class VectorN\n 588: dup\n 589: iconst_4\n 590: newarray int\n 592: astore 19\n 594: aload 19\n 596: iconst_0\n 597: iconst_1\n 598: iastore\n 599: aload 19\n 601: iconst_1\n 602: iconst_0\n 603: iastore\n 604: aload 19\n 606: iconst_2\n 607: iconst_0\n 608: iastore\n 609: aload 19\n 611: iconst_3\n 612: iconst_0\n 613: iastore\n 614: aload 19\n 616: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 619: astore 17\n 621: new #244 // class kotlin/ranges/IntRange\n 624: dup\n 625: iconst_0\n 626: iconst_3\n 627: invokespecial #247 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 630: checkcast #68 // class java/lang/Iterable\n 633: astore 20\n 635: iconst_0\n 636: istore 21\n 638: aload 20\n 640: astore 22\n 642: new #70 // class java/util/ArrayList\n 645: dup\n 646: aload 20\n 648: bipush 10\n 650: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 653: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 656: checkcast #82 // class java/util/Collection\n 659: astore 23\n 661: iconst_0\n 662: istore 24\n 664: aload 22\n 666: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 671: astore 25\n 673: aload 25\n 675: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 680: ifeq 846\n 683: aload 25\n 685: checkcast #249 // class kotlin/collections/IntIterator\n 688: invokevirtual #252 // Method kotlin/collections/IntIterator.nextInt:()I\n 691: istore 26\n 693: aload 23\n 695: iload 26\n 697: istore 27\n 699: astore 28\n 701: iconst_0\n 702: istore 29\n 704: aload 13\n 706: checkcast #68 // class java/lang/Iterable\n 709: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 714: astore 30\n 716: aload 30\n 718: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 723: ifne 734\n 726: new #161 // class java/util/NoSuchElementException\n 729: dup\n 730: invokespecial #162 // Method java/util/NoSuchElementException.\"<init>\":()V\n 733: athrow\n 734: aload 30\n 736: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 741: checkcast #41 // class VectorN\n 744: astore 31\n 746: iconst_0\n 747: istore 32\n 749: aload 31\n 751: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 754: iload 27\n 756: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 761: checkcast #53 // class java/lang/Number\n 764: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 767: istore 31\n 769: aload 30\n 771: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 776: ifeq 828\n 779: aload 30\n 781: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 786: checkcast #41 // class VectorN\n 789: astore 32\n 791: iconst_0\n 792: istore 33\n 794: aload 32\n 796: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 799: iload 27\n 801: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 806: checkcast #53 // class java/lang/Number\n 809: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 812: istore 32\n 814: iload 31\n 816: iload 32\n 818: if_icmpge 769\n 821: iload 32\n 823: istore 31\n 825: goto 769\n 828: iload 31\n 830: nop\n 831: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 834: aload 28\n 836: swap\n 837: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 842: pop\n 843: goto 673\n 846: aload 23\n 848: checkcast #47 // class java/util/List\n 851: nop\n 852: checkcast #82 // class java/util/Collection\n 855: invokestatic #256 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 858: astore 35\n 860: new #41 // class VectorN\n 863: dup\n 864: aload 35\n 866: invokespecial #259 // Method VectorN.\"<init>\":(Ljava/util/List;)V\n 869: astore 19\n 871: new #261 // class java/lang/StringBuilder\n 874: dup\n 875: invokespecial #262 // Method java/lang/StringBuilder.\"<init>\":()V\n 878: ldc_w #264 // String maxBudget\n 881: invokevirtual #268 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 884: aload 19\n 886: invokevirtual #271 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 889: invokevirtual #275 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 892: getstatic #281 // Field java/lang/System.out:Ljava/io/PrintStream;\n 895: swap\n 896: invokevirtual #287 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 899: iload_2\n 900: aload_3\n 901: aload 16\n 903: aload 17\n 905: iconst_1\n 906: aload 13\n 908: aload 19\n 910: aconst_null\n 911: sipush 128\n 914: aconst_null\n 915: invokestatic #154 // Method main$part1$decision$default:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;ILjava/lang/Object;)I\n 918: istore 20\n 920: new #261 // class java/lang/StringBuilder\n 923: dup\n 924: invokespecial #262 // Method java/lang/StringBuilder.\"<init>\":()V\n 927: ldc_w #289 // String Blueprint\n 930: invokevirtual #268 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 933: iload 14\n 935: invokevirtual #292 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 938: ldc_w #294 // String produces max\n 941: invokevirtual #268 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 944: iload 20\n 946: invokevirtual #292 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 949: ldc_w #296 // String geodes\n 952: invokevirtual #268 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 955: invokevirtual #275 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 958: getstatic #281 // Field java/lang/System.out:Ljava/io/PrintStream;\n 961: swap\n 962: invokevirtual #287 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 965: iload 14\n 967: iconst_1\n 968: iadd\n 969: iload 20\n 971: imul\n 972: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 975: aload 34\n 977: swap\n 978: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 983: pop\n 984: goto 451\n 987: aload 7\n 989: checkcast #47 // class java/util/List\n 992: nop\n 993: checkcast #68 // class java/lang/Iterable\n 996: invokestatic #300 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I\n 999: ireturn\n\n private static final int main$part2$decision$19(int, kotlin.jvm.internal.Ref$ObjectRef<java.lang.Integer[]>, VectorN, VectorN, int, java.util.List<VectorN>, VectorN, java.util.Set<java.lang.Integer>);\n Code:\n 0: iload 4\n 2: iload_0\n 3: if_icmple 23\n 6: aload_2\n 7: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 10: iconst_3\n 11: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 16: checkcast #53 // class java/lang/Number\n 19: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 22: ireturn\n 23: aload_2\n 24: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 27: iconst_3\n 28: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 33: checkcast #53 // class java/lang/Number\n 36: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 39: aload_1\n 40: getfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 43: checkcast #65 // class \"[Ljava/lang/Integer;\"\n 46: iload 4\n 48: aaload\n 49: invokevirtual #66 // Method java/lang/Integer.intValue:()I\n 52: if_icmple 75\n 55: aload_1\n 56: getfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 59: checkcast #65 // class \"[Ljava/lang/Integer;\"\n 62: iload 4\n 64: aload_2\n 65: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 68: iconst_3\n 69: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 74: aastore\n 75: aload_1\n 76: getfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 79: checkcast #65 // class \"[Ljava/lang/Integer;\"\n 82: iload 4\n 84: aaload\n 85: invokevirtual #66 // Method java/lang/Integer.intValue:()I\n 88: aload_2\n 89: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 92: iconst_3\n 93: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 98: checkcast #53 // class java/lang/Number\n 101: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 104: if_icmple 124\n 107: aload_2\n 108: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 111: iconst_3\n 112: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 117: checkcast #53 // class java/lang/Number\n 120: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 123: ireturn\n 124: aload 5\n 126: checkcast #68 // class java/lang/Iterable\n 129: astore 9\n 131: iconst_0\n 132: istore 10\n 134: aload 9\n 136: astore 11\n 138: new #70 // class java/util/ArrayList\n 141: dup\n 142: aload 9\n 144: bipush 10\n 146: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 149: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 152: checkcast #82 // class java/util/Collection\n 155: astore 12\n 157: iconst_0\n 158: istore 13\n 160: iconst_0\n 161: istore 14\n 163: aload 11\n 165: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 170: astore 15\n 172: aload 15\n 174: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 179: ifeq 276\n 182: aload 15\n 184: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 189: astore 16\n 191: aload 12\n 193: iload 14\n 195: iinc 14, 1\n 198: istore 17\n 200: iload 17\n 202: ifge 208\n 205: invokestatic #99 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 208: iload 17\n 210: aload 16\n 212: checkcast #41 // class VectorN\n 215: astore 18\n 217: istore 19\n 219: astore 25\n 221: iconst_0\n 222: istore 20\n 224: iload 19\n 226: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 229: aload_2\n 230: aload 18\n 232: invokevirtual #103 // Method VectorN.minus:(LVectorN;)LVectorN;\n 235: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 238: checkcast #68 // class java/lang/Iterable\n 241: invokestatic #107 // Method kotlin/collections/CollectionsKt.minOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 244: checkcast #53 // class java/lang/Number\n 247: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 250: iflt 257\n 253: iconst_1\n 254: goto 258\n 257: iconst_0\n 258: invokestatic #112 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;\n 261: invokestatic #118 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 264: aload 25\n 266: swap\n 267: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 272: pop\n 273: goto 172\n 276: aload 12\n 278: checkcast #47 // class java/util/List\n 281: nop\n 282: checkcast #68 // class java/lang/Iterable\n 285: astore 9\n 287: nop\n 288: iconst_0\n 289: istore 10\n 291: aload 9\n 293: astore 11\n 295: new #70 // class java/util/ArrayList\n 298: dup\n 299: invokespecial #124 // Method java/util/ArrayList.\"<init>\":()V\n 302: checkcast #82 // class java/util/Collection\n 305: astore 12\n 307: iconst_0\n 308: istore 13\n 310: aload 11\n 312: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 317: astore 14\n 319: aload 14\n 321: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 326: ifeq 379\n 329: aload 14\n 331: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 336: astore 15\n 338: aload 15\n 340: checkcast #126 // class kotlin/Pair\n 343: astore 16\n 345: iconst_0\n 346: istore 17\n 348: aload 16\n 350: invokevirtual #129 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 353: checkcast #109 // class java/lang/Boolean\n 356: invokevirtual #132 // Method java/lang/Boolean.booleanValue:()Z\n 359: istore 18\n 361: iload 18\n 363: ifeq 319\n 366: aload 12\n 368: aload 15\n 370: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 375: pop\n 376: goto 319\n 379: aload 12\n 381: checkcast #47 // class java/util/List\n 384: nop\n 385: checkcast #68 // class java/lang/Iterable\n 388: astore 9\n 390: nop\n 391: iconst_0\n 392: istore 10\n 394: aload 9\n 396: astore 11\n 398: new #70 // class java/util/ArrayList\n 401: dup\n 402: aload 9\n 404: bipush 10\n 406: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 409: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 412: checkcast #82 // class java/util/Collection\n 415: astore 12\n 417: iconst_0\n 418: istore 13\n 420: aload 11\n 422: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 427: astore 14\n 429: aload 14\n 431: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 436: ifeq 488\n 439: aload 14\n 441: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 446: astore 15\n 448: aload 12\n 450: aload 15\n 452: checkcast #126 // class kotlin/Pair\n 455: astore 16\n 457: astore 25\n 459: iconst_0\n 460: istore 17\n 462: aload 16\n 464: invokevirtual #135 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 467: checkcast #53 // class java/lang/Number\n 470: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 473: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 476: aload 25\n 478: swap\n 479: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 484: pop\n 485: goto 429\n 488: aload 12\n 490: checkcast #47 // class java/util/List\n 493: nop\n 494: checkcast #68 // class java/lang/Iterable\n 497: invokestatic #139 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 500: astore 8\n 502: aload 8\n 504: iconst_3\n 505: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 508: invokeinterface #144, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 513: ifeq 592\n 516: iload_0\n 517: aload_1\n 518: aload_2\n 519: aload_3\n 520: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 523: aload 5\n 525: iconst_3\n 526: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 531: checkcast #41 // class VectorN\n 534: invokevirtual #103 // Method VectorN.minus:(LVectorN;)LVectorN;\n 537: aload_3\n 538: new #41 // class VectorN\n 541: dup\n 542: iconst_4\n 543: newarray int\n 545: astore 9\n 547: aload 9\n 549: iconst_0\n 550: iconst_0\n 551: iastore\n 552: aload 9\n 554: iconst_1\n 555: iconst_0\n 556: iastore\n 557: aload 9\n 559: iconst_2\n 560: iconst_0\n 561: iastore\n 562: aload 9\n 564: iconst_3\n 565: iconst_1\n 566: iastore\n 567: aload 9\n 569: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 572: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 575: iload 4\n 577: iconst_1\n 578: iadd\n 579: aload 5\n 581: aload 6\n 583: aconst_null\n 584: sipush 128\n 587: aconst_null\n 588: invokestatic #317 // Method main$part2$decision$19$default:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;ILjava/lang/Object;)I\n 591: ireturn\n 592: aload 8\n 594: checkcast #68 // class java/lang/Iterable\n 597: astore 10\n 599: iconst_0\n 600: istore 11\n 602: aload 10\n 604: astore 12\n 606: new #70 // class java/util/ArrayList\n 609: dup\n 610: invokespecial #124 // Method java/util/ArrayList.\"<init>\":()V\n 613: checkcast #82 // class java/util/Collection\n 616: astore 13\n 618: iconst_0\n 619: istore 14\n 621: aload 12\n 623: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 628: astore 15\n 630: aload 15\n 632: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 637: ifeq 742\n 640: aload 15\n 642: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 647: astore 16\n 649: aload 16\n 651: checkcast #53 // class java/lang/Number\n 654: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 657: istore 17\n 659: iconst_0\n 660: istore 18\n 662: nop\n 663: aload 7\n 665: iload 17\n 667: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 670: invokeinterface #144, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 675: ifeq 682\n 678: iconst_0\n 679: goto 725\n 682: aload_3\n 683: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 686: iload 17\n 688: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 693: checkcast #53 // class java/lang/Number\n 696: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 699: aload 6\n 701: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 704: iload 17\n 706: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 711: checkcast #53 // class java/lang/Number\n 714: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 717: if_icmplt 724\n 720: iconst_0\n 721: goto 725\n 724: iconst_1\n 725: nop\n 726: ifeq 630\n 729: aload 13\n 731: aload 16\n 733: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 738: pop\n 739: goto 630\n 742: aload 13\n 744: checkcast #47 // class java/util/List\n 747: nop\n 748: checkcast #68 // class java/lang/Iterable\n 751: invokestatic #139 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 754: astore 9\n 756: iload_0\n 757: aload_1\n 758: aload_2\n 759: aload_3\n 760: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 763: aload_3\n 764: iload 4\n 766: iconst_1\n 767: iadd\n 768: aload 5\n 770: aload 6\n 772: aload 9\n 774: invokestatic #319 // Method main$part2$decision$19:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;)I\n 777: istore 10\n 779: aload 9\n 781: checkcast #82 // class java/util/Collection\n 784: invokeinterface #159, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 789: ifne 796\n 792: iconst_1\n 793: goto 797\n 796: iconst_0\n 797: ifeq 1156\n 800: aload 9\n 802: checkcast #68 // class java/lang/Iterable\n 805: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 810: astore 13\n 812: aload 13\n 814: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 819: ifne 830\n 822: new #161 // class java/util/NoSuchElementException\n 825: dup\n 826: invokespecial #162 // Method java/util/NoSuchElementException.\"<init>\":()V\n 829: athrow\n 830: aload 13\n 832: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 837: checkcast #53 // class java/lang/Number\n 840: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 843: istore 14\n 845: iconst_0\n 846: istore 15\n 848: iload_0\n 849: aload_1\n 850: aload_2\n 851: aload_3\n 852: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 855: aload 5\n 857: iload 14\n 859: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 864: checkcast #41 // class VectorN\n 867: invokevirtual #103 // Method VectorN.minus:(LVectorN;)LVectorN;\n 870: aload_3\n 871: new #41 // class VectorN\n 874: dup\n 875: iconst_4\n 876: newarray int\n 878: astore 16\n 880: aload 16\n 882: iconst_0\n 883: iconst_0\n 884: iastore\n 885: aload 16\n 887: iconst_1\n 888: iconst_0\n 889: iastore\n 890: aload 16\n 892: iconst_2\n 893: iconst_0\n 894: iastore\n 895: aload 16\n 897: iconst_3\n 898: iconst_0\n 899: iastore\n 900: aload 16\n 902: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 905: astore 16\n 907: aload 16\n 909: astore 17\n 911: astore 18\n 913: astore 19\n 915: astore 20\n 917: istore 21\n 919: iconst_0\n 920: istore 22\n 922: aload 17\n 924: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 927: iload 14\n 929: iconst_1\n 930: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 933: invokeinterface #166, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 938: pop\n 939: getstatic #171 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 942: astore 23\n 944: iload 21\n 946: aload 20\n 948: aload 19\n 950: aload 18\n 952: aload 16\n 954: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 957: iload 4\n 959: iconst_1\n 960: iadd\n 961: aload 5\n 963: aload 6\n 965: aconst_null\n 966: sipush 128\n 969: aconst_null\n 970: invokestatic #317 // Method main$part2$decision$19$default:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;ILjava/lang/Object;)I\n 973: istore 14\n 975: aload 13\n 977: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 982: ifeq 1144\n 985: aload 13\n 987: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 992: checkcast #53 // class java/lang/Number\n 995: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 998: istore 15\n 1000: iconst_0\n 1001: istore 16\n 1003: iload_0\n 1004: aload_1\n 1005: aload_2\n 1006: aload_3\n 1007: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 1010: aload 5\n 1012: iload 15\n 1014: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1019: checkcast #41 // class VectorN\n 1022: invokevirtual #103 // Method VectorN.minus:(LVectorN;)LVectorN;\n 1025: aload_3\n 1026: new #41 // class VectorN\n 1029: dup\n 1030: iconst_4\n 1031: newarray int\n 1033: astore 17\n 1035: aload 17\n 1037: iconst_0\n 1038: iconst_0\n 1039: iastore\n 1040: aload 17\n 1042: iconst_1\n 1043: iconst_0\n 1044: iastore\n 1045: aload 17\n 1047: iconst_2\n 1048: iconst_0\n 1049: iastore\n 1050: aload 17\n 1052: iconst_3\n 1053: iconst_0\n 1054: iastore\n 1055: aload 17\n 1057: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 1060: astore 17\n 1062: aload 17\n 1064: astore 18\n 1066: astore 19\n 1068: astore 20\n 1070: astore 21\n 1072: istore 22\n 1074: iconst_0\n 1075: istore 23\n 1077: aload 18\n 1079: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 1082: iload 15\n 1084: iconst_1\n 1085: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 1088: invokeinterface #166, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 1093: pop\n 1094: getstatic #171 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 1097: astore 24\n 1099: iload 22\n 1101: aload 21\n 1103: aload 20\n 1105: aload 19\n 1107: aload 17\n 1109: invokevirtual #147 // Method VectorN.plus:(LVectorN;)LVectorN;\n 1112: iload 4\n 1114: iconst_1\n 1115: iadd\n 1116: aload 5\n 1118: aload 6\n 1120: aconst_null\n 1121: sipush 128\n 1124: aconst_null\n 1125: invokestatic #317 // Method main$part2$decision$19$default:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;ILjava/lang/Object;)I\n 1128: istore 15\n 1130: iload 14\n 1132: iload 15\n 1134: if_icmpge 975\n 1137: iload 15\n 1139: istore 14\n 1141: goto 975\n 1144: iload 14\n 1146: istore 11\n 1148: iload 11\n 1150: iload 10\n 1152: invokestatic #175 // Method java/lang/Integer.max:(II)I\n 1155: ireturn\n 1156: iload 10\n 1158: ireturn\n\n static int main$part2$decision$19$default(int, kotlin.jvm.internal.Ref$ObjectRef, VectorN, VectorN, int, java.util.List, VectorN, java.util.Set, int, java.lang.Object);\n Code:\n 0: iload 8\n 2: sipush 128\n 5: iand\n 6: ifeq 14\n 9: invokestatic #228 // Method kotlin/collections/SetsKt.emptySet:()Ljava/util/Set;\n 12: astore 7\n 14: iload_0\n 15: aload_1\n 16: aload_2\n 17: aload_3\n 18: iload 4\n 20: aload 5\n 22: aload 6\n 24: aload 7\n 26: invokestatic #319 // Method main$part2$decision$19:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;)I\n 29: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #68 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #70 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #82 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 340\n 50: aload 7\n 52: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #233 // class java/lang/String\n 66: astore 9\n 68: astore 34\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: invokestatic #237 // Method UtilsKt.ints:(Ljava/lang/String;)Ljava/util/List;\n 78: astore 11\n 80: iconst_0\n 81: istore 12\n 83: iconst_4\n 84: anewarray #41 // class VectorN\n 87: astore 13\n 89: aload 13\n 91: iconst_0\n 92: new #41 // class VectorN\n 95: dup\n 96: iconst_4\n 97: newarray int\n 99: astore 14\n 101: aload 14\n 103: iconst_0\n 104: aload 11\n 106: iconst_1\n 107: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 112: checkcast #53 // class java/lang/Number\n 115: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 118: iastore\n 119: aload 14\n 121: iconst_1\n 122: iconst_0\n 123: iastore\n 124: aload 14\n 126: iconst_2\n 127: iconst_0\n 128: iastore\n 129: aload 14\n 131: iconst_3\n 132: iconst_0\n 133: iastore\n 134: aload 14\n 136: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 139: aastore\n 140: aload 13\n 142: iconst_1\n 143: new #41 // class VectorN\n 146: dup\n 147: iconst_4\n 148: newarray int\n 150: astore 14\n 152: aload 14\n 154: iconst_0\n 155: aload 11\n 157: iconst_2\n 158: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 163: checkcast #53 // class java/lang/Number\n 166: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 169: iastore\n 170: aload 14\n 172: iconst_1\n 173: iconst_0\n 174: iastore\n 175: aload 14\n 177: iconst_2\n 178: iconst_0\n 179: iastore\n 180: aload 14\n 182: iconst_3\n 183: iconst_0\n 184: iastore\n 185: aload 14\n 187: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 190: aastore\n 191: aload 13\n 193: iconst_2\n 194: new #41 // class VectorN\n 197: dup\n 198: iconst_4\n 199: newarray int\n 201: astore 14\n 203: aload 14\n 205: iconst_0\n 206: aload 11\n 208: iconst_3\n 209: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 214: checkcast #53 // class java/lang/Number\n 217: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 220: iastore\n 221: aload 14\n 223: iconst_1\n 224: aload 11\n 226: iconst_4\n 227: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 232: checkcast #53 // class java/lang/Number\n 235: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 238: iastore\n 239: aload 14\n 241: iconst_2\n 242: iconst_0\n 243: iastore\n 244: aload 14\n 246: iconst_3\n 247: iconst_0\n 248: iastore\n 249: aload 14\n 251: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 254: aastore\n 255: aload 13\n 257: iconst_3\n 258: new #41 // class VectorN\n 261: dup\n 262: iconst_4\n 263: newarray int\n 265: astore 14\n 267: aload 14\n 269: iconst_0\n 270: aload 11\n 272: iconst_5\n 273: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 278: checkcast #53 // class java/lang/Number\n 281: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 284: iastore\n 285: aload 14\n 287: iconst_1\n 288: iconst_0\n 289: iastore\n 290: aload 14\n 292: iconst_2\n 293: aload 11\n 295: bipush 6\n 297: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 302: checkcast #53 // class java/lang/Number\n 305: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 308: iastore\n 309: aload 14\n 311: iconst_3\n 312: iconst_0\n 313: iastore\n 314: aload 14\n 316: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 319: aastore\n 320: aload 13\n 322: invokestatic #241 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 325: nop\n 326: nop\n 327: nop\n 328: aload 34\n 330: swap\n 331: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 336: pop\n 337: goto 40\n 340: aload 5\n 342: checkcast #47 // class java/util/List\n 345: nop\n 346: checkcast #68 // class java/lang/Iterable\n 349: iconst_3\n 350: invokestatic #330 // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;\n 353: astore_1\n 354: bipush 32\n 356: istore_2\n 357: new #59 // class kotlin/jvm/internal/Ref$ObjectRef\n 360: dup\n 361: invokespecial #242 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 364: astore_3\n 365: aload_3\n 366: iconst_0\n 367: istore 4\n 369: bipush 33\n 371: anewarray #8 // class java/lang/Integer\n 374: astore 5\n 376: astore 34\n 378: iload 4\n 380: bipush 33\n 382: if_icmpge 404\n 385: iload 4\n 387: istore 6\n 389: aload 5\n 391: iload 6\n 393: iconst_0\n 394: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 397: aastore\n 398: iinc 4, 1\n 401: goto 378\n 404: aload 34\n 406: aload 5\n 408: putfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 411: aload_1\n 412: checkcast #68 // class java/lang/Iterable\n 415: astore 4\n 417: iconst_0\n 418: istore 5\n 420: aload 4\n 422: astore 6\n 424: new #70 // class java/util/ArrayList\n 427: dup\n 428: aload 4\n 430: bipush 10\n 432: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 435: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 438: checkcast #82 // class java/util/Collection\n 441: astore 7\n 443: iconst_0\n 444: istore 8\n 446: iconst_0\n 447: istore 9\n 449: aload 6\n 451: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 456: astore 10\n 458: aload 10\n 460: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 465: ifeq 989\n 468: aload 10\n 470: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 475: astore 11\n 477: aload 7\n 479: iload 9\n 481: iinc 9, 1\n 484: istore 12\n 486: iload 12\n 488: ifge 494\n 491: invokestatic #99 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 494: iload 12\n 496: aload 11\n 498: checkcast #47 // class java/util/List\n 501: astore 13\n 503: istore 14\n 505: astore 34\n 507: iconst_0\n 508: istore 15\n 510: aload_3\n 511: iconst_0\n 512: istore 16\n 514: bipush 33\n 516: anewarray #8 // class java/lang/Integer\n 519: astore 17\n 521: astore 18\n 523: iload 16\n 525: bipush 33\n 527: if_icmpge 549\n 530: iload 16\n 532: istore 19\n 534: aload 17\n 536: iload 19\n 538: iconst_0\n 539: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 542: aastore\n 543: iinc 16, 1\n 546: goto 523\n 549: aload 18\n 551: aload 17\n 553: putfield #63 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 556: new #41 // class VectorN\n 559: dup\n 560: iconst_4\n 561: newarray int\n 563: astore 17\n 565: aload 17\n 567: iconst_0\n 568: iconst_0\n 569: iastore\n 570: aload 17\n 572: iconst_1\n 573: iconst_0\n 574: iastore\n 575: aload 17\n 577: iconst_2\n 578: iconst_0\n 579: iastore\n 580: aload 17\n 582: iconst_3\n 583: iconst_0\n 584: iastore\n 585: aload 17\n 587: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 590: astore 16\n 592: new #41 // class VectorN\n 595: dup\n 596: iconst_4\n 597: newarray int\n 599: astore 19\n 601: aload 19\n 603: iconst_0\n 604: iconst_1\n 605: iastore\n 606: aload 19\n 608: iconst_1\n 609: iconst_0\n 610: iastore\n 611: aload 19\n 613: iconst_2\n 614: iconst_0\n 615: iastore\n 616: aload 19\n 618: iconst_3\n 619: iconst_0\n 620: iastore\n 621: aload 19\n 623: invokespecial #150 // Method VectorN.\"<init>\":([I)V\n 626: astore 17\n 628: new #244 // class kotlin/ranges/IntRange\n 631: dup\n 632: iconst_0\n 633: iconst_3\n 634: invokespecial #247 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 637: checkcast #68 // class java/lang/Iterable\n 640: astore 20\n 642: iconst_0\n 643: istore 21\n 645: aload 20\n 647: astore 22\n 649: new #70 // class java/util/ArrayList\n 652: dup\n 653: aload 20\n 655: bipush 10\n 657: invokestatic #76 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 660: invokespecial #80 // Method java/util/ArrayList.\"<init>\":(I)V\n 663: checkcast #82 // class java/util/Collection\n 666: astore 23\n 668: iconst_0\n 669: istore 24\n 671: aload 22\n 673: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 678: astore 25\n 680: aload 25\n 682: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 687: ifeq 853\n 690: aload 25\n 692: checkcast #249 // class kotlin/collections/IntIterator\n 695: invokevirtual #252 // Method kotlin/collections/IntIterator.nextInt:()I\n 698: istore 26\n 700: aload 23\n 702: iload 26\n 704: istore 27\n 706: astore 28\n 708: iconst_0\n 709: istore 29\n 711: aload 13\n 713: checkcast #68 // class java/lang/Iterable\n 716: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 721: astore 30\n 723: aload 30\n 725: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 730: ifne 741\n 733: new #161 // class java/util/NoSuchElementException\n 736: dup\n 737: invokespecial #162 // Method java/util/NoSuchElementException.\"<init>\":()V\n 740: athrow\n 741: aload 30\n 743: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 748: checkcast #41 // class VectorN\n 751: astore 31\n 753: iconst_0\n 754: istore 32\n 756: aload 31\n 758: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 761: iload 27\n 763: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 768: checkcast #53 // class java/lang/Number\n 771: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 774: istore 31\n 776: aload 30\n 778: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 783: ifeq 835\n 786: aload 30\n 788: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 793: checkcast #41 // class VectorN\n 796: astore 32\n 798: iconst_0\n 799: istore 33\n 801: aload 32\n 803: invokevirtual #45 // Method VectorN.getComponents:()Ljava/util/List;\n 806: iload 27\n 808: invokeinterface #51, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 813: checkcast #53 // class java/lang/Number\n 816: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 819: istore 32\n 821: iload 31\n 823: iload 32\n 825: if_icmpge 776\n 828: iload 32\n 830: istore 31\n 832: goto 776\n 835: iload 31\n 837: nop\n 838: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 841: aload 28\n 843: swap\n 844: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 849: pop\n 850: goto 680\n 853: aload 23\n 855: checkcast #47 // class java/util/List\n 858: nop\n 859: checkcast #82 // class java/util/Collection\n 862: invokestatic #256 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 865: astore 35\n 867: new #41 // class VectorN\n 870: dup\n 871: aload 35\n 873: invokespecial #259 // Method VectorN.\"<init>\":(Ljava/util/List;)V\n 876: astore 19\n 878: new #261 // class java/lang/StringBuilder\n 881: dup\n 882: invokespecial #262 // Method java/lang/StringBuilder.\"<init>\":()V\n 885: ldc_w #264 // String maxBudget\n 888: invokevirtual #268 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 891: aload 19\n 893: invokevirtual #271 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 896: invokevirtual #275 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 899: getstatic #281 // Field java/lang/System.out:Ljava/io/PrintStream;\n 902: swap\n 903: invokevirtual #287 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 906: iload_2\n 907: aload_3\n 908: aload 16\n 910: aload 17\n 912: iconst_1\n 913: aload 13\n 915: aload 19\n 917: aconst_null\n 918: sipush 128\n 921: aconst_null\n 922: invokestatic #317 // Method main$part2$decision$19$default:(ILkotlin/jvm/internal/Ref$ObjectRef;LVectorN;LVectorN;ILjava/util/List;LVectorN;Ljava/util/Set;ILjava/lang/Object;)I\n 925: istore 20\n 927: new #261 // class java/lang/StringBuilder\n 930: dup\n 931: invokespecial #262 // Method java/lang/StringBuilder.\"<init>\":()V\n 934: ldc_w #289 // String Blueprint\n 937: invokevirtual #268 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 940: iload 14\n 942: invokevirtual #292 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 945: ldc_w #294 // String produces max\n 948: invokevirtual #268 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 951: iload 20\n 953: invokevirtual #292 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 956: ldc_w #296 // String geodes\n 959: invokevirtual #268 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 962: invokevirtual #275 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 965: getstatic #281 // Field java/lang/System.out:Ljava/io/PrintStream;\n 968: swap\n 969: invokevirtual #287 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 972: iload 20\n 974: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 977: aload 34\n 979: swap\n 980: invokeinterface #122, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 985: pop\n 986: goto 458\n 989: aload 7\n 991: checkcast #47 // class java/util/List\n 994: nop\n 995: checkcast #68 // class java/lang/Iterable\n 998: astore 4\n 1000: nop\n 1001: iconst_0\n 1002: istore 5\n 1004: aload 4\n 1006: invokeinterface #86, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 1011: astore 6\n 1013: aload 6\n 1015: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 1020: ifne 1034\n 1023: new #332 // class java/lang/UnsupportedOperationException\n 1026: dup\n 1027: ldc_w #334 // String Empty collection can\\'t be reduced.\n 1030: invokespecial #337 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 1033: athrow\n 1034: aload 6\n 1036: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 1041: astore 7\n 1043: aload 6\n 1045: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 1050: ifeq 1094\n 1053: aload 7\n 1055: aload 6\n 1057: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 1062: checkcast #53 // class java/lang/Number\n 1065: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 1068: istore 8\n 1070: checkcast #53 // class java/lang/Number\n 1073: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 1076: istore 9\n 1078: iconst_0\n 1079: istore 10\n 1081: iload 9\n 1083: iload 8\n 1085: imul\n 1086: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 1089: astore 7\n 1091: goto 1043\n 1094: aload 7\n 1096: checkcast #53 // class java/lang/Number\n 1099: invokevirtual #57 // Method java/lang/Number.intValue:()I\n 1102: ireturn\n\n public static final int access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #353 // Method main$part1:(Ljava/util/List;)I\n 4: ireturn\n\n public static final int access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #356 // Method main$part2:(Ljava/util/List;)I\n 4: ireturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day12.kt
fun main() { val aCode = 'a'.code val (startCode, endCode) = arrayOf('S'.code - aCode, 'E'.code - aCode) fun neighbours(cell: GridCell<Int>, grid: Grid<Int>) = grid.crossNeighbours(cell.position).filter { it.value < cell.value + 2 } fun prepareData(input: List<String>): Triple<Grid<Int>, GridCell<Int>, GridCell<Int>> { val grid = Grid(input.map { it.toCharArray().asList().map { char -> char.code - aCode } }) val start = grid.data.flatten().first { it.value == startCode }.also { it.value = 0 } val end = grid.data.flatten().first { it.value == endCode }.also { it.value = 26 } return Triple(grid, start, end) } fun part1(input: List<String>) = prepareData(input).let { (grid, start, end) -> grid.path(start, end, neighbours = { neighbours(it, grid) }).size - 1 } fun part2(input: List<String>) = prepareData(input).let { (grid, _, end) -> grid.data.asSequence().flatten().filter { it.value == 0 }.map { cell -> grid.path(cell, end, neighbours = { neighbours(it, grid) }) }.filter { it.isNotEmpty() }.minOf { it.size - 1 } } test( day = 12, testTarget1 = 31, testTarget2 = 29, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day12Kt$main$1.class", "javap": "Compiled from \"Day12.kt\"\nfinal class Day12Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final int $aCode;\n\n final int $startCode;\n\n final int $endCode;\n\n Day12Kt$main$1(int, int, int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #13 // Field $aCode:I\n 5: aload_0\n 6: iload_2\n 7: putfield #16 // Field $startCode:I\n 10: aload_0\n 11: iload_3\n 12: putfield #19 // Field $endCode:I\n 15: aload_0\n 16: iconst_1\n 17: ldc #21 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 19: ldc #23 // String part1\n 21: ldc #25 // String main$part1(IIILjava/util/List;)I\n 23: iconst_0\n 24: invokespecial #28 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 27: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #35 // String p0\n 3: invokestatic #41 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $aCode:I\n 10: aload_0\n 11: getfield #16 // Field $startCode:I\n 14: aload_0\n 15: getfield #19 // Field $endCode:I\n 18: aload_1\n 19: invokestatic #47 // Method Day12Kt.access$main$part1:(IIILjava/util/List;)I\n 22: invokestatic #53 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #57 // class java/util/List\n 5: invokevirtual #59 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day12Kt.class", "javap": "Compiled from \"Day12.kt\"\npublic final class Day12Kt {\n public static final void main();\n Code:\n 0: bipush 97\n 2: istore_0\n 3: iconst_2\n 4: anewarray #8 // class java/lang/Integer\n 7: astore_2\n 8: aload_2\n 9: iconst_0\n 10: bipush 83\n 12: iload_0\n 13: isub\n 14: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 17: aastore\n 18: aload_2\n 19: iconst_1\n 20: bipush 69\n 22: iload_0\n 23: isub\n 24: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 27: aastore\n 28: aload_2\n 29: astore_1\n 30: aload_1\n 31: iconst_0\n 32: aaload\n 33: checkcast #14 // class java/lang/Number\n 36: invokevirtual #18 // Method java/lang/Number.intValue:()I\n 39: istore_2\n 40: aload_1\n 41: iconst_1\n 42: aaload\n 43: checkcast #14 // class java/lang/Number\n 46: invokevirtual #18 // Method java/lang/Number.intValue:()I\n 49: istore_3\n 50: bipush 12\n 52: bipush 31\n 54: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 57: bipush 29\n 59: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 62: new #20 // class Day12Kt$main$1\n 65: dup\n 66: iload_0\n 67: iload_2\n 68: iload_3\n 69: invokespecial #24 // Method Day12Kt$main$1.\"<init>\":(III)V\n 72: checkcast #26 // class kotlin/jvm/functions/Function1\n 75: new #28 // class Day12Kt$main$2\n 78: dup\n 79: iload_0\n 80: iload_2\n 81: iload_3\n 82: invokespecial #29 // Method Day12Kt$main$2.\"<init>\":(III)V\n 85: checkcast #26 // class kotlin/jvm/functions/Function1\n 88: invokestatic #35 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 91: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #42 // Method main:()V\n 3: return\n\n private static final java.util.List<GridCell<java.lang.Integer>> main$neighbours(GridCell<java.lang.Integer>, Grid<java.lang.Integer>);\n Code:\n 0: aload_1\n 1: aload_0\n 2: invokevirtual #53 // Method GridCell.getPosition:()LVector2d;\n 5: invokevirtual #59 // Method Grid.crossNeighbours:(LVector2d;)Ljava/util/List;\n 8: checkcast #61 // class java/lang/Iterable\n 11: astore_2\n 12: iconst_0\n 13: istore_3\n 14: aload_2\n 15: astore 4\n 17: new #63 // class java/util/ArrayList\n 20: dup\n 21: invokespecial #65 // Method java/util/ArrayList.\"<init>\":()V\n 24: checkcast #67 // class java/util/Collection\n 27: astore 5\n 29: iconst_0\n 30: istore 6\n 32: aload 4\n 34: invokeinterface #71, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 39: astore 7\n 41: aload 7\n 43: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 48: ifeq 117\n 51: aload 7\n 53: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 58: astore 8\n 60: aload 8\n 62: checkcast #49 // class GridCell\n 65: astore 9\n 67: iconst_0\n 68: istore 10\n 70: aload 9\n 72: invokevirtual #84 // Method GridCell.getValue:()Ljava/lang/Object;\n 75: checkcast #14 // class java/lang/Number\n 78: invokevirtual #18 // Method java/lang/Number.intValue:()I\n 81: aload_0\n 82: invokevirtual #84 // Method GridCell.getValue:()Ljava/lang/Object;\n 85: checkcast #14 // class java/lang/Number\n 88: invokevirtual #18 // Method java/lang/Number.intValue:()I\n 91: iconst_2\n 92: iadd\n 93: if_icmpge 100\n 96: iconst_1\n 97: goto 101\n 100: iconst_0\n 101: ifeq 41\n 104: aload 5\n 106: aload 8\n 108: invokeinterface #88, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 113: pop\n 114: goto 41\n 117: aload 5\n 119: checkcast #90 // class java/util/List\n 122: nop\n 123: areturn\n\n private static final kotlin.Triple<Grid<java.lang.Integer>, GridCell<java.lang.Integer>, GridCell<java.lang.Integer>> main$prepareData(int, int, int, java.util.List<java.lang.String>);\n Code:\n 0: aload_3\n 1: checkcast #61 // class java/lang/Iterable\n 4: astore 5\n 6: iconst_0\n 7: istore 6\n 9: aload 5\n 11: astore 7\n 13: new #63 // class java/util/ArrayList\n 16: dup\n 17: aload 5\n 19: bipush 10\n 21: invokestatic #114 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 24: invokespecial #117 // Method java/util/ArrayList.\"<init>\":(I)V\n 27: checkcast #67 // class java/util/Collection\n 30: astore 8\n 32: iconst_0\n 33: istore 9\n 35: aload 7\n 37: invokeinterface #71, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 42: astore 10\n 44: aload 10\n 46: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 208\n 54: aload 10\n 56: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 61: astore 11\n 63: aload 8\n 65: aload 11\n 67: checkcast #119 // class java/lang/String\n 70: astore 12\n 72: astore 24\n 74: iconst_0\n 75: istore 13\n 77: aload 12\n 79: invokevirtual #123 // Method java/lang/String.toCharArray:()[C\n 82: dup\n 83: ldc #125 // String toCharArray(...)\n 85: invokestatic #131 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 88: invokestatic #137 // Method kotlin/collections/ArraysKt.asList:([C)Ljava/util/List;\n 91: checkcast #61 // class java/lang/Iterable\n 94: astore 14\n 96: iconst_0\n 97: istore 15\n 99: aload 14\n 101: astore 16\n 103: new #63 // class java/util/ArrayList\n 106: dup\n 107: aload 14\n 109: bipush 10\n 111: invokestatic #114 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 114: invokespecial #117 // Method java/util/ArrayList.\"<init>\":(I)V\n 117: checkcast #67 // class java/util/Collection\n 120: astore 17\n 122: iconst_0\n 123: istore 18\n 125: aload 16\n 127: invokeinterface #71, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 132: astore 19\n 134: aload 19\n 136: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 141: ifeq 189\n 144: aload 19\n 146: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 151: astore 20\n 153: aload 17\n 155: aload 20\n 157: checkcast #139 // class java/lang/Character\n 160: invokevirtual #143 // Method java/lang/Character.charValue:()C\n 163: istore 21\n 165: astore 22\n 167: iconst_0\n 168: istore 23\n 170: iload 21\n 172: iload_0\n 173: isub\n 174: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 177: aload 22\n 179: swap\n 180: invokeinterface #88, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 185: pop\n 186: goto 134\n 189: aload 17\n 191: checkcast #90 // class java/util/List\n 194: nop\n 195: nop\n 196: aload 24\n 198: swap\n 199: invokeinterface #88, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 204: pop\n 205: goto 44\n 208: aload 8\n 210: checkcast #90 // class java/util/List\n 213: nop\n 214: astore 25\n 216: new #55 // class Grid\n 219: dup\n 220: aload 25\n 222: invokespecial #146 // Method Grid.\"<init>\":(Ljava/util/List;)V\n 225: astore 4\n 227: aload 4\n 229: invokevirtual #150 // Method Grid.getData:()Ljava/util/List;\n 232: checkcast #61 // class java/lang/Iterable\n 235: invokestatic #154 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 238: checkcast #61 // class java/lang/Iterable\n 241: astore 6\n 243: iconst_0\n 244: istore 7\n 246: aload 6\n 248: invokeinterface #71, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 253: astore 8\n 255: aload 8\n 257: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 262: ifeq 312\n 265: aload 8\n 267: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 272: astore 9\n 274: aload 9\n 276: checkcast #49 // class GridCell\n 279: astore 10\n 281: iconst_0\n 282: istore 11\n 284: aload 10\n 286: invokevirtual #84 // Method GridCell.getValue:()Ljava/lang/Object;\n 289: checkcast #14 // class java/lang/Number\n 292: invokevirtual #18 // Method java/lang/Number.intValue:()I\n 295: iload_1\n 296: if_icmpne 303\n 299: iconst_1\n 300: goto 304\n 303: iconst_0\n 304: ifeq 255\n 307: aload 9\n 309: goto 322\n 312: new #156 // class java/util/NoSuchElementException\n 315: dup\n 316: ldc #158 // String Collection contains no element matching the predicate.\n 318: invokespecial #161 // Method java/util/NoSuchElementException.\"<init>\":(Ljava/lang/String;)V\n 321: athrow\n 322: astore 6\n 324: aload 6\n 326: checkcast #49 // class GridCell\n 329: astore 7\n 331: iconst_0\n 332: istore 8\n 334: aload 7\n 336: iconst_0\n 337: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 340: invokevirtual #165 // Method GridCell.setValue:(Ljava/lang/Object;)V\n 343: aload 6\n 345: checkcast #49 // class GridCell\n 348: astore 5\n 350: aload 4\n 352: invokevirtual #150 // Method Grid.getData:()Ljava/util/List;\n 355: checkcast #61 // class java/lang/Iterable\n 358: invokestatic #154 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 361: checkcast #61 // class java/lang/Iterable\n 364: astore 7\n 366: iconst_0\n 367: istore 8\n 369: aload 7\n 371: invokeinterface #71, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 376: astore 9\n 378: aload 9\n 380: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 385: ifeq 435\n 388: aload 9\n 390: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 395: astore 10\n 397: aload 10\n 399: checkcast #49 // class GridCell\n 402: astore 11\n 404: iconst_0\n 405: istore 12\n 407: aload 11\n 409: invokevirtual #84 // Method GridCell.getValue:()Ljava/lang/Object;\n 412: checkcast #14 // class java/lang/Number\n 415: invokevirtual #18 // Method java/lang/Number.intValue:()I\n 418: iload_2\n 419: if_icmpne 426\n 422: iconst_1\n 423: goto 427\n 426: iconst_0\n 427: ifeq 378\n 430: aload 10\n 432: goto 445\n 435: new #156 // class java/util/NoSuchElementException\n 438: dup\n 439: ldc #158 // String Collection contains no element matching the predicate.\n 441: invokespecial #161 // Method java/util/NoSuchElementException.\"<init>\":(Ljava/lang/String;)V\n 444: athrow\n 445: astore 7\n 447: aload 7\n 449: checkcast #49 // class GridCell\n 452: astore 8\n 454: iconst_0\n 455: istore 9\n 457: aload 8\n 459: bipush 26\n 461: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 464: invokevirtual #165 // Method GridCell.setValue:(Ljava/lang/Object;)V\n 467: aload 7\n 469: checkcast #49 // class GridCell\n 472: astore 6\n 474: new #167 // class kotlin/Triple\n 477: dup\n 478: aload 4\n 480: aload 5\n 482: aload 6\n 484: invokespecial #170 // Method kotlin/Triple.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V\n 487: areturn\n\n private static final java.util.Collection main$part1$lambda$8$lambda$7(Grid, GridCell);\n Code:\n 0: aload_1\n 1: ldc #194 // String it\n 3: invokestatic #197 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: aload_0\n 8: invokestatic #199 // Method main$neighbours:(LGridCell;LGrid;)Ljava/util/List;\n 11: checkcast #67 // class java/util/Collection\n 14: areturn\n\n private static final int main$part1(int, int, int, java.util.List<java.lang.String>);\n Code:\n 0: iload_0\n 1: iload_1\n 2: iload_2\n 3: aload_3\n 4: invokestatic #205 // Method main$prepareData:(IIILjava/util/List;)Lkotlin/Triple;\n 7: astore 4\n 9: iconst_0\n 10: istore 5\n 12: aload 4\n 14: invokevirtual #208 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 17: checkcast #55 // class Grid\n 20: astore 6\n 22: aload 4\n 24: invokevirtual #211 // Method kotlin/Triple.component2:()Ljava/lang/Object;\n 27: checkcast #49 // class GridCell\n 30: astore 7\n 32: aload 4\n 34: invokevirtual #214 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 37: checkcast #49 // class GridCell\n 40: astore 8\n 42: aload 6\n 44: aload 7\n 46: aload 8\n 48: aconst_null\n 49: aload 6\n 51: invokedynamic #232, 0 // InvokeDynamic #0:invoke:(LGrid;)Lkotlin/jvm/functions/Function1;\n 56: iconst_4\n 57: aconst_null\n 58: invokestatic #236 // Method Grid.path$default:(LGrid;LGridCell;LGridCell;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/util/List;\n 61: invokeinterface #239, 1 // InterfaceMethod java/util/List.size:()I\n 66: iconst_1\n 67: isub\n 68: nop\n 69: ireturn\n\n private static final boolean main$part2$lambda$14$lambda$9(GridCell);\n Code:\n 0: aload_0\n 1: ldc #194 // String it\n 3: invokestatic #197 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #84 // Method GridCell.getValue:()Ljava/lang/Object;\n 10: checkcast #14 // class java/lang/Number\n 13: invokevirtual #18 // Method java/lang/Number.intValue:()I\n 16: ifne 23\n 19: iconst_1\n 20: goto 24\n 23: iconst_0\n 24: ireturn\n\n private static final java.util.Collection main$part2$lambda$14$lambda$11$lambda$10(Grid, GridCell);\n Code:\n 0: aload_1\n 1: ldc #194 // String it\n 3: invokestatic #197 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: aload_0\n 8: invokestatic #199 // Method main$neighbours:(LGridCell;LGrid;)Ljava/util/List;\n 11: checkcast #67 // class java/util/Collection\n 14: areturn\n\n private static final java.util.List main$part2$lambda$14$lambda$11(Grid, GridCell, GridCell);\n Code:\n 0: aload_2\n 1: ldc #246 // String cell\n 3: invokestatic #197 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_2\n 8: aload_1\n 9: aconst_null\n 10: aload_0\n 11: invokedynamic #250, 0 // InvokeDynamic #1:invoke:(LGrid;)Lkotlin/jvm/functions/Function1;\n 16: iconst_4\n 17: aconst_null\n 18: invokestatic #236 // Method Grid.path$default:(LGrid;LGridCell;LGridCell;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/util/List;\n 21: areturn\n\n private static final boolean main$part2$lambda$14$lambda$12(java.util.List);\n Code:\n 0: aload_0\n 1: ldc #194 // String it\n 3: invokestatic #197 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #67 // class java/util/Collection\n 10: invokeinterface #256, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 15: ifne 22\n 18: iconst_1\n 19: goto 23\n 22: iconst_0\n 23: ireturn\n\n private static final int main$part2(int, int, int, java.util.List<java.lang.String>);\n Code:\n 0: iload_0\n 1: iload_1\n 2: iload_2\n 3: aload_3\n 4: invokestatic #205 // Method main$prepareData:(IIILjava/util/List;)Lkotlin/Triple;\n 7: astore 4\n 9: iconst_0\n 10: istore 5\n 12: aload 4\n 14: invokevirtual #208 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 17: checkcast #55 // class Grid\n 20: astore 6\n 22: aload 4\n 24: invokevirtual #214 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 27: checkcast #49 // class GridCell\n 30: astore 7\n 32: aload 6\n 34: invokevirtual #150 // Method Grid.getData:()Ljava/util/List;\n 37: checkcast #61 // class java/lang/Iterable\n 40: invokestatic #261 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;\n 43: invokestatic #267 // Method kotlin/sequences/SequencesKt.flattenSequenceOfIterable:(Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;\n 46: invokedynamic #275, 0 // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;\n 51: invokestatic #279 // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 54: aload 6\n 56: aload 7\n 58: invokedynamic #287, 0 // InvokeDynamic #3:invoke:(LGrid;LGridCell;)Lkotlin/jvm/functions/Function1;\n 63: invokestatic #290 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 66: invokedynamic #296, 0 // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;\n 71: invokestatic #279 // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 74: invokeinterface #299, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 79: astore 8\n 81: aload 8\n 83: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 88: ifne 99\n 91: new #156 // class java/util/NoSuchElementException\n 94: dup\n 95: invokespecial #300 // Method java/util/NoSuchElementException.\"<init>\":()V\n 98: athrow\n 99: aload 8\n 101: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 106: checkcast #90 // class java/util/List\n 109: astore 9\n 111: iconst_0\n 112: istore 10\n 114: aload 9\n 116: invokeinterface #239, 1 // InterfaceMethod java/util/List.size:()I\n 121: iconst_1\n 122: isub\n 123: istore 9\n 125: aload 8\n 127: invokeinterface #77, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 132: ifeq 175\n 135: aload 8\n 137: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 142: checkcast #90 // class java/util/List\n 145: astore 10\n 147: iconst_0\n 148: istore 11\n 150: aload 10\n 152: invokeinterface #239, 1 // InterfaceMethod java/util/List.size:()I\n 157: iconst_1\n 158: isub\n 159: istore 10\n 161: iload 9\n 163: iload 10\n 165: if_icmple 125\n 168: iload 10\n 170: istore 9\n 172: goto 125\n 175: iload 9\n 177: nop\n 178: nop\n 179: ireturn\n\n public static final int access$main$part1(int, int, int, java.util.List);\n Code:\n 0: iload_0\n 1: iload_1\n 2: iload_2\n 3: aload_3\n 4: invokestatic #305 // Method main$part1:(IIILjava/util/List;)I\n 7: ireturn\n\n public static final int access$main$part2(int, int, int, java.util.List);\n Code:\n 0: iload_0\n 1: iload_1\n 2: iload_2\n 3: aload_3\n 4: invokestatic #308 // Method main$part2:(IIILjava/util/List;)I\n 7: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day12Kt$main$2.class", "javap": "Compiled from \"Day12.kt\"\nfinal class Day12Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final int $aCode;\n\n final int $startCode;\n\n final int $endCode;\n\n Day12Kt$main$2(int, int, int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #13 // Field $aCode:I\n 5: aload_0\n 6: iload_2\n 7: putfield #16 // Field $startCode:I\n 10: aload_0\n 11: iload_3\n 12: putfield #19 // Field $endCode:I\n 15: aload_0\n 16: iconst_1\n 17: ldc #21 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 19: ldc #23 // String part2\n 21: ldc #25 // String main$part2(IIILjava/util/List;)I\n 23: iconst_0\n 24: invokespecial #28 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 27: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #35 // String p0\n 3: invokestatic #41 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $aCode:I\n 10: aload_0\n 11: getfield #16 // Field $startCode:I\n 14: aload_0\n 15: getfield #19 // Field $endCode:I\n 18: aload_1\n 19: invokestatic #47 // Method Day12Kt.access$main$part2:(IIILjava/util/List;)I\n 22: invokestatic #53 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #57 // class java/util/List\n 5: invokevirtual #59 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day13.kt
fun main() { data class ListOrValue(val value: Int? = null, val list: List<ListOrValue>? = null) fun parseLine(line: String): ListOrValue = when { line.startsWith("[") -> { // find the end val list = mutableListOf<ListOrValue>() var stackSize = 0 var accumulator = "" for (n in 1 until line.length - 1) { accumulator += line[n] when { line[n] == '[' -> stackSize++ line[n] == ']' -> stackSize-- line[n] == ',' && stackSize == 0 -> { list.add(parseLine(accumulator.dropLast(1))) accumulator = "" } } } if (accumulator.isNotBlank()) list.add(parseLine(accumulator)) ListOrValue(list = list) } else -> ListOrValue(value = line.toInt()) } fun compare(left: ListOrValue, right: ListOrValue): Int { if (left.value != null && right.value != null) // both are ints return left.value.compareTo(right.value) else if (left.list != null && right.list != null) { for (n in 0 until left.list.size) { if (right.list.size < n + 1) return 1 when (val itemComparison = compare(left.list[n], right.list[n])) { 0 -> continue else -> return itemComparison } } if (left.list.size < right.list.size) return -1 return 0 } else { val leftConverted = if (left.value != null) ListOrValue(list = listOf(left)) else left val rightConverted = if (right.value != null) ListOrValue(list = listOf(right)) else right return compare(leftConverted, rightConverted) } } fun compareStrings(left: String, right: String) = compare(parseLine(left), parseLine(right)) fun part1(input: List<String>) = input.chunked(3) .mapIndexed { index, lines -> Pair(index, compare(parseLine(lines[0]), parseLine(lines[1]))) } .filter { it.second < 0 } .sumOf { it.first + 1 } val dividers = arrayOf("[[2]]", "[[6]]") fun part2(input: List<String>) = (input + dividers).asSequence() .filter { it.isNotBlank() } .sortedWith(::compareStrings) .mapIndexed { index, line -> Pair(index + 1, line) } .filter { it.second in dividers } .map { it.first } .reduce(Int::times) test( day = 13, testTarget1 = 13, testTarget2 = 140, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day13Kt.class", "javap": "Compiled from \"Day13.kt\"\npublic final class Day13Kt {\n public static final void main();\n Code:\n 0: iconst_2\n 1: anewarray #8 // class java/lang/String\n 4: astore_1\n 5: aload_1\n 6: iconst_0\n 7: ldc #10 // String [[2]]\n 9: aastore\n 10: aload_1\n 11: iconst_1\n 12: ldc #12 // String [[6]]\n 14: aastore\n 15: aload_1\n 16: astore_0\n 17: bipush 13\n 19: bipush 13\n 21: invokestatic #18 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 24: sipush 140\n 27: invokestatic #18 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 30: getstatic #24 // Field Day13Kt$main$1.INSTANCE:LDay13Kt$main$1;\n 33: checkcast #26 // class kotlin/jvm/functions/Function1\n 36: new #28 // class Day13Kt$main$2\n 39: dup\n 40: aload_0\n 41: invokespecial #32 // Method Day13Kt$main$2.\"<init>\":([Ljava/lang/String;)V\n 44: checkcast #26 // class kotlin/jvm/functions/Function1\n 47: invokestatic #38 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 50: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #42 // Method main:()V\n 3: return\n\n private static final Day13Kt$main$ListOrValue main$parseLine(java.lang.String);\n Code:\n 0: nop\n 1: aload_0\n 2: ldc #47 // String [\n 4: iconst_0\n 5: iconst_2\n 6: aconst_null\n 7: invokestatic #53 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 10: ifeq 188\n 13: new #55 // class java/util/ArrayList\n 16: dup\n 17: invokespecial #57 // Method java/util/ArrayList.\"<init>\":()V\n 20: checkcast #59 // class java/util/List\n 23: astore_1\n 24: iconst_0\n 25: istore_2\n 26: ldc #61 // String\n 28: astore_3\n 29: iconst_1\n 30: istore 4\n 32: aload_0\n 33: invokevirtual #65 // Method java/lang/String.length:()I\n 36: iconst_1\n 37: isub\n 38: istore 5\n 40: iload 4\n 42: iload 5\n 44: if_icmpge 145\n 47: new #67 // class java/lang/StringBuilder\n 50: dup\n 51: invokespecial #68 // Method java/lang/StringBuilder.\"<init>\":()V\n 54: aload_3\n 55: invokevirtual #72 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 58: aload_0\n 59: iload 4\n 61: invokevirtual #76 // Method java/lang/String.charAt:(I)C\n 64: invokevirtual #79 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 67: invokevirtual #83 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 70: astore_3\n 71: nop\n 72: aload_0\n 73: iload 4\n 75: invokevirtual #76 // Method java/lang/String.charAt:(I)C\n 78: bipush 91\n 80: if_icmpne 89\n 83: iinc 2, 1\n 86: goto 139\n 89: aload_0\n 90: iload 4\n 92: invokevirtual #76 // Method java/lang/String.charAt:(I)C\n 95: bipush 93\n 97: if_icmpne 106\n 100: iinc 2, -1\n 103: goto 139\n 106: aload_0\n 107: iload 4\n 109: invokevirtual #76 // Method java/lang/String.charAt:(I)C\n 112: bipush 44\n 114: if_icmpne 139\n 117: iload_2\n 118: ifne 139\n 121: aload_1\n 122: aload_3\n 123: iconst_1\n 124: invokestatic #87 // Method kotlin/text/StringsKt.dropLast:(Ljava/lang/String;I)Ljava/lang/String;\n 127: invokestatic #89 // Method main$parseLine:(Ljava/lang/String;)LDay13Kt$main$ListOrValue;\n 130: invokeinterface #93, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 135: pop\n 136: ldc #61 // String\n 138: astore_3\n 139: iinc 4, 1\n 142: goto 40\n 145: aload_3\n 146: checkcast #95 // class java/lang/CharSequence\n 149: invokestatic #99 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z\n 152: ifne 159\n 155: iconst_1\n 156: goto 160\n 159: iconst_0\n 160: ifeq 174\n 163: aload_1\n 164: aload_3\n 165: invokestatic #89 // Method main$parseLine:(Ljava/lang/String;)LDay13Kt$main$ListOrValue;\n 168: invokeinterface #93, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 173: pop\n 174: new #101 // class Day13Kt$main$ListOrValue\n 177: dup\n 178: aconst_null\n 179: aload_1\n 180: iconst_1\n 181: aconst_null\n 182: invokespecial #104 // Method Day13Kt$main$ListOrValue.\"<init>\":(Ljava/lang/Integer;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 185: goto 205\n 188: new #101 // class Day13Kt$main$ListOrValue\n 191: dup\n 192: aload_0\n 193: invokestatic #108 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 196: invokestatic #18 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 199: aconst_null\n 200: iconst_2\n 201: aconst_null\n 202: invokespecial #104 // Method Day13Kt$main$ListOrValue.\"<init>\":(Ljava/lang/Integer;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 205: areturn\n\n private static final int main$compare(Day13Kt$main$ListOrValue, Day13Kt$main$ListOrValue);\n Code:\n 0: aload_0\n 1: invokevirtual #122 // Method Day13Kt$main$ListOrValue.getValue:()Ljava/lang/Integer;\n 4: ifnull 32\n 7: aload_1\n 8: invokevirtual #122 // Method Day13Kt$main$ListOrValue.getValue:()Ljava/lang/Integer;\n 11: ifnull 32\n 14: aload_0\n 15: invokevirtual #122 // Method Day13Kt$main$ListOrValue.getValue:()Ljava/lang/Integer;\n 18: invokevirtual #125 // Method java/lang/Integer.intValue:()I\n 21: aload_1\n 22: invokevirtual #122 // Method Day13Kt$main$ListOrValue.getValue:()Ljava/lang/Integer;\n 25: invokevirtual #125 // Method java/lang/Integer.intValue:()I\n 28: invokestatic #131 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I\n 31: ireturn\n 32: aload_0\n 33: invokevirtual #135 // Method Day13Kt$main$ListOrValue.getList:()Ljava/util/List;\n 36: ifnull 150\n 39: aload_1\n 40: invokevirtual #135 // Method Day13Kt$main$ListOrValue.getList:()Ljava/util/List;\n 43: ifnull 150\n 46: iconst_0\n 47: istore_2\n 48: aload_0\n 49: invokevirtual #135 // Method Day13Kt$main$ListOrValue.getList:()Ljava/util/List;\n 52: invokeinterface #138, 1 // InterfaceMethod java/util/List.size:()I\n 57: istore_3\n 58: iload_2\n 59: iload_3\n 60: if_icmpge 125\n 63: aload_1\n 64: invokevirtual #135 // Method Day13Kt$main$ListOrValue.getList:()Ljava/util/List;\n 67: invokeinterface #138, 1 // InterfaceMethod java/util/List.size:()I\n 72: iload_2\n 73: iconst_1\n 74: iadd\n 75: if_icmpge 80\n 78: iconst_1\n 79: ireturn\n 80: aload_0\n 81: invokevirtual #135 // Method Day13Kt$main$ListOrValue.getList:()Ljava/util/List;\n 84: iload_2\n 85: invokeinterface #142, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 90: checkcast #101 // class Day13Kt$main$ListOrValue\n 93: aload_1\n 94: invokevirtual #135 // Method Day13Kt$main$ListOrValue.getList:()Ljava/util/List;\n 97: iload_2\n 98: invokeinterface #142, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 103: checkcast #101 // class Day13Kt$main$ListOrValue\n 106: invokestatic #144 // Method main$compare:(LDay13Kt$main$ListOrValue;LDay13Kt$main$ListOrValue;)I\n 109: istore 4\n 111: iload 4\n 113: ifeq 119\n 116: iload 4\n 118: ireturn\n 119: iinc 2, 1\n 122: goto 58\n 125: aload_0\n 126: invokevirtual #135 // Method Day13Kt$main$ListOrValue.getList:()Ljava/util/List;\n 129: invokeinterface #138, 1 // InterfaceMethod java/util/List.size:()I\n 134: aload_1\n 135: invokevirtual #135 // Method Day13Kt$main$ListOrValue.getList:()Ljava/util/List;\n 138: invokeinterface #138, 1 // InterfaceMethod java/util/List.size:()I\n 143: if_icmpge 148\n 146: iconst_m1\n 147: ireturn\n 148: iconst_0\n 149: ireturn\n 150: aload_0\n 151: invokevirtual #122 // Method Day13Kt$main$ListOrValue.getValue:()Ljava/lang/Integer;\n 154: ifnull 174\n 157: new #101 // class Day13Kt$main$ListOrValue\n 160: dup\n 161: aconst_null\n 162: aload_0\n 163: invokestatic #150 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;\n 166: iconst_1\n 167: aconst_null\n 168: invokespecial #104 // Method Day13Kt$main$ListOrValue.\"<init>\":(Ljava/lang/Integer;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 171: goto 175\n 174: aload_0\n 175: astore_2\n 176: aload_1\n 177: invokevirtual #122 // Method Day13Kt$main$ListOrValue.getValue:()Ljava/lang/Integer;\n 180: ifnull 200\n 183: new #101 // class Day13Kt$main$ListOrValue\n 186: dup\n 187: aconst_null\n 188: aload_1\n 189: invokestatic #150 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;\n 192: iconst_1\n 193: aconst_null\n 194: invokespecial #104 // Method Day13Kt$main$ListOrValue.\"<init>\":(Ljava/lang/Integer;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 197: goto 201\n 200: aload_1\n 201: astore_3\n 202: aload_2\n 203: aload_3\n 204: invokestatic #144 // Method main$compare:(LDay13Kt$main$ListOrValue;LDay13Kt$main$ListOrValue;)I\n 207: ireturn\n\n private static final int main$compareStrings(java.lang.String, java.lang.String);\n Code:\n 0: aload_0\n 1: invokestatic #89 // Method main$parseLine:(Ljava/lang/String;)LDay13Kt$main$ListOrValue;\n 4: aload_1\n 5: invokestatic #89 // Method main$parseLine:(Ljava/lang/String;)LDay13Kt$main$ListOrValue;\n 8: invokestatic #144 // Method main$compare:(LDay13Kt$main$ListOrValue;LDay13Kt$main$ListOrValue;)I\n 11: ireturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #163 // class java/lang/Iterable\n 4: iconst_3\n 5: invokestatic #167 // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;\n 8: checkcast #163 // class java/lang/Iterable\n 11: astore_1\n 12: nop\n 13: iconst_0\n 14: istore_2\n 15: aload_1\n 16: astore_3\n 17: new #55 // class java/util/ArrayList\n 20: dup\n 21: aload_1\n 22: bipush 10\n 24: invokestatic #171 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 27: invokespecial #174 // Method java/util/ArrayList.\"<init>\":(I)V\n 30: checkcast #176 // class java/util/Collection\n 33: astore 4\n 35: iconst_0\n 36: istore 5\n 38: iconst_0\n 39: istore 6\n 41: aload_3\n 42: invokeinterface #180, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 47: astore 7\n 49: aload 7\n 51: invokeinterface #186, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 56: ifeq 159\n 59: aload 7\n 61: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 66: astore 8\n 68: aload 4\n 70: iload 6\n 72: iinc 6, 1\n 75: istore 9\n 77: iload 9\n 79: ifge 85\n 82: invokestatic #193 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 85: iload 9\n 87: aload 8\n 89: checkcast #59 // class java/util/List\n 92: astore 10\n 94: istore 11\n 96: astore 13\n 98: iconst_0\n 99: istore 12\n 101: new #195 // class kotlin/Pair\n 104: dup\n 105: iload 11\n 107: invokestatic #18 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 110: aload 10\n 112: iconst_0\n 113: invokeinterface #142, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 118: checkcast #8 // class java/lang/String\n 121: invokestatic #89 // Method main$parseLine:(Ljava/lang/String;)LDay13Kt$main$ListOrValue;\n 124: aload 10\n 126: iconst_1\n 127: invokeinterface #142, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 132: checkcast #8 // class java/lang/String\n 135: invokestatic #89 // Method main$parseLine:(Ljava/lang/String;)LDay13Kt$main$ListOrValue;\n 138: invokestatic #144 // Method main$compare:(LDay13Kt$main$ListOrValue;LDay13Kt$main$ListOrValue;)I\n 141: invokestatic #18 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 144: invokespecial #198 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 147: aload 13\n 149: swap\n 150: invokeinterface #199, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 155: pop\n 156: goto 49\n 159: aload 4\n 161: checkcast #59 // class java/util/List\n 164: nop\n 165: checkcast #163 // class java/lang/Iterable\n 168: astore_1\n 169: nop\n 170: iconst_0\n 171: istore_2\n 172: aload_1\n 173: astore_3\n 174: new #55 // class java/util/ArrayList\n 177: dup\n 178: invokespecial #57 // Method java/util/ArrayList.\"<init>\":()V\n 181: checkcast #176 // class java/util/Collection\n 184: astore 4\n 186: iconst_0\n 187: istore 5\n 189: aload_3\n 190: invokeinterface #180, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 195: astore 6\n 197: aload 6\n 199: invokeinterface #186, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 204: ifeq 261\n 207: aload 6\n 209: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 214: astore 7\n 216: aload 7\n 218: checkcast #195 // class kotlin/Pair\n 221: astore 8\n 223: iconst_0\n 224: istore 9\n 226: aload 8\n 228: invokevirtual #202 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 231: checkcast #204 // class java/lang/Number\n 234: invokevirtual #205 // Method java/lang/Number.intValue:()I\n 237: ifge 244\n 240: iconst_1\n 241: goto 245\n 244: iconst_0\n 245: ifeq 197\n 248: aload 4\n 250: aload 7\n 252: invokeinterface #199, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 257: pop\n 258: goto 197\n 261: aload 4\n 263: checkcast #59 // class java/util/List\n 266: nop\n 267: checkcast #163 // class java/lang/Iterable\n 270: astore_1\n 271: iconst_0\n 272: istore_2\n 273: aload_1\n 274: invokeinterface #180, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 279: astore_3\n 280: aload_3\n 281: invokeinterface #186, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 286: ifeq 334\n 289: aload_3\n 290: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 295: astore 4\n 297: iload_2\n 298: aload 4\n 300: checkcast #195 // class kotlin/Pair\n 303: astore 5\n 305: istore 13\n 307: iconst_0\n 308: istore 6\n 310: aload 5\n 312: invokevirtual #208 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 315: checkcast #204 // class java/lang/Number\n 318: invokevirtual #205 // Method java/lang/Number.intValue:()I\n 321: iconst_1\n 322: iadd\n 323: istore 14\n 325: iload 13\n 327: iload 14\n 329: iadd\n 330: istore_2\n 331: goto 280\n 334: iload_2\n 335: ireturn\n\n private static final boolean main$part2$lambda$3(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #234 // String it\n 3: invokestatic #238 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #95 // class java/lang/CharSequence\n 10: invokestatic #99 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z\n 13: ifne 20\n 16: iconst_1\n 17: goto 21\n 20: iconst_0\n 21: ireturn\n\n private static final int main$part2$lambda$4(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokeinterface #246, 3 // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 8: checkcast #204 // class java/lang/Number\n 11: invokevirtual #205 // Method java/lang/Number.intValue:()I\n 14: ireturn\n\n private static final kotlin.Pair main$part2$lambda$5(int, java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #253 // String line\n 3: invokestatic #238 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #195 // class kotlin/Pair\n 9: dup\n 10: iload_0\n 11: iconst_1\n 12: iadd\n 13: invokestatic #18 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 16: aload_1\n 17: invokespecial #198 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 20: areturn\n\n private static final boolean main$part2$lambda$6(java.lang.String[], kotlin.Pair);\n Code:\n 0: aload_1\n 1: ldc #234 // String it\n 3: invokestatic #238 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: invokevirtual #202 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 11: invokestatic #261 // Method kotlin/collections/ArraysKt.contains:([Ljava/lang/Object;Ljava/lang/Object;)Z\n 14: ireturn\n\n private static final int main$part2$lambda$7(kotlin.Pair);\n Code:\n 0: aload_0\n 1: ldc #234 // String it\n 3: invokestatic #238 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #208 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 10: checkcast #204 // class java/lang/Number\n 13: invokevirtual #205 // Method java/lang/Number.intValue:()I\n 16: ireturn\n\n private static final int main$part2(java.lang.String[], java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: checkcast #176 // class java/util/Collection\n 4: aload_0\n 5: invokestatic #271 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;[Ljava/lang/Object;)Ljava/util/List;\n 8: checkcast #163 // class java/lang/Iterable\n 11: invokestatic #275 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;\n 14: invokedynamic #292, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 19: invokestatic #298 // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 22: getstatic #303 // Field Day13Kt$main$part2$2.INSTANCE:LDay13Kt$main$part2$2;\n 25: checkcast #242 // class kotlin/jvm/functions/Function2\n 28: invokedynamic #311, 0 // InvokeDynamic #1:compare:(Lkotlin/jvm/functions/Function2;)Ljava/util/Comparator;\n 33: invokestatic #315 // Method kotlin/sequences/SequencesKt.sortedWith:(Lkotlin/sequences/Sequence;Ljava/util/Comparator;)Lkotlin/sequences/Sequence;\n 36: invokedynamic #324, 0 // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function2;\n 41: invokestatic #328 // Method kotlin/sequences/SequencesKt.mapIndexed:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;\n 44: aload_0\n 45: invokedynamic #336, 0 // InvokeDynamic #3:invoke:([Ljava/lang/String;)Lkotlin/jvm/functions/Function1;\n 50: invokestatic #298 // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 53: invokedynamic #342, 0 // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;\n 58: invokestatic #345 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 61: astore_2\n 62: nop\n 63: iconst_0\n 64: istore_3\n 65: aload_2\n 66: invokeinterface #348, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 71: astore 4\n 73: aload 4\n 75: invokeinterface #186, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 80: ifne 94\n 83: new #350 // class java/lang/UnsupportedOperationException\n 86: dup\n 87: ldc_w #352 // String Empty sequence can\\'t be reduced.\n 90: invokespecial #355 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 93: athrow\n 94: aload 4\n 96: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 101: astore 5\n 103: aload 4\n 105: invokeinterface #186, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 110: ifeq 154\n 113: aload 5\n 115: aload 4\n 117: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 122: checkcast #204 // class java/lang/Number\n 125: invokevirtual #205 // Method java/lang/Number.intValue:()I\n 128: istore 6\n 130: checkcast #204 // class java/lang/Number\n 133: invokevirtual #205 // Method java/lang/Number.intValue:()I\n 136: istore 7\n 138: iconst_0\n 139: istore 8\n 141: iload 7\n 143: iload 6\n 145: imul\n 146: invokestatic #18 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 149: astore 5\n 151: goto 103\n 154: aload 5\n 156: checkcast #204 // class java/lang/Number\n 159: invokevirtual #205 // Method java/lang/Number.intValue:()I\n 162: ireturn\n\n public static final int access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #365 // Method main$part1:(Ljava/util/List;)I\n 4: ireturn\n\n public static final int access$main$part2(java.lang.String[], java.util.List);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #368 // Method main$part2:([Ljava/lang/String;Ljava/util/List;)I\n 5: ireturn\n\n public static final int access$main$compareStrings(java.lang.String, java.lang.String);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #371 // Method main$compareStrings:(Ljava/lang/String;Ljava/lang/String;)I\n 5: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day13Kt$main$ListOrValue.class", "javap": "Compiled from \"Day13.kt\"\npublic final class Day13Kt$main$ListOrValue {\n private final java.lang.Integer value;\n\n private final java.util.List<Day13Kt$main$ListOrValue> list;\n\n public Day13Kt$main$ListOrValue(java.lang.Integer, java.util.List<Day13Kt$main$ListOrValue>);\n Code:\n 0: aload_0\n 1: invokespecial #10 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: aload_1\n 6: putfield #14 // Field value:Ljava/lang/Integer;\n 9: aload_0\n 10: aload_2\n 11: putfield #18 // Field list:Ljava/util/List;\n 14: return\n\n public Day13Kt$main$ListOrValue(java.lang.Integer, java.util.List, int, kotlin.jvm.internal.DefaultConstructorMarker);\n Code:\n 0: iload_3\n 1: iconst_1\n 2: iand\n 3: ifeq 8\n 6: aconst_null\n 7: astore_1\n 8: iload_3\n 9: iconst_2\n 10: iand\n 11: ifeq 16\n 14: aconst_null\n 15: astore_2\n 16: aload_0\n 17: aload_1\n 18: aload_2\n 19: invokespecial #23 // Method \"<init>\":(Ljava/lang/Integer;Ljava/util/List;)V\n 22: return\n\n public final java.lang.Integer getValue();\n Code:\n 0: aload_0\n 1: getfield #14 // Field value:Ljava/lang/Integer;\n 4: areturn\n\n public final java.util.List<Day13Kt$main$ListOrValue> getList();\n Code:\n 0: aload_0\n 1: getfield #18 // Field list:Ljava/util/List;\n 4: areturn\n\n public final java.lang.Integer component1();\n Code:\n 0: aload_0\n 1: getfield #14 // Field value:Ljava/lang/Integer;\n 4: areturn\n\n public final java.util.List<Day13Kt$main$ListOrValue> component2();\n Code:\n 0: aload_0\n 1: getfield #18 // Field list:Ljava/util/List;\n 4: areturn\n\n public final Day13Kt$main$ListOrValue copy(java.lang.Integer, java.util.List<Day13Kt$main$ListOrValue>);\n Code:\n 0: new #2 // class Day13Kt$main$ListOrValue\n 3: dup\n 4: aload_1\n 5: aload_2\n 6: invokespecial #23 // Method \"<init>\":(Ljava/lang/Integer;Ljava/util/List;)V\n 9: areturn\n\n public static Day13Kt$main$ListOrValue copy$default(Day13Kt$main$ListOrValue, java.lang.Integer, java.util.List, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_1\n 2: iand\n 3: ifeq 11\n 6: aload_0\n 7: getfield #14 // Field value:Ljava/lang/Integer;\n 10: astore_1\n 11: iload_3\n 12: iconst_2\n 13: iand\n 14: ifeq 22\n 17: aload_0\n 18: getfield #18 // Field list:Ljava/util/List;\n 21: astore_2\n 22: aload_0\n 23: aload_1\n 24: aload_2\n 25: invokevirtual #37 // Method copy:(Ljava/lang/Integer;Ljava/util/List;)LDay13Kt$main$ListOrValue;\n 28: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #41 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #42 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #44 // String ListOrValue(value=\n 9: invokevirtual #48 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #14 // Field value:Ljava/lang/Integer;\n 16: invokevirtual #51 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 19: ldc #53 // String , list=\n 21: invokevirtual #48 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 24: aload_0\n 25: getfield #18 // Field list:Ljava/util/List;\n 28: invokevirtual #51 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 31: bipush 41\n 33: invokevirtual #56 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 36: invokevirtual #58 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 39: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #14 // Field value:Ljava/lang/Integer;\n 4: ifnonnull 11\n 7: iconst_0\n 8: goto 18\n 11: aload_0\n 12: getfield #14 // Field value:Ljava/lang/Integer;\n 15: invokevirtual #62 // Method java/lang/Object.hashCode:()I\n 18: istore_1\n 19: iload_1\n 20: bipush 31\n 22: imul\n 23: aload_0\n 24: getfield #18 // Field list:Ljava/util/List;\n 27: ifnonnull 34\n 30: iconst_0\n 31: goto 41\n 34: aload_0\n 35: getfield #18 // Field list:Ljava/util/List;\n 38: invokevirtual #62 // Method java/lang/Object.hashCode:()I\n 41: iadd\n 42: istore_1\n 43: iload_1\n 44: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class Day13Kt$main$ListOrValue\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class Day13Kt$main$ListOrValue\n 20: astore_2\n 21: aload_0\n 22: getfield #14 // Field value:Ljava/lang/Integer;\n 25: aload_2\n 26: getfield #14 // Field value:Ljava/lang/Integer;\n 29: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 32: ifne 37\n 35: iconst_0\n 36: ireturn\n 37: aload_0\n 38: getfield #18 // Field list:Ljava/util/List;\n 41: aload_2\n 42: getfield #18 // Field list:Ljava/util/List;\n 45: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 48: ifne 53\n 51: iconst_0\n 52: ireturn\n 53: iconst_1\n 54: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day13Kt$main$1.class", "javap": "Compiled from \"Day13.kt\"\nfinal class Day13Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day13Kt$main$1 INSTANCE;\n\n Day13Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day13Kt.access$main$part1:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day13Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay13Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day13Kt$main$part2$2.class", "javap": "Compiled from \"Day13.kt\"\nfinal class Day13Kt$main$part2$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function2<java.lang.String, java.lang.String, java.lang.Integer> {\n public static final Day13Kt$main$part2$2 INSTANCE;\n\n Day13Kt$main$part2$2();\n Code:\n 0: aload_0\n 1: iconst_2\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String compareStrings\n 6: ldc #15 // String main$compareStrings(Ljava/lang/String;Ljava/lang/String;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.lang.String, java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #24 // String p0\n 3: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_2\n 7: ldc #32 // String p1\n 9: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_1\n 13: aload_2\n 14: invokestatic #38 // Method Day13Kt.access$main$compareStrings:(Ljava/lang/String;Ljava/lang/String;)I\n 17: invokestatic #44 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 20: areturn\n\n public java.lang.Object invoke(java.lang.Object, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #48 // class java/lang/String\n 5: aload_2\n 6: checkcast #48 // class java/lang/String\n 9: invokevirtual #50 // Method invoke:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Integer;\n 12: areturn\n\n static {};\n Code:\n 0: new #2 // class Day13Kt$main$part2$2\n 3: dup\n 4: invokespecial #55 // Method \"<init>\":()V\n 7: putstatic #58 // Field INSTANCE:LDay13Kt$main$part2$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day13Kt$main$2.class", "javap": "Compiled from \"Day13.kt\"\nfinal class Day13Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final java.lang.String[] $dividers;\n\n Day13Kt$main$2(java.lang.String[]);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $dividers:[Ljava/lang/String;\n 5: aload_0\n 6: iconst_1\n 7: ldc #15 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 9: ldc #17 // String part2\n 11: ldc #19 // String main$part2([Ljava/lang/String;Ljava/util/List;)I\n 13: iconst_0\n 14: invokespecial #22 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 17: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #29 // String p0\n 3: invokestatic #35 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $dividers:[Ljava/lang/String;\n 10: aload_1\n 11: invokestatic #41 // Method Day13Kt.access$main$part2:([Ljava/lang/String;Ljava/util/List;)I\n 14: invokestatic #47 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 17: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/util/List\n 5: invokevirtual #53 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day03.kt
fun main() { val lowerScoreOffset = 'a'.code - 1 val upperScoreOffset = 'A'.code - 1 - 26 fun Char.priority(): Int = this.code - (if (this.code > lowerScoreOffset) lowerScoreOffset else upperScoreOffset) fun part1(input: List<String>): Int = input.sumOf { items -> items.chunked(items.length / 2) .map { it.toSet() } .reduce { a, b -> a.intersect(b) } .first() .priority() } fun part2(input: List<String>): Int = input.chunked(3).sumOf { group -> group.map { it.toSet() } .reduce { a, b -> a.intersect(b) } .first() .priority() } test( day = 3, testTarget1 = 157, testTarget2 = 70, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day03Kt.class", "javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: bipush 96\n 2: istore_0\n 3: bipush 38\n 5: istore_1\n 6: iconst_3\n 7: sipush 157\n 10: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: bipush 70\n 15: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 18: new #14 // class Day03Kt$main$1\n 21: dup\n 22: iload_0\n 23: iload_1\n 24: invokespecial #18 // Method Day03Kt$main$1.\"<init>\":(II)V\n 27: checkcast #20 // class kotlin/jvm/functions/Function1\n 30: new #22 // class Day03Kt$main$2\n 33: dup\n 34: iload_0\n 35: iload_1\n 36: invokespecial #23 // Method Day03Kt$main$2.\"<init>\":(II)V\n 39: checkcast #20 // class kotlin/jvm/functions/Function1\n 42: invokestatic #29 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 45: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #35 // Method main:()V\n 3: return\n\n private static final int main$priority(char, int, int);\n Code:\n 0: iload_0\n 1: iload_0\n 2: iload_1\n 3: if_icmple 10\n 6: iload_1\n 7: goto 11\n 10: iload_2\n 11: isub\n 12: ireturn\n\n private static final int main$part1(int, int, java.util.List<java.lang.String>);\n Code:\n 0: aload_2\n 1: checkcast #46 // class java/lang/Iterable\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 14: astore 5\n 16: aload 5\n 18: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 23: ifeq 295\n 26: aload 5\n 28: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 33: astore 6\n 35: iload 4\n 37: aload 6\n 39: checkcast #62 // class java/lang/String\n 42: astore 7\n 44: istore 19\n 46: iconst_0\n 47: istore 8\n 49: aload 7\n 51: checkcast #64 // class java/lang/CharSequence\n 54: aload 7\n 56: invokevirtual #68 // Method java/lang/String.length:()I\n 59: iconst_2\n 60: idiv\n 61: invokestatic #74 // Method kotlin/text/StringsKt.chunked:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 64: checkcast #46 // class java/lang/Iterable\n 67: astore 9\n 69: nop\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: astore 11\n 77: new #76 // class java/util/ArrayList\n 80: dup\n 81: aload 9\n 83: bipush 10\n 85: invokestatic #82 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 88: invokespecial #85 // Method java/util/ArrayList.\"<init>\":(I)V\n 91: checkcast #87 // class java/util/Collection\n 94: astore 12\n 96: iconst_0\n 97: istore 13\n 99: aload 11\n 101: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 106: astore 14\n 108: aload 14\n 110: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 115: ifeq 161\n 118: aload 14\n 120: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 125: astore 15\n 127: aload 12\n 129: aload 15\n 131: checkcast #62 // class java/lang/String\n 134: astore 16\n 136: astore 17\n 138: iconst_0\n 139: istore 18\n 141: aload 16\n 143: checkcast #64 // class java/lang/CharSequence\n 146: invokestatic #91 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;\n 149: aload 17\n 151: swap\n 152: invokeinterface #95, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 157: pop\n 158: goto 108\n 161: aload 12\n 163: checkcast #97 // class java/util/List\n 166: nop\n 167: checkcast #46 // class java/lang/Iterable\n 170: astore 9\n 172: nop\n 173: iconst_0\n 174: istore 10\n 176: aload 9\n 178: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 183: astore 11\n 185: aload 11\n 187: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 192: ifne 205\n 195: new #99 // class java/lang/UnsupportedOperationException\n 198: dup\n 199: ldc #101 // String Empty collection can\\'t be reduced.\n 201: invokespecial #104 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 204: athrow\n 205: aload 11\n 207: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 212: astore 12\n 214: aload 11\n 216: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 221: ifeq 264\n 224: aload 12\n 226: aload 11\n 228: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 233: checkcast #106 // class java/util/Set\n 236: astore 13\n 238: checkcast #106 // class java/util/Set\n 241: astore 14\n 243: iconst_0\n 244: istore 15\n 246: aload 14\n 248: checkcast #46 // class java/lang/Iterable\n 251: aload 13\n 253: checkcast #46 // class java/lang/Iterable\n 256: invokestatic #110 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 259: astore 12\n 261: goto 214\n 264: aload 12\n 266: checkcast #46 // class java/lang/Iterable\n 269: invokestatic #114 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;\n 272: checkcast #116 // class java/lang/Character\n 275: invokevirtual #120 // Method java/lang/Character.charValue:()C\n 278: iload_0\n 279: iload_1\n 280: invokestatic #122 // Method main$priority:(CII)I\n 283: istore 20\n 285: iload 19\n 287: iload 20\n 289: iadd\n 290: istore 4\n 292: goto 16\n 295: iload 4\n 297: ireturn\n\n private static final int main$part2(int, int, java.util.List<java.lang.String>);\n Code:\n 0: aload_2\n 1: checkcast #46 // class java/lang/Iterable\n 4: iconst_3\n 5: invokestatic #151 // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;\n 8: checkcast #46 // class java/lang/Iterable\n 11: astore_3\n 12: iconst_0\n 13: istore 4\n 15: aload_3\n 16: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 21: astore 5\n 23: aload 5\n 25: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 30: ifeq 288\n 33: aload 5\n 35: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 40: astore 6\n 42: iload 4\n 44: aload 6\n 46: checkcast #97 // class java/util/List\n 49: astore 7\n 51: istore 19\n 53: iconst_0\n 54: istore 8\n 56: aload 7\n 58: checkcast #46 // class java/lang/Iterable\n 61: astore 9\n 63: iconst_0\n 64: istore 10\n 66: aload 9\n 68: astore 11\n 70: new #76 // class java/util/ArrayList\n 73: dup\n 74: aload 9\n 76: bipush 10\n 78: invokestatic #82 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 81: invokespecial #85 // Method java/util/ArrayList.\"<init>\":(I)V\n 84: checkcast #87 // class java/util/Collection\n 87: astore 12\n 89: iconst_0\n 90: istore 13\n 92: aload 11\n 94: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 99: astore 14\n 101: aload 14\n 103: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 108: ifeq 154\n 111: aload 14\n 113: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 118: astore 15\n 120: aload 12\n 122: aload 15\n 124: checkcast #62 // class java/lang/String\n 127: astore 16\n 129: astore 17\n 131: iconst_0\n 132: istore 18\n 134: aload 16\n 136: checkcast #64 // class java/lang/CharSequence\n 139: invokestatic #91 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;\n 142: aload 17\n 144: swap\n 145: invokeinterface #95, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 150: pop\n 151: goto 101\n 154: aload 12\n 156: checkcast #97 // class java/util/List\n 159: nop\n 160: checkcast #46 // class java/lang/Iterable\n 163: astore 9\n 165: nop\n 166: iconst_0\n 167: istore 10\n 169: aload 9\n 171: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 176: astore 11\n 178: aload 11\n 180: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 185: ifne 198\n 188: new #99 // class java/lang/UnsupportedOperationException\n 191: dup\n 192: ldc #101 // String Empty collection can\\'t be reduced.\n 194: invokespecial #104 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 197: athrow\n 198: aload 11\n 200: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 205: astore 12\n 207: aload 11\n 209: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 214: ifeq 257\n 217: aload 12\n 219: aload 11\n 221: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 226: checkcast #106 // class java/util/Set\n 229: astore 13\n 231: checkcast #106 // class java/util/Set\n 234: astore 14\n 236: iconst_0\n 237: istore 15\n 239: aload 14\n 241: checkcast #46 // class java/lang/Iterable\n 244: aload 13\n 246: checkcast #46 // class java/lang/Iterable\n 249: invokestatic #110 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 252: astore 12\n 254: goto 207\n 257: aload 12\n 259: checkcast #46 // class java/lang/Iterable\n 262: invokestatic #114 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;\n 265: checkcast #116 // class java/lang/Character\n 268: invokevirtual #120 // Method java/lang/Character.charValue:()C\n 271: iload_0\n 272: iload_1\n 273: invokestatic #122 // Method main$priority:(CII)I\n 276: istore 20\n 278: iload 19\n 280: iload 20\n 282: iadd\n 283: istore 4\n 285: goto 23\n 288: iload 4\n 290: ireturn\n\n public static final int access$main$part1(int, int, java.util.List);\n Code:\n 0: iload_0\n 1: iload_1\n 2: aload_2\n 3: invokestatic #158 // Method main$part1:(IILjava/util/List;)I\n 6: ireturn\n\n public static final int access$main$part2(int, int, java.util.List);\n Code:\n 0: iload_0\n 1: iload_1\n 2: aload_2\n 3: invokestatic #161 // Method main$part2:(IILjava/util/List;)I\n 6: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day03Kt$main$2.class", "javap": "Compiled from \"Day03.kt\"\nfinal class Day03Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final int $lowerScoreOffset;\n\n final int $upperScoreOffset;\n\n Day03Kt$main$2(int, int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #13 // Field $lowerScoreOffset:I\n 5: aload_0\n 6: iload_2\n 7: putfield #16 // Field $upperScoreOffset:I\n 10: aload_0\n 11: iconst_1\n 12: ldc #18 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 14: ldc #20 // String part2\n 16: ldc #22 // String main$part2(IILjava/util/List;)I\n 18: iconst_0\n 19: invokespecial #25 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 22: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #32 // String p0\n 3: invokestatic #38 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $lowerScoreOffset:I\n 10: aload_0\n 11: getfield #16 // Field $upperScoreOffset:I\n 14: aload_1\n 15: invokestatic #44 // Method Day03Kt.access$main$part2:(IILjava/util/List;)I\n 18: invokestatic #50 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 21: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #54 // class java/util/List\n 5: invokevirtual #56 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day03Kt$main$1.class", "javap": "Compiled from \"Day03.kt\"\nfinal class Day03Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n final int $lowerScoreOffset;\n\n final int $upperScoreOffset;\n\n Day03Kt$main$1(int, int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #13 // Field $lowerScoreOffset:I\n 5: aload_0\n 6: iload_2\n 7: putfield #16 // Field $upperScoreOffset:I\n 10: aload_0\n 11: iconst_1\n 12: ldc #18 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 14: ldc #20 // String part1\n 16: ldc #22 // String main$part1(IILjava/util/List;)I\n 18: iconst_0\n 19: invokespecial #25 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 22: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #32 // String p0\n 3: invokestatic #38 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #13 // Field $lowerScoreOffset:I\n 10: aload_0\n 11: getfield #16 // Field $upperScoreOffset:I\n 14: aload_1\n 15: invokestatic #44 // Method Day03Kt.access$main$part1:(IILjava/util/List;)I\n 18: invokestatic #50 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 21: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #54 // class java/util/List\n 5: invokevirtual #56 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day08.kt
fun main() { fun part1(input: List<String>): Int { val grid = Grid(input.map { it.toCharArray().asList().map(Char::digitToInt) }) val outside = 2 * grid.width + 2 * (grid.height - 2) var otherVisible = 0 for (x in 1 until grid.width - 1) for (y in 1 until grid.height - 1) { var visible = false val cell = grid.get(x, y) dirs@ for (direction in Vector2d.DIRECTIONS) { var neighbour = cell.position + direction while (neighbour in grid) { if (grid[neighbour].value >= cell.value) // not visible - check other directions continue@dirs neighbour += direction if (neighbour !in grid) { // we reached the end - it is visible! visible = true break@dirs } } } if (visible) otherVisible += 1 } return outside + otherVisible } fun part2(input: List<String>): Int { val grid = Grid(input.map { it.toCharArray().asList().map(Char::digitToInt) }) var bestScore = 0 for (x in 1 until grid.width - 1) for (y in 1 until grid.height - 1) { val cell = grid.get(x, y) val score = Vector2d.DIRECTIONS.map { direction -> var dirScore = 0 var neighbour = cell.position + direction while (neighbour in grid) { dirScore += 1 if (grid[neighbour].value >= cell.value) break neighbour += direction } dirScore }.reduce(Int::times) if (score > bestScore) bestScore = score } return bestScore } test( day = 8, testTarget1 = 21, testTarget2 = 8, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day08Kt$main$1.class", "javap": "Compiled from \"Day08.kt\"\nfinal class Day08Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day08Kt$main$1 INSTANCE;\n\n Day08Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day08Kt.access$main$part1:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day08Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay08Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day08Kt$main$2.class", "javap": "Compiled from \"Day08.kt\"\nfinal class Day08Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day08Kt$main$2 INSTANCE;\n\n Day08Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day08Kt.access$main$part2:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day08Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay08Kt$main$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day08Kt.class", "javap": "Compiled from \"Day08.kt\"\npublic final class Day08Kt {\n public static final void main();\n Code:\n 0: bipush 8\n 2: bipush 21\n 4: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 7: bipush 8\n 9: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 12: getstatic #18 // Field Day08Kt$main$1.INSTANCE:LDay08Kt$main$1;\n 15: checkcast #20 // class kotlin/jvm/functions/Function1\n 18: getstatic #25 // Field Day08Kt$main$2.INSTANCE:LDay08Kt$main$2;\n 21: checkcast #20 // class kotlin/jvm/functions/Function1\n 24: invokestatic #31 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 27: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #34 // Method main:()V\n 3: return\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #41 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #43 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #55 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 205\n 50: aload 7\n 52: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #71 // class java/lang/String\n 66: astore 9\n 68: astore 21\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: invokevirtual #75 // Method java/lang/String.toCharArray:()[C\n 78: dup\n 79: ldc #77 // String toCharArray(...)\n 81: invokestatic #83 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 84: invokestatic #89 // Method kotlin/collections/ArraysKt.asList:([C)Ljava/util/List;\n 87: checkcast #41 // class java/lang/Iterable\n 90: astore 11\n 92: iconst_0\n 93: istore 12\n 95: aload 11\n 97: astore 13\n 99: new #43 // class java/util/ArrayList\n 102: dup\n 103: aload 11\n 105: bipush 10\n 107: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 110: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 113: checkcast #55 // class java/util/Collection\n 116: astore 14\n 118: iconst_0\n 119: istore 15\n 121: aload 13\n 123: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 128: astore 16\n 130: aload 16\n 132: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 137: ifeq 186\n 140: aload 16\n 142: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 147: astore 17\n 149: aload 14\n 151: aload 17\n 153: checkcast #91 // class java/lang/Character\n 156: invokevirtual #95 // Method java/lang/Character.charValue:()C\n 159: istore 18\n 161: astore 19\n 163: iconst_0\n 164: istore 20\n 166: iload 18\n 168: invokestatic #101 // Method kotlin/text/CharsKt.digitToInt:(C)I\n 171: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 174: aload 19\n 176: swap\n 177: invokeinterface #105, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 182: pop\n 183: goto 130\n 186: aload 14\n 188: checkcast #107 // class java/util/List\n 191: nop\n 192: nop\n 193: aload 21\n 195: swap\n 196: invokeinterface #105, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 201: pop\n 202: goto 40\n 205: aload 5\n 207: checkcast #107 // class java/util/List\n 210: nop\n 211: astore 22\n 213: new #109 // class Grid\n 216: dup\n 217: aload 22\n 219: invokespecial #112 // Method Grid.\"<init>\":(Ljava/util/List;)V\n 222: astore_1\n 223: iconst_2\n 224: aload_1\n 225: invokevirtual #116 // Method Grid.getWidth:()I\n 228: imul\n 229: iconst_2\n 230: aload_1\n 231: invokevirtual #119 // Method Grid.getHeight:()I\n 234: iconst_2\n 235: isub\n 236: imul\n 237: iadd\n 238: istore_2\n 239: iconst_0\n 240: istore_3\n 241: iconst_1\n 242: istore 4\n 244: aload_1\n 245: invokevirtual #116 // Method Grid.getWidth:()I\n 248: iconst_1\n 249: isub\n 250: istore 5\n 252: iload 4\n 254: iload 5\n 256: if_icmpge 423\n 259: iconst_1\n 260: istore 6\n 262: aload_1\n 263: invokevirtual #119 // Method Grid.getHeight:()I\n 266: iconst_1\n 267: isub\n 268: istore 7\n 270: iload 6\n 272: iload 7\n 274: if_icmpge 417\n 277: iconst_0\n 278: istore 8\n 280: aload_1\n 281: iload 4\n 283: iload 6\n 285: invokevirtual #123 // Method Grid.get:(II)LGridCell;\n 288: astore 9\n 290: getstatic #129 // Field Vector2d.Companion:LVector2d$Companion;\n 293: invokevirtual #135 // Method Vector2d$Companion.getDIRECTIONS:()[LVector2d;\n 296: astore 10\n 298: iconst_0\n 299: istore 11\n 301: aload 10\n 303: arraylength\n 304: istore 12\n 306: iload 11\n 308: iload 12\n 310: if_icmpge 403\n 313: aload 10\n 315: iload 11\n 317: aaload\n 318: astore 13\n 320: aload 9\n 322: invokevirtual #141 // Method GridCell.getPosition:()LVector2d;\n 325: aload 13\n 327: invokevirtual #145 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 330: astore 14\n 332: aload_1\n 333: aload 14\n 335: invokevirtual #149 // Method Grid.contains:(LVector2d;)Z\n 338: ifeq 397\n 341: aload_1\n 342: aload 14\n 344: invokevirtual #152 // Method Grid.get:(LVector2d;)LGridCell;\n 347: invokevirtual #155 // Method GridCell.getValue:()Ljava/lang/Object;\n 350: checkcast #157 // class java/lang/Number\n 353: invokevirtual #160 // Method java/lang/Number.intValue:()I\n 356: aload 9\n 358: invokevirtual #155 // Method GridCell.getValue:()Ljava/lang/Object;\n 361: checkcast #157 // class java/lang/Number\n 364: invokevirtual #160 // Method java/lang/Number.intValue:()I\n 367: if_icmplt 373\n 370: goto 397\n 373: aload 14\n 375: aload 13\n 377: invokevirtual #145 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 380: astore 14\n 382: aload_1\n 383: aload 14\n 385: invokevirtual #149 // Method Grid.contains:(LVector2d;)Z\n 388: ifne 332\n 391: iconst_1\n 392: istore 8\n 394: goto 403\n 397: iinc 11, 1\n 400: goto 306\n 403: iload 8\n 405: ifeq 411\n 408: iinc 3, 1\n 411: iinc 6, 1\n 414: goto 270\n 417: iinc 4, 1\n 420: goto 252\n 423: iload_2\n 424: iload_3\n 425: iadd\n 426: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #41 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #43 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #55 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 205\n 50: aload 7\n 52: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #71 // class java/lang/String\n 66: astore 9\n 68: astore 22\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: invokevirtual #75 // Method java/lang/String.toCharArray:()[C\n 78: dup\n 79: ldc #77 // String toCharArray(...)\n 81: invokestatic #83 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 84: invokestatic #89 // Method kotlin/collections/ArraysKt.asList:([C)Ljava/util/List;\n 87: checkcast #41 // class java/lang/Iterable\n 90: astore 11\n 92: iconst_0\n 93: istore 12\n 95: aload 11\n 97: astore 13\n 99: new #43 // class java/util/ArrayList\n 102: dup\n 103: aload 11\n 105: bipush 10\n 107: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 110: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 113: checkcast #55 // class java/util/Collection\n 116: astore 14\n 118: iconst_0\n 119: istore 15\n 121: aload 13\n 123: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 128: astore 16\n 130: aload 16\n 132: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 137: ifeq 186\n 140: aload 16\n 142: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 147: astore 17\n 149: aload 14\n 151: aload 17\n 153: checkcast #91 // class java/lang/Character\n 156: invokevirtual #95 // Method java/lang/Character.charValue:()C\n 159: istore 18\n 161: astore 19\n 163: iconst_0\n 164: istore 20\n 166: iload 18\n 168: invokestatic #101 // Method kotlin/text/CharsKt.digitToInt:(C)I\n 171: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 174: aload 19\n 176: swap\n 177: invokeinterface #105, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 182: pop\n 183: goto 130\n 186: aload 14\n 188: checkcast #107 // class java/util/List\n 191: nop\n 192: nop\n 193: aload 22\n 195: swap\n 196: invokeinterface #105, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 201: pop\n 202: goto 40\n 205: aload 5\n 207: checkcast #107 // class java/util/List\n 210: nop\n 211: astore 23\n 213: new #109 // class Grid\n 216: dup\n 217: aload 23\n 219: invokespecial #112 // Method Grid.\"<init>\":(Ljava/util/List;)V\n 222: astore_1\n 223: iconst_0\n 224: istore_2\n 225: iconst_1\n 226: istore_3\n 227: aload_1\n 228: invokevirtual #116 // Method Grid.getWidth:()I\n 231: iconst_1\n 232: isub\n 233: istore 4\n 235: iload_3\n 236: iload 4\n 238: if_icmpge 560\n 241: iconst_1\n 242: istore 5\n 244: aload_1\n 245: invokevirtual #119 // Method Grid.getHeight:()I\n 248: iconst_1\n 249: isub\n 250: istore 6\n 252: iload 5\n 254: iload 6\n 256: if_icmpge 554\n 259: aload_1\n 260: iload_3\n 261: iload 5\n 263: invokevirtual #123 // Method Grid.get:(II)LGridCell;\n 266: astore 7\n 268: getstatic #129 // Field Vector2d.Companion:LVector2d$Companion;\n 271: invokevirtual #135 // Method Vector2d$Companion.getDIRECTIONS:()[LVector2d;\n 274: astore 9\n 276: iconst_0\n 277: istore 10\n 279: aload 9\n 281: astore 11\n 283: new #43 // class java/util/ArrayList\n 286: dup\n 287: aload 9\n 289: arraylength\n 290: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 293: checkcast #55 // class java/util/Collection\n 296: astore 12\n 298: iconst_0\n 299: istore 13\n 301: iconst_0\n 302: istore 14\n 304: aload 11\n 306: arraylength\n 307: istore 15\n 309: iload 14\n 311: iload 15\n 313: if_icmpge 425\n 316: aload 11\n 318: iload 14\n 320: aaload\n 321: astore 16\n 323: aload 12\n 325: aload 16\n 327: astore 17\n 329: astore 21\n 331: iconst_0\n 332: istore 18\n 334: iconst_0\n 335: istore 19\n 337: aload 7\n 339: invokevirtual #141 // Method GridCell.getPosition:()LVector2d;\n 342: aload 17\n 344: invokevirtual #145 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 347: astore 20\n 349: aload_1\n 350: aload 20\n 352: invokevirtual #149 // Method Grid.contains:(LVector2d;)Z\n 355: ifeq 405\n 358: iinc 19, 1\n 361: aload_1\n 362: aload 20\n 364: invokevirtual #152 // Method Grid.get:(LVector2d;)LGridCell;\n 367: invokevirtual #155 // Method GridCell.getValue:()Ljava/lang/Object;\n 370: checkcast #157 // class java/lang/Number\n 373: invokevirtual #160 // Method java/lang/Number.intValue:()I\n 376: aload 7\n 378: invokevirtual #155 // Method GridCell.getValue:()Ljava/lang/Object;\n 381: checkcast #157 // class java/lang/Number\n 384: invokevirtual #160 // Method java/lang/Number.intValue:()I\n 387: if_icmplt 393\n 390: goto 405\n 393: aload 20\n 395: aload 17\n 397: invokevirtual #145 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 400: astore 20\n 402: goto 349\n 405: iload 19\n 407: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 410: aload 21\n 412: swap\n 413: invokeinterface #105, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 418: pop\n 419: iinc 14, 1\n 422: goto 309\n 425: aload 12\n 427: checkcast #107 // class java/util/List\n 430: nop\n 431: checkcast #41 // class java/lang/Iterable\n 434: astore 9\n 436: nop\n 437: iconst_0\n 438: istore 10\n 440: aload 9\n 442: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 447: astore 11\n 449: aload 11\n 451: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 456: ifne 469\n 459: new #196 // class java/lang/UnsupportedOperationException\n 462: dup\n 463: ldc #198 // String Empty collection can\\'t be reduced.\n 465: invokespecial #201 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 468: athrow\n 469: aload 11\n 471: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 476: astore 12\n 478: aload 11\n 480: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 485: ifeq 529\n 488: aload 12\n 490: aload 11\n 492: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 497: checkcast #157 // class java/lang/Number\n 500: invokevirtual #160 // Method java/lang/Number.intValue:()I\n 503: istore 13\n 505: checkcast #157 // class java/lang/Number\n 508: invokevirtual #160 // Method java/lang/Number.intValue:()I\n 511: istore 14\n 513: iconst_0\n 514: istore 15\n 516: iload 14\n 518: iload 13\n 520: imul\n 521: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 524: astore 12\n 526: goto 478\n 529: aload 12\n 531: checkcast #157 // class java/lang/Number\n 534: invokevirtual #160 // Method java/lang/Number.intValue:()I\n 537: istore 8\n 539: iload 8\n 541: iload_2\n 542: if_icmple 548\n 545: iload 8\n 547: istore_2\n 548: iinc 5, 1\n 551: goto 252\n 554: iinc 3, 1\n 557: goto 235\n 560: iload_2\n 561: ireturn\n\n public static final int access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #218 // Method main$part1:(Ljava/util/List;)I\n 4: ireturn\n\n public static final int access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #221 // Method main$part2:(Ljava/util/List;)I\n 4: ireturn\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day09.kt
fun main() { fun ropeTailTravel(input: List<String>, ropeLength: Int): Int { val knots = Array(ropeLength) { Vector2d(0, 0) } val visited = mutableSetOf(knots.last()) for (command in input) { val (direction, steps) = command.split(" ") repeat(steps.toInt()) { knots[0] += when (direction) { "U" -> Vector2d.UP "D" -> Vector2d.DOWN "L" -> Vector2d.LEFT "R" -> Vector2d.RIGHT else -> throw Exception("Unknown command $direction") } for (n in 1 until knots.size) { val diff = knots[n - 1] - knots[n] if (diff.length() > 1) // we need to move knots[n] += diff.normalized() } visited.add(knots.last()) } } return visited.size } fun part1(input: List<String>) = ropeTailTravel(input, 2) fun part2(input: List<String>) = ropeTailTravel(input, 10) test( day = 9, testTarget1 = 13, testTarget2 = 1, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day09Kt$main$1.class", "javap": "Compiled from \"Day09.kt\"\nfinal class Day09Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day09Kt$main$1 INSTANCE;\n\n Day09Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day09Kt.access$main$part1:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day09Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay09Kt$main$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day09Kt.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt {\n public static final void main();\n Code:\n 0: bipush 9\n 2: bipush 13\n 4: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 7: iconst_1\n 8: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 11: getstatic #18 // Field Day09Kt$main$1.INSTANCE:LDay09Kt$main$1;\n 14: checkcast #20 // class kotlin/jvm/functions/Function1\n 17: getstatic #25 // Field Day09Kt$main$2.INSTANCE:LDay09Kt$main$2;\n 20: checkcast #20 // class kotlin/jvm/functions/Function1\n 23: invokestatic #31 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 26: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #34 // Method main:()V\n 3: return\n\n private static final int main$ropeTailTravel(java.util.List<java.lang.String>, int);\n Code:\n 0: iconst_0\n 1: istore_3\n 2: iload_1\n 3: anewarray #41 // class Vector2d\n 6: astore 4\n 8: iload_3\n 9: iload_1\n 10: if_icmpge 36\n 13: iload_3\n 14: istore 5\n 16: aload 4\n 18: iload 5\n 20: new #41 // class Vector2d\n 23: dup\n 24: iconst_0\n 25: iconst_0\n 26: invokespecial #45 // Method Vector2d.\"<init>\":(II)V\n 29: aastore\n 30: iinc 3, 1\n 33: goto 8\n 36: aload 4\n 38: astore_2\n 39: iconst_1\n 40: anewarray #41 // class Vector2d\n 43: astore 4\n 45: aload 4\n 47: iconst_0\n 48: aload_2\n 49: invokestatic #51 // Method kotlin/collections/ArraysKt.last:([Ljava/lang/Object;)Ljava/lang/Object;\n 52: aastore\n 53: aload 4\n 55: invokestatic #57 // Method kotlin/collections/SetsKt.mutableSetOf:([Ljava/lang/Object;)Ljava/util/Set;\n 58: astore_3\n 59: aload_0\n 60: invokeinterface #63, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 65: astore 4\n 67: aload 4\n 69: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 74: ifeq 426\n 77: aload 4\n 79: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 84: checkcast #75 // class java/lang/String\n 87: astore 5\n 89: aload 5\n 91: checkcast #77 // class java/lang/CharSequence\n 94: iconst_1\n 95: anewarray #75 // class java/lang/String\n 98: astore 7\n 100: aload 7\n 102: iconst_0\n 103: ldc #79 // String\n 105: aastore\n 106: aload 7\n 108: iconst_0\n 109: iconst_0\n 110: bipush 6\n 112: aconst_null\n 113: invokestatic #85 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 116: astore 6\n 118: aload 6\n 120: iconst_0\n 121: invokeinterface #89, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 126: checkcast #75 // class java/lang/String\n 129: astore 7\n 131: aload 6\n 133: iconst_1\n 134: invokeinterface #89, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 139: checkcast #75 // class java/lang/String\n 142: astore 8\n 144: aload 8\n 146: invokestatic #93 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 149: istore 9\n 151: iconst_0\n 152: istore 10\n 154: iload 10\n 156: iload 9\n 158: if_icmpge 67\n 161: iload 10\n 163: istore 11\n 165: iconst_0\n 166: istore 12\n 168: aload_2\n 169: iconst_0\n 170: aload_2\n 171: iconst_0\n 172: aaload\n 173: aload 7\n 175: astore 13\n 177: aload 13\n 179: invokevirtual #97 // Method java/lang/String.hashCode:()I\n 182: lookupswitch { // 4\n 68: 237\n 76: 263\n 82: 224\n 85: 250\n default: 312\n }\n 224: aload 13\n 226: ldc #99 // String R\n 228: invokevirtual #103 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 231: ifne 303\n 234: goto 312\n 237: aload 13\n 239: ldc #105 // String D\n 241: invokevirtual #103 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 244: ifne 285\n 247: goto 312\n 250: aload 13\n 252: ldc #107 // String U\n 254: invokevirtual #103 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 257: ifne 276\n 260: goto 312\n 263: aload 13\n 265: ldc #109 // String L\n 267: invokevirtual #103 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 270: ifne 294\n 273: goto 312\n 276: getstatic #113 // Field Vector2d.Companion:LVector2d$Companion;\n 279: invokevirtual #119 // Method Vector2d$Companion.getUP:()LVector2d;\n 282: goto 340\n 285: getstatic #113 // Field Vector2d.Companion:LVector2d$Companion;\n 288: invokevirtual #122 // Method Vector2d$Companion.getDOWN:()LVector2d;\n 291: goto 340\n 294: getstatic #113 // Field Vector2d.Companion:LVector2d$Companion;\n 297: invokevirtual #125 // Method Vector2d$Companion.getLEFT:()LVector2d;\n 300: goto 340\n 303: getstatic #113 // Field Vector2d.Companion:LVector2d$Companion;\n 306: invokevirtual #128 // Method Vector2d$Companion.getRIGHT:()LVector2d;\n 309: goto 340\n 312: new #130 // class java/lang/Exception\n 315: dup\n 316: new #132 // class java/lang/StringBuilder\n 319: dup\n 320: invokespecial #134 // Method java/lang/StringBuilder.\"<init>\":()V\n 323: ldc #136 // String Unknown command\n 325: invokevirtual #140 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 328: aload 7\n 330: invokevirtual #140 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 333: invokevirtual #144 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 336: invokespecial #147 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 339: athrow\n 340: invokevirtual #151 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 343: aastore\n 344: iconst_1\n 345: istore 13\n 347: aload_2\n 348: arraylength\n 349: istore 14\n 351: iload 13\n 353: iload 14\n 355: if_icmpge 408\n 358: aload_2\n 359: iload 13\n 361: iconst_1\n 362: isub\n 363: aaload\n 364: aload_2\n 365: iload 13\n 367: aaload\n 368: invokevirtual #154 // Method Vector2d.minus:(LVector2d;)LVector2d;\n 371: astore 15\n 373: aload 15\n 375: invokevirtual #157 // Method Vector2d.length:()I\n 378: iconst_1\n 379: if_icmple 402\n 382: iload 13\n 384: istore 16\n 386: aload_2\n 387: iload 16\n 389: aload_2\n 390: iload 16\n 392: aaload\n 393: aload 15\n 395: invokevirtual #160 // Method Vector2d.normalized:()LVector2d;\n 398: invokevirtual #151 // Method Vector2d.plus:(LVector2d;)LVector2d;\n 401: aastore\n 402: iinc 13, 1\n 405: goto 351\n 408: aload_3\n 409: aload_2\n 410: invokestatic #51 // Method kotlin/collections/ArraysKt.last:([Ljava/lang/Object;)Ljava/lang/Object;\n 413: invokeinterface #165, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 418: pop\n 419: nop\n 420: iinc 10, 1\n 423: goto 154\n 426: aload_3\n 427: invokeinterface #168, 1 // InterfaceMethod java/util/Set.size:()I\n 432: ireturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: iconst_2\n 2: invokestatic #191 // Method main$ropeTailTravel:(Ljava/util/List;I)I\n 5: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: bipush 10\n 3: invokestatic #191 // Method main$ropeTailTravel:(Ljava/util/List;I)I\n 6: ireturn\n\n public static final int access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #195 // Method main$part1:(Ljava/util/List;)I\n 4: ireturn\n\n public static final int access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #198 // Method main$part2:(Ljava/util/List;)I\n 4: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day09Kt$main$2.class", "javap": "Compiled from \"Day09.kt\"\nfinal class Day09Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day09Kt$main$2 INSTANCE;\n\n Day09Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day09Kt.access$main$part2:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day09Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay09Kt$main$2;\n 10: return\n}\n", "javap_err": "" } ]
er453r__aoc2022__9f98e24/src/Day18.kt
fun main() { fun part1(input: List<String>): Int { val occupied = input.map { it.ints() }.map { (x, y, z) -> Vector3d(x, y, z) }.toSet() return occupied.sumOf { cube -> 6 - Vector3d.DIRECTIONS.count { dir -> cube + dir in occupied } } } fun part2(input: List<String>): Int { val occupied = input.map { it.ints() }.map { (x, y, z) -> Vector3d(x, y, z) }.toMutableSet() val minX = occupied.minOf { it.x } - 1 val minY = occupied.minOf { it.y } - 1 val minZ = occupied.minOf { it.z } - 1 val maxX = occupied.maxOf { it.x } + 1 val maxY = occupied.maxOf { it.y } + 1 val maxZ = occupied.maxOf { it.z } + 1 val xRange = minX..maxX val yRange = minY..maxY val zRange = minZ..maxZ val all = xRange.map { x -> yRange.map { y -> zRange.map { z -> Vector3d(x, y, z) } } }.flatten().flatten().toSet() val airOutside = mutableSetOf<Vector3d>() val visitQueue = mutableListOf(Vector3d(minX, minY, minZ)) while (visitQueue.isNotEmpty()) { // fill the outside with air! val candidate = visitQueue.removeLast() airOutside += candidate for (direction in Vector3d.DIRECTIONS) { val next = candidate + direction if (next in airOutside || next in occupied || next.x !in xRange || next.y !in yRange || next.z !in zRange) continue visitQueue += next } } val airPockets = all - airOutside - occupied occupied += airPockets return occupied.sumOf { cube -> 6 - Vector3d.DIRECTIONS.count { dir -> cube + dir in occupied } } } test( day = 18, testTarget1 = 64, testTarget2 = 58, part1 = ::part1, part2 = ::part2, ) }
[ { "class_path": "er453r__aoc2022__9f98e24/Day18Kt$main$2.class", "javap": "Compiled from \"Day18.kt\"\nfinal class Day18Kt$main$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day18Kt$main$2 INSTANCE;\n\n Day18Kt$main$2();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part2\n 6: ldc #15 // String main$part2(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day18Kt.access$main$part2:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day18Kt$main$2\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay18Kt$main$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day18Kt.class", "javap": "Compiled from \"Day18.kt\"\npublic final class Day18Kt {\n public static final void main();\n Code:\n 0: bipush 18\n 2: bipush 64\n 4: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 7: bipush 58\n 9: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 12: getstatic #18 // Field Day18Kt$main$1.INSTANCE:LDay18Kt$main$1;\n 15: checkcast #20 // class kotlin/jvm/functions/Function1\n 18: getstatic #25 // Field Day18Kt$main$2.INSTANCE:LDay18Kt$main$2;\n 21: checkcast #20 // class kotlin/jvm/functions/Function1\n 24: invokestatic #31 // Method UtilsKt.test:(ILjava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V\n 27: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #34 // Method main:()V\n 3: return\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #41 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #43 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #55 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 90\n 50: aload 7\n 52: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #71 // class java/lang/String\n 66: astore 9\n 68: astore 18\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: invokestatic #75 // Method UtilsKt.ints:(Ljava/lang/String;)Ljava/util/List;\n 78: aload 18\n 80: swap\n 81: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 86: pop\n 87: goto 40\n 90: aload 5\n 92: checkcast #81 // class java/util/List\n 95: nop\n 96: checkcast #41 // class java/lang/Iterable\n 99: astore_2\n 100: nop\n 101: iconst_0\n 102: istore_3\n 103: aload_2\n 104: astore 4\n 106: new #43 // class java/util/ArrayList\n 109: dup\n 110: aload_2\n 111: bipush 10\n 113: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 116: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 119: checkcast #55 // class java/util/Collection\n 122: astore 5\n 124: iconst_0\n 125: istore 6\n 127: aload 4\n 129: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 134: astore 7\n 136: aload 7\n 138: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 143: ifeq 242\n 146: aload 7\n 148: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 153: astore 8\n 155: aload 5\n 157: aload 8\n 159: checkcast #81 // class java/util/List\n 162: astore 9\n 164: astore 18\n 166: iconst_0\n 167: istore 10\n 169: aload 9\n 171: iconst_0\n 172: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 177: checkcast #87 // class java/lang/Number\n 180: invokevirtual #91 // Method java/lang/Number.intValue:()I\n 183: istore 11\n 185: aload 9\n 187: iconst_1\n 188: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 193: checkcast #87 // class java/lang/Number\n 196: invokevirtual #91 // Method java/lang/Number.intValue:()I\n 199: istore 12\n 201: aload 9\n 203: iconst_2\n 204: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 209: checkcast #87 // class java/lang/Number\n 212: invokevirtual #91 // Method java/lang/Number.intValue:()I\n 215: istore 13\n 217: new #93 // class Vector3d\n 220: dup\n 221: iload 11\n 223: iload 12\n 225: iload 13\n 227: invokespecial #96 // Method Vector3d.\"<init>\":(III)V\n 230: aload 18\n 232: swap\n 233: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 238: pop\n 239: goto 136\n 242: aload 5\n 244: checkcast #81 // class java/util/List\n 247: nop\n 248: checkcast #41 // class java/lang/Iterable\n 251: invokestatic #100 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 254: astore_1\n 255: aload_1\n 256: checkcast #41 // class java/lang/Iterable\n 259: astore_2\n 260: iconst_0\n 261: istore_3\n 262: aload_2\n 263: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 268: astore 4\n 270: aload 4\n 272: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 277: ifeq 394\n 280: aload 4\n 282: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 287: astore 5\n 289: iload_3\n 290: aload 5\n 292: checkcast #93 // class Vector3d\n 295: astore 6\n 297: istore 18\n 299: iconst_0\n 300: istore 7\n 302: bipush 6\n 304: getstatic #104 // Field Vector3d.Companion:LVector3d$Companion;\n 307: invokevirtual #110 // Method Vector3d$Companion.getDIRECTIONS:()[LVector3d;\n 310: astore 8\n 312: istore 9\n 314: iconst_0\n 315: istore 10\n 317: iconst_0\n 318: istore 11\n 320: iconst_0\n 321: istore 12\n 323: aload 8\n 325: arraylength\n 326: istore 13\n 328: iload 12\n 330: iload 13\n 332: if_icmpge 374\n 335: aload 8\n 337: iload 12\n 339: aaload\n 340: astore 14\n 342: aload 14\n 344: astore 15\n 346: iconst_0\n 347: istore 16\n 349: aload_1\n 350: aload 6\n 352: aload 15\n 354: invokevirtual #114 // Method Vector3d.plus:(LVector3d;)LVector3d;\n 357: invokeinterface #119, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 362: ifeq 368\n 365: iinc 11, 1\n 368: iinc 12, 1\n 371: goto 328\n 374: iload 11\n 376: istore 17\n 378: iload 9\n 380: iload 17\n 382: isub\n 383: istore 19\n 385: iload 18\n 387: iload 19\n 389: iadd\n 390: istore_3\n 391: goto 270\n 394: iload_3\n 395: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #41 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #43 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #55 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 90\n 50: aload 7\n 52: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #71 // class java/lang/String\n 66: astore 9\n 68: astore 41\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: invokestatic #75 // Method UtilsKt.ints:(Ljava/lang/String;)Ljava/util/List;\n 78: aload 41\n 80: swap\n 81: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 86: pop\n 87: goto 40\n 90: aload 5\n 92: checkcast #81 // class java/util/List\n 95: nop\n 96: checkcast #41 // class java/lang/Iterable\n 99: astore_2\n 100: nop\n 101: iconst_0\n 102: istore_3\n 103: aload_2\n 104: astore 4\n 106: new #43 // class java/util/ArrayList\n 109: dup\n 110: aload_2\n 111: bipush 10\n 113: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 116: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 119: checkcast #55 // class java/util/Collection\n 122: astore 5\n 124: iconst_0\n 125: istore 6\n 127: aload 4\n 129: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 134: astore 7\n 136: aload 7\n 138: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 143: ifeq 242\n 146: aload 7\n 148: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 153: astore 8\n 155: aload 5\n 157: aload 8\n 159: checkcast #81 // class java/util/List\n 162: astore 9\n 164: astore 41\n 166: iconst_0\n 167: istore 10\n 169: aload 9\n 171: iconst_0\n 172: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 177: checkcast #87 // class java/lang/Number\n 180: invokevirtual #91 // Method java/lang/Number.intValue:()I\n 183: istore 11\n 185: aload 9\n 187: iconst_1\n 188: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 193: checkcast #87 // class java/lang/Number\n 196: invokevirtual #91 // Method java/lang/Number.intValue:()I\n 199: istore 12\n 201: aload 9\n 203: iconst_2\n 204: invokeinterface #85, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 209: checkcast #87 // class java/lang/Number\n 212: invokevirtual #91 // Method java/lang/Number.intValue:()I\n 215: istore 13\n 217: new #93 // class Vector3d\n 220: dup\n 221: iload 11\n 223: iload 12\n 225: iload 13\n 227: invokespecial #96 // Method Vector3d.\"<init>\":(III)V\n 230: aload 41\n 232: swap\n 233: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 238: pop\n 239: goto 136\n 242: aload 5\n 244: checkcast #81 // class java/util/List\n 247: nop\n 248: checkcast #41 // class java/lang/Iterable\n 251: invokestatic #156 // Method kotlin/collections/CollectionsKt.toMutableSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 254: astore_1\n 255: aload_1\n 256: checkcast #41 // class java/lang/Iterable\n 259: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 264: astore 4\n 266: aload 4\n 268: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 273: ifne 284\n 276: new #158 // class java/util/NoSuchElementException\n 279: dup\n 280: invokespecial #160 // Method java/util/NoSuchElementException.\"<init>\":()V\n 283: athrow\n 284: aload 4\n 286: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 291: checkcast #93 // class Vector3d\n 294: astore 5\n 296: iconst_0\n 297: istore 6\n 299: aload 5\n 301: invokevirtual #163 // Method Vector3d.getX:()I\n 304: istore 5\n 306: aload 4\n 308: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 313: ifeq 352\n 316: aload 4\n 318: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 323: checkcast #93 // class Vector3d\n 326: astore 6\n 328: iconst_0\n 329: istore 7\n 331: aload 6\n 333: invokevirtual #163 // Method Vector3d.getX:()I\n 336: istore 6\n 338: iload 5\n 340: iload 6\n 342: if_icmple 306\n 345: iload 6\n 347: istore 5\n 349: goto 306\n 352: iload 5\n 354: iconst_1\n 355: isub\n 356: istore_2\n 357: aload_1\n 358: checkcast #41 // class java/lang/Iterable\n 361: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 366: astore 5\n 368: aload 5\n 370: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 375: ifne 386\n 378: new #158 // class java/util/NoSuchElementException\n 381: dup\n 382: invokespecial #160 // Method java/util/NoSuchElementException.\"<init>\":()V\n 385: athrow\n 386: aload 5\n 388: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 393: checkcast #93 // class Vector3d\n 396: astore 6\n 398: iconst_0\n 399: istore 7\n 401: aload 6\n 403: invokevirtual #166 // Method Vector3d.getY:()I\n 406: istore 6\n 408: aload 5\n 410: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 415: ifeq 454\n 418: aload 5\n 420: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 425: checkcast #93 // class Vector3d\n 428: astore 7\n 430: iconst_0\n 431: istore 8\n 433: aload 7\n 435: invokevirtual #166 // Method Vector3d.getY:()I\n 438: istore 7\n 440: iload 6\n 442: iload 7\n 444: if_icmple 408\n 447: iload 7\n 449: istore 6\n 451: goto 408\n 454: iload 6\n 456: iconst_1\n 457: isub\n 458: istore_3\n 459: aload_1\n 460: checkcast #41 // class java/lang/Iterable\n 463: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 468: astore 6\n 470: aload 6\n 472: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 477: ifne 488\n 480: new #158 // class java/util/NoSuchElementException\n 483: dup\n 484: invokespecial #160 // Method java/util/NoSuchElementException.\"<init>\":()V\n 487: athrow\n 488: aload 6\n 490: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 495: checkcast #93 // class Vector3d\n 498: astore 7\n 500: iconst_0\n 501: istore 8\n 503: aload 7\n 505: invokevirtual #169 // Method Vector3d.getZ:()I\n 508: istore 7\n 510: aload 6\n 512: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 517: ifeq 556\n 520: aload 6\n 522: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 527: checkcast #93 // class Vector3d\n 530: astore 8\n 532: iconst_0\n 533: istore 9\n 535: aload 8\n 537: invokevirtual #169 // Method Vector3d.getZ:()I\n 540: istore 8\n 542: iload 7\n 544: iload 8\n 546: if_icmple 510\n 549: iload 8\n 551: istore 7\n 553: goto 510\n 556: iload 7\n 558: iconst_1\n 559: isub\n 560: istore 4\n 562: aload_1\n 563: checkcast #41 // class java/lang/Iterable\n 566: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 571: astore 7\n 573: aload 7\n 575: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 580: ifne 591\n 583: new #158 // class java/util/NoSuchElementException\n 586: dup\n 587: invokespecial #160 // Method java/util/NoSuchElementException.\"<init>\":()V\n 590: athrow\n 591: aload 7\n 593: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 598: checkcast #93 // class Vector3d\n 601: astore 8\n 603: iconst_0\n 604: istore 9\n 606: aload 8\n 608: invokevirtual #163 // Method Vector3d.getX:()I\n 611: istore 8\n 613: aload 7\n 615: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 620: ifeq 659\n 623: aload 7\n 625: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 630: checkcast #93 // class Vector3d\n 633: astore 9\n 635: iconst_0\n 636: istore 10\n 638: aload 9\n 640: invokevirtual #163 // Method Vector3d.getX:()I\n 643: istore 9\n 645: iload 8\n 647: iload 9\n 649: if_icmpge 613\n 652: iload 9\n 654: istore 8\n 656: goto 613\n 659: iload 8\n 661: iconst_1\n 662: iadd\n 663: istore 5\n 665: aload_1\n 666: checkcast #41 // class java/lang/Iterable\n 669: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 674: astore 8\n 676: aload 8\n 678: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 683: ifne 694\n 686: new #158 // class java/util/NoSuchElementException\n 689: dup\n 690: invokespecial #160 // Method java/util/NoSuchElementException.\"<init>\":()V\n 693: athrow\n 694: aload 8\n 696: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 701: checkcast #93 // class Vector3d\n 704: astore 9\n 706: iconst_0\n 707: istore 10\n 709: aload 9\n 711: invokevirtual #166 // Method Vector3d.getY:()I\n 714: istore 9\n 716: aload 8\n 718: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 723: ifeq 762\n 726: aload 8\n 728: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 733: checkcast #93 // class Vector3d\n 736: astore 10\n 738: iconst_0\n 739: istore 11\n 741: aload 10\n 743: invokevirtual #166 // Method Vector3d.getY:()I\n 746: istore 10\n 748: iload 9\n 750: iload 10\n 752: if_icmpge 716\n 755: iload 10\n 757: istore 9\n 759: goto 716\n 762: iload 9\n 764: iconst_1\n 765: iadd\n 766: istore 6\n 768: aload_1\n 769: checkcast #41 // class java/lang/Iterable\n 772: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 777: astore 9\n 779: aload 9\n 781: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 786: ifne 797\n 789: new #158 // class java/util/NoSuchElementException\n 792: dup\n 793: invokespecial #160 // Method java/util/NoSuchElementException.\"<init>\":()V\n 796: athrow\n 797: aload 9\n 799: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 804: checkcast #93 // class Vector3d\n 807: astore 10\n 809: iconst_0\n 810: istore 11\n 812: aload 10\n 814: invokevirtual #169 // Method Vector3d.getZ:()I\n 817: istore 10\n 819: aload 9\n 821: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 826: ifeq 865\n 829: aload 9\n 831: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 836: checkcast #93 // class Vector3d\n 839: astore 11\n 841: iconst_0\n 842: istore 12\n 844: aload 11\n 846: invokevirtual #169 // Method Vector3d.getZ:()I\n 849: istore 11\n 851: iload 10\n 853: iload 11\n 855: if_icmpge 819\n 858: iload 11\n 860: istore 10\n 862: goto 819\n 865: iload 10\n 867: iconst_1\n 868: iadd\n 869: istore 7\n 871: new #171 // class kotlin/ranges/IntRange\n 874: dup\n 875: iload_2\n 876: iload 5\n 878: invokespecial #174 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 881: astore 8\n 883: new #171 // class kotlin/ranges/IntRange\n 886: dup\n 887: iload_3\n 888: iload 6\n 890: invokespecial #174 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 893: astore 9\n 895: new #171 // class kotlin/ranges/IntRange\n 898: dup\n 899: iload 4\n 901: iload 7\n 903: invokespecial #174 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 906: astore 10\n 908: aload 8\n 910: checkcast #41 // class java/lang/Iterable\n 913: astore 12\n 915: iconst_0\n 916: istore 13\n 918: aload 12\n 920: astore 14\n 922: new #43 // class java/util/ArrayList\n 925: dup\n 926: aload 12\n 928: bipush 10\n 930: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 933: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 936: checkcast #55 // class java/util/Collection\n 939: astore 15\n 941: iconst_0\n 942: istore 16\n 944: aload 14\n 946: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 951: astore 17\n 953: aload 17\n 955: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 960: ifeq 1199\n 963: aload 17\n 965: checkcast #176 // class kotlin/collections/IntIterator\n 968: invokevirtual #179 // Method kotlin/collections/IntIterator.nextInt:()I\n 971: istore 18\n 973: aload 15\n 975: iload 18\n 977: istore 19\n 979: astore 41\n 981: iconst_0\n 982: istore 20\n 984: aload 9\n 986: checkcast #41 // class java/lang/Iterable\n 989: astore 21\n 991: iconst_0\n 992: istore 22\n 994: aload 21\n 996: astore 23\n 998: new #43 // class java/util/ArrayList\n 1001: dup\n 1002: aload 21\n 1004: bipush 10\n 1006: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 1009: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 1012: checkcast #55 // class java/util/Collection\n 1015: astore 24\n 1017: iconst_0\n 1018: istore 25\n 1020: aload 23\n 1022: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 1027: astore 26\n 1029: aload 26\n 1031: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 1036: ifeq 1180\n 1039: aload 26\n 1041: checkcast #176 // class kotlin/collections/IntIterator\n 1044: invokevirtual #179 // Method kotlin/collections/IntIterator.nextInt:()I\n 1047: istore 27\n 1049: aload 24\n 1051: iload 27\n 1053: istore 28\n 1055: astore 29\n 1057: iconst_0\n 1058: istore 30\n 1060: aload 10\n 1062: checkcast #41 // class java/lang/Iterable\n 1065: astore 31\n 1067: iconst_0\n 1068: istore 32\n 1070: aload 31\n 1072: astore 33\n 1074: new #43 // class java/util/ArrayList\n 1077: dup\n 1078: aload 31\n 1080: bipush 10\n 1082: invokestatic #49 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 1085: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 1088: checkcast #55 // class java/util/Collection\n 1091: astore 34\n 1093: iconst_0\n 1094: istore 35\n 1096: aload 33\n 1098: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 1103: astore 36\n 1105: aload 36\n 1107: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 1112: ifeq 1161\n 1115: aload 36\n 1117: checkcast #176 // class kotlin/collections/IntIterator\n 1120: invokevirtual #179 // Method kotlin/collections/IntIterator.nextInt:()I\n 1123: istore 37\n 1125: aload 34\n 1127: iload 37\n 1129: istore 38\n 1131: astore 39\n 1133: iconst_0\n 1134: istore 40\n 1136: new #93 // class Vector3d\n 1139: dup\n 1140: iload 19\n 1142: iload 28\n 1144: iload 38\n 1146: invokespecial #96 // Method Vector3d.\"<init>\":(III)V\n 1149: aload 39\n 1151: swap\n 1152: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 1157: pop\n 1158: goto 1105\n 1161: aload 34\n 1163: checkcast #81 // class java/util/List\n 1166: nop\n 1167: nop\n 1168: aload 29\n 1170: swap\n 1171: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 1176: pop\n 1177: goto 1029\n 1180: aload 24\n 1182: checkcast #81 // class java/util/List\n 1185: nop\n 1186: nop\n 1187: aload 41\n 1189: swap\n 1190: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 1195: pop\n 1196: goto 953\n 1199: aload 15\n 1201: checkcast #81 // class java/util/List\n 1204: nop\n 1205: checkcast #41 // class java/lang/Iterable\n 1208: invokestatic #183 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 1211: checkcast #41 // class java/lang/Iterable\n 1214: invokestatic #183 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 1217: checkcast #41 // class java/lang/Iterable\n 1220: invokestatic #100 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 1223: astore 11\n 1225: new #185 // class java/util/LinkedHashSet\n 1228: dup\n 1229: invokespecial #186 // Method java/util/LinkedHashSet.\"<init>\":()V\n 1232: checkcast #116 // class java/util/Set\n 1235: astore 12\n 1237: iconst_1\n 1238: anewarray #93 // class Vector3d\n 1241: astore 14\n 1243: aload 14\n 1245: iconst_0\n 1246: new #93 // class Vector3d\n 1249: dup\n 1250: iload_2\n 1251: iload_3\n 1252: iload 4\n 1254: invokespecial #96 // Method Vector3d.\"<init>\":(III)V\n 1257: aastore\n 1258: aload 14\n 1260: invokestatic #190 // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;\n 1263: astore 13\n 1265: aload 13\n 1267: checkcast #55 // class java/util/Collection\n 1270: invokeinterface #193, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 1275: ifne 1282\n 1278: iconst_1\n 1279: goto 1283\n 1282: iconst_0\n 1283: ifeq 1542\n 1286: aload 13\n 1288: invokeinterface #196, 1 // InterfaceMethod java/util/List.removeLast:()Ljava/lang/Object;\n 1293: dup\n 1294: ldc #198 // String removeLast(...)\n 1296: invokestatic #204 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 1299: checkcast #93 // class Vector3d\n 1302: astore 14\n 1304: aload 12\n 1306: checkcast #55 // class java/util/Collection\n 1309: aload 14\n 1311: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 1316: pop\n 1317: getstatic #104 // Field Vector3d.Companion:LVector3d$Companion;\n 1320: invokevirtual #110 // Method Vector3d$Companion.getDIRECTIONS:()[LVector3d;\n 1323: astore 15\n 1325: iconst_0\n 1326: istore 16\n 1328: aload 15\n 1330: arraylength\n 1331: istore 17\n 1333: iload 16\n 1335: iload 17\n 1337: if_icmpge 1265\n 1340: aload 15\n 1342: iload 16\n 1344: aaload\n 1345: astore 18\n 1347: aload 14\n 1349: aload 18\n 1351: invokevirtual #114 // Method Vector3d.plus:(LVector3d;)LVector3d;\n 1354: astore 19\n 1356: aload 12\n 1358: aload 19\n 1360: invokeinterface #119, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 1365: ifne 1520\n 1368: aload_1\n 1369: aload 19\n 1371: invokeinterface #119, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 1376: ifne 1520\n 1379: aload 8\n 1381: invokevirtual #207 // Method kotlin/ranges/IntRange.getFirst:()I\n 1384: istore 20\n 1386: aload 8\n 1388: invokevirtual #210 // Method kotlin/ranges/IntRange.getLast:()I\n 1391: istore 21\n 1393: aload 19\n 1395: invokevirtual #163 // Method Vector3d.getX:()I\n 1398: istore 22\n 1400: iload 20\n 1402: iload 22\n 1404: if_icmpgt 1422\n 1407: iload 22\n 1409: iload 21\n 1411: if_icmpgt 1418\n 1414: iconst_1\n 1415: goto 1423\n 1418: iconst_0\n 1419: goto 1423\n 1422: iconst_0\n 1423: ifeq 1520\n 1426: aload 9\n 1428: invokevirtual #207 // Method kotlin/ranges/IntRange.getFirst:()I\n 1431: istore 20\n 1433: aload 9\n 1435: invokevirtual #210 // Method kotlin/ranges/IntRange.getLast:()I\n 1438: istore 21\n 1440: aload 19\n 1442: invokevirtual #166 // Method Vector3d.getY:()I\n 1445: istore 22\n 1447: iload 20\n 1449: iload 22\n 1451: if_icmpgt 1469\n 1454: iload 22\n 1456: iload 21\n 1458: if_icmpgt 1465\n 1461: iconst_1\n 1462: goto 1470\n 1465: iconst_0\n 1466: goto 1470\n 1469: iconst_0\n 1470: ifeq 1520\n 1473: aload 10\n 1475: invokevirtual #207 // Method kotlin/ranges/IntRange.getFirst:()I\n 1478: istore 20\n 1480: aload 10\n 1482: invokevirtual #210 // Method kotlin/ranges/IntRange.getLast:()I\n 1485: istore 21\n 1487: aload 19\n 1489: invokevirtual #169 // Method Vector3d.getZ:()I\n 1492: istore 22\n 1494: iload 20\n 1496: iload 22\n 1498: if_icmpgt 1516\n 1501: iload 22\n 1503: iload 21\n 1505: if_icmpgt 1512\n 1508: iconst_1\n 1509: goto 1517\n 1512: iconst_0\n 1513: goto 1517\n 1516: iconst_0\n 1517: ifne 1523\n 1520: goto 1536\n 1523: aload 13\n 1525: checkcast #55 // class java/util/Collection\n 1528: aload 19\n 1530: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 1535: pop\n 1536: iinc 16, 1\n 1539: goto 1333\n 1542: aload 11\n 1544: aload 12\n 1546: checkcast #41 // class java/lang/Iterable\n 1549: invokestatic #216 // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Iterable;)Ljava/util/Set;\n 1552: aload_1\n 1553: checkcast #41 // class java/lang/Iterable\n 1556: invokestatic #216 // Method kotlin/collections/SetsKt.minus:(Ljava/util/Set;Ljava/lang/Iterable;)Ljava/util/Set;\n 1559: astore 14\n 1561: aload_1\n 1562: checkcast #55 // class java/util/Collection\n 1565: aload 14\n 1567: checkcast #41 // class java/lang/Iterable\n 1570: invokestatic #220 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 1573: pop\n 1574: aload_1\n 1575: checkcast #41 // class java/lang/Iterable\n 1578: astore 15\n 1580: iconst_0\n 1581: istore 16\n 1583: aload 15\n 1585: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 1590: astore 17\n 1592: aload 17\n 1594: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 1599: ifeq 1718\n 1602: aload 17\n 1604: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 1609: astore 18\n 1611: iload 16\n 1613: aload 18\n 1615: checkcast #93 // class Vector3d\n 1618: astore 19\n 1620: istore 41\n 1622: iconst_0\n 1623: istore 20\n 1625: bipush 6\n 1627: getstatic #104 // Field Vector3d.Companion:LVector3d$Companion;\n 1630: invokevirtual #110 // Method Vector3d$Companion.getDIRECTIONS:()[LVector3d;\n 1633: astore 21\n 1635: istore 22\n 1637: iconst_0\n 1638: istore 23\n 1640: iconst_0\n 1641: istore 24\n 1643: iconst_0\n 1644: istore 25\n 1646: aload 21\n 1648: arraylength\n 1649: istore 26\n 1651: iload 25\n 1653: iload 26\n 1655: if_icmpge 1697\n 1658: aload 21\n 1660: iload 25\n 1662: aaload\n 1663: astore 27\n 1665: aload 27\n 1667: astore 28\n 1669: iconst_0\n 1670: istore 29\n 1672: aload_1\n 1673: aload 19\n 1675: aload 28\n 1677: invokevirtual #114 // Method Vector3d.plus:(LVector3d;)LVector3d;\n 1680: invokeinterface #119, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 1685: ifeq 1691\n 1688: iinc 24, 1\n 1691: iinc 25, 1\n 1694: goto 1651\n 1697: iload 24\n 1699: istore 30\n 1701: iload 22\n 1703: iload 30\n 1705: isub\n 1706: istore 42\n 1708: iload 41\n 1710: iload 42\n 1712: iadd\n 1713: istore 16\n 1715: goto 1592\n 1718: iload 16\n 1720: ireturn\n\n public static final int access$main$part1(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #252 // Method main$part1:(Ljava/util/List;)I\n 4: ireturn\n\n public static final int access$main$part2(java.util.List);\n Code:\n 0: aload_0\n 1: invokestatic #255 // Method main$part2:(Ljava/util/List;)I\n 4: ireturn\n}\n", "javap_err": "" }, { "class_path": "er453r__aoc2022__9f98e24/Day18Kt$main$1.class", "javap": "Compiled from \"Day18.kt\"\nfinal class Day18Kt$main$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.List<? extends java.lang.String>, java.lang.Integer> {\n public static final Day18Kt$main$1 INSTANCE;\n\n Day18Kt$main$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String part1\n 6: ldc #15 // String main$part1(Ljava/util/List;)I\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Integer invoke(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #37 // Method Day18Kt.access$main$part1:(Ljava/util/List;)I\n 10: invokestatic #43 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #47 // class java/util/List\n 5: invokevirtual #49 // Method invoke:(Ljava/util/List;)Ljava/lang/Integer;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class Day18Kt$main$1\n 3: dup\n 4: invokespecial #54 // Method \"<init>\":()V\n 7: putstatic #57 // Field INSTANCE:LDay18Kt$main$1;\n 10: return\n}\n", "javap_err": "" } ]
tucuxi__leetcode-make-a-large-island__b44a1d3/src/main/kotlin/Solution.kt
class Solution { fun largestIsland(grid: Array<IntArray>): Int { val n = grid.size val firstLabel = 2 val sizes = mutableMapOf<Int, Int>() fun label(row: Int, col: Int): Int = if (row !in 0 until n || col !in 0 until n) 0 else grid[row][col] fun conquerIsland(label: Int, row: Int, col: Int): Int { val queue = mutableListOf<Pair<Int, Int>>() var size = 0 grid[row][col] = label queue.add(Pair(row, col)) while (queue.isNotEmpty()) { val (r, c) = queue.removeAt(0) size++ for (step in steps) { val nextR = r + step.first val nextC = c + step.second if (label(nextR, nextC) == 1) { grid[nextR][nextC] = label queue.add(Pair(nextR, nextC)) } } } return size } fun discoverIslands() { var k = firstLabel for (row in 0 until n) { for (col in 0 until n) { if (grid[row][col] == 1) { val size = conquerIsland(k, row, col) sizes[k] = size k++ } } } } fun largestCombinedIsland(): Int { var maxSize = sizes.getOrDefault(firstLabel, 0) for (row in 0 until n) { for (col in 0 until n) { if (grid[row][col] == 0) { val neighbors = steps.map { (dr, dc) -> label(row + dr, col + dc) }.toSet() val combinedSize = neighbors.sumOf { label -> sizes.getOrDefault(label, 0) } maxSize = maxOf(combinedSize + 1, maxSize) } } } return maxSize } discoverIslands() return largestCombinedIsland() } companion object { private val steps = arrayOf(Pair(-1, 0), Pair(1, 0), Pair(0, -1), Pair(0, 1)) } }
[ { "class_path": "tucuxi__leetcode-make-a-large-island__b44a1d3/Solution.class", "javap": "Compiled from \"Solution.kt\"\npublic final class Solution {\n public static final Solution$Companion Companion;\n\n private static final kotlin.Pair<java.lang.Integer, java.lang.Integer>[] steps;\n\n public Solution();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int largestIsland(int[][]);\n Code:\n 0: aload_1\n 1: ldc #15 // String grid\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: checkcast #23 // class \"[Ljava/lang/Object;\"\n 10: arraylength\n 11: istore_2\n 12: iconst_2\n 13: istore_3\n 14: new #25 // class java/util/LinkedHashMap\n 17: dup\n 18: invokespecial #26 // Method java/util/LinkedHashMap.\"<init>\":()V\n 21: checkcast #28 // class java/util/Map\n 24: astore 4\n 26: iload_3\n 27: iload_2\n 28: aload_1\n 29: aload 4\n 31: invokestatic #32 // Method largestIsland$discoverIslands:(II[[ILjava/util/Map;)V\n 34: aload 4\n 36: iload_3\n 37: iload_2\n 38: aload_1\n 39: invokestatic #36 // Method largestIsland$largestCombinedIsland:(Ljava/util/Map;II[[I)I\n 42: ireturn\n\n private static final int largestIsland$label(int, int[][], int, int);\n Code:\n 0: iconst_0\n 1: iload_2\n 2: if_icmpgt 18\n 5: iload_2\n 6: iload_0\n 7: if_icmpge 14\n 10: iconst_1\n 11: goto 19\n 14: iconst_0\n 15: goto 19\n 18: iconst_0\n 19: ifeq 44\n 22: iconst_0\n 23: iload_3\n 24: if_icmpgt 40\n 27: iload_3\n 28: iload_0\n 29: if_icmpge 36\n 32: iconst_1\n 33: goto 41\n 36: iconst_0\n 37: goto 41\n 40: iconst_0\n 41: ifne 48\n 44: iconst_0\n 45: goto 53\n 48: aload_1\n 49: iload_2\n 50: aaload\n 51: iload_3\n 52: iaload\n 53: ireturn\n\n private static final int largestIsland$conquerIsland(int[][], int, int, int, int);\n Code:\n 0: new #51 // class java/util/ArrayList\n 3: dup\n 4: invokespecial #52 // Method java/util/ArrayList.\"<init>\":()V\n 7: checkcast #54 // class java/util/List\n 10: astore 5\n 12: iconst_0\n 13: istore 6\n 15: aload_0\n 16: iload_3\n 17: aaload\n 18: iload 4\n 20: iload_2\n 21: iastore\n 22: aload 5\n 24: new #56 // class kotlin/Pair\n 27: dup\n 28: iload_3\n 29: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 32: iload 4\n 34: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 37: invokespecial #65 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 40: invokeinterface #69, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 45: pop\n 46: aload 5\n 48: checkcast #71 // class java/util/Collection\n 51: invokeinterface #75, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 56: ifne 63\n 59: iconst_1\n 60: goto 64\n 63: iconst_0\n 64: ifeq 220\n 67: aload 5\n 69: iconst_0\n 70: invokeinterface #79, 2 // InterfaceMethod java/util/List.remove:(I)Ljava/lang/Object;\n 75: checkcast #56 // class kotlin/Pair\n 78: astore 7\n 80: aload 7\n 82: invokevirtual #83 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 85: checkcast #85 // class java/lang/Number\n 88: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 91: istore 8\n 93: aload 7\n 95: invokevirtual #92 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 98: checkcast #85 // class java/lang/Number\n 101: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 104: istore 9\n 106: iinc 6, 1\n 109: getstatic #96 // Field steps:[Lkotlin/Pair;\n 112: astore 10\n 114: iconst_0\n 115: istore 11\n 117: aload 10\n 119: arraylength\n 120: istore 12\n 122: iload 11\n 124: iload 12\n 126: if_icmpge 46\n 129: aload 10\n 131: iload 11\n 133: aaload\n 134: astore 13\n 136: iload 8\n 138: aload 13\n 140: invokevirtual #99 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 143: checkcast #85 // class java/lang/Number\n 146: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 149: iadd\n 150: istore 14\n 152: iload 9\n 154: aload 13\n 156: invokevirtual #102 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 159: checkcast #85 // class java/lang/Number\n 162: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 165: iadd\n 166: istore 15\n 168: iload_1\n 169: aload_0\n 170: iload 14\n 172: iload 15\n 174: invokestatic #104 // Method largestIsland$label:(I[[III)I\n 177: iconst_1\n 178: if_icmpne 214\n 181: aload_0\n 182: iload 14\n 184: aaload\n 185: iload 15\n 187: iload_2\n 188: iastore\n 189: aload 5\n 191: new #56 // class kotlin/Pair\n 194: dup\n 195: iload 14\n 197: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 200: iload 15\n 202: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 205: invokespecial #65 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 208: invokeinterface #69, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 213: pop\n 214: iinc 11, 1\n 217: goto 122\n 220: iload 6\n 222: ireturn\n\n private static final void largestIsland$discoverIslands(int, int, int[][], java.util.Map<java.lang.Integer, java.lang.Integer>);\n Code:\n 0: iload_0\n 1: istore 4\n 3: iconst_0\n 4: istore 5\n 6: iload 5\n 8: iload_1\n 9: if_icmpge 85\n 12: iconst_0\n 13: istore 6\n 15: iload 6\n 17: iload_1\n 18: if_icmpge 79\n 21: aload_2\n 22: iload 5\n 24: aaload\n 25: iload 6\n 27: iaload\n 28: iconst_1\n 29: if_icmpne 73\n 32: aload_2\n 33: iload_1\n 34: iload 4\n 36: iload 5\n 38: iload 6\n 40: invokestatic #119 // Method largestIsland$conquerIsland:([[IIIII)I\n 43: istore 7\n 45: iload 4\n 47: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 50: astore 8\n 52: iload 7\n 54: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 57: astore 9\n 59: aload_3\n 60: aload 8\n 62: aload 9\n 64: invokeinterface #123, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 69: pop\n 70: iinc 4, 1\n 73: iinc 6, 1\n 76: goto 15\n 79: iinc 5, 1\n 82: goto 6\n 85: return\n\n private static final int largestIsland$largestCombinedIsland(java.util.Map<java.lang.Integer, java.lang.Integer>, int, int, int[][]);\n Code:\n 0: aload_0\n 1: iload_1\n 2: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 5: iconst_0\n 6: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 9: invokeinterface #128, 3 // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 14: checkcast #85 // class java/lang/Number\n 17: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 20: istore 4\n 22: iconst_0\n 23: istore 5\n 25: iload 5\n 27: iload_2\n 28: if_icmpge 301\n 31: iconst_0\n 32: istore 6\n 34: iload 6\n 36: iload_2\n 37: if_icmpge 295\n 40: aload_3\n 41: iload 5\n 43: aaload\n 44: iload 6\n 46: iaload\n 47: ifne 289\n 50: getstatic #96 // Field steps:[Lkotlin/Pair;\n 53: astore 8\n 55: iconst_0\n 56: istore 9\n 58: aload 8\n 60: astore 10\n 62: new #51 // class java/util/ArrayList\n 65: dup\n 66: aload 8\n 68: arraylength\n 69: invokespecial #131 // Method java/util/ArrayList.\"<init>\":(I)V\n 72: checkcast #71 // class java/util/Collection\n 75: astore 11\n 77: iconst_0\n 78: istore 12\n 80: iconst_0\n 81: istore 13\n 83: aload 10\n 85: arraylength\n 86: istore 14\n 88: iload 13\n 90: iload 14\n 92: if_icmpge 172\n 95: aload 10\n 97: iload 13\n 99: aaload\n 100: astore 15\n 102: aload 11\n 104: aload 15\n 106: astore 16\n 108: astore 20\n 110: iconst_0\n 111: istore 17\n 113: aload 16\n 115: invokevirtual #83 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 118: checkcast #85 // class java/lang/Number\n 121: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 124: istore 18\n 126: aload 16\n 128: invokevirtual #92 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 131: checkcast #85 // class java/lang/Number\n 134: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 137: istore 19\n 139: iload_2\n 140: aload_3\n 141: iload 5\n 143: iload 18\n 145: iadd\n 146: iload 6\n 148: iload 19\n 150: iadd\n 151: invokestatic #104 // Method largestIsland$label:(I[[III)I\n 154: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 157: aload 20\n 159: swap\n 160: invokeinterface #132, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 165: pop\n 166: iinc 13, 1\n 169: goto 88\n 172: aload 11\n 174: checkcast #54 // class java/util/List\n 177: nop\n 178: checkcast #134 // class java/lang/Iterable\n 181: invokestatic #140 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 184: astore 7\n 186: aload 7\n 188: checkcast #134 // class java/lang/Iterable\n 191: astore 9\n 193: iconst_0\n 194: istore 10\n 196: aload 9\n 198: invokeinterface #144, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 203: astore 11\n 205: aload 11\n 207: invokeinterface #149, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 212: ifeq 274\n 215: aload 11\n 217: invokeinterface #152, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 222: astore 12\n 224: iload 10\n 226: aload 12\n 228: checkcast #85 // class java/lang/Number\n 231: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 234: istore 13\n 236: istore 20\n 238: iconst_0\n 239: istore 14\n 241: aload_0\n 242: iload 13\n 244: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 247: iconst_0\n 248: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 251: invokeinterface #128, 3 // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 256: checkcast #85 // class java/lang/Number\n 259: invokevirtual #89 // Method java/lang/Number.intValue:()I\n 262: istore 21\n 264: iload 20\n 266: iload 21\n 268: iadd\n 269: istore 10\n 271: goto 205\n 274: iload 10\n 276: istore 8\n 278: iload 8\n 280: iconst_1\n 281: iadd\n 282: iload 4\n 284: invokestatic #158 // Method java/lang/Math.max:(II)I\n 287: istore 4\n 289: iinc 6, 1\n 292: goto 34\n 295: iinc 5, 1\n 298: goto 25\n 301: iload 4\n 303: ireturn\n\n static {};\n Code:\n 0: new #179 // class Solution$Companion\n 3: dup\n 4: aconst_null\n 5: invokespecial #182 // Method Solution$Companion.\"<init>\":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V\n 8: putstatic #186 // Field Companion:LSolution$Companion;\n 11: iconst_4\n 12: anewarray #56 // class kotlin/Pair\n 15: astore_0\n 16: aload_0\n 17: iconst_0\n 18: new #56 // class kotlin/Pair\n 21: dup\n 22: iconst_m1\n 23: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 26: iconst_0\n 27: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 30: invokespecial #65 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 33: aastore\n 34: aload_0\n 35: iconst_1\n 36: new #56 // class kotlin/Pair\n 39: dup\n 40: iconst_1\n 41: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 44: iconst_0\n 45: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 48: invokespecial #65 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 51: aastore\n 52: aload_0\n 53: iconst_2\n 54: new #56 // class kotlin/Pair\n 57: dup\n 58: iconst_0\n 59: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 62: iconst_m1\n 63: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 66: invokespecial #65 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 69: aastore\n 70: aload_0\n 71: iconst_3\n 72: new #56 // class kotlin/Pair\n 75: dup\n 76: iconst_0\n 77: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 80: iconst_1\n 81: invokestatic #62 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 84: invokespecial #65 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 87: aastore\n 88: aload_0\n 89: putstatic #96 // Field steps:[Lkotlin/Pair;\n 92: return\n}\n", "javap_err": "" }, { "class_path": "tucuxi__leetcode-make-a-large-island__b44a1d3/Solution$Companion.class", "javap": "Compiled from \"Solution.kt\"\npublic final class Solution$Companion {\n private Solution$Companion();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public Solution$Companion(kotlin.jvm.internal.DefaultConstructorMarker);\n Code:\n 0: aload_0\n 1: invokespecial #12 // Method \"<init>\":()V\n 4: return\n}\n", "javap_err": "" } ]
csabapap__aoc-2017__c1cca8f/src/main/kotlin/Day02.kt
object Day02 { fun part1(input: String): Int { var sum = 0 input.lines().forEach({ line -> var min = 0 var max = 0 line.split("\\s+".toRegex()).forEach { val number = it.toInt() if (min == 0 || min > number) { min = number } if (max == 0 || max < number) { max = number } } sum += max - min }) return sum } fun part2(input: String): Int { var sum = 0 input.lines().forEach({ line -> var lineSum = 0; val numbersString = line.split("\\s".toRegex()) for (i in 0 until numbersString.size - 1) { (i + 1 until numbersString.size) .filter { val first = numbersString[i].toInt() val second = numbersString[it].toInt() if (first > second) { first % second == 0 } else { second % first == 0 } } .forEach { val first = numbersString[i].toInt() val second = numbersString[it].toInt() if (first > second) { lineSum += first / second } else { lineSum += second / first } } } sum += lineSum }) return sum } }
[ { "class_path": "csabapap__aoc-2017__c1cca8f/Day02.class", "javap": "Compiled from \"Day02.kt\"\npublic final class Day02 {\n public static final Day02 INSTANCE;\n\n private Day02();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int part1(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #15 // String input\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: aload_1\n 9: checkcast #23 // class java/lang/CharSequence\n 12: invokestatic #29 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;\n 15: checkcast #31 // class java/lang/Iterable\n 18: astore_3\n 19: iconst_0\n 20: istore 4\n 22: aload_3\n 23: invokeinterface #35, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 28: astore 5\n 30: aload 5\n 32: invokeinterface #41, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 37: ifeq 200\n 40: aload 5\n 42: invokeinterface #45, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 47: astore 6\n 49: aload 6\n 51: checkcast #47 // class java/lang/String\n 54: astore 7\n 56: iconst_0\n 57: istore 8\n 59: iconst_0\n 60: istore 9\n 62: iconst_0\n 63: istore 10\n 65: aload 7\n 67: checkcast #23 // class java/lang/CharSequence\n 70: astore 11\n 72: new #49 // class kotlin/text/Regex\n 75: dup\n 76: ldc #51 // String \\\\s+\n 78: invokespecial #54 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 81: astore 12\n 83: iconst_0\n 84: istore 13\n 86: aload 12\n 88: aload 11\n 90: iload 13\n 92: invokevirtual #58 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 95: checkcast #31 // class java/lang/Iterable\n 98: astore 11\n 100: nop\n 101: iconst_0\n 102: istore 12\n 104: aload 11\n 106: invokeinterface #35, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 111: astore 13\n 113: aload 13\n 115: invokeinterface #41, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 120: ifeq 186\n 123: aload 13\n 125: invokeinterface #45, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 130: astore 14\n 132: aload 14\n 134: checkcast #47 // class java/lang/String\n 137: astore 15\n 139: iconst_0\n 140: istore 16\n 142: aload 15\n 144: invokestatic #63 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 147: istore 17\n 149: iload 9\n 151: ifeq 161\n 154: iload 9\n 156: iload 17\n 158: if_icmple 165\n 161: iload 17\n 163: istore 9\n 165: iload 10\n 167: ifeq 177\n 170: iload 10\n 172: iload 17\n 174: if_icmpge 181\n 177: iload 17\n 179: istore 10\n 181: nop\n 182: nop\n 183: goto 113\n 186: nop\n 187: iload_2\n 188: iload 10\n 190: iload 9\n 192: isub\n 193: iadd\n 194: istore_2\n 195: nop\n 196: nop\n 197: goto 30\n 200: nop\n 201: iload_2\n 202: ireturn\n\n public final int part2(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #15 // String input\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: aload_1\n 9: checkcast #23 // class java/lang/CharSequence\n 12: invokestatic #29 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;\n 15: checkcast #31 // class java/lang/Iterable\n 18: astore_3\n 19: iconst_0\n 20: istore 4\n 22: aload_3\n 23: invokeinterface #35, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 28: astore 5\n 30: aload 5\n 32: invokeinterface #41, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 37: ifeq 427\n 40: aload 5\n 42: invokeinterface #45, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 47: astore 6\n 49: aload 6\n 51: checkcast #47 // class java/lang/String\n 54: astore 7\n 56: iconst_0\n 57: istore 8\n 59: iconst_0\n 60: istore 9\n 62: aload 7\n 64: checkcast #23 // class java/lang/CharSequence\n 67: astore 10\n 69: new #49 // class kotlin/text/Regex\n 72: dup\n 73: ldc #81 // String \\\\s\n 75: invokespecial #54 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 78: astore 11\n 80: iconst_0\n 81: istore 12\n 83: aload 11\n 85: aload 10\n 87: iload 12\n 89: invokevirtual #58 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 92: astore 13\n 94: iconst_0\n 95: istore 10\n 97: aload 13\n 99: invokeinterface #87, 1 // InterfaceMethod java/util/List.size:()I\n 104: iconst_1\n 105: isub\n 106: istore 11\n 108: iload 10\n 110: iload 11\n 112: if_icmpge 417\n 115: iload 10\n 117: iconst_1\n 118: iadd\n 119: aload 13\n 121: invokeinterface #87, 1 // InterfaceMethod java/util/List.size:()I\n 126: invokestatic #93 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 129: checkcast #31 // class java/lang/Iterable\n 132: astore 12\n 134: nop\n 135: iconst_0\n 136: istore 14\n 138: aload 12\n 140: astore 15\n 142: new #95 // class java/util/ArrayList\n 145: dup\n 146: invokespecial #96 // Method java/util/ArrayList.\"<init>\":()V\n 149: checkcast #98 // class java/util/Collection\n 152: astore 16\n 154: iconst_0\n 155: istore 17\n 157: aload 15\n 159: invokeinterface #35, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 164: astore 18\n 166: aload 18\n 168: invokeinterface #41, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 173: ifeq 285\n 176: aload 18\n 178: invokeinterface #45, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 183: astore 19\n 185: aload 19\n 187: checkcast #100 // class java/lang/Number\n 190: invokevirtual #103 // Method java/lang/Number.intValue:()I\n 193: istore 20\n 195: iconst_0\n 196: istore 21\n 198: aload 13\n 200: iload 10\n 202: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 207: checkcast #47 // class java/lang/String\n 210: invokestatic #63 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 213: istore 22\n 215: aload 13\n 217: iload 20\n 219: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 224: checkcast #47 // class java/lang/String\n 227: invokestatic #63 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 230: istore 23\n 232: iload 22\n 234: iload 23\n 236: if_icmple 255\n 239: iload 22\n 241: iload 23\n 243: irem\n 244: ifne 251\n 247: iconst_1\n 248: goto 268\n 251: iconst_0\n 252: goto 268\n 255: iload 23\n 257: iload 22\n 259: irem\n 260: ifne 267\n 263: iconst_1\n 264: goto 268\n 267: iconst_0\n 268: nop\n 269: ifeq 166\n 272: aload 16\n 274: aload 19\n 276: invokeinterface #111, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 281: pop\n 282: goto 166\n 285: aload 16\n 287: checkcast #83 // class java/util/List\n 290: nop\n 291: checkcast #31 // class java/lang/Iterable\n 294: astore 12\n 296: nop\n 297: iconst_0\n 298: istore 14\n 300: aload 12\n 302: invokeinterface #35, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 307: astore 15\n 309: aload 15\n 311: invokeinterface #41, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 316: ifeq 410\n 319: aload 15\n 321: invokeinterface #45, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 326: astore 16\n 328: aload 16\n 330: checkcast #100 // class java/lang/Number\n 333: invokevirtual #103 // Method java/lang/Number.intValue:()I\n 336: istore 17\n 338: iconst_0\n 339: istore 18\n 341: aload 13\n 343: iload 10\n 345: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 350: checkcast #47 // class java/lang/String\n 353: invokestatic #63 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 356: istore 19\n 358: aload 13\n 360: iload 17\n 362: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 367: checkcast #47 // class java/lang/String\n 370: invokestatic #63 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 373: istore 20\n 375: iload 19\n 377: iload 20\n 379: if_icmple 395\n 382: iload 9\n 384: iload 19\n 386: iload 20\n 388: idiv\n 389: iadd\n 390: istore 9\n 392: goto 405\n 395: iload 9\n 397: iload 20\n 399: iload 19\n 401: idiv\n 402: iadd\n 403: istore 9\n 405: nop\n 406: nop\n 407: goto 309\n 410: nop\n 411: iinc 10, 1\n 414: goto 108\n 417: iload_2\n 418: iload 9\n 420: iadd\n 421: istore_2\n 422: nop\n 423: nop\n 424: goto 30\n 427: nop\n 428: iload_2\n 429: ireturn\n\n static {};\n Code:\n 0: new #2 // class Day02\n 3: dup\n 4: invokespecial #129 // Method \"<init>\":()V\n 7: putstatic #132 // Field INSTANCE:LDay02;\n 10: return\n}\n", "javap_err": "" } ]
ikr__exercism__37f5054/kotlin/roman-numerals/src/main/kotlin/RomanNumeral.kt
object RomanNumeral { fun value(x: Int): String { val result = StringBuilder() var remainder = x while (remainder > 0) { val next = firstNotExceeding(remainder) result.append(next.literal) remainder -= next.value } return result.toString() } } private fun firstNotExceeding(x: Int): Term { for (i in 0 until atoms.size - 1) { val candidates = if (i % 2 == 0) listOf( atoms[i], atoms[i] - atoms[i + 2] ) else listOf( atoms[i] + atoms[i + 1] + atoms[i + 1] + atoms[i + 1], atoms[i] + atoms[i + 1] + atoms[i + 1], atoms[i] + atoms[i + 1], atoms[i], atoms[i] - atoms[i + 1] ) val result = candidates.find {it.value <= x} if (result != null) return result } return atoms.last() } private val atoms = listOf( Term(1000, "M"), Term(500, "D"), Term(100, "C"), Term(50, "L"), Term(10, "X"), Term(5, "V"), Term(1, "I") ) private data class Term(val value: Int, val literal: String) { operator fun plus(other: Term): Term { return Term(value + other.value, literal + other.literal) } operator fun minus(other: Term): Term { return Term(value - other.value, other.literal + literal) } }
[ { "class_path": "ikr__exercism__37f5054/RomanNumeral.class", "javap": "Compiled from \"RomanNumeral.kt\"\npublic final class RomanNumeral {\n public static final RomanNumeral INSTANCE;\n\n private RomanNumeral();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final java.lang.String value(int);\n Code:\n 0: new #15 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #16 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: astore_2\n 8: iload_1\n 9: istore_3\n 10: iload_3\n 11: ifle 41\n 14: iload_3\n 15: invokestatic #22 // Method RomanNumeralKt.access$firstNotExceeding:(I)LTerm;\n 18: astore 4\n 20: aload_2\n 21: aload 4\n 23: invokevirtual #28 // Method Term.getLiteral:()Ljava/lang/String;\n 26: invokevirtual #32 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 29: pop\n 30: iload_3\n 31: aload 4\n 33: invokevirtual #36 // Method Term.getValue:()I\n 36: isub\n 37: istore_3\n 38: goto 10\n 41: aload_2\n 42: invokevirtual #39 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 45: dup\n 46: ldc #41 // String toString(...)\n 48: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 51: areturn\n\n static {};\n Code:\n 0: new #2 // class RomanNumeral\n 3: dup\n 4: invokespecial #56 // Method \"<init>\":()V\n 7: putstatic #59 // Field INSTANCE:LRomanNumeral;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "ikr__exercism__37f5054/RomanNumeralKt.class", "javap": "Compiled from \"RomanNumeral.kt\"\npublic final class RomanNumeralKt {\n private static final java.util.List<Term> atoms;\n\n private static final Term firstNotExceeding(int);\n Code:\n 0: iconst_0\n 1: istore_1\n 2: getstatic #10 // Field atoms:Ljava/util/List;\n 5: invokeinterface #16, 1 // InterfaceMethod java/util/List.size:()I\n 10: iconst_1\n 11: isub\n 12: istore_2\n 13: iload_1\n 14: iload_2\n 15: if_icmpge 378\n 18: iload_1\n 19: iconst_2\n 20: irem\n 21: ifne 84\n 24: iconst_2\n 25: anewarray #18 // class Term\n 28: astore 4\n 30: aload 4\n 32: iconst_0\n 33: getstatic #10 // Field atoms:Ljava/util/List;\n 36: iload_1\n 37: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 42: aastore\n 43: aload 4\n 45: iconst_1\n 46: getstatic #10 // Field atoms:Ljava/util/List;\n 49: iload_1\n 50: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 55: checkcast #18 // class Term\n 58: getstatic #10 // Field atoms:Ljava/util/List;\n 61: iload_1\n 62: iconst_2\n 63: iadd\n 64: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 69: checkcast #18 // class Term\n 72: invokevirtual #26 // Method Term.minus:(LTerm;)LTerm;\n 75: aastore\n 76: aload 4\n 78: invokestatic #32 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 81: goto 291\n 84: iconst_5\n 85: anewarray #18 // class Term\n 88: astore 4\n 90: aload 4\n 92: iconst_0\n 93: getstatic #10 // Field atoms:Ljava/util/List;\n 96: iload_1\n 97: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 102: checkcast #18 // class Term\n 105: getstatic #10 // Field atoms:Ljava/util/List;\n 108: iload_1\n 109: iconst_1\n 110: iadd\n 111: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 116: checkcast #18 // class Term\n 119: invokevirtual #35 // Method Term.plus:(LTerm;)LTerm;\n 122: getstatic #10 // Field atoms:Ljava/util/List;\n 125: iload_1\n 126: iconst_1\n 127: iadd\n 128: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 133: checkcast #18 // class Term\n 136: invokevirtual #35 // Method Term.plus:(LTerm;)LTerm;\n 139: getstatic #10 // Field atoms:Ljava/util/List;\n 142: iload_1\n 143: iconst_1\n 144: iadd\n 145: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 150: checkcast #18 // class Term\n 153: invokevirtual #35 // Method Term.plus:(LTerm;)LTerm;\n 156: aastore\n 157: aload 4\n 159: iconst_1\n 160: getstatic #10 // Field atoms:Ljava/util/List;\n 163: iload_1\n 164: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 169: checkcast #18 // class Term\n 172: getstatic #10 // Field atoms:Ljava/util/List;\n 175: iload_1\n 176: iconst_1\n 177: iadd\n 178: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 183: checkcast #18 // class Term\n 186: invokevirtual #35 // Method Term.plus:(LTerm;)LTerm;\n 189: getstatic #10 // Field atoms:Ljava/util/List;\n 192: iload_1\n 193: iconst_1\n 194: iadd\n 195: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 200: checkcast #18 // class Term\n 203: invokevirtual #35 // Method Term.plus:(LTerm;)LTerm;\n 206: aastore\n 207: aload 4\n 209: iconst_2\n 210: getstatic #10 // Field atoms:Ljava/util/List;\n 213: iload_1\n 214: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 219: checkcast #18 // class Term\n 222: getstatic #10 // Field atoms:Ljava/util/List;\n 225: iload_1\n 226: iconst_1\n 227: iadd\n 228: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 233: checkcast #18 // class Term\n 236: invokevirtual #35 // Method Term.plus:(LTerm;)LTerm;\n 239: aastore\n 240: aload 4\n 242: iconst_3\n 243: getstatic #10 // Field atoms:Ljava/util/List;\n 246: iload_1\n 247: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 252: aastore\n 253: aload 4\n 255: iconst_4\n 256: getstatic #10 // Field atoms:Ljava/util/List;\n 259: iload_1\n 260: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 265: checkcast #18 // class Term\n 268: getstatic #10 // Field atoms:Ljava/util/List;\n 271: iload_1\n 272: iconst_1\n 273: iadd\n 274: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 279: checkcast #18 // class Term\n 282: invokevirtual #26 // Method Term.minus:(LTerm;)LTerm;\n 285: aastore\n 286: aload 4\n 288: invokestatic #32 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 291: astore_3\n 292: aload_3\n 293: checkcast #37 // class java/lang/Iterable\n 296: astore 5\n 298: aload 5\n 300: invokeinterface #41, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 305: astore 6\n 307: aload 6\n 309: invokeinterface #47, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 314: ifeq 358\n 317: aload 6\n 319: invokeinterface #51, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 324: astore 7\n 326: aload 7\n 328: checkcast #18 // class Term\n 331: astore 8\n 333: iconst_0\n 334: istore 9\n 336: aload 8\n 338: invokevirtual #54 // Method Term.getValue:()I\n 341: iload_0\n 342: if_icmpgt 349\n 345: iconst_1\n 346: goto 350\n 349: iconst_0\n 350: ifeq 307\n 353: aload 7\n 355: goto 359\n 358: aconst_null\n 359: checkcast #18 // class Term\n 362: astore 4\n 364: aload 4\n 366: dup\n 367: ifnull 371\n 370: areturn\n 371: pop\n 372: iinc 1, 1\n 375: goto 13\n 378: getstatic #10 // Field atoms:Ljava/util/List;\n 381: invokestatic #58 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 384: checkcast #18 // class Term\n 387: areturn\n\n public static final Term access$firstNotExceeding(int);\n Code:\n 0: iload_0\n 1: invokestatic #71 // Method firstNotExceeding:(I)LTerm;\n 4: areturn\n\n static {};\n Code:\n 0: bipush 7\n 2: anewarray #18 // class Term\n 5: astore_0\n 6: aload_0\n 7: iconst_0\n 8: new #18 // class Term\n 11: dup\n 12: sipush 1000\n 15: ldc #75 // String M\n 17: invokespecial #79 // Method Term.\"<init>\":(ILjava/lang/String;)V\n 20: aastore\n 21: aload_0\n 22: iconst_1\n 23: new #18 // class Term\n 26: dup\n 27: sipush 500\n 30: ldc #81 // String D\n 32: invokespecial #79 // Method Term.\"<init>\":(ILjava/lang/String;)V\n 35: aastore\n 36: aload_0\n 37: iconst_2\n 38: new #18 // class Term\n 41: dup\n 42: bipush 100\n 44: ldc #83 // String C\n 46: invokespecial #79 // Method Term.\"<init>\":(ILjava/lang/String;)V\n 49: aastore\n 50: aload_0\n 51: iconst_3\n 52: new #18 // class Term\n 55: dup\n 56: bipush 50\n 58: ldc #85 // String L\n 60: invokespecial #79 // Method Term.\"<init>\":(ILjava/lang/String;)V\n 63: aastore\n 64: aload_0\n 65: iconst_4\n 66: new #18 // class Term\n 69: dup\n 70: bipush 10\n 72: ldc #87 // String X\n 74: invokespecial #79 // Method Term.\"<init>\":(ILjava/lang/String;)V\n 77: aastore\n 78: aload_0\n 79: iconst_5\n 80: new #18 // class Term\n 83: dup\n 84: iconst_5\n 85: ldc #89 // String V\n 87: invokespecial #79 // Method Term.\"<init>\":(ILjava/lang/String;)V\n 90: aastore\n 91: aload_0\n 92: bipush 6\n 94: new #18 // class Term\n 97: dup\n 98: iconst_1\n 99: ldc #90 // String I\n 101: invokespecial #79 // Method Term.\"<init>\":(ILjava/lang/String;)V\n 104: aastore\n 105: aload_0\n 106: invokestatic #32 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 109: putstatic #10 // Field atoms:Ljava/util/List;\n 112: return\n}\n", "javap_err": "" } ]
ikr__exercism__37f5054/kotlin/largest-series-product/src/main/kotlin/Series.kt
data class Series(val s: String) { init { require(Regex("^[0-9]*$") matches s) } fun getLargestProduct(length: Int): Int { require(length <= s.length) val subSeqs = s.split("0").filter {it != ""} val subSolutions = subSeqs.map {largestProductOfNonZeroes(digits(it), length)} return subSolutions.max() ?: if (length == 0) 1 else 0 } } private fun largestProductOfNonZeroes(ds: List<Int>, length: Int): Int { if (ds.size < length) return 0 var result = product(ds.take(length)) var runningProd = result for (i in length..(ds.size - 1)) { runningProd = (runningProd / (ds[i - length])) * ds[i] if (runningProd > result) { result = runningProd } } return result } private fun digits(s: String) = s.map {it.toString().toInt()} private fun product(xs: List<Int>): Int = xs.fold(1, {m, x -> m * x})
[ { "class_path": "ikr__exercism__37f5054/Series.class", "javap": "Compiled from \"Series.kt\"\npublic final class Series {\n private final java.lang.String s;\n\n public Series(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #9 // String s\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokespecial #18 // Method java/lang/Object.\"<init>\":()V\n 10: aload_0\n 11: aload_1\n 12: putfield #21 // Field s:Ljava/lang/String;\n 15: nop\n 16: new #23 // class kotlin/text/Regex\n 19: dup\n 20: ldc #25 // String ^[0-9]*$\n 22: invokespecial #27 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 25: aload_0\n 26: getfield #21 // Field s:Ljava/lang/String;\n 29: checkcast #29 // class java/lang/CharSequence\n 32: invokevirtual #33 // Method kotlin/text/Regex.matches:(Ljava/lang/CharSequence;)Z\n 35: ifne 53\n 38: ldc #35 // String Failed requirement.\n 40: astore_2\n 41: new #37 // class java/lang/IllegalArgumentException\n 44: dup\n 45: aload_2\n 46: invokevirtual #41 // Method java/lang/Object.toString:()Ljava/lang/String;\n 49: invokespecial #42 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 52: athrow\n 53: nop\n 54: return\n\n public final java.lang.String getS();\n Code:\n 0: aload_0\n 1: getfield #21 // Field s:Ljava/lang/String;\n 4: areturn\n\n public final int getLargestProduct(int);\n Code:\n 0: iload_1\n 1: aload_0\n 2: getfield #21 // Field s:Ljava/lang/String;\n 5: invokevirtual #53 // Method java/lang/String.length:()I\n 8: if_icmpgt 15\n 11: iconst_1\n 12: goto 16\n 15: iconst_0\n 16: ifne 34\n 19: ldc #35 // String Failed requirement.\n 21: astore_3\n 22: new #37 // class java/lang/IllegalArgumentException\n 25: dup\n 26: aload_3\n 27: invokevirtual #41 // Method java/lang/Object.toString:()Ljava/lang/String;\n 30: invokespecial #42 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 33: athrow\n 34: aload_0\n 35: getfield #21 // Field s:Ljava/lang/String;\n 38: checkcast #29 // class java/lang/CharSequence\n 41: iconst_1\n 42: anewarray #46 // class java/lang/String\n 45: astore_3\n 46: aload_3\n 47: iconst_0\n 48: ldc #55 // String 0\n 50: aastore\n 51: aload_3\n 52: iconst_0\n 53: iconst_0\n 54: bipush 6\n 56: aconst_null\n 57: invokestatic #61 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 60: checkcast #63 // class java/lang/Iterable\n 63: astore_3\n 64: iconst_0\n 65: istore 4\n 67: aload_3\n 68: astore 5\n 70: new #65 // class java/util/ArrayList\n 73: dup\n 74: invokespecial #66 // Method java/util/ArrayList.\"<init>\":()V\n 77: checkcast #68 // class java/util/Collection\n 80: astore 6\n 82: iconst_0\n 83: istore 7\n 85: aload 5\n 87: invokeinterface #72, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 92: astore 8\n 94: aload 8\n 96: invokeinterface #78, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 101: ifeq 154\n 104: aload 8\n 106: invokeinterface #82, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 111: astore 9\n 113: aload 9\n 115: checkcast #46 // class java/lang/String\n 118: astore 10\n 120: iconst_0\n 121: istore 11\n 123: aload 10\n 125: ldc #84 // String\n 127: invokestatic #88 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 130: ifne 137\n 133: iconst_1\n 134: goto 138\n 137: iconst_0\n 138: ifeq 94\n 141: aload 6\n 143: aload 9\n 145: invokeinterface #92, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 150: pop\n 151: goto 94\n 154: aload 6\n 156: checkcast #94 // class java/util/List\n 159: nop\n 160: astore_2\n 161: aload_2\n 162: checkcast #63 // class java/lang/Iterable\n 165: astore 4\n 167: iconst_0\n 168: istore 5\n 170: aload 4\n 172: astore 6\n 174: new #65 // class java/util/ArrayList\n 177: dup\n 178: aload 4\n 180: bipush 10\n 182: invokestatic #100 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 185: invokespecial #103 // Method java/util/ArrayList.\"<init>\":(I)V\n 188: checkcast #68 // class java/util/Collection\n 191: astore 7\n 193: iconst_0\n 194: istore 8\n 196: aload 6\n 198: invokeinterface #72, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 203: astore 9\n 205: aload 9\n 207: invokeinterface #78, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 212: ifeq 262\n 215: aload 9\n 217: invokeinterface #82, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 222: astore 10\n 224: aload 7\n 226: aload 10\n 228: checkcast #46 // class java/lang/String\n 231: astore 11\n 233: astore 13\n 235: iconst_0\n 236: istore 12\n 238: aload 11\n 240: invokestatic #109 // Method SeriesKt.access$digits:(Ljava/lang/String;)Ljava/util/List;\n 243: iload_1\n 244: invokestatic #113 // Method SeriesKt.access$largestProductOfNonZeroes:(Ljava/util/List;I)I\n 247: invokestatic #119 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 250: aload 13\n 252: swap\n 253: invokeinterface #92, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 258: pop\n 259: goto 205\n 262: aload 7\n 264: checkcast #94 // class java/util/List\n 267: nop\n 268: astore_3\n 269: aload_3\n 270: checkcast #63 // class java/lang/Iterable\n 273: invokestatic #123 // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 276: checkcast #125 // class java/lang/Number\n 279: invokevirtual #128 // Method java/lang/Number.intValue:()I\n 282: ireturn\n\n public final java.lang.String component1();\n Code:\n 0: aload_0\n 1: getfield #21 // Field s:Ljava/lang/String;\n 4: areturn\n\n public final Series copy(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #9 // String s\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #2 // class Series\n 9: dup\n 10: aload_1\n 11: invokespecial #153 // Method \"<init>\":(Ljava/lang/String;)V\n 14: areturn\n\n public static Series copy$default(Series, java.lang.String, int, java.lang.Object);\n Code:\n 0: iload_2\n 1: iconst_1\n 2: iand\n 3: ifeq 11\n 6: aload_0\n 7: getfield #21 // Field s:Ljava/lang/String;\n 10: astore_1\n 11: aload_0\n 12: aload_1\n 13: invokevirtual #157 // Method copy:(Ljava/lang/String;)LSeries;\n 16: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #159 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #160 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #162 // String Series(s=\n 9: invokevirtual #166 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #21 // Field s:Ljava/lang/String;\n 16: invokevirtual #166 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 19: bipush 41\n 21: invokevirtual #169 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 24: invokevirtual #170 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 27: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #21 // Field s:Ljava/lang/String;\n 4: invokevirtual #173 // Method java/lang/String.hashCode:()I\n 7: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class Series\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class Series\n 20: astore_2\n 21: aload_0\n 22: getfield #21 // Field s:Ljava/lang/String;\n 25: aload_2\n 26: getfield #21 // Field s:Ljava/lang/String;\n 29: invokestatic #88 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 32: ifne 37\n 35: iconst_0\n 36: ireturn\n 37: iconst_1\n 38: ireturn\n}\n", "javap_err": "" }, { "class_path": "ikr__exercism__37f5054/SeriesKt.class", "javap": "Compiled from \"Series.kt\"\npublic final class SeriesKt {\n private static final int largestProductOfNonZeroes(java.util.List<java.lang.Integer>, int);\n Code:\n 0: aload_0\n 1: invokeinterface #13, 1 // InterfaceMethod java/util/List.size:()I\n 6: iload_1\n 7: if_icmpge 12\n 10: iconst_0\n 11: ireturn\n 12: aload_0\n 13: checkcast #15 // class java/lang/Iterable\n 16: iload_1\n 17: invokestatic #21 // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;\n 20: invokestatic #25 // Method product:(Ljava/util/List;)I\n 23: istore_2\n 24: iload_2\n 25: istore_3\n 26: iload_1\n 27: istore 4\n 29: aload_0\n 30: invokeinterface #13, 1 // InterfaceMethod java/util/List.size:()I\n 35: istore 5\n 37: iload 4\n 39: iload 5\n 41: if_icmpge 91\n 44: iload_3\n 45: aload_0\n 46: iload 4\n 48: iload_1\n 49: isub\n 50: invokeinterface #29, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 55: checkcast #31 // class java/lang/Number\n 58: invokevirtual #34 // Method java/lang/Number.intValue:()I\n 61: idiv\n 62: aload_0\n 63: iload 4\n 65: invokeinterface #29, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 70: checkcast #31 // class java/lang/Number\n 73: invokevirtual #34 // Method java/lang/Number.intValue:()I\n 76: imul\n 77: istore_3\n 78: iload_3\n 79: iload_2\n 80: if_icmple 85\n 83: iload_3\n 84: istore_2\n 85: iinc 4, 1\n 88: goto 37\n 91: iload_2\n 92: ireturn\n\n private static final java.util.List<java.lang.Integer> digits(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #46 // class java/lang/CharSequence\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: aload_1\n 8: astore_3\n 9: new #48 // class java/util/ArrayList\n 12: dup\n 13: aload_1\n 14: invokeinterface #50, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 19: invokespecial #54 // Method java/util/ArrayList.\"<init>\":(I)V\n 22: checkcast #56 // class java/util/Collection\n 25: astore 4\n 27: iconst_0\n 28: istore 5\n 30: iconst_0\n 31: istore 6\n 33: iload 6\n 35: aload_3\n 36: invokeinterface #50, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 41: if_icmpge 92\n 44: aload_3\n 45: iload 6\n 47: invokeinterface #60, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 52: istore 7\n 54: aload 4\n 56: iload 7\n 58: istore 8\n 60: astore 10\n 62: iconst_0\n 63: istore 9\n 65: iload 8\n 67: invokestatic #66 // Method java/lang/String.valueOf:(C)Ljava/lang/String;\n 70: invokestatic #72 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 73: nop\n 74: invokestatic #75 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 77: aload 10\n 79: swap\n 80: invokeinterface #79, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 85: pop\n 86: iinc 6, 1\n 89: goto 33\n 92: aload 4\n 94: checkcast #9 // class java/util/List\n 97: nop\n 98: areturn\n\n private static final int product(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: checkcast #15 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_1\n 6: istore_2\n 7: iconst_0\n 8: istore_3\n 9: iload_2\n 10: istore 4\n 12: aload_1\n 13: invokeinterface #97, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 18: astore 5\n 20: aload 5\n 22: invokeinterface #103, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 27: ifeq 66\n 30: aload 5\n 32: invokeinterface #107, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 37: astore 6\n 39: iload 4\n 41: aload 6\n 43: checkcast #31 // class java/lang/Number\n 46: invokevirtual #34 // Method java/lang/Number.intValue:()I\n 49: istore 7\n 51: istore 8\n 53: iconst_0\n 54: istore 9\n 56: iload 8\n 58: iload 7\n 60: imul\n 61: istore 4\n 63: goto 20\n 66: iload 4\n 68: ireturn\n\n public static final int access$largestProductOfNonZeroes(java.util.List, int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: invokestatic #121 // Method largestProductOfNonZeroes:(Ljava/util/List;I)I\n 5: ireturn\n\n public static final java.util.List access$digits(java.lang.String);\n Code:\n 0: aload_0\n 1: invokestatic #124 // Method digits:(Ljava/lang/String;)Ljava/util/List;\n 4: areturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Utils.kt
import java.io.File import java.math.BigInteger import java.security.MessageDigest import kotlin.math.abs typealias Vector2D = Coord2D /** * Reads lines from the given input txt file. */ fun readInput(name: String) = File("src", "$name.txt") .readLines() /** * Read whole input txt file as one string. */ fun readWholeInput(name: String) = File("src", "$name.txt") .readText() /** * Converts string to md5 hash. */ fun String.md5() = BigInteger(1, MessageDigest.getInstance("MD5").digest(toByteArray())) .toString(16) .padStart(32, '0') data class Coord2D(val x: Int, val y: Int) { fun adjacentTo(coord2D: Coord2D): Boolean { return abs(x - coord2D.x) <= 1 && abs(y - coord2D.y) <= 1 } operator fun minus(other: Coord2D): Coord2D { return Coord2D(this.x - other.x, this.y - other.y) } operator fun plus(other: Coord2D): Coord2D { return Coord2D(this.x + other.x, this.y + other.y) } fun moved(byX: Int, byY: Int): Coord2D { return Coord2D(x + byX, y + byY) } fun manhattenDistance(other: Vector2D): Int { return abs(this.x - other.x) + abs(this.y - other.y) } } /** * Returns the product (multiplication) of all elements in the collection. */ fun List<Int>.product(): Int { return this.reduce { acc, i -> acc * i } } /** * All permutations of a list * Source: https://rosettacode.org/wiki/Permutations#Kotlin */ fun <T> permute(input: List<T>): List<List<T>> { if (input.size == 1) return listOf(input) val perms = mutableListOf<List<T>>() val toInsert = input[0] for (perm in permute(input.drop(1))) { for (i in 0..perm.size) { val newPerm = perm.toMutableList() newPerm.add(i, toInsert) perms.add(newPerm) } } return perms }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/UtilsKt.class", "javap": "Compiled from \"Utils.kt\"\npublic final class UtilsKt {\n public static final java.util.List<java.lang.String> readInput(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #10 // String name\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #18 // class java/io/File\n 9: dup\n 10: ldc #20 // String src\n 12: new #22 // class java/lang/StringBuilder\n 15: dup\n 16: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 19: aload_0\n 20: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 23: ldc #32 // String .txt\n 25: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 28: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 31: invokespecial #39 // Method java/io/File.\"<init>\":(Ljava/lang/String;Ljava/lang/String;)V\n 34: aconst_null\n 35: iconst_1\n 36: aconst_null\n 37: invokestatic #45 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;\n 40: areturn\n\n public static final java.lang.String readWholeInput(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #10 // String name\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #18 // class java/io/File\n 9: dup\n 10: ldc #20 // String src\n 12: new #22 // class java/lang/StringBuilder\n 15: dup\n 16: invokespecial #26 // Method java/lang/StringBuilder.\"<init>\":()V\n 19: aload_0\n 20: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 23: ldc #32 // String .txt\n 25: invokevirtual #30 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 28: invokevirtual #36 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 31: invokespecial #39 // Method java/io/File.\"<init>\":(Ljava/lang/String;Ljava/lang/String;)V\n 34: aconst_null\n 35: iconst_1\n 36: aconst_null\n 37: invokestatic #52 // Method kotlin/io/FilesKt.readText$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/lang/String;\n 40: areturn\n\n public static final java.lang.String md5(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #55 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #57 // class java/math/BigInteger\n 9: dup\n 10: iconst_1\n 11: ldc #59 // String MD5\n 13: invokestatic #65 // Method java/security/MessageDigest.getInstance:(Ljava/lang/String;)Ljava/security/MessageDigest;\n 16: aload_0\n 17: astore_1\n 18: getstatic #71 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;\n 21: aload_1\n 22: swap\n 23: invokevirtual #77 // Method java/lang/String.getBytes:(Ljava/nio/charset/Charset;)[B\n 26: dup\n 27: ldc #79 // String getBytes(...)\n 29: invokestatic #82 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 32: invokevirtual #86 // Method java/security/MessageDigest.digest:([B)[B\n 35: invokespecial #89 // Method java/math/BigInteger.\"<init>\":(I[B)V\n 38: bipush 16\n 40: invokevirtual #92 // Method java/math/BigInteger.toString:(I)Ljava/lang/String;\n 43: dup\n 44: ldc #94 // String toString(...)\n 46: invokestatic #82 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 49: bipush 32\n 51: bipush 48\n 53: invokestatic #100 // Method kotlin/text/StringsKt.padStart:(Ljava/lang/String;IC)Ljava/lang/String;\n 56: areturn\n\n public static final int product(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #55 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #106 // class java/lang/Iterable\n 10: astore_1\n 11: iconst_0\n 12: istore_2\n 13: aload_1\n 14: invokeinterface #110, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 19: astore_3\n 20: aload_3\n 21: invokeinterface #116, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 26: ifne 39\n 29: new #118 // class java/lang/UnsupportedOperationException\n 32: dup\n 33: ldc #120 // String Empty collection can\\'t be reduced.\n 35: invokespecial #123 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 38: athrow\n 39: aload_3\n 40: invokeinterface #127, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 45: astore 4\n 47: aload_3\n 48: invokeinterface #116, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 53: ifeq 96\n 56: aload 4\n 58: aload_3\n 59: invokeinterface #127, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 64: checkcast #129 // class java/lang/Number\n 67: invokevirtual #133 // Method java/lang/Number.intValue:()I\n 70: istore 5\n 72: checkcast #129 // class java/lang/Number\n 75: invokevirtual #133 // Method java/lang/Number.intValue:()I\n 78: istore 6\n 80: iconst_0\n 81: istore 7\n 83: iload 6\n 85: iload 5\n 87: imul\n 88: invokestatic #139 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 91: astore 4\n 93: goto 47\n 96: aload 4\n 98: checkcast #129 // class java/lang/Number\n 101: invokevirtual #133 // Method java/lang/Number.intValue:()I\n 104: ireturn\n\n public static final <T> java.util.List<java.util.List<T>> permute(java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: ldc #157 // String input\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #162, 1 // InterfaceMethod java/util/List.size:()I\n 12: iconst_1\n 13: if_icmpne 21\n 16: aload_0\n 17: invokestatic #168 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;\n 20: areturn\n 21: new #170 // class java/util/ArrayList\n 24: dup\n 25: invokespecial #171 // Method java/util/ArrayList.\"<init>\":()V\n 28: checkcast #159 // class java/util/List\n 31: astore_1\n 32: aload_0\n 33: iconst_0\n 34: invokeinterface #175, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 39: astore_2\n 40: aload_0\n 41: checkcast #106 // class java/lang/Iterable\n 44: iconst_1\n 45: invokestatic #179 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;\n 48: invokestatic #181 // Method permute:(Ljava/util/List;)Ljava/util/List;\n 51: invokeinterface #182, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 56: astore_3\n 57: aload_3\n 58: invokeinterface #116, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 63: ifeq 138\n 66: aload_3\n 67: invokeinterface #127, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 72: checkcast #159 // class java/util/List\n 75: astore 4\n 77: iconst_0\n 78: istore 5\n 80: aload 4\n 82: invokeinterface #162, 1 // InterfaceMethod java/util/List.size:()I\n 87: istore 6\n 89: iload 5\n 91: iload 6\n 93: if_icmpgt 57\n 96: aload 4\n 98: checkcast #184 // class java/util/Collection\n 101: invokestatic #188 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 104: astore 7\n 106: aload 7\n 108: iload 5\n 110: aload_2\n 111: invokeinterface #192, 3 // InterfaceMethod java/util/List.add:(ILjava/lang/Object;)V\n 116: aload_1\n 117: aload 7\n 119: invokeinterface #195, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 124: pop\n 125: iload 5\n 127: iload 6\n 129: if_icmpeq 57\n 132: iinc 5, 1\n 135: goto 96\n 138: aload_1\n 139: areturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day04.kt
fun main() { fun part1(input: List<List<Int>>): Int { return input.count { list -> (list[0] <= list[2] && list[1] >= list[3]) || (list[0] >= list[2] && list[1] <= list[3]) } } fun part2(input: List<List<Int>>): Int { return input.count { list -> (list[0] <= list[2] && list[2] <= list[1]) || (list[2] <= list[0] && list[0] <= list[3]) } } val input = readInput("Day04") .map { line -> line.split(',', '-') .map { it.toInt() } } println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day04Kt.class", "javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day04\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: checkcast #16 // class java/lang/Iterable\n 8: astore_1\n 9: nop\n 10: iconst_0\n 11: istore_2\n 12: aload_1\n 13: astore_3\n 14: new #18 // class java/util/ArrayList\n 17: dup\n 18: aload_1\n 19: bipush 10\n 21: invokestatic #24 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 24: invokespecial #28 // Method java/util/ArrayList.\"<init>\":(I)V\n 27: checkcast #30 // class java/util/Collection\n 30: astore 4\n 32: iconst_0\n 33: istore 5\n 35: aload_3\n 36: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 41: astore 6\n 43: aload 6\n 45: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 50: ifeq 225\n 53: aload 6\n 55: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 60: astore 7\n 62: aload 4\n 64: aload 7\n 66: checkcast #46 // class java/lang/String\n 69: astore 8\n 71: astore 20\n 73: iconst_0\n 74: istore 9\n 76: aload 8\n 78: checkcast #48 // class java/lang/CharSequence\n 81: iconst_2\n 82: newarray char\n 84: astore 10\n 86: aload 10\n 88: iconst_0\n 89: bipush 44\n 91: castore\n 92: aload 10\n 94: iconst_1\n 95: bipush 45\n 97: castore\n 98: aload 10\n 100: iconst_0\n 101: iconst_0\n 102: bipush 6\n 104: aconst_null\n 105: invokestatic #54 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;\n 108: checkcast #16 // class java/lang/Iterable\n 111: astore 10\n 113: nop\n 114: iconst_0\n 115: istore 11\n 117: aload 10\n 119: astore 12\n 121: new #18 // class java/util/ArrayList\n 124: dup\n 125: aload 10\n 127: bipush 10\n 129: invokestatic #24 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 132: invokespecial #28 // Method java/util/ArrayList.\"<init>\":(I)V\n 135: checkcast #30 // class java/util/Collection\n 138: astore 13\n 140: iconst_0\n 141: istore 14\n 143: aload 12\n 145: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 150: astore 15\n 152: aload 15\n 154: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 159: ifeq 206\n 162: aload 15\n 164: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 169: astore 16\n 171: aload 13\n 173: aload 16\n 175: checkcast #46 // class java/lang/String\n 178: astore 17\n 180: astore 18\n 182: iconst_0\n 183: istore 19\n 185: aload 17\n 187: invokestatic #60 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 190: nop\n 191: invokestatic #64 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 194: aload 18\n 196: swap\n 197: invokeinterface #68, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 202: pop\n 203: goto 152\n 206: aload 13\n 208: checkcast #70 // class java/util/List\n 211: nop\n 212: nop\n 213: aload 20\n 215: swap\n 216: invokeinterface #68, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 221: pop\n 222: goto 43\n 225: aload 4\n 227: checkcast #70 // class java/util/List\n 230: nop\n 231: astore_0\n 232: aload_0\n 233: invokestatic #74 // Method main$part1:(Ljava/util/List;)I\n 236: istore_1\n 237: getstatic #80 // Field java/lang/System.out:Ljava/io/PrintStream;\n 240: iload_1\n 241: invokevirtual #85 // Method java/io/PrintStream.println:(I)V\n 244: aload_0\n 245: invokestatic #88 // Method main$part2:(Ljava/util/List;)I\n 248: istore_1\n 249: getstatic #80 // Field java/lang/System.out:Ljava/io/PrintStream;\n 252: iload_1\n 253: invokevirtual #85 // Method java/io/PrintStream.println:(I)V\n 256: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #108 // Method main:()V\n 3: return\n\n private static final int main$part1(java.util.List<? extends java.util.List<java.lang.Integer>>);\n Code:\n 0: aload_0\n 1: checkcast #16 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: aload_1\n 8: instanceof #30 // class java/util/Collection\n 11: ifeq 30\n 14: aload_1\n 15: checkcast #30 // class java/util/Collection\n 18: invokeinterface #114, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 23: ifeq 30\n 26: iconst_0\n 27: goto 215\n 30: iconst_0\n 31: istore_3\n 32: aload_1\n 33: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 4\n 40: aload 4\n 42: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 214\n 50: aload 4\n 52: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 5\n 59: aload 5\n 61: checkcast #70 // class java/util/List\n 64: astore 6\n 66: iconst_0\n 67: istore 7\n 69: aload 6\n 71: iconst_0\n 72: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 77: checkcast #120 // class java/lang/Number\n 80: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 83: aload 6\n 85: iconst_2\n 86: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 91: checkcast #120 // class java/lang/Number\n 94: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 97: if_icmpgt 131\n 100: aload 6\n 102: iconst_1\n 103: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 108: checkcast #120 // class java/lang/Number\n 111: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 114: aload 6\n 116: iconst_3\n 117: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 122: checkcast #120 // class java/lang/Number\n 125: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 128: if_icmpge 193\n 131: aload 6\n 133: iconst_0\n 134: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 139: checkcast #120 // class java/lang/Number\n 142: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 145: aload 6\n 147: iconst_2\n 148: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 153: checkcast #120 // class java/lang/Number\n 156: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 159: if_icmplt 197\n 162: aload 6\n 164: iconst_1\n 165: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 170: checkcast #120 // class java/lang/Number\n 173: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 176: aload 6\n 178: iconst_3\n 179: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 184: checkcast #120 // class java/lang/Number\n 187: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 190: if_icmpgt 197\n 193: iconst_1\n 194: goto 198\n 197: iconst_0\n 198: ifeq 40\n 201: iinc 3, 1\n 204: iload_3\n 205: ifge 40\n 208: invokestatic #127 // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V\n 211: goto 40\n 214: iload_3\n 215: ireturn\n\n private static final int main$part2(java.util.List<? extends java.util.List<java.lang.Integer>>);\n Code:\n 0: aload_0\n 1: checkcast #16 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: aload_1\n 8: instanceof #30 // class java/util/Collection\n 11: ifeq 30\n 14: aload_1\n 15: checkcast #30 // class java/util/Collection\n 18: invokeinterface #114, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 23: ifeq 30\n 26: iconst_0\n 27: goto 215\n 30: iconst_0\n 31: istore_3\n 32: aload_1\n 33: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 4\n 40: aload 4\n 42: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 214\n 50: aload 4\n 52: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 5\n 59: aload 5\n 61: checkcast #70 // class java/util/List\n 64: astore 6\n 66: iconst_0\n 67: istore 7\n 69: aload 6\n 71: iconst_0\n 72: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 77: checkcast #120 // class java/lang/Number\n 80: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 83: aload 6\n 85: iconst_2\n 86: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 91: checkcast #120 // class java/lang/Number\n 94: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 97: if_icmpgt 131\n 100: aload 6\n 102: iconst_2\n 103: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 108: checkcast #120 // class java/lang/Number\n 111: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 114: aload 6\n 116: iconst_1\n 117: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 122: checkcast #120 // class java/lang/Number\n 125: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 128: if_icmple 193\n 131: aload 6\n 133: iconst_2\n 134: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 139: checkcast #120 // class java/lang/Number\n 142: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 145: aload 6\n 147: iconst_0\n 148: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 153: checkcast #120 // class java/lang/Number\n 156: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 159: if_icmpgt 197\n 162: aload 6\n 164: iconst_0\n 165: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 170: checkcast #120 // class java/lang/Number\n 173: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 176: aload 6\n 178: iconst_3\n 179: invokeinterface #118, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 184: checkcast #120 // class java/lang/Number\n 187: invokevirtual #124 // Method java/lang/Number.intValue:()I\n 190: if_icmpgt 197\n 193: iconst_1\n 194: goto 198\n 197: iconst_0\n 198: ifeq 40\n 201: iinc 3, 1\n 204: iload_3\n 205: ifge 40\n 208: invokestatic #127 // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V\n 211: goto 40\n 214: iload_3\n 215: ireturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day15.kt
import kotlin.math.abs fun main() { data class Interval(var start: Int, var end: Int) { fun limit(minStart: Int, maxEnd: Int) { start = maxOf(minStart, start) end = minOf(maxEnd, end) } fun size(): Int { return 1 + end - start } } fun List<Interval>.maxReduce(): List<Interval> { if (isEmpty()) return emptyList() val iterator = this.sortedWith(compareBy({ it.start }, { it.end })).listIterator() var last = iterator.next() val reduced = mutableListOf(last) while (iterator.hasNext()) { val next = iterator.next() if (next.start <= last.end) { last.end = maxOf(next.end, last.end) } else { reduced.add(next) last = next } } return reduced } fun parseSensorsBeacons(input: List<String>): Map<Vector2D, Vector2D> { return input.associate { line -> val split = line.split("=", ",", ":") Vector2D(split[1].toInt(), split[3].toInt()) to Vector2D(split[5].toInt(), split[7].toInt()) } } fun rangeAtY(sensor: Vector2D, distance: Int, y: Int): Interval? { val yDist = abs(sensor.y - y) if (yDist > distance) return null val restDist = distance - yDist return Interval(sensor.x - restDist, sensor.x + restDist) } fun part1(input: List<String>): Int { val sensorToBeacons = parseSensorsBeacons(input) val beaconsCount = sensorToBeacons.values.filter { it.y == 2_000_000 }.toSet().size val sensorToDistances = sensorToBeacons.mapValues { (s, b) -> s.manhattenDistance(b) } return sensorToDistances .mapNotNull { (s, d) -> rangeAtY(s, d, 2_000_000) } .maxReduce() .sumOf { it.size() } - beaconsCount } fun part2(input: List<String>): Long { val sensorToDistances = parseSensorsBeacons(input).mapValues { (s, b) -> s.manhattenDistance(b) } for (y in 0..4_000_000) { val intervals = sensorToDistances .mapNotNull { (s, d) -> rangeAtY(s, d, y) } .maxReduce() .onEach { it.limit(0, 4_000_000) } if (intervals.size > 1) { return 4_000_000L * (intervals.first().end + 1) + y } } return -1L } val input = readInput("Day15") println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day15Kt$main$Interval.class", "javap": "Compiled from \"Day15.kt\"\npublic final class Day15Kt$main$Interval {\n private int start;\n\n private int end;\n\n public Day15Kt$main$Interval(int, int);\n Code:\n 0: aload_0\n 1: invokespecial #9 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: iload_1\n 6: putfield #13 // Field start:I\n 9: aload_0\n 10: iload_2\n 11: putfield #16 // Field end:I\n 14: return\n\n public final int getStart();\n Code:\n 0: aload_0\n 1: getfield #13 // Field start:I\n 4: ireturn\n\n public final void setStart(int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #13 // Field start:I\n 5: return\n\n public final int getEnd();\n Code:\n 0: aload_0\n 1: getfield #16 // Field end:I\n 4: ireturn\n\n public final void setEnd(int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #16 // Field end:I\n 5: return\n\n public final void limit(int, int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: aload_0\n 3: getfield #13 // Field start:I\n 6: invokestatic #32 // Method java/lang/Math.max:(II)I\n 9: putfield #13 // Field start:I\n 12: aload_0\n 13: iload_2\n 14: aload_0\n 15: getfield #16 // Field end:I\n 18: invokestatic #35 // Method java/lang/Math.min:(II)I\n 21: putfield #16 // Field end:I\n 24: return\n\n public final int size();\n Code:\n 0: iconst_1\n 1: aload_0\n 2: getfield #16 // Field end:I\n 5: iadd\n 6: aload_0\n 7: getfield #13 // Field start:I\n 10: isub\n 11: ireturn\n\n public final int component1();\n Code:\n 0: aload_0\n 1: getfield #13 // Field start:I\n 4: ireturn\n\n public final int component2();\n Code:\n 0: aload_0\n 1: getfield #16 // Field end:I\n 4: ireturn\n\n public final Day15Kt$main$Interval copy(int, int);\n Code:\n 0: new #2 // class Day15Kt$main$Interval\n 3: dup\n 4: iload_1\n 5: iload_2\n 6: invokespecial #44 // Method \"<init>\":(II)V\n 9: areturn\n\n public static Day15Kt$main$Interval copy$default(Day15Kt$main$Interval, int, int, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_1\n 2: iand\n 3: ifeq 11\n 6: aload_0\n 7: getfield #13 // Field start:I\n 10: istore_1\n 11: iload_3\n 12: iconst_2\n 13: iand\n 14: ifeq 22\n 17: aload_0\n 18: getfield #16 // Field end:I\n 21: istore_2\n 22: aload_0\n 23: iload_1\n 24: iload_2\n 25: invokevirtual #48 // Method copy:(II)LDay15Kt$main$Interval;\n 28: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #52 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #53 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #55 // String Interval(start=\n 9: invokevirtual #59 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #13 // Field start:I\n 16: invokevirtual #62 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 19: ldc #64 // String , end=\n 21: invokevirtual #59 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 24: aload_0\n 25: getfield #16 // Field end:I\n 28: invokevirtual #62 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 31: bipush 41\n 33: invokevirtual #67 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 36: invokevirtual #69 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 39: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #13 // Field start:I\n 4: invokestatic #75 // Method java/lang/Integer.hashCode:(I)I\n 7: istore_1\n 8: iload_1\n 9: bipush 31\n 11: imul\n 12: aload_0\n 13: getfield #16 // Field end:I\n 16: invokestatic #75 // Method java/lang/Integer.hashCode:(I)I\n 19: iadd\n 20: istore_1\n 21: iload_1\n 22: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class Day15Kt$main$Interval\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class Day15Kt$main$Interval\n 20: astore_2\n 21: aload_0\n 22: getfield #13 // Field start:I\n 25: aload_2\n 26: getfield #13 // Field start:I\n 29: if_icmpeq 34\n 32: iconst_0\n 33: ireturn\n 34: aload_0\n 35: getfield #16 // Field end:I\n 38: aload_2\n 39: getfield #16 // Field end:I\n 42: if_icmpeq 47\n 45: iconst_0\n 46: ireturn\n 47: iconst_1\n 48: ireturn\n}\n", "javap_err": "" }, { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day15Kt.class", "javap": "Compiled from \"Day15.kt\"\npublic final class Day15Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day15\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: astore_0\n 6: aload_0\n 7: invokestatic #18 // Method main$part1:(Ljava/util/List;)I\n 10: istore_1\n 11: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 14: iload_1\n 15: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 18: aload_0\n 19: invokestatic #34 // Method main$part2:(Ljava/util/List;)J\n 22: lstore_1\n 23: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 26: lload_1\n 27: invokevirtual #37 // Method java/io/PrintStream.println:(J)V\n 30: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #42 // Method main:()V\n 3: return\n\n private static final java.lang.Comparable main$maxReduce$lambda$0(Day15Kt$main$Interval);\n Code:\n 0: aload_0\n 1: ldc #48 // String it\n 3: invokestatic #54 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #60 // Method Day15Kt$main$Interval.getStart:()I\n 10: invokestatic #66 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: checkcast #68 // class java/lang/Comparable\n 16: areturn\n\n private static final java.lang.Comparable main$maxReduce$lambda$1(Day15Kt$main$Interval);\n Code:\n 0: aload_0\n 1: ldc #48 // String it\n 3: invokestatic #54 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #73 // Method Day15Kt$main$Interval.getEnd:()I\n 10: invokestatic #66 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 13: checkcast #68 // class java/lang/Comparable\n 16: areturn\n\n private static final java.util.List<Day15Kt$main$Interval> main$maxReduce(java.util.List<Day15Kt$main$Interval>);\n Code:\n 0: aload_0\n 1: invokeinterface #82, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 6: ifeq 13\n 9: invokestatic #88 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 12: areturn\n 13: aload_0\n 14: checkcast #90 // class java/lang/Iterable\n 17: iconst_2\n 18: anewarray #92 // class kotlin/jvm/functions/Function1\n 21: astore_2\n 22: aload_2\n 23: iconst_0\n 24: invokedynamic #109, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 29: aastore\n 30: aload_2\n 31: iconst_1\n 32: invokedynamic #113, 0 // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;\n 37: aastore\n 38: aload_2\n 39: invokestatic #119 // Method kotlin/comparisons/ComparisonsKt.compareBy:([Lkotlin/jvm/functions/Function1;)Ljava/util/Comparator;\n 42: invokestatic #123 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 45: invokeinterface #127, 1 // InterfaceMethod java/util/List.listIterator:()Ljava/util/ListIterator;\n 50: astore_1\n 51: aload_1\n 52: invokeinterface #133, 1 // InterfaceMethod java/util/ListIterator.next:()Ljava/lang/Object;\n 57: checkcast #56 // class Day15Kt$main$Interval\n 60: astore_2\n 61: iconst_1\n 62: anewarray #56 // class Day15Kt$main$Interval\n 65: astore 4\n 67: aload 4\n 69: iconst_0\n 70: aload_2\n 71: aastore\n 72: aload 4\n 74: invokestatic #137 // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;\n 77: astore_3\n 78: aload_1\n 79: invokeinterface #140, 1 // InterfaceMethod java/util/ListIterator.hasNext:()Z\n 84: ifeq 144\n 87: aload_1\n 88: invokeinterface #133, 1 // InterfaceMethod java/util/ListIterator.next:()Ljava/lang/Object;\n 93: checkcast #56 // class Day15Kt$main$Interval\n 96: astore 4\n 98: aload 4\n 100: invokevirtual #60 // Method Day15Kt$main$Interval.getStart:()I\n 103: aload_2\n 104: invokevirtual #73 // Method Day15Kt$main$Interval.getEnd:()I\n 107: if_icmpgt 129\n 110: aload_2\n 111: aload 4\n 113: invokevirtual #73 // Method Day15Kt$main$Interval.getEnd:()I\n 116: aload_2\n 117: invokevirtual #73 // Method Day15Kt$main$Interval.getEnd:()I\n 120: invokestatic #146 // Method java/lang/Math.max:(II)I\n 123: invokevirtual #149 // Method Day15Kt$main$Interval.setEnd:(I)V\n 126: goto 78\n 129: aload_3\n 130: aload 4\n 132: invokeinterface #153, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 137: pop\n 138: aload 4\n 140: astore_2\n 141: goto 78\n 144: aload_3\n 145: areturn\n\n private static final java.util.Map<Coord2D, Coord2D> main$parseSensorsBeacons(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #90 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: aload_1\n 8: bipush 10\n 10: invokestatic #165 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 13: invokestatic #171 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 16: bipush 16\n 18: invokestatic #176 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I\n 21: istore_3\n 22: aload_1\n 23: astore 4\n 25: new #178 // class java/util/LinkedHashMap\n 28: dup\n 29: iload_3\n 30: invokespecial #181 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 33: checkcast #183 // class java/util/Map\n 36: astore 5\n 38: iconst_0\n 39: istore 6\n 41: aload 4\n 43: invokeinterface #186, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 48: astore 7\n 50: aload 7\n 52: invokeinterface #189, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 57: ifeq 221\n 60: aload 7\n 62: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 67: astore 8\n 69: aload 5\n 71: astore 9\n 73: aload 8\n 75: checkcast #192 // class java/lang/String\n 78: astore 10\n 80: iconst_0\n 81: istore 11\n 83: aload 10\n 85: checkcast #194 // class java/lang/CharSequence\n 88: iconst_3\n 89: anewarray #192 // class java/lang/String\n 92: astore 12\n 94: aload 12\n 96: iconst_0\n 97: ldc #196 // String =\n 99: aastore\n 100: aload 12\n 102: iconst_1\n 103: ldc #198 // String ,\n 105: aastore\n 106: aload 12\n 108: iconst_2\n 109: ldc #200 // String :\n 111: aastore\n 112: aload 12\n 114: iconst_0\n 115: iconst_0\n 116: bipush 6\n 118: aconst_null\n 119: invokestatic #206 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 122: astore 13\n 124: new #208 // class Coord2D\n 127: dup\n 128: aload 13\n 130: iconst_1\n 131: invokeinterface #212, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 136: checkcast #192 // class java/lang/String\n 139: invokestatic #216 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 142: aload 13\n 144: iconst_3\n 145: invokeinterface #212, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 150: checkcast #192 // class java/lang/String\n 153: invokestatic #216 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 156: invokespecial #219 // Method Coord2D.\"<init>\":(II)V\n 159: new #208 // class Coord2D\n 162: dup\n 163: aload 13\n 165: iconst_5\n 166: invokeinterface #212, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 171: checkcast #192 // class java/lang/String\n 174: invokestatic #216 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 177: aload 13\n 179: bipush 7\n 181: invokeinterface #212, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 186: checkcast #192 // class java/lang/String\n 189: invokestatic #216 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 192: invokespecial #219 // Method Coord2D.\"<init>\":(II)V\n 195: invokestatic #225 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 198: astore 10\n 200: aload 9\n 202: aload 10\n 204: invokevirtual #230 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 207: aload 10\n 209: invokevirtual #233 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 212: invokeinterface #237, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 217: pop\n 218: goto 50\n 221: aload 5\n 223: nop\n 224: areturn\n\n private static final Day15Kt$main$Interval main$rangeAtY(Coord2D, int, int);\n Code:\n 0: aload_0\n 1: invokevirtual #257 // Method Coord2D.getY:()I\n 4: iload_2\n 5: isub\n 6: invokestatic #260 // Method java/lang/Math.abs:(I)I\n 9: istore_3\n 10: iload_3\n 11: iload_1\n 12: if_icmple 17\n 15: aconst_null\n 16: areturn\n 17: iload_1\n 18: iload_3\n 19: isub\n 20: istore 4\n 22: new #56 // class Day15Kt$main$Interval\n 25: dup\n 26: aload_0\n 27: invokevirtual #263 // Method Coord2D.getX:()I\n 30: iload 4\n 32: isub\n 33: aload_0\n 34: invokevirtual #263 // Method Coord2D.getX:()I\n 37: iload 4\n 39: iadd\n 40: invokespecial #264 // Method Day15Kt$main$Interval.\"<init>\":(II)V\n 43: areturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #273 // Method main$parseSensorsBeacons:(Ljava/util/List;)Ljava/util/Map;\n 4: astore_1\n 5: aload_1\n 6: invokeinterface #277, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 11: checkcast #90 // class java/lang/Iterable\n 14: astore_3\n 15: iconst_0\n 16: istore 4\n 18: aload_3\n 19: astore 5\n 21: new #279 // class java/util/ArrayList\n 24: dup\n 25: invokespecial #281 // Method java/util/ArrayList.\"<init>\":()V\n 28: checkcast #283 // class java/util/Collection\n 31: astore 6\n 33: iconst_0\n 34: istore 7\n 36: aload 5\n 38: invokeinterface #186, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 43: astore 8\n 45: aload 8\n 47: invokeinterface #189, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 52: ifeq 106\n 55: aload 8\n 57: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 62: astore 9\n 64: aload 9\n 66: checkcast #208 // class Coord2D\n 69: astore 10\n 71: iconst_0\n 72: istore 11\n 74: aload 10\n 76: invokevirtual #257 // Method Coord2D.getY:()I\n 79: ldc_w #284 // int 2000000\n 82: if_icmpne 89\n 85: iconst_1\n 86: goto 90\n 89: iconst_0\n 90: ifeq 45\n 93: aload 6\n 95: aload 9\n 97: invokeinterface #285, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 102: pop\n 103: goto 45\n 106: aload 6\n 108: checkcast #78 // class java/util/List\n 111: nop\n 112: checkcast #90 // class java/lang/Iterable\n 115: invokestatic #289 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 118: invokeinterface #294, 1 // InterfaceMethod java/util/Set.size:()I\n 123: istore_2\n 124: aload_1\n 125: astore 4\n 127: iconst_0\n 128: istore 5\n 130: aload 4\n 132: astore 6\n 134: new #178 // class java/util/LinkedHashMap\n 137: dup\n 138: aload 4\n 140: invokeinterface #295, 1 // InterfaceMethod java/util/Map.size:()I\n 145: invokestatic #171 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 148: invokespecial #181 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 151: checkcast #183 // class java/util/Map\n 154: astore 7\n 156: iconst_0\n 157: istore 8\n 159: aload 6\n 161: invokeinterface #299, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 166: checkcast #90 // class java/lang/Iterable\n 169: astore 9\n 171: iconst_0\n 172: istore 10\n 174: aload 9\n 176: invokeinterface #186, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 181: astore 11\n 183: aload 11\n 185: invokeinterface #189, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 190: ifeq 291\n 193: aload 11\n 195: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 200: astore 12\n 202: aload 7\n 204: aload 12\n 206: checkcast #301 // class java/util/Map$Entry\n 209: astore 13\n 211: astore 14\n 213: iconst_0\n 214: istore 15\n 216: aload 13\n 218: invokeinterface #304, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 223: aload 14\n 225: swap\n 226: aload 12\n 228: checkcast #301 // class java/util/Map$Entry\n 231: astore 16\n 233: astore 22\n 235: astore 21\n 237: iconst_0\n 238: istore 17\n 240: aload 16\n 242: invokeinterface #304, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 247: checkcast #208 // class Coord2D\n 250: astore 18\n 252: aload 16\n 254: invokeinterface #307, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 259: checkcast #208 // class Coord2D\n 262: astore 19\n 264: aload 18\n 266: aload 19\n 268: invokevirtual #311 // Method Coord2D.manhattenDistance:(LCoord2D;)I\n 271: invokestatic #66 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 274: astore 23\n 276: aload 21\n 278: aload 22\n 280: aload 23\n 282: invokeinterface #237, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 287: pop\n 288: goto 183\n 291: aload 7\n 293: nop\n 294: nop\n 295: astore_3\n 296: aload_3\n 297: astore 4\n 299: nop\n 300: iconst_0\n 301: istore 5\n 303: aload 4\n 305: astore 6\n 307: new #279 // class java/util/ArrayList\n 310: dup\n 311: invokespecial #281 // Method java/util/ArrayList.\"<init>\":()V\n 314: checkcast #283 // class java/util/Collection\n 317: astore 7\n 319: iconst_0\n 320: istore 8\n 322: aload 6\n 324: astore 9\n 326: iconst_0\n 327: istore 10\n 329: aload 9\n 331: invokeinterface #299, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 336: invokeinterface #312, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 341: astore 11\n 343: aload 11\n 345: invokeinterface #189, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 350: ifeq 443\n 353: aload 11\n 355: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 360: checkcast #301 // class java/util/Map$Entry\n 363: astore 12\n 365: aload 12\n 367: astore 13\n 369: iconst_0\n 370: istore 14\n 372: aload 13\n 374: astore 15\n 376: iconst_0\n 377: istore 16\n 379: aload 15\n 381: invokeinterface #304, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 386: checkcast #208 // class Coord2D\n 389: astore 17\n 391: aload 15\n 393: invokeinterface #307, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 398: checkcast #314 // class java/lang/Number\n 401: invokevirtual #317 // Method java/lang/Number.intValue:()I\n 404: istore 18\n 406: aload 17\n 408: iload 18\n 410: ldc_w #284 // int 2000000\n 413: invokestatic #319 // Method main$rangeAtY:(LCoord2D;II)LDay15Kt$main$Interval;\n 416: dup\n 417: ifnull 438\n 420: astore 19\n 422: iconst_0\n 423: istore 20\n 425: aload 7\n 427: aload 19\n 429: invokeinterface #285, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 434: pop\n 435: goto 439\n 438: pop\n 439: nop\n 440: goto 343\n 443: nop\n 444: aload 7\n 446: checkcast #78 // class java/util/List\n 449: nop\n 450: invokestatic #321 // Method main$maxReduce:(Ljava/util/List;)Ljava/util/List;\n 453: checkcast #90 // class java/lang/Iterable\n 456: astore 4\n 458: iconst_0\n 459: istore 5\n 461: aload 4\n 463: invokeinterface #186, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 468: astore 6\n 470: aload 6\n 472: invokeinterface #189, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 477: ifeq 520\n 480: aload 6\n 482: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 487: astore 7\n 489: iload 5\n 491: aload 7\n 493: checkcast #56 // class Day15Kt$main$Interval\n 496: astore 8\n 498: istore 21\n 500: iconst_0\n 501: istore 9\n 503: aload 8\n 505: invokevirtual #322 // Method Day15Kt$main$Interval.size:()I\n 508: istore 22\n 510: iload 21\n 512: iload 22\n 514: iadd\n 515: istore 5\n 517: goto 470\n 520: iload 5\n 522: iload_2\n 523: isub\n 524: ireturn\n\n private static final long main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #273 // Method main$parseSensorsBeacons:(Ljava/util/List;)Ljava/util/Map;\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #178 // class java/util/LinkedHashMap\n 13: dup\n 14: aload_2\n 15: invokeinterface #295, 1 // InterfaceMethod java/util/Map.size:()I\n 20: invokestatic #171 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 23: invokespecial #181 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 26: checkcast #183 // class java/util/Map\n 29: astore 5\n 31: iconst_0\n 32: istore 6\n 34: aload 4\n 36: invokeinterface #299, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 41: checkcast #90 // class java/lang/Iterable\n 44: astore 7\n 46: iconst_0\n 47: istore 8\n 49: aload 7\n 51: invokeinterface #186, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 56: astore 9\n 58: aload 9\n 60: invokeinterface #189, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 65: ifeq 166\n 68: aload 9\n 70: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 75: astore 10\n 77: aload 5\n 79: aload 10\n 81: checkcast #301 // class java/util/Map$Entry\n 84: astore 11\n 86: astore 12\n 88: iconst_0\n 89: istore 13\n 91: aload 11\n 93: invokeinterface #304, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 98: aload 12\n 100: swap\n 101: aload 10\n 103: checkcast #301 // class java/util/Map$Entry\n 106: astore 14\n 108: astore 22\n 110: astore 21\n 112: iconst_0\n 113: istore 15\n 115: aload 14\n 117: invokeinterface #304, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 122: checkcast #208 // class Coord2D\n 125: astore 16\n 127: aload 14\n 129: invokeinterface #307, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 134: checkcast #208 // class Coord2D\n 137: astore 17\n 139: aload 16\n 141: aload 17\n 143: invokevirtual #311 // Method Coord2D.manhattenDistance:(LCoord2D;)I\n 146: invokestatic #66 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 149: astore 23\n 151: aload 21\n 153: aload 22\n 155: aload 23\n 157: invokeinterface #237, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 162: pop\n 163: goto 58\n 166: aload 5\n 168: nop\n 169: nop\n 170: astore_1\n 171: iconst_0\n 172: istore_2\n 173: iload_2\n 174: ldc_w #357 // int 4000001\n 177: if_icmpge 450\n 180: aload_1\n 181: astore 4\n 183: nop\n 184: iconst_0\n 185: istore 5\n 187: aload 4\n 189: astore 6\n 191: new #279 // class java/util/ArrayList\n 194: dup\n 195: invokespecial #281 // Method java/util/ArrayList.\"<init>\":()V\n 198: checkcast #283 // class java/util/Collection\n 201: astore 7\n 203: iconst_0\n 204: istore 8\n 206: aload 6\n 208: astore 9\n 210: iconst_0\n 211: istore 10\n 213: aload 9\n 215: invokeinterface #299, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 220: invokeinterface #312, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 225: astore 11\n 227: aload 11\n 229: invokeinterface #189, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 234: ifeq 325\n 237: aload 11\n 239: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 244: checkcast #301 // class java/util/Map$Entry\n 247: astore 12\n 249: aload 12\n 251: astore 13\n 253: iconst_0\n 254: istore 14\n 256: aload 13\n 258: astore 15\n 260: iconst_0\n 261: istore 16\n 263: aload 15\n 265: invokeinterface #304, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 270: checkcast #208 // class Coord2D\n 273: astore 17\n 275: aload 15\n 277: invokeinterface #307, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 282: checkcast #314 // class java/lang/Number\n 285: invokevirtual #317 // Method java/lang/Number.intValue:()I\n 288: istore 18\n 290: aload 17\n 292: iload 18\n 294: iload_2\n 295: invokestatic #319 // Method main$rangeAtY:(LCoord2D;II)LDay15Kt$main$Interval;\n 298: dup\n 299: ifnull 320\n 302: astore 19\n 304: iconst_0\n 305: istore 20\n 307: aload 7\n 309: aload 19\n 311: invokeinterface #285, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 316: pop\n 317: goto 321\n 320: pop\n 321: nop\n 322: goto 227\n 325: nop\n 326: aload 7\n 328: checkcast #78 // class java/util/List\n 331: nop\n 332: invokestatic #321 // Method main$maxReduce:(Ljava/util/List;)Ljava/util/List;\n 335: checkcast #90 // class java/lang/Iterable\n 338: astore 4\n 340: nop\n 341: iconst_0\n 342: istore 5\n 344: aload 4\n 346: astore 6\n 348: aload 6\n 350: astore 7\n 352: iconst_0\n 353: istore 8\n 355: aload 7\n 357: invokeinterface #186, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 362: astore 9\n 364: aload 9\n 366: invokeinterface #189, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 371: ifeq 406\n 374: aload 9\n 376: invokeinterface #190, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 381: astore 10\n 383: aload 10\n 385: checkcast #56 // class Day15Kt$main$Interval\n 388: astore 11\n 390: iconst_0\n 391: istore 12\n 393: aload 11\n 395: iconst_0\n 396: ldc_w #358 // int 4000000\n 399: invokevirtual #361 // Method Day15Kt$main$Interval.limit:(II)V\n 402: nop\n 403: goto 364\n 406: aload 6\n 408: nop\n 409: checkcast #78 // class java/util/List\n 412: astore_3\n 413: aload_3\n 414: invokeinterface #362, 1 // InterfaceMethod java/util/List.size:()I\n 419: iconst_1\n 420: if_icmple 444\n 423: ldc2_w #363 // long 4000000l\n 426: aload_3\n 427: invokestatic #368 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 430: checkcast #56 // class Day15Kt$main$Interval\n 433: invokevirtual #73 // Method Day15Kt$main$Interval.getEnd:()I\n 436: iconst_1\n 437: iadd\n 438: i2l\n 439: lmul\n 440: iload_2\n 441: i2l\n 442: ladd\n 443: lreturn\n 444: iinc 2, 1\n 447: goto 173\n 450: ldc2_w #369 // long -1l\n 453: lreturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day05.kt
fun main() { data class Move(val count: Int, val source: Int, val target: Int) class CrateStacks(input: List<String>) { val stacks = mutableMapOf<Int, ArrayDeque<Char>>() val moves = mutableListOf<Move>() init { var parseMoves = false input.forEach { line -> if (line.isBlank()) { parseMoves = true return@forEach } if (parseMoves) { addMove(line) return@forEach } parseStacks(line) } } fun addMove(line: String) { val (c, s, t) = line.split("move ", " from ", " to ").mapNotNull { it.toIntOrNull() } moves.add(Move(c, s, t)) } fun parseStacks(line: String) { line.forEachIndexed { index, c -> if (index % 4 != 1) return@forEachIndexed if (c.isDigit()) return if (!c.isUpperCase()) return@forEachIndexed val stack = index / 4 + 1 ArrayDeque<String>() stacks.compute(stack) { _, v -> val ad = v ?: ArrayDeque() ad.add(c) return@compute ad } } } fun doMovesSingle(): CrateStacks { moves.forEach { executeMoveSingle(it) } return this } fun doMovesGrouped(): CrateStacks { moves.forEach { executeMoveGrouped(it) } return this } private fun executeMoveSingle(move: Move) { repeat(move.count) { val crate = stacks[move.source]!!.removeFirst() stacks[move.target]!!.addFirst(crate) } } private fun executeMoveGrouped(move: Move) { for (i in 0 until move.count) { val crate = stacks[move.source]!!.removeFirst() stacks[move.target]!!.add(i, crate) } } fun getTop(): String { return stacks.keys.sorted().mapNotNull { stacks[it]?.first() }.joinToString("") } } fun part1(input: List<String>): String { return CrateStacks(input).doMovesSingle().getTop() } fun part2(input: List<String>): String { return CrateStacks(input).doMovesGrouped().getTop() } val input = readInput("Day05") println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day05Kt$main$Move.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt$main$Move {\n private final int count;\n\n private final int source;\n\n private final int target;\n\n public Day05Kt$main$Move(int, int, int);\n Code:\n 0: aload_0\n 1: invokespecial #9 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: iload_1\n 6: putfield #13 // Field count:I\n 9: aload_0\n 10: iload_2\n 11: putfield #16 // Field source:I\n 14: aload_0\n 15: iload_3\n 16: putfield #19 // Field target:I\n 19: return\n\n public final int getCount();\n Code:\n 0: aload_0\n 1: getfield #13 // Field count:I\n 4: ireturn\n\n public final int getSource();\n Code:\n 0: aload_0\n 1: getfield #16 // Field source:I\n 4: ireturn\n\n public final int getTarget();\n Code:\n 0: aload_0\n 1: getfield #19 // Field target:I\n 4: ireturn\n\n public final int component1();\n Code:\n 0: aload_0\n 1: getfield #13 // Field count:I\n 4: ireturn\n\n public final int component2();\n Code:\n 0: aload_0\n 1: getfield #16 // Field source:I\n 4: ireturn\n\n public final int component3();\n Code:\n 0: aload_0\n 1: getfield #19 // Field target:I\n 4: ireturn\n\n public final Day05Kt$main$Move copy(int, int, int);\n Code:\n 0: new #2 // class Day05Kt$main$Move\n 3: dup\n 4: iload_1\n 5: iload_2\n 6: iload_3\n 7: invokespecial #32 // Method \"<init>\":(III)V\n 10: areturn\n\n public static Day05Kt$main$Move copy$default(Day05Kt$main$Move, int, int, int, int, java.lang.Object);\n Code:\n 0: iload 4\n 2: iconst_1\n 3: iand\n 4: ifeq 12\n 7: aload_0\n 8: getfield #13 // Field count:I\n 11: istore_1\n 12: iload 4\n 14: iconst_2\n 15: iand\n 16: ifeq 24\n 19: aload_0\n 20: getfield #16 // Field source:I\n 23: istore_2\n 24: iload 4\n 26: iconst_4\n 27: iand\n 28: ifeq 36\n 31: aload_0\n 32: getfield #19 // Field target:I\n 35: istore_3\n 36: aload_0\n 37: iload_1\n 38: iload_2\n 39: iload_3\n 40: invokevirtual #36 // Method copy:(III)LDay05Kt$main$Move;\n 43: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #40 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #41 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #43 // String Move(count=\n 9: invokevirtual #47 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #13 // Field count:I\n 16: invokevirtual #50 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 19: ldc #52 // String , source=\n 21: invokevirtual #47 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 24: aload_0\n 25: getfield #16 // Field source:I\n 28: invokevirtual #50 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 31: ldc #54 // String , target=\n 33: invokevirtual #47 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 36: aload_0\n 37: getfield #19 // Field target:I\n 40: invokevirtual #50 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 43: bipush 41\n 45: invokevirtual #57 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 48: invokevirtual #59 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 51: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #13 // Field count:I\n 4: invokestatic #65 // Method java/lang/Integer.hashCode:(I)I\n 7: istore_1\n 8: iload_1\n 9: bipush 31\n 11: imul\n 12: aload_0\n 13: getfield #16 // Field source:I\n 16: invokestatic #65 // Method java/lang/Integer.hashCode:(I)I\n 19: iadd\n 20: istore_1\n 21: iload_1\n 22: bipush 31\n 24: imul\n 25: aload_0\n 26: getfield #19 // Field target:I\n 29: invokestatic #65 // Method java/lang/Integer.hashCode:(I)I\n 32: iadd\n 33: istore_1\n 34: iload_1\n 35: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class Day05Kt$main$Move\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class Day05Kt$main$Move\n 20: astore_2\n 21: aload_0\n 22: getfield #13 // Field count:I\n 25: aload_2\n 26: getfield #13 // Field count:I\n 29: if_icmpeq 34\n 32: iconst_0\n 33: ireturn\n 34: aload_0\n 35: getfield #16 // Field source:I\n 38: aload_2\n 39: getfield #16 // Field source:I\n 42: if_icmpeq 47\n 45: iconst_0\n 46: ireturn\n 47: aload_0\n 48: getfield #19 // Field target:I\n 51: aload_2\n 52: getfield #19 // Field target:I\n 55: if_icmpeq 60\n 58: iconst_0\n 59: ireturn\n 60: iconst_1\n 61: ireturn\n}\n", "javap_err": "" }, { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day05Kt.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day05\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: astore_0\n 6: aload_0\n 7: invokestatic #18 // Method main$part1:(Ljava/util/List;)Ljava/lang/String;\n 10: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 13: swap\n 14: invokevirtual #30 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 17: aload_0\n 18: invokestatic #33 // Method main$part2:(Ljava/util/List;)Ljava/lang/String;\n 21: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 24: swap\n 25: invokevirtual #30 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 28: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final java.lang.String main$part1(java.util.List<java.lang.String>);\n Code:\n 0: new #43 // class Day05Kt$main$CrateStacks\n 3: dup\n 4: aload_0\n 5: invokespecial #47 // Method Day05Kt$main$CrateStacks.\"<init>\":(Ljava/util/List;)V\n 8: invokevirtual #51 // Method Day05Kt$main$CrateStacks.doMovesSingle:()LDay05Kt$main$CrateStacks;\n 11: invokevirtual #55 // Method Day05Kt$main$CrateStacks.getTop:()Ljava/lang/String;\n 14: areturn\n\n private static final java.lang.String main$part2(java.util.List<java.lang.String>);\n Code:\n 0: new #43 // class Day05Kt$main$CrateStacks\n 3: dup\n 4: aload_0\n 5: invokespecial #47 // Method Day05Kt$main$CrateStacks.\"<init>\":(Ljava/util/List;)V\n 8: invokevirtual #58 // Method Day05Kt$main$CrateStacks.doMovesGrouped:()LDay05Kt$main$CrateStacks;\n 11: invokevirtual #55 // Method Day05Kt$main$CrateStacks.getTop:()Ljava/lang/String;\n 14: areturn\n}\n", "javap_err": "" }, { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day05Kt$main$CrateStacks.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt$main$CrateStacks {\n private final java.util.Map<java.lang.Integer, kotlin.collections.ArrayDeque<java.lang.Character>> stacks;\n\n private final java.util.List<Day05Kt$main$Move> moves;\n\n public Day05Kt$main$CrateStacks(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #9 // String input\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokespecial #18 // Method java/lang/Object.\"<init>\":()V\n 10: aload_0\n 11: new #20 // class java/util/LinkedHashMap\n 14: dup\n 15: invokespecial #21 // Method java/util/LinkedHashMap.\"<init>\":()V\n 18: checkcast #23 // class java/util/Map\n 21: putfield #27 // Field stacks:Ljava/util/Map;\n 24: aload_0\n 25: new #29 // class java/util/ArrayList\n 28: dup\n 29: invokespecial #30 // Method java/util/ArrayList.\"<init>\":()V\n 32: checkcast #32 // class java/util/List\n 35: putfield #36 // Field moves:Ljava/util/List;\n 38: nop\n 39: iconst_0\n 40: istore_2\n 41: aload_1\n 42: checkcast #38 // class java/lang/Iterable\n 45: astore_3\n 46: iconst_0\n 47: istore 4\n 49: aload_3\n 50: invokeinterface #42, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 55: astore 5\n 57: aload 5\n 59: invokeinterface #48, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 64: ifeq 126\n 67: aload 5\n 69: invokeinterface #52, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 74: astore 6\n 76: aload 6\n 78: checkcast #54 // class java/lang/String\n 81: astore 7\n 83: iconst_0\n 84: istore 8\n 86: aload 7\n 88: checkcast #56 // class java/lang/CharSequence\n 91: invokestatic #62 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z\n 94: ifeq 102\n 97: iconst_1\n 98: istore_2\n 99: goto 122\n 102: iload_2\n 103: ifeq 115\n 106: aload_0\n 107: aload 7\n 109: invokevirtual #66 // Method addMove:(Ljava/lang/String;)V\n 112: goto 122\n 115: aload_0\n 116: aload 7\n 118: invokevirtual #69 // Method parseStacks:(Ljava/lang/String;)V\n 121: nop\n 122: nop\n 123: goto 57\n 126: nop\n 127: nop\n 128: return\n\n public final java.util.Map<java.lang.Integer, kotlin.collections.ArrayDeque<java.lang.Character>> getStacks();\n Code:\n 0: aload_0\n 1: getfield #27 // Field stacks:Ljava/util/Map;\n 4: areturn\n\n public final java.util.List<Day05Kt$main$Move> getMoves();\n Code:\n 0: aload_0\n 1: getfield #36 // Field moves:Ljava/util/List;\n 4: areturn\n\n public final void addMove(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #89 // String line\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: checkcast #56 // class java/lang/CharSequence\n 10: iconst_3\n 11: anewarray #54 // class java/lang/String\n 14: astore_3\n 15: aload_3\n 16: iconst_0\n 17: ldc #91 // String move\n 19: aastore\n 20: aload_3\n 21: iconst_1\n 22: ldc #93 // String from\n 24: aastore\n 25: aload_3\n 26: iconst_2\n 27: ldc #95 // String to\n 29: aastore\n 30: aload_3\n 31: iconst_0\n 32: iconst_0\n 33: bipush 6\n 35: aconst_null\n 36: invokestatic #99 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 39: checkcast #38 // class java/lang/Iterable\n 42: astore_3\n 43: iconst_0\n 44: istore 4\n 46: aload_3\n 47: astore 5\n 49: new #29 // class java/util/ArrayList\n 52: dup\n 53: invokespecial #30 // Method java/util/ArrayList.\"<init>\":()V\n 56: checkcast #101 // class java/util/Collection\n 59: astore 6\n 61: iconst_0\n 62: istore 7\n 64: aload 5\n 66: astore 8\n 68: iconst_0\n 69: istore 9\n 71: aload 8\n 73: invokeinterface #42, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 78: astore 10\n 80: aload 10\n 82: invokeinterface #48, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 87: ifeq 148\n 90: aload 10\n 92: invokeinterface #52, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 97: astore 11\n 99: aload 11\n 101: astore 12\n 103: iconst_0\n 104: istore 13\n 106: aload 12\n 108: checkcast #54 // class java/lang/String\n 111: astore 14\n 113: iconst_0\n 114: istore 15\n 116: aload 14\n 118: invokestatic #105 // Method kotlin/text/StringsKt.toIntOrNull:(Ljava/lang/String;)Ljava/lang/Integer;\n 121: dup\n 122: ifnull 143\n 125: astore 16\n 127: iconst_0\n 128: istore 17\n 130: aload 6\n 132: aload 16\n 134: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 139: pop\n 140: goto 144\n 143: pop\n 144: nop\n 145: goto 80\n 148: nop\n 149: aload 6\n 151: checkcast #32 // class java/util/List\n 154: nop\n 155: astore_2\n 156: aload_2\n 157: iconst_0\n 158: invokeinterface #113, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 163: checkcast #115 // class java/lang/Number\n 166: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 169: istore_3\n 170: aload_2\n 171: iconst_1\n 172: invokeinterface #113, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 177: checkcast #115 // class java/lang/Number\n 180: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 183: istore 4\n 185: aload_2\n 186: iconst_2\n 187: invokeinterface #113, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 192: checkcast #115 // class java/lang/Number\n 195: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 198: istore 5\n 200: aload_0\n 201: getfield #36 // Field moves:Ljava/util/List;\n 204: new #121 // class Day05Kt$main$Move\n 207: dup\n 208: iload_3\n 209: iload 4\n 211: iload 5\n 213: invokespecial #124 // Method Day05Kt$main$Move.\"<init>\":(III)V\n 216: invokeinterface #125, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 221: pop\n 222: return\n\n public final void parseStacks(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #89 // String line\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: checkcast #56 // class java/lang/CharSequence\n 10: astore_2\n 11: iconst_0\n 12: istore_3\n 13: iconst_0\n 14: istore 4\n 16: iconst_0\n 17: istore 5\n 19: iload 5\n 21: aload_2\n 22: invokeinterface #147, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 27: if_icmpge 130\n 30: aload_2\n 31: iload 5\n 33: invokeinterface #151, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 38: istore 6\n 40: iload 4\n 42: iinc 4, 1\n 45: iload 6\n 47: istore 7\n 49: istore 8\n 51: iconst_0\n 52: istore 9\n 54: iload 8\n 56: iconst_4\n 57: irem\n 58: iconst_1\n 59: if_icmpne 123\n 62: iload 7\n 64: invokestatic #157 // Method java/lang/Character.isDigit:(C)Z\n 67: ifeq 71\n 70: return\n 71: iload 7\n 73: invokestatic #160 // Method java/lang/Character.isUpperCase:(C)Z\n 76: ifeq 123\n 79: iload 8\n 81: iconst_4\n 82: idiv\n 83: iconst_1\n 84: iadd\n 85: istore 10\n 87: new #162 // class kotlin/collections/ArrayDeque\n 90: dup\n 91: invokespecial #163 // Method kotlin/collections/ArrayDeque.\"<init>\":()V\n 94: pop\n 95: aload_0\n 96: getfield #27 // Field stacks:Ljava/util/Map;\n 99: iload 10\n 101: invokestatic #167 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 104: iload 7\n 106: invokedynamic #187, 0 // InvokeDynamic #0:invoke:(C)Lkotlin/jvm/functions/Function2;\n 111: invokedynamic #198, 0 // InvokeDynamic #1:apply:(Lkotlin/jvm/functions/Function2;)Ljava/util/function/BiFunction;\n 116: invokeinterface #202, 3 // InterfaceMethod java/util/Map.compute:(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;\n 121: pop\n 122: nop\n 123: nop\n 124: iinc 5, 1\n 127: goto 19\n 130: nop\n 131: return\n\n public final Day05Kt$main$CrateStacks doMovesSingle();\n Code:\n 0: aload_0\n 1: getfield #36 // Field moves:Ljava/util/List;\n 4: checkcast #38 // class java/lang/Iterable\n 7: astore_1\n 8: iconst_0\n 9: istore_2\n 10: aload_1\n 11: invokeinterface #42, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 16: astore_3\n 17: aload_3\n 18: invokeinterface #48, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 23: ifeq 54\n 26: aload_3\n 27: invokeinterface #52, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 32: astore 4\n 34: aload 4\n 36: checkcast #121 // class Day05Kt$main$Move\n 39: astore 5\n 41: iconst_0\n 42: istore 6\n 44: aload_0\n 45: aload 5\n 47: invokespecial #217 // Method executeMoveSingle:(LDay05Kt$main$Move;)V\n 50: nop\n 51: goto 17\n 54: nop\n 55: aload_0\n 56: areturn\n\n public final Day05Kt$main$CrateStacks doMovesGrouped();\n Code:\n 0: aload_0\n 1: getfield #36 // Field moves:Ljava/util/List;\n 4: checkcast #38 // class java/lang/Iterable\n 7: astore_1\n 8: iconst_0\n 9: istore_2\n 10: aload_1\n 11: invokeinterface #42, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 16: astore_3\n 17: aload_3\n 18: invokeinterface #48, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 23: ifeq 54\n 26: aload_3\n 27: invokeinterface #52, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 32: astore 4\n 34: aload 4\n 36: checkcast #121 // class Day05Kt$main$Move\n 39: astore 5\n 41: iconst_0\n 42: istore 6\n 44: aload_0\n 45: aload 5\n 47: invokespecial #223 // Method executeMoveGrouped:(LDay05Kt$main$Move;)V\n 50: nop\n 51: goto 17\n 54: nop\n 55: aload_0\n 56: areturn\n\n private final void executeMoveSingle(Day05Kt$main$Move);\n Code:\n 0: aload_1\n 1: invokevirtual #227 // Method Day05Kt$main$Move.getCount:()I\n 4: istore_2\n 5: iconst_0\n 6: istore_3\n 7: iload_3\n 8: iload_2\n 9: if_icmpge 90\n 12: iload_3\n 13: istore 4\n 15: iconst_0\n 16: istore 5\n 18: aload_0\n 19: getfield #27 // Field stacks:Ljava/util/Map;\n 22: aload_1\n 23: invokevirtual #230 // Method Day05Kt$main$Move.getSource:()I\n 26: invokestatic #167 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 29: invokeinterface #233, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 34: dup\n 35: invokestatic #237 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 38: checkcast #162 // class kotlin/collections/ArrayDeque\n 41: invokevirtual #240 // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;\n 44: checkcast #153 // class java/lang/Character\n 47: invokevirtual #244 // Method java/lang/Character.charValue:()C\n 50: istore 6\n 52: aload_0\n 53: getfield #27 // Field stacks:Ljava/util/Map;\n 56: aload_1\n 57: invokevirtual #247 // Method Day05Kt$main$Move.getTarget:()I\n 60: invokestatic #167 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 63: invokeinterface #233, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 68: dup\n 69: invokestatic #237 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 72: checkcast #162 // class kotlin/collections/ArrayDeque\n 75: iload 6\n 77: invokestatic #250 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 80: invokevirtual #253 // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V\n 83: nop\n 84: iinc 3, 1\n 87: goto 7\n 90: return\n\n private final void executeMoveGrouped(Day05Kt$main$Move);\n Code:\n 0: iconst_0\n 1: istore_2\n 2: aload_1\n 3: invokevirtual #227 // Method Day05Kt$main$Move.getCount:()I\n 6: istore_3\n 7: iload_2\n 8: iload_3\n 9: if_icmpge 84\n 12: aload_0\n 13: getfield #27 // Field stacks:Ljava/util/Map;\n 16: aload_1\n 17: invokevirtual #230 // Method Day05Kt$main$Move.getSource:()I\n 20: invokestatic #167 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 23: invokeinterface #233, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 28: dup\n 29: invokestatic #237 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 32: checkcast #162 // class kotlin/collections/ArrayDeque\n 35: invokevirtual #240 // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;\n 38: checkcast #153 // class java/lang/Character\n 41: invokevirtual #244 // Method java/lang/Character.charValue:()C\n 44: istore 4\n 46: aload_0\n 47: getfield #27 // Field stacks:Ljava/util/Map;\n 50: aload_1\n 51: invokevirtual #247 // Method Day05Kt$main$Move.getTarget:()I\n 54: invokestatic #167 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 57: invokeinterface #233, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 62: dup\n 63: invokestatic #237 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 66: checkcast #162 // class kotlin/collections/ArrayDeque\n 69: iload_2\n 70: iload 4\n 72: invokestatic #250 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 75: invokevirtual #259 // Method kotlin/collections/ArrayDeque.add:(ILjava/lang/Object;)V\n 78: iinc 2, 1\n 81: goto 7\n 84: return\n\n public final java.lang.String getTop();\n Code:\n 0: aload_0\n 1: getfield #27 // Field stacks:Ljava/util/Map;\n 4: invokeinterface #266, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 9: checkcast #38 // class java/lang/Iterable\n 12: invokestatic #272 // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;\n 15: checkcast #38 // class java/lang/Iterable\n 18: astore_1\n 19: iconst_0\n 20: istore_2\n 21: aload_1\n 22: astore_3\n 23: new #29 // class java/util/ArrayList\n 26: dup\n 27: invokespecial #30 // Method java/util/ArrayList.\"<init>\":()V\n 30: checkcast #101 // class java/util/Collection\n 33: astore 4\n 35: iconst_0\n 36: istore 5\n 38: aload_3\n 39: astore 6\n 41: iconst_0\n 42: istore 7\n 44: aload 6\n 46: invokeinterface #42, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 51: astore 8\n 53: aload 8\n 55: invokeinterface #48, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 60: ifeq 151\n 63: aload 8\n 65: invokeinterface #52, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 70: astore 9\n 72: aload 9\n 74: astore 10\n 76: iconst_0\n 77: istore 11\n 79: aload 10\n 81: checkcast #115 // class java/lang/Number\n 84: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 87: istore 12\n 89: iconst_0\n 90: istore 13\n 92: aload_0\n 93: getfield #27 // Field stacks:Ljava/util/Map;\n 96: iload 12\n 98: invokestatic #167 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 101: invokeinterface #233, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 106: checkcast #162 // class kotlin/collections/ArrayDeque\n 109: dup\n 110: ifnull 122\n 113: invokevirtual #275 // Method kotlin/collections/ArrayDeque.first:()Ljava/lang/Object;\n 116: checkcast #153 // class java/lang/Character\n 119: goto 124\n 122: pop\n 123: aconst_null\n 124: dup\n 125: ifnull 146\n 128: astore 14\n 130: iconst_0\n 131: istore 15\n 133: aload 4\n 135: aload 14\n 137: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 142: pop\n 143: goto 147\n 146: pop\n 147: nop\n 148: goto 53\n 151: nop\n 152: aload 4\n 154: checkcast #32 // class java/util/List\n 157: nop\n 158: checkcast #38 // class java/lang/Iterable\n 161: ldc_w #277 // String\n 164: checkcast #56 // class java/lang/CharSequence\n 167: aconst_null\n 168: aconst_null\n 169: iconst_0\n 170: aconst_null\n 171: aconst_null\n 172: bipush 62\n 174: aconst_null\n 175: invokestatic #281 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 178: areturn\n\n private static final kotlin.collections.ArrayDeque parseStacks$lambda$4$lambda$2(char, java.lang.Integer, kotlin.collections.ArrayDeque);\n Code:\n 0: aload_1\n 1: ldc_w #284 // String <unused var>\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_2\n 8: dup\n 9: ifnonnull 20\n 12: pop\n 13: new #162 // class kotlin/collections/ArrayDeque\n 16: dup\n 17: invokespecial #163 // Method kotlin/collections/ArrayDeque.\"<init>\":()V\n 20: astore_3\n 21: aload_3\n 22: iload_0\n 23: invokestatic #250 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 26: invokevirtual #285 // Method kotlin/collections/ArrayDeque.add:(Ljava/lang/Object;)Z\n 29: pop\n 30: aload_3\n 31: areturn\n\n private static final kotlin.collections.ArrayDeque parseStacks$lambda$4$lambda$3(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokeinterface #293, 3 // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 8: checkcast #162 // class kotlin/collections/ArrayDeque\n 11: areturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day09.kt
fun main() { val oneX = Coord2D(1, 0) val oneY = Coord2D(0, 1) data class Motion(val dir: Char, val count: Int) fun mapToMotions(input: List<String>): List<Motion> { return input.map { val (d, c) = it.split(" ") Motion(d.first(), c.toInt()) } } fun moveInDir(coor: Coord2D, dir: Char): Coord2D { return when (dir) { 'L' -> Coord2D(coor.x - 1, coor.y) 'R' -> Coord2D(coor.x + 1, coor.y) 'U' -> Coord2D(coor.x, coor.y + 1) 'D' -> Coord2D(coor.x, coor.y - 1) else -> error("bad direction $dir") } } fun follow(head: Coord2D, tail: Coord2D): Coord2D { var newTail = tail while (head != newTail && !newTail.adjacentTo(head)) { when { head.x < newTail.x -> newTail -= oneX head.x > newTail.x -> newTail += oneX } when { head.y < newTail.y -> newTail -= oneY head.y > newTail.y -> newTail += oneY } } return newTail } fun part1(input: List<Motion>): Int { val visited = mutableSetOf<Coord2D>() var head = Coord2D(0, 0) var tail = Coord2D(0, 0) visited.add(tail) input.forEach { m -> repeat(m.count) { head = moveInDir(head, m.dir) tail = follow(head, tail) visited.add(tail) } } return visited.size } fun part2(input: List<Motion>): Int { val visited = mutableSetOf<Coord2D>() val rope = MutableList(10) { Coord2D(0, 0) } visited.add(rope.last()) input.forEach { m -> repeat(m.count) { rope[0] = moveInDir(rope[0], m.dir) for (i in 1..rope.lastIndex) { rope[i] = follow(rope[i - 1], rope[i]) } visited.add(rope.last()) } } return visited.size } val testInput1 = mapToMotions(readInput("Day09test1")) check(part1(testInput1) == 13) check(part2(testInput1) == 1) val testInput2 = mapToMotions(readInput("Day09test2")) check(part2(testInput2) == 36) val input = mapToMotions(readInput("Day09")) println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day09Kt$main$Motion.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt$main$Motion {\n private final char dir;\n\n private final int count;\n\n public Day09Kt$main$Motion(char, int);\n Code:\n 0: aload_0\n 1: invokespecial #9 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: iload_1\n 6: putfield #13 // Field dir:C\n 9: aload_0\n 10: iload_2\n 11: putfield #17 // Field count:I\n 14: return\n\n public final char getDir();\n Code:\n 0: aload_0\n 1: getfield #13 // Field dir:C\n 4: ireturn\n\n public final int getCount();\n Code:\n 0: aload_0\n 1: getfield #17 // Field count:I\n 4: ireturn\n\n public final char component1();\n Code:\n 0: aload_0\n 1: getfield #13 // Field dir:C\n 4: ireturn\n\n public final int component2();\n Code:\n 0: aload_0\n 1: getfield #17 // Field count:I\n 4: ireturn\n\n public final Day09Kt$main$Motion copy(char, int);\n Code:\n 0: new #2 // class Day09Kt$main$Motion\n 3: dup\n 4: iload_1\n 5: iload_2\n 6: invokespecial #29 // Method \"<init>\":(CI)V\n 9: areturn\n\n public static Day09Kt$main$Motion copy$default(Day09Kt$main$Motion, char, int, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_1\n 2: iand\n 3: ifeq 11\n 6: aload_0\n 7: getfield #13 // Field dir:C\n 10: istore_1\n 11: iload_3\n 12: iconst_2\n 13: iand\n 14: ifeq 22\n 17: aload_0\n 18: getfield #17 // Field count:I\n 21: istore_2\n 22: aload_0\n 23: iload_1\n 24: iload_2\n 25: invokevirtual #33 // Method copy:(CI)LDay09Kt$main$Motion;\n 28: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #37 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #38 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #40 // String Motion(dir=\n 9: invokevirtual #44 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #13 // Field dir:C\n 16: invokevirtual #47 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 19: ldc #49 // String , count=\n 21: invokevirtual #44 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 24: aload_0\n 25: getfield #17 // Field count:I\n 28: invokevirtual #52 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 31: bipush 41\n 33: invokevirtual #47 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 36: invokevirtual #54 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 39: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #13 // Field dir:C\n 4: invokestatic #60 // Method java/lang/Character.hashCode:(C)I\n 7: istore_1\n 8: iload_1\n 9: bipush 31\n 11: imul\n 12: aload_0\n 13: getfield #17 // Field count:I\n 16: invokestatic #65 // Method java/lang/Integer.hashCode:(I)I\n 19: iadd\n 20: istore_1\n 21: iload_1\n 22: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class Day09Kt$main$Motion\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class Day09Kt$main$Motion\n 20: astore_2\n 21: aload_0\n 22: getfield #13 // Field dir:C\n 25: aload_2\n 26: getfield #13 // Field dir:C\n 29: if_icmpeq 34\n 32: iconst_0\n 33: ireturn\n 34: aload_0\n 35: getfield #17 // Field count:I\n 38: aload_2\n 39: getfield #17 // Field count:I\n 42: if_icmpeq 47\n 45: iconst_0\n 46: ireturn\n 47: iconst_1\n 48: ireturn\n}\n", "javap_err": "" }, { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day09Kt.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt {\n public static final void main();\n Code:\n 0: new #8 // class Coord2D\n 3: dup\n 4: iconst_1\n 5: iconst_0\n 6: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 9: astore_0\n 10: new #8 // class Coord2D\n 13: dup\n 14: iconst_0\n 15: iconst_1\n 16: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 19: astore_1\n 20: ldc #14 // String Day09test1\n 22: invokestatic #20 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 25: invokestatic #24 // Method main$mapToMotions:(Ljava/util/List;)Ljava/util/List;\n 28: astore_2\n 29: aload_0\n 30: aload_1\n 31: aload_2\n 32: invokestatic #28 // Method main$part1:(LCoord2D;LCoord2D;Ljava/util/List;)I\n 35: bipush 13\n 37: if_icmpne 44\n 40: iconst_1\n 41: goto 45\n 44: iconst_0\n 45: ifne 58\n 48: new #30 // class java/lang/IllegalStateException\n 51: dup\n 52: ldc #32 // String Check failed.\n 54: invokespecial #35 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 57: athrow\n 58: aload_0\n 59: aload_1\n 60: aload_2\n 61: invokestatic #38 // Method main$part2:(LCoord2D;LCoord2D;Ljava/util/List;)I\n 64: iconst_1\n 65: if_icmpne 72\n 68: iconst_1\n 69: goto 73\n 72: iconst_0\n 73: ifne 86\n 76: new #30 // class java/lang/IllegalStateException\n 79: dup\n 80: ldc #32 // String Check failed.\n 82: invokespecial #35 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 85: athrow\n 86: ldc #40 // String Day09test2\n 88: invokestatic #20 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 91: invokestatic #24 // Method main$mapToMotions:(Ljava/util/List;)Ljava/util/List;\n 94: astore_3\n 95: aload_0\n 96: aload_1\n 97: aload_3\n 98: invokestatic #38 // Method main$part2:(LCoord2D;LCoord2D;Ljava/util/List;)I\n 101: bipush 36\n 103: if_icmpne 110\n 106: iconst_1\n 107: goto 111\n 110: iconst_0\n 111: ifne 124\n 114: new #30 // class java/lang/IllegalStateException\n 117: dup\n 118: ldc #32 // String Check failed.\n 120: invokespecial #35 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 123: athrow\n 124: ldc #42 // String Day09\n 126: invokestatic #20 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 129: invokestatic #24 // Method main$mapToMotions:(Ljava/util/List;)Ljava/util/List;\n 132: astore 4\n 134: aload_0\n 135: aload_1\n 136: aload 4\n 138: invokestatic #28 // Method main$part1:(LCoord2D;LCoord2D;Ljava/util/List;)I\n 141: istore 5\n 143: getstatic #48 // Field java/lang/System.out:Ljava/io/PrintStream;\n 146: iload 5\n 148: invokevirtual #54 // Method java/io/PrintStream.println:(I)V\n 151: aload_0\n 152: aload_1\n 153: aload 4\n 155: invokestatic #38 // Method main$part2:(LCoord2D;LCoord2D;Ljava/util/List;)I\n 158: istore 5\n 160: getstatic #48 // Field java/lang/System.out:Ljava/io/PrintStream;\n 163: iload 5\n 165: invokevirtual #54 // Method java/io/PrintStream.println:(I)V\n 168: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #66 // Method main:()V\n 3: return\n\n private static final java.util.List<Day09Kt$main$Motion> main$mapToMotions(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #71 // class java/lang/Iterable\n 4: astore_1\n 5: iconst_0\n 6: istore_2\n 7: aload_1\n 8: astore_3\n 9: new #73 // class java/util/ArrayList\n 12: dup\n 13: aload_1\n 14: bipush 10\n 16: invokestatic #79 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 19: invokespecial #81 // Method java/util/ArrayList.\"<init>\":(I)V\n 22: checkcast #83 // class java/util/Collection\n 25: astore 4\n 27: iconst_0\n 28: istore 5\n 30: aload_3\n 31: invokeinterface #87, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 36: astore 6\n 38: aload 6\n 40: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 45: ifeq 158\n 48: aload 6\n 50: invokeinterface #97, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 55: astore 7\n 57: aload 4\n 59: aload 7\n 61: checkcast #99 // class java/lang/String\n 64: astore 8\n 66: astore 13\n 68: iconst_0\n 69: istore 9\n 71: aload 8\n 73: checkcast #101 // class java/lang/CharSequence\n 76: iconst_1\n 77: anewarray #99 // class java/lang/String\n 80: astore 10\n 82: aload 10\n 84: iconst_0\n 85: ldc #103 // String\n 87: aastore\n 88: aload 10\n 90: iconst_0\n 91: iconst_0\n 92: bipush 6\n 94: aconst_null\n 95: invokestatic #109 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 98: astore 11\n 100: aload 11\n 102: iconst_0\n 103: invokeinterface #113, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 108: checkcast #99 // class java/lang/String\n 111: astore 10\n 113: aload 11\n 115: iconst_1\n 116: invokeinterface #113, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 121: checkcast #99 // class java/lang/String\n 124: astore 12\n 126: new #115 // class Day09Kt$main$Motion\n 129: dup\n 130: aload 10\n 132: checkcast #101 // class java/lang/CharSequence\n 135: invokestatic #119 // Method kotlin/text/StringsKt.first:(Ljava/lang/CharSequence;)C\n 138: aload 12\n 140: invokestatic #125 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 143: invokespecial #128 // Method Day09Kt$main$Motion.\"<init>\":(CI)V\n 146: aload 13\n 148: swap\n 149: invokeinterface #132, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 154: pop\n 155: goto 38\n 158: aload 4\n 160: checkcast #63 // class java/util/List\n 163: nop\n 164: areturn\n\n private static final Coord2D main$moveInDir(Coord2D, char);\n Code:\n 0: iload_1\n 1: lookupswitch { // 4\n 68: 104\n 76: 44\n 82: 64\n 85: 84\n default: 124\n }\n 44: new #8 // class Coord2D\n 47: dup\n 48: aload_0\n 49: invokevirtual #153 // Method Coord2D.getX:()I\n 52: iconst_1\n 53: isub\n 54: aload_0\n 55: invokevirtual #156 // Method Coord2D.getY:()I\n 58: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 61: goto 154\n 64: new #8 // class Coord2D\n 67: dup\n 68: aload_0\n 69: invokevirtual #153 // Method Coord2D.getX:()I\n 72: iconst_1\n 73: iadd\n 74: aload_0\n 75: invokevirtual #156 // Method Coord2D.getY:()I\n 78: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 81: goto 154\n 84: new #8 // class Coord2D\n 87: dup\n 88: aload_0\n 89: invokevirtual #153 // Method Coord2D.getX:()I\n 92: aload_0\n 93: invokevirtual #156 // Method Coord2D.getY:()I\n 96: iconst_1\n 97: iadd\n 98: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 101: goto 154\n 104: new #8 // class Coord2D\n 107: dup\n 108: aload_0\n 109: invokevirtual #153 // Method Coord2D.getX:()I\n 112: aload_0\n 113: invokevirtual #156 // Method Coord2D.getY:()I\n 116: iconst_1\n 117: isub\n 118: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 121: goto 154\n 124: new #30 // class java/lang/IllegalStateException\n 127: dup\n 128: new #158 // class java/lang/StringBuilder\n 131: dup\n 132: invokespecial #160 // Method java/lang/StringBuilder.\"<init>\":()V\n 135: ldc #162 // String bad direction\n 137: invokevirtual #166 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 140: iload_1\n 141: invokevirtual #169 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 144: invokevirtual #173 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 147: invokevirtual #174 // Method java/lang/Object.toString:()Ljava/lang/String;\n 150: invokespecial #35 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 153: athrow\n 154: areturn\n\n private static final Coord2D main$follow(Coord2D, Coord2D, Coord2D, Coord2D);\n Code:\n 0: aload_3\n 1: astore 4\n 3: aload_2\n 4: aload 4\n 6: invokestatic #185 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 9: ifne 112\n 12: aload 4\n 14: aload_2\n 15: invokevirtual #189 // Method Coord2D.adjacentTo:(LCoord2D;)Z\n 18: ifne 112\n 21: nop\n 22: aload_2\n 23: invokevirtual #153 // Method Coord2D.getX:()I\n 26: aload 4\n 28: invokevirtual #153 // Method Coord2D.getX:()I\n 31: if_icmpge 45\n 34: aload 4\n 36: aload_0\n 37: invokevirtual #193 // Method Coord2D.minus:(LCoord2D;)LCoord2D;\n 40: astore 4\n 42: goto 65\n 45: aload_2\n 46: invokevirtual #153 // Method Coord2D.getX:()I\n 49: aload 4\n 51: invokevirtual #153 // Method Coord2D.getX:()I\n 54: if_icmple 65\n 57: aload 4\n 59: aload_0\n 60: invokevirtual #196 // Method Coord2D.plus:(LCoord2D;)LCoord2D;\n 63: astore 4\n 65: nop\n 66: aload_2\n 67: invokevirtual #156 // Method Coord2D.getY:()I\n 70: aload 4\n 72: invokevirtual #156 // Method Coord2D.getY:()I\n 75: if_icmpge 89\n 78: aload 4\n 80: aload_1\n 81: invokevirtual #193 // Method Coord2D.minus:(LCoord2D;)LCoord2D;\n 84: astore 4\n 86: goto 3\n 89: aload_2\n 90: invokevirtual #156 // Method Coord2D.getY:()I\n 93: aload 4\n 95: invokevirtual #156 // Method Coord2D.getY:()I\n 98: if_icmple 3\n 101: aload 4\n 103: aload_1\n 104: invokevirtual #196 // Method Coord2D.plus:(LCoord2D;)LCoord2D;\n 107: astore 4\n 109: goto 3\n 112: aload 4\n 114: areturn\n\n private static final int main$part1(Coord2D, Coord2D, java.util.List<Day09Kt$main$Motion>);\n Code:\n 0: new #202 // class java/util/LinkedHashSet\n 3: dup\n 4: invokespecial #203 // Method java/util/LinkedHashSet.\"<init>\":()V\n 7: checkcast #205 // class java/util/Set\n 10: astore_3\n 11: aconst_null\n 12: astore 4\n 14: new #8 // class Coord2D\n 17: dup\n 18: iconst_0\n 19: iconst_0\n 20: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 23: astore 4\n 25: aconst_null\n 26: astore 5\n 28: new #8 // class Coord2D\n 31: dup\n 32: iconst_0\n 33: iconst_0\n 34: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 37: astore 5\n 39: aload_3\n 40: aload 5\n 42: invokeinterface #206, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 47: pop\n 48: aload_2\n 49: checkcast #71 // class java/lang/Iterable\n 52: astore 6\n 54: iconst_0\n 55: istore 7\n 57: aload 6\n 59: invokeinterface #87, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 64: astore 8\n 66: aload 8\n 68: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 73: ifeq 163\n 76: aload 8\n 78: invokeinterface #97, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 83: astore 9\n 85: aload 9\n 87: checkcast #115 // class Day09Kt$main$Motion\n 90: astore 10\n 92: iconst_0\n 93: istore 11\n 95: aload 10\n 97: invokevirtual #209 // Method Day09Kt$main$Motion.getCount:()I\n 100: istore 12\n 102: iconst_0\n 103: istore 13\n 105: iload 13\n 107: iload 12\n 109: if_icmpge 158\n 112: iload 13\n 114: istore 14\n 116: iconst_0\n 117: istore 15\n 119: aload 4\n 121: aload 10\n 123: invokevirtual #213 // Method Day09Kt$main$Motion.getDir:()C\n 126: invokestatic #215 // Method main$moveInDir:(LCoord2D;C)LCoord2D;\n 129: astore 4\n 131: aload_0\n 132: aload_1\n 133: aload 4\n 135: aload 5\n 137: invokestatic #217 // Method main$follow:(LCoord2D;LCoord2D;LCoord2D;LCoord2D;)LCoord2D;\n 140: astore 5\n 142: aload_3\n 143: aload 5\n 145: invokeinterface #206, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 150: pop\n 151: nop\n 152: iinc 13, 1\n 155: goto 105\n 158: nop\n 159: nop\n 160: goto 66\n 163: nop\n 164: aload_3\n 165: invokeinterface #220, 1 // InterfaceMethod java/util/Set.size:()I\n 170: ireturn\n\n private static final int main$part2(Coord2D, Coord2D, java.util.List<Day09Kt$main$Motion>);\n Code:\n 0: new #202 // class java/util/LinkedHashSet\n 3: dup\n 4: invokespecial #203 // Method java/util/LinkedHashSet.\"<init>\":()V\n 7: checkcast #205 // class java/util/Set\n 10: astore_3\n 11: bipush 10\n 13: istore 5\n 15: new #73 // class java/util/ArrayList\n 18: dup\n 19: iload 5\n 21: invokespecial #81 // Method java/util/ArrayList.\"<init>\":(I)V\n 24: astore 6\n 26: iconst_0\n 27: istore 7\n 29: iload 7\n 31: iload 5\n 33: if_icmpge 73\n 36: iload 7\n 38: istore 8\n 40: aload 6\n 42: iload 8\n 44: istore 9\n 46: astore 17\n 48: iconst_0\n 49: istore 10\n 51: new #8 // class Coord2D\n 54: dup\n 55: iconst_0\n 56: iconst_0\n 57: invokespecial #12 // Method Coord2D.\"<init>\":(II)V\n 60: aload 17\n 62: swap\n 63: invokevirtual #230 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 66: pop\n 67: iinc 7, 1\n 70: goto 29\n 73: aload 6\n 75: checkcast #63 // class java/util/List\n 78: astore 4\n 80: aload_3\n 81: aload 4\n 83: invokestatic #234 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 86: invokeinterface #206, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 91: pop\n 92: aload_2\n 93: checkcast #71 // class java/lang/Iterable\n 96: astore 5\n 98: iconst_0\n 99: istore 6\n 101: aload 5\n 103: invokeinterface #87, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 108: astore 7\n 110: aload 7\n 112: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 117: ifeq 286\n 120: aload 7\n 122: invokeinterface #97, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 127: astore 8\n 129: aload 8\n 131: checkcast #115 // class Day09Kt$main$Motion\n 134: astore 9\n 136: iconst_0\n 137: istore 10\n 139: aload 9\n 141: invokevirtual #209 // Method Day09Kt$main$Motion.getCount:()I\n 144: istore 11\n 146: iconst_0\n 147: istore 12\n 149: iload 12\n 151: iload 11\n 153: if_icmpge 281\n 156: iload 12\n 158: istore 13\n 160: iconst_0\n 161: istore 14\n 163: aload 4\n 165: iconst_0\n 166: aload 4\n 168: iconst_0\n 169: invokeinterface #113, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 174: checkcast #8 // class Coord2D\n 177: aload 9\n 179: invokevirtual #213 // Method Day09Kt$main$Motion.getDir:()C\n 182: invokestatic #215 // Method main$moveInDir:(LCoord2D;C)LCoord2D;\n 185: invokeinterface #238, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 190: pop\n 191: iconst_1\n 192: istore 15\n 194: aload 4\n 196: invokestatic #242 // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I\n 199: istore 16\n 201: iload 15\n 203: iload 16\n 205: if_icmpgt 262\n 208: aload 4\n 210: iload 15\n 212: aload_0\n 213: aload_1\n 214: aload 4\n 216: iload 15\n 218: iconst_1\n 219: isub\n 220: invokeinterface #113, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 225: checkcast #8 // class Coord2D\n 228: aload 4\n 230: iload 15\n 232: invokeinterface #113, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 237: checkcast #8 // class Coord2D\n 240: invokestatic #217 // Method main$follow:(LCoord2D;LCoord2D;LCoord2D;LCoord2D;)LCoord2D;\n 243: invokeinterface #238, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 248: pop\n 249: iload 15\n 251: iload 16\n 253: if_icmpeq 262\n 256: iinc 15, 1\n 259: goto 208\n 262: aload_3\n 263: aload 4\n 265: invokestatic #234 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 268: invokeinterface #206, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 273: pop\n 274: nop\n 275: iinc 12, 1\n 278: goto 149\n 281: nop\n 282: nop\n 283: goto 110\n 286: nop\n 287: aload_3\n 288: invokeinterface #220, 1 // InterfaceMethod java/util/Set.size:()I\n 293: ireturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day07.kt
fun main() { fun buildFileSystem(input: List<String>): Directory { val root = Directory(null, "/") var currentDir: Directory = root val iter = input.iterator() while (iter.hasNext()) { val line = iter.next() when { line == "$ cd /" -> currentDir = root line == "$ ls" -> continue line == "$ cd .." -> currentDir = currentDir.parent!! line.startsWith("$ cd") -> currentDir = currentDir.cd(line) else -> currentDir.new(line) } } return root } fun part1(input: Directory): Long { return input.sumOfUnderSize(100_000) } fun part2(input: Directory): Long? { // 70M: available, free 30M required val missingSpace = 30_000_000 - 70_000_000L + input.size return input.smallestDirBigger(missingSpace) } val input = buildFileSystem(readInput("Day07")) println(part1(input)) println(part2(input)) } interface FileSystem { fun sumOfUnderSize(sizeLimit: Long): Long fun smallestDirBigger(minimum: Long): Long? val parent: Directory? val name: String val size: Long } class Day07File(override val parent: Directory, override val name: String, override val size: Long) : FileSystem { override fun sumOfUnderSize(sizeLimit: Long): Long = 0L override fun smallestDirBigger(minimum: Long) = null // we don't want a file } class Directory(override val parent: Directory?, override val name: String) : FileSystem { override val size: Long get() = content.values.sumOf { it.size } private val content: MutableMap<String, FileSystem> = mutableMapOf() operator fun get(line: String): FileSystem { return content[line.removePrefix("$ cd ")] ?: error("$name has no such file: $line") } fun cd(line: String): Directory { val file = this[line] return if (file is Directory) file else error("$name has no such dir: $line") } fun new(line: String) { when { line.startsWith("dir") -> { val newName = line.removePrefix("dir ") content.putIfAbsent(newName, Directory(this, newName)) } line.startsWith('$') -> error("bad new file $line") else -> { val (size, newName) = line.split(' ', limit = 2) content.putIfAbsent(newName, Day07File(this, newName, size.toLong())) } } } override fun sumOfUnderSize(sizeLimit: Long): Long { return content.values.sumOf { it.sumOfUnderSize(sizeLimit) } + if (size <= sizeLimit) size else 0 } override fun smallestDirBigger(minimum: Long): Long? { if (this.size < minimum) return null // we could filter it instead using null, but that's good enough return content.values .mapNotNull { it.smallestDirBigger(minimum) } .minOrNull() ?: this.size } }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day07Kt.class", "javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day07\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: invokestatic #18 // Method main$buildFileSystem:(Ljava/util/List;)LDirectory;\n 8: astore_0\n 9: aload_0\n 10: invokestatic #22 // Method main$part1:(LDirectory;)J\n 13: lstore_1\n 14: getstatic #28 // Field java/lang/System.out:Ljava/io/PrintStream;\n 17: lload_1\n 18: invokevirtual #34 // Method java/io/PrintStream.println:(J)V\n 21: aload_0\n 22: invokestatic #38 // Method main$part2:(LDirectory;)Ljava/lang/Long;\n 25: getstatic #28 // Field java/lang/System.out:Ljava/io/PrintStream;\n 28: swap\n 29: invokevirtual #41 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 32: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #46 // Method main:()V\n 3: return\n\n private static final Directory main$buildFileSystem(java.util.List<java.lang.String>);\n Code:\n 0: new #51 // class Directory\n 3: dup\n 4: aconst_null\n 5: ldc #53 // String /\n 7: invokespecial #57 // Method Directory.\"<init>\":(LDirectory;Ljava/lang/String;)V\n 10: astore_1\n 11: aload_1\n 12: astore_2\n 13: aload_0\n 14: invokeinterface #63, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 19: astore_3\n 20: aload_3\n 21: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 26: ifeq 120\n 29: aload_3\n 30: invokeinterface #73, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 35: checkcast #75 // class java/lang/String\n 38: astore 4\n 40: nop\n 41: aload 4\n 43: ldc #77 // String $ cd /\n 45: invokestatic #83 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 48: ifeq 56\n 51: aload_1\n 52: astore_2\n 53: goto 20\n 56: aload 4\n 58: ldc #85 // String $ ls\n 60: invokestatic #83 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 63: ifne 20\n 66: aload 4\n 68: ldc #87 // String $ cd ..\n 70: invokestatic #83 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 73: ifeq 88\n 76: aload_2\n 77: invokevirtual #91 // Method Directory.getParent:()LDirectory;\n 80: dup\n 81: invokestatic #94 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 84: astore_2\n 85: goto 20\n 88: aload 4\n 90: ldc #96 // String $ cd\n 92: iconst_0\n 93: iconst_2\n 94: aconst_null\n 95: invokestatic #102 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 98: ifeq 111\n 101: aload_2\n 102: aload 4\n 104: invokevirtual #106 // Method Directory.cd:(Ljava/lang/String;)LDirectory;\n 107: astore_2\n 108: goto 20\n 111: aload_2\n 112: aload 4\n 114: invokevirtual #110 // Method Directory.new:(Ljava/lang/String;)V\n 117: goto 20\n 120: aload_1\n 121: areturn\n\n private static final long main$part1(Directory);\n Code:\n 0: aload_0\n 1: ldc2_w #118 // long 100000l\n 4: invokevirtual #123 // Method Directory.sumOfUnderSize:(J)J\n 7: lreturn\n\n private static final java.lang.Long main$part2(Directory);\n Code:\n 0: ldc2_w #124 // long -40000000l\n 3: aload_0\n 4: invokevirtual #129 // Method Directory.getSize:()J\n 7: ladd\n 8: lstore_1\n 9: aload_0\n 10: lload_1\n 11: invokevirtual #133 // Method Directory.smallestDirBigger:(J)Ljava/lang/Long;\n 14: areturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day03.kt
fun main() { fun Char.priority(): Int { return this.code - if (this.isLowerCase()) 96 else 38 } fun part1(input: List<String>): Int { var prioSum = 0 input.forEach { line -> val chunked = line.chunked(line.length / 2) val duplicate = chunked[0].toSet().intersect(chunked[1].toSet()).first() prioSum += duplicate.priority() } return prioSum } fun part2(input: List<String>): Int { return input.asSequence() .map { it.toSet() } .chunked(3) .map { it.reduce { intersection, prev -> intersection.intersect(prev) } } .map { it.first().priority() } .sum() } val input = readInput("Day03") println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day03Kt.class", "javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day03\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: astore_0\n 6: aload_0\n 7: invokestatic #18 // Method main$part1:(Ljava/util/List;)I\n 10: istore_1\n 11: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 14: iload_1\n 15: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 18: aload_0\n 19: invokestatic #33 // Method main$part2:(Ljava/util/List;)I\n 22: istore_1\n 23: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 26: iload_1\n 27: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 30: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final int main$priority(char);\n Code:\n 0: iload_0\n 1: iload_0\n 2: invokestatic #48 // Method java/lang/Character.isLowerCase:(C)Z\n 5: ifeq 13\n 8: bipush 96\n 10: goto 15\n 13: bipush 38\n 15: isub\n 16: ireturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: iconst_0\n 1: istore_1\n 2: aload_0\n 3: checkcast #53 // class java/lang/Iterable\n 6: astore_2\n 7: iconst_0\n 8: istore_3\n 9: aload_2\n 10: invokeinterface #57, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 15: astore 4\n 17: aload 4\n 19: invokeinterface #63, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 24: ifeq 127\n 27: aload 4\n 29: invokeinterface #67, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 34: astore 5\n 36: aload 5\n 38: checkcast #69 // class java/lang/String\n 41: astore 6\n 43: iconst_0\n 44: istore 7\n 46: aload 6\n 48: checkcast #71 // class java/lang/CharSequence\n 51: aload 6\n 53: invokevirtual #75 // Method java/lang/String.length:()I\n 56: iconst_2\n 57: idiv\n 58: invokestatic #81 // Method kotlin/text/StringsKt.chunked:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 61: astore 8\n 63: aload 8\n 65: iconst_0\n 66: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 71: checkcast #71 // class java/lang/CharSequence\n 74: invokestatic #91 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;\n 77: checkcast #53 // class java/lang/Iterable\n 80: aload 8\n 82: iconst_1\n 83: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 88: checkcast #71 // class java/lang/CharSequence\n 91: invokestatic #91 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;\n 94: checkcast #53 // class java/lang/Iterable\n 97: invokestatic #97 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 100: checkcast #53 // class java/lang/Iterable\n 103: invokestatic #101 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;\n 106: checkcast #44 // class java/lang/Character\n 109: invokevirtual #105 // Method java/lang/Character.charValue:()C\n 112: istore 9\n 114: iload_1\n 115: iload 9\n 117: invokestatic #107 // Method main$priority:(C)I\n 120: iadd\n 121: istore_1\n 122: nop\n 123: nop\n 124: goto 17\n 127: nop\n 128: iload_1\n 129: ireturn\n\n private static final java.util.Set main$part2$lambda$1(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #122 // String it\n 3: invokestatic #128 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #71 // class java/lang/CharSequence\n 10: invokestatic #91 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;\n 13: areturn\n\n private static final java.util.Set main$part2$lambda$3(java.util.List);\n Code:\n 0: aload_0\n 1: ldc #122 // String it\n 3: invokestatic #128 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #53 // class java/lang/Iterable\n 10: astore_1\n 11: iconst_0\n 12: istore_2\n 13: aload_1\n 14: invokeinterface #57, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 19: astore_3\n 20: aload_3\n 21: invokeinterface #63, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 26: ifne 39\n 29: new #132 // class java/lang/UnsupportedOperationException\n 32: dup\n 33: ldc #134 // String Empty collection can\\'t be reduced.\n 35: invokespecial #138 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 38: athrow\n 39: aload_3\n 40: invokeinterface #67, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 45: astore 4\n 47: aload_3\n 48: invokeinterface #63, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 53: ifeq 95\n 56: aload 4\n 58: aload_3\n 59: invokeinterface #67, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 64: checkcast #140 // class java/util/Set\n 67: astore 5\n 69: checkcast #140 // class java/util/Set\n 72: astore 6\n 74: iconst_0\n 75: istore 7\n 77: aload 6\n 79: checkcast #53 // class java/lang/Iterable\n 82: aload 5\n 84: checkcast #53 // class java/lang/Iterable\n 87: invokestatic #97 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 90: astore 4\n 92: goto 47\n 95: aload 4\n 97: checkcast #140 // class java/util/Set\n 100: areturn\n\n private static final int main$part2$lambda$4(java.util.Set);\n Code:\n 0: aload_0\n 1: ldc #122 // String it\n 3: invokestatic #128 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #53 // class java/lang/Iterable\n 10: invokestatic #101 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;\n 13: checkcast #44 // class java/lang/Character\n 16: invokevirtual #105 // Method java/lang/Character.charValue:()C\n 19: invokestatic #107 // Method main$priority:(C)I\n 22: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #53 // class java/lang/Iterable\n 4: invokestatic #155 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;\n 7: invokedynamic #172, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 12: invokestatic #178 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 15: iconst_3\n 16: invokestatic #181 // Method kotlin/sequences/SequencesKt.chunked:(Lkotlin/sequences/Sequence;I)Lkotlin/sequences/Sequence;\n 19: invokedynamic #186, 0 // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;\n 24: invokestatic #178 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 27: invokedynamic #192, 0 // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;\n 32: invokestatic #178 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 35: invokestatic #196 // Method kotlin/sequences/SequencesKt.sumOfInt:(Lkotlin/sequences/Sequence;)I\n 38: ireturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day10.kt
fun main() { /** * cathode-ray tube screen and simple CPU */ class CRT { var cycle = 0 var register = 1 var row = mutableListOf<Char>() fun exec(op: String) { doCycle() if ("noop" == op) return doCycle() register += op.split(" ")[1].toInt() } private fun doCycle() { cycle++ drawPixel() } private fun drawPixel() { val idx = row.size if (idx >= register - 1 && idx <= register + 1) row.add('#') else row.add('.') if (cycle % 40 == 0) { println(row.joinToString(" ")) // a bit easier to read with spaces row.clear() } } } fun part1(input: List<String>): Int { val signals = mutableListOf<Int>() var register = 1 var cycle = 0 input.forEach { line -> if ("noop" == line) { cycle++ if ((cycle - 20) % 40 == 0) signals.add(cycle * register) return@forEach } cycle++ if ((cycle - 20) % 40 == 0) signals.add(cycle * register) cycle++ if ((cycle - 20) % 40 == 0) signals.add(cycle * register) register += line.split(" ")[1].toInt() } return signals.sum() } fun part2(input: List<String>): Int { val crt = CRT() input.forEach { line -> crt.exec(line) } return 0 } val input = readInput("Day10") println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day10Kt$main$CRT.class", "javap": "Compiled from \"Day10.kt\"\npublic final class Day10Kt$main$CRT {\n private int cycle;\n\n private int register;\n\n private java.util.List<java.lang.Character> row;\n\n public Day10Kt$main$CRT();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: iconst_1\n 6: putfield #12 // Field register:I\n 9: aload_0\n 10: new #14 // class java/util/ArrayList\n 13: dup\n 14: invokespecial #15 // Method java/util/ArrayList.\"<init>\":()V\n 17: checkcast #17 // class java/util/List\n 20: putfield #21 // Field row:Ljava/util/List;\n 23: return\n\n public final int getCycle();\n Code:\n 0: aload_0\n 1: getfield #28 // Field cycle:I\n 4: ireturn\n\n public final void setCycle(int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #28 // Field cycle:I\n 5: return\n\n public final int getRegister();\n Code:\n 0: aload_0\n 1: getfield #12 // Field register:I\n 4: ireturn\n\n public final void setRegister(int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #12 // Field register:I\n 5: return\n\n public final java.util.List<java.lang.Character> getRow();\n Code:\n 0: aload_0\n 1: getfield #21 // Field row:Ljava/util/List;\n 4: areturn\n\n public final void setRow(java.util.List<java.lang.Character>);\n Code:\n 0: aload_1\n 1: ldc #40 // String <set-?>\n 3: invokestatic #46 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: putfield #21 // Field row:Ljava/util/List;\n 11: return\n\n public final void exec(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #50 // String op\n 3: invokestatic #46 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokespecial #53 // Method doCycle:()V\n 10: ldc #55 // String noop\n 12: aload_1\n 13: invokestatic #59 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 16: ifeq 20\n 19: return\n 20: aload_0\n 21: invokespecial #53 // Method doCycle:()V\n 24: aload_0\n 25: aload_0\n 26: getfield #12 // Field register:I\n 29: aload_1\n 30: checkcast #61 // class java/lang/CharSequence\n 33: iconst_1\n 34: anewarray #63 // class java/lang/String\n 37: astore_2\n 38: aload_2\n 39: iconst_0\n 40: ldc #65 // String\n 42: aastore\n 43: aload_2\n 44: iconst_0\n 45: iconst_0\n 46: bipush 6\n 48: aconst_null\n 49: invokestatic #71 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 52: iconst_1\n 53: invokeinterface #75, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 58: checkcast #63 // class java/lang/String\n 61: invokestatic #81 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 64: iadd\n 65: putfield #12 // Field register:I\n 68: return\n\n private final void doCycle();\n Code:\n 0: aload_0\n 1: getfield #28 // Field cycle:I\n 4: istore_1\n 5: aload_0\n 6: iload_1\n 7: iconst_1\n 8: iadd\n 9: putfield #28 // Field cycle:I\n 12: aload_0\n 13: invokespecial #85 // Method drawPixel:()V\n 16: return\n\n private final void drawPixel();\n Code:\n 0: aload_0\n 1: getfield #21 // Field row:Ljava/util/List;\n 4: invokeinterface #88, 1 // InterfaceMethod java/util/List.size:()I\n 9: istore_1\n 10: iload_1\n 11: aload_0\n 12: getfield #12 // Field register:I\n 15: iconst_1\n 16: isub\n 17: if_icmplt 47\n 20: iload_1\n 21: aload_0\n 22: getfield #12 // Field register:I\n 25: iconst_1\n 26: iadd\n 27: if_icmpgt 47\n 30: aload_0\n 31: getfield #21 // Field row:Ljava/util/List;\n 34: bipush 35\n 36: invokestatic #94 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 39: invokeinterface #98, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 44: goto 61\n 47: aload_0\n 48: getfield #21 // Field row:Ljava/util/List;\n 51: bipush 46\n 53: invokestatic #94 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 56: invokeinterface #98, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 61: pop\n 62: aload_0\n 63: getfield #28 // Field cycle:I\n 66: bipush 40\n 68: irem\n 69: ifne 111\n 72: aload_0\n 73: getfield #21 // Field row:Ljava/util/List;\n 76: checkcast #100 // class java/lang/Iterable\n 79: ldc #65 // String\n 81: checkcast #61 // class java/lang/CharSequence\n 84: aconst_null\n 85: aconst_null\n 86: iconst_0\n 87: aconst_null\n 88: aconst_null\n 89: bipush 62\n 91: aconst_null\n 92: invokestatic #106 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 95: getstatic #112 // Field java/lang/System.out:Ljava/io/PrintStream;\n 98: swap\n 99: invokevirtual #118 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 102: aload_0\n 103: getfield #21 // Field row:Ljava/util/List;\n 106: invokeinterface #121, 1 // InterfaceMethod java/util/List.clear:()V\n 111: return\n}\n", "javap_err": "" }, { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day10Kt.class", "javap": "Compiled from \"Day10.kt\"\npublic final class Day10Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day10\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: astore_0\n 6: aload_0\n 7: invokestatic #18 // Method main$part1:(Ljava/util/List;)I\n 10: istore_1\n 11: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 14: iload_1\n 15: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 18: aload_0\n 19: invokestatic #33 // Method main$part2:(Ljava/util/List;)I\n 22: istore_1\n 23: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 26: iload_1\n 27: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 30: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: new #43 // class java/util/ArrayList\n 3: dup\n 4: invokespecial #46 // Method java/util/ArrayList.\"<init>\":()V\n 7: checkcast #48 // class java/util/List\n 10: astore_1\n 11: iconst_0\n 12: istore_2\n 13: iconst_1\n 14: istore_2\n 15: iconst_0\n 16: istore_3\n 17: aload_0\n 18: checkcast #50 // class java/lang/Iterable\n 21: astore 4\n 23: iconst_0\n 24: istore 5\n 26: aload 4\n 28: invokeinterface #54, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 33: astore 6\n 35: aload 6\n 37: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 42: ifeq 205\n 45: aload 6\n 47: invokeinterface #64, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 52: astore 7\n 54: aload 7\n 56: checkcast #66 // class java/lang/String\n 59: astore 8\n 61: iconst_0\n 62: istore 9\n 64: ldc #68 // String noop\n 66: aload 8\n 68: invokestatic #74 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 71: ifeq 104\n 74: iload_3\n 75: iconst_1\n 76: iadd\n 77: istore_3\n 78: iload_3\n 79: bipush 20\n 81: isub\n 82: bipush 40\n 84: irem\n 85: ifne 101\n 88: aload_1\n 89: iload_3\n 90: iload_2\n 91: imul\n 92: invokestatic #80 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 95: invokeinterface #84, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 100: pop\n 101: goto 201\n 104: iload_3\n 105: iconst_1\n 106: iadd\n 107: istore_3\n 108: iload_3\n 109: bipush 20\n 111: isub\n 112: bipush 40\n 114: irem\n 115: ifne 131\n 118: aload_1\n 119: iload_3\n 120: iload_2\n 121: imul\n 122: invokestatic #80 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 125: invokeinterface #84, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 130: pop\n 131: iload_3\n 132: iconst_1\n 133: iadd\n 134: istore_3\n 135: iload_3\n 136: bipush 20\n 138: isub\n 139: bipush 40\n 141: irem\n 142: ifne 158\n 145: aload_1\n 146: iload_3\n 147: iload_2\n 148: imul\n 149: invokestatic #80 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 152: invokeinterface #84, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 157: pop\n 158: iload_2\n 159: aload 8\n 161: checkcast #86 // class java/lang/CharSequence\n 164: iconst_1\n 165: anewarray #66 // class java/lang/String\n 168: astore 10\n 170: aload 10\n 172: iconst_0\n 173: ldc #88 // String\n 175: aastore\n 176: aload 10\n 178: iconst_0\n 179: iconst_0\n 180: bipush 6\n 182: aconst_null\n 183: invokestatic #94 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 186: iconst_1\n 187: invokeinterface #98, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 192: checkcast #66 // class java/lang/String\n 195: invokestatic #102 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 198: iadd\n 199: istore_2\n 200: nop\n 201: nop\n 202: goto 35\n 205: nop\n 206: aload_1\n 207: checkcast #50 // class java/lang/Iterable\n 210: invokestatic #108 // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I\n 213: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: new #122 // class Day10Kt$main$CRT\n 3: dup\n 4: invokespecial #123 // Method Day10Kt$main$CRT.\"<init>\":()V\n 7: astore_1\n 8: aload_0\n 9: checkcast #50 // class java/lang/Iterable\n 12: astore_2\n 13: iconst_0\n 14: istore_3\n 15: aload_2\n 16: invokeinterface #54, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 21: astore 4\n 23: aload 4\n 25: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 30: ifeq 63\n 33: aload 4\n 35: invokeinterface #64, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 40: astore 5\n 42: aload 5\n 44: checkcast #66 // class java/lang/String\n 47: astore 6\n 49: iconst_0\n 50: istore 7\n 52: aload_1\n 53: aload 6\n 55: invokevirtual #127 // Method Day10Kt$main$CRT.exec:(Ljava/lang/String;)V\n 58: nop\n 59: nop\n 60: goto 23\n 63: nop\n 64: iconst_0\n 65: ireturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day02.kt
fun main() { fun myScore(strategy: String): Int { return when { strategy.contains('X') -> 1 strategy.contains('Y') -> 2 strategy.contains('Z') -> 3 else -> throw IllegalArgumentException() } } fun part1(input: List<String>): Int { val wins = listOf("A Y", "B Z", "C X") val draws = listOf("A X", "B Y", "C Z") var score = 0 input.forEach { score += myScore(it) when { wins.contains(it) -> score += 6 draws.contains(it) -> score += 3 } } return score } fun lose(theirs: Char): Int { return when (theirs) { 'A' -> myScore("Z") 'B' -> myScore("X") 'C' -> myScore("Y") else -> throw IllegalArgumentException() } } fun draw(theirs: Char): Int { return 3 + when (theirs) { 'A' -> myScore("X") 'B' -> myScore("Y") 'C' -> myScore("Z") else -> throw IllegalArgumentException() } } fun win(theirs: Char): Int { return 6 + when (theirs) { 'A' -> myScore("Y") 'B' -> myScore("Z") 'C' -> myScore("X") else -> throw IllegalArgumentException() } } fun part2(input: List<String>): Int { var score = 0 input.forEach { when (it[2]) { 'X' -> { score += lose(it[0]) } 'Y' -> { score += draw(it[0]) } 'Z' -> { score += win(it[0]) } } } return score } val input = readInput("Day02") println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day02Kt.class", "javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day02\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: astore_0\n 6: aload_0\n 7: invokestatic #18 // Method main$part1:(Ljava/util/List;)I\n 10: istore_1\n 11: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 14: iload_1\n 15: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 18: aload_0\n 19: invokestatic #33 // Method main$part2:(Ljava/util/List;)I\n 22: istore_1\n 23: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 26: iload_1\n 27: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 30: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final int main$myScore(java.lang.String);\n Code:\n 0: nop\n 1: aload_0\n 2: checkcast #44 // class java/lang/CharSequence\n 5: bipush 88\n 7: iconst_0\n 8: iconst_2\n 9: aconst_null\n 10: invokestatic #50 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z\n 13: ifeq 20\n 16: iconst_1\n 17: goto 66\n 20: aload_0\n 21: checkcast #44 // class java/lang/CharSequence\n 24: bipush 89\n 26: iconst_0\n 27: iconst_2\n 28: aconst_null\n 29: invokestatic #50 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z\n 32: ifeq 39\n 35: iconst_2\n 36: goto 66\n 39: aload_0\n 40: checkcast #44 // class java/lang/CharSequence\n 43: bipush 90\n 45: iconst_0\n 46: iconst_2\n 47: aconst_null\n 48: invokestatic #50 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z\n 51: ifeq 58\n 54: iconst_3\n 55: goto 66\n 58: new #52 // class java/lang/IllegalArgumentException\n 61: dup\n 62: invokespecial #55 // Method java/lang/IllegalArgumentException.\"<init>\":()V\n 65: athrow\n 66: ireturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: iconst_3\n 1: anewarray #60 // class java/lang/String\n 4: astore_2\n 5: aload_2\n 6: iconst_0\n 7: ldc #62 // String A Y\n 9: aastore\n 10: aload_2\n 11: iconst_1\n 12: ldc #64 // String B Z\n 14: aastore\n 15: aload_2\n 16: iconst_2\n 17: ldc #66 // String C X\n 19: aastore\n 20: aload_2\n 21: invokestatic #72 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 24: astore_1\n 25: iconst_3\n 26: anewarray #60 // class java/lang/String\n 29: astore_3\n 30: aload_3\n 31: iconst_0\n 32: ldc #74 // String A X\n 34: aastore\n 35: aload_3\n 36: iconst_1\n 37: ldc #76 // String B Y\n 39: aastore\n 40: aload_3\n 41: iconst_2\n 42: ldc #78 // String C Z\n 44: aastore\n 45: aload_3\n 46: invokestatic #72 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 49: astore_2\n 50: iconst_0\n 51: istore_3\n 52: aload_0\n 53: checkcast #80 // class java/lang/Iterable\n 56: astore 4\n 58: iconst_0\n 59: istore 5\n 61: aload 4\n 63: invokeinterface #84, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 68: astore 6\n 70: aload 6\n 72: invokeinterface #90, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 77: ifeq 147\n 80: aload 6\n 82: invokeinterface #94, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 87: astore 7\n 89: aload 7\n 91: checkcast #60 // class java/lang/String\n 94: astore 8\n 96: iconst_0\n 97: istore 9\n 99: iload_3\n 100: aload 8\n 102: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 105: iadd\n 106: istore_3\n 107: nop\n 108: aload_1\n 109: aload 8\n 111: invokeinterface #102, 2 // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z\n 116: ifeq 127\n 119: iload_3\n 120: bipush 6\n 122: iadd\n 123: istore_3\n 124: goto 142\n 127: aload_2\n 128: aload 8\n 130: invokeinterface #102, 2 // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z\n 135: ifeq 142\n 138: iload_3\n 139: iconst_3\n 140: iadd\n 141: istore_3\n 142: nop\n 143: nop\n 144: goto 70\n 147: nop\n 148: iload_3\n 149: ireturn\n\n private static final int main$lose(char);\n Code:\n 0: iload_0\n 1: tableswitch { // 65 to 67\n 65: 28\n 66: 36\n 67: 44\n default: 52\n }\n 28: ldc #117 // String Z\n 30: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 33: goto 60\n 36: ldc #119 // String X\n 38: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 41: goto 60\n 44: ldc #121 // String Y\n 46: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 49: goto 60\n 52: new #52 // class java/lang/IllegalArgumentException\n 55: dup\n 56: invokespecial #55 // Method java/lang/IllegalArgumentException.\"<init>\":()V\n 59: athrow\n 60: ireturn\n\n private static final int main$draw(char);\n Code:\n 0: iconst_3\n 1: iload_0\n 2: tableswitch { // 65 to 67\n 65: 28\n 66: 36\n 67: 44\n default: 52\n }\n 28: ldc #119 // String X\n 30: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 33: goto 60\n 36: ldc #121 // String Y\n 38: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 41: goto 60\n 44: ldc #117 // String Z\n 46: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 49: goto 60\n 52: new #52 // class java/lang/IllegalArgumentException\n 55: dup\n 56: invokespecial #55 // Method java/lang/IllegalArgumentException.\"<init>\":()V\n 59: athrow\n 60: iadd\n 61: ireturn\n\n private static final int main$win(char);\n Code:\n 0: bipush 6\n 2: iload_0\n 3: tableswitch { // 65 to 67\n 65: 28\n 66: 36\n 67: 44\n default: 52\n }\n 28: ldc #121 // String Y\n 30: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 33: goto 60\n 36: ldc #117 // String Z\n 38: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 41: goto 60\n 44: ldc #119 // String X\n 46: invokestatic #96 // Method main$myScore:(Ljava/lang/String;)I\n 49: goto 60\n 52: new #52 // class java/lang/IllegalArgumentException\n 55: dup\n 56: invokespecial #55 // Method java/lang/IllegalArgumentException.\"<init>\":()V\n 59: athrow\n 60: iadd\n 61: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: iconst_0\n 1: istore_1\n 2: aload_0\n 3: checkcast #80 // class java/lang/Iterable\n 6: astore_2\n 7: iconst_0\n 8: istore_3\n 9: aload_2\n 10: invokeinterface #84, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 15: astore 4\n 17: aload 4\n 19: invokeinterface #90, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 24: ifeq 127\n 27: aload 4\n 29: invokeinterface #94, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 34: astore 5\n 36: aload 5\n 38: checkcast #60 // class java/lang/String\n 41: astore 6\n 43: iconst_0\n 44: istore 7\n 46: aload 6\n 48: iconst_2\n 49: invokevirtual #129 // Method java/lang/String.charAt:(I)C\n 52: tableswitch { // 88 to 90\n 88: 80\n 89: 95\n 90: 110\n default: 122\n }\n 80: iload_1\n 81: aload 6\n 83: iconst_0\n 84: invokevirtual #129 // Method java/lang/String.charAt:(I)C\n 87: invokestatic #131 // Method main$lose:(C)I\n 90: iadd\n 91: istore_1\n 92: goto 122\n 95: iload_1\n 96: aload 6\n 98: iconst_0\n 99: invokevirtual #129 // Method java/lang/String.charAt:(I)C\n 102: invokestatic #133 // Method main$draw:(C)I\n 105: iadd\n 106: istore_1\n 107: goto 122\n 110: iload_1\n 111: aload 6\n 113: iconst_0\n 114: invokevirtual #129 // Method java/lang/String.charAt:(I)C\n 117: invokestatic #135 // Method main$win:(C)I\n 120: iadd\n 121: istore_1\n 122: nop\n 123: nop\n 124: goto 17\n 127: nop\n 128: iload_1\n 129: ireturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day12.kt
fun main() { fun neighborsOf(coord: Coord2D, map: Map<Coord2D, Int>): List<Coord2D> { val neighbors = mutableListOf<Coord2D>() if (coord.x > 0) { val newCoord = coord.moved(-1, 0) if (map[newCoord]!! - map[coord]!! <= 1) neighbors.add(newCoord) } if (coord.y > 0) { val newCoord = coord.moved(0, -1) if (map[newCoord]!! - map[coord]!! <= 1) neighbors.add(newCoord) } val newCoordX = coord.moved(1, 0) if (map.containsKey(newCoordX) && map[newCoordX]!! - map[coord]!! <= 1) neighbors.add(newCoordX) val newCoordY = coord.moved(0, 1) if (map.containsKey(newCoordY) && map[newCoordY]!! - map[coord]!! <= 1) neighbors.add(newCoordY) return neighbors } fun printDistanceMap(distances: Map<Coord2D, Int>) { val minX = distances.keys.minOf { it.x } val maxX = distances.keys.maxOf { it.x } val minY = distances.keys.minOf { it.y } val maxY = distances.keys.maxOf { it.y } for (x in minX..maxX) { for (y in minY..maxY) { val dStr = distances.getOrDefault(Coord2D(x, y), -1).toString().padStart(2, ' ') print("$dStr | ") } println() } } fun shortestPath(heights: Map<Coord2D, Int>, start: Coord2D, end: Coord2D): Int { val distances = mutableMapOf(start to 0) val queue = mutableListOf(start) while (queue.isNotEmpty()) { val current = queue.removeFirst() val distance = distances[current]!! if (current == end) { // printDistanceMap(distances) return distance } val newEntries = neighborsOf(current, heights).filter { !distances.containsKey(it) } queue.addAll(newEntries) distances.putAll(newEntries.map { it to distance + 1 }) } return -1 } fun buildHeightMap(input: List<String>): Triple<Coord2D, Coord2D, Map<Coord2D, Int>> { lateinit var start: Coord2D lateinit var end: Coord2D val heights = input.flatMapIndexed { x, line -> line.mapIndexed { y, c -> Coord2D(x, y) to when (c) { 'E' -> { end = Coord2D(x, y) 'z'.code - 97 } 'S' -> { start = Coord2D(x, y) 'a'.code - 97 } else -> c.code - 97 } } }.toMap() return Triple(start, end, heights) } fun part1(input: List<String>): Int { val (start, end, heights) = buildHeightMap(input) return shortestPath(heights, start, end) } fun part2(input: List<String>): Int { val (_, end, heights) = buildHeightMap(input) return heights.filterValues { it == 0 }.keys.map { shortestPath(heights, it, end) }.filter { it > 0 }.min() } // val testinput = readInput("Day12_test") // println(part1(testinput)) val input = readInput("Day12") println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day12Kt.class", "javap": "Compiled from \"Day12.kt\"\npublic final class Day12Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day12\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: astore_0\n 6: aload_0\n 7: invokestatic #18 // Method main$part1:(Ljava/util/List;)I\n 10: istore_1\n 11: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 14: iload_1\n 15: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 18: aload_0\n 19: invokestatic #33 // Method main$part2:(Ljava/util/List;)I\n 22: istore_1\n 23: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 26: iload_1\n 27: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 30: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final java.util.List<Coord2D> main$neighborsOf(Coord2D, java.util.Map<Coord2D, java.lang.Integer>);\n Code:\n 0: new #45 // class java/util/ArrayList\n 3: dup\n 4: invokespecial #48 // Method java/util/ArrayList.\"<init>\":()V\n 7: checkcast #50 // class java/util/List\n 10: astore_2\n 11: aload_0\n 12: invokevirtual #56 // Method Coord2D.getX:()I\n 15: ifle 72\n 18: aload_0\n 19: iconst_m1\n 20: iconst_0\n 21: invokevirtual #60 // Method Coord2D.moved:(II)LCoord2D;\n 24: astore_3\n 25: aload_1\n 26: aload_3\n 27: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 32: dup\n 33: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 36: checkcast #74 // class java/lang/Number\n 39: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 42: aload_1\n 43: aload_0\n 44: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 49: dup\n 50: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 53: checkcast #74 // class java/lang/Number\n 56: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 59: isub\n 60: iconst_1\n 61: if_icmpgt 72\n 64: aload_2\n 65: aload_3\n 66: invokeinterface #81, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 71: pop\n 72: aload_0\n 73: invokevirtual #84 // Method Coord2D.getY:()I\n 76: ifle 133\n 79: aload_0\n 80: iconst_0\n 81: iconst_m1\n 82: invokevirtual #60 // Method Coord2D.moved:(II)LCoord2D;\n 85: astore_3\n 86: aload_1\n 87: aload_3\n 88: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 93: dup\n 94: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 97: checkcast #74 // class java/lang/Number\n 100: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 103: aload_1\n 104: aload_0\n 105: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 110: dup\n 111: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 114: checkcast #74 // class java/lang/Number\n 117: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 120: isub\n 121: iconst_1\n 122: if_icmpgt 133\n 125: aload_2\n 126: aload_3\n 127: invokeinterface #81, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 132: pop\n 133: aload_0\n 134: iconst_1\n 135: iconst_0\n 136: invokevirtual #60 // Method Coord2D.moved:(II)LCoord2D;\n 139: astore_3\n 140: aload_1\n 141: aload_3\n 142: invokeinterface #87, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 147: ifeq 197\n 150: aload_1\n 151: aload_3\n 152: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 157: dup\n 158: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 161: checkcast #74 // class java/lang/Number\n 164: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 167: aload_1\n 168: aload_0\n 169: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 174: dup\n 175: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 178: checkcast #74 // class java/lang/Number\n 181: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 184: isub\n 185: iconst_1\n 186: if_icmpgt 197\n 189: aload_2\n 190: aload_3\n 191: invokeinterface #81, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 196: pop\n 197: aload_0\n 198: iconst_0\n 199: iconst_1\n 200: invokevirtual #60 // Method Coord2D.moved:(II)LCoord2D;\n 203: astore 4\n 205: aload_1\n 206: aload 4\n 208: invokeinterface #87, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 213: ifeq 265\n 216: aload_1\n 217: aload 4\n 219: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 224: dup\n 225: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 228: checkcast #74 // class java/lang/Number\n 231: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 234: aload_1\n 235: aload_0\n 236: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 241: dup\n 242: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 245: checkcast #74 // class java/lang/Number\n 248: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 251: isub\n 252: iconst_1\n 253: if_icmpgt 265\n 256: aload_2\n 257: aload 4\n 259: invokeinterface #81, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 264: pop\n 265: aload_2\n 266: areturn\n\n private static final void main$printDistanceMap(java.util.Map<Coord2D, java.lang.Integer>);\n Code:\n 0: aload_0\n 1: invokeinterface #102, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 6: checkcast #104 // class java/lang/Iterable\n 9: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 14: astore_3\n 15: aload_3\n 16: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 21: ifne 32\n 24: new #116 // class java/util/NoSuchElementException\n 27: dup\n 28: invokespecial #117 // Method java/util/NoSuchElementException.\"<init>\":()V\n 31: athrow\n 32: aload_3\n 33: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 38: checkcast #52 // class Coord2D\n 41: astore 4\n 43: iconst_0\n 44: istore 5\n 46: aload 4\n 48: invokevirtual #56 // Method Coord2D.getX:()I\n 51: istore 4\n 53: aload_3\n 54: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 59: ifeq 97\n 62: aload_3\n 63: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 68: checkcast #52 // class Coord2D\n 71: astore 5\n 73: iconst_0\n 74: istore 6\n 76: aload 5\n 78: invokevirtual #56 // Method Coord2D.getX:()I\n 81: istore 5\n 83: iload 4\n 85: iload 5\n 87: if_icmple 53\n 90: iload 5\n 92: istore 4\n 94: goto 53\n 97: iload 4\n 99: istore_1\n 100: aload_0\n 101: invokeinterface #102, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 106: checkcast #104 // class java/lang/Iterable\n 109: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 114: astore 4\n 116: aload 4\n 118: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 123: ifne 134\n 126: new #116 // class java/util/NoSuchElementException\n 129: dup\n 130: invokespecial #117 // Method java/util/NoSuchElementException.\"<init>\":()V\n 133: athrow\n 134: aload 4\n 136: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 141: checkcast #52 // class Coord2D\n 144: astore 5\n 146: iconst_0\n 147: istore 6\n 149: aload 5\n 151: invokevirtual #56 // Method Coord2D.getX:()I\n 154: istore 5\n 156: aload 4\n 158: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 163: ifeq 202\n 166: aload 4\n 168: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 173: checkcast #52 // class Coord2D\n 176: astore 6\n 178: iconst_0\n 179: istore 7\n 181: aload 6\n 183: invokevirtual #56 // Method Coord2D.getX:()I\n 186: istore 6\n 188: iload 5\n 190: iload 6\n 192: if_icmpge 156\n 195: iload 6\n 197: istore 5\n 199: goto 156\n 202: iload 5\n 204: istore_2\n 205: aload_0\n 206: invokeinterface #102, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 211: checkcast #104 // class java/lang/Iterable\n 214: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 219: astore 5\n 221: aload 5\n 223: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 228: ifne 239\n 231: new #116 // class java/util/NoSuchElementException\n 234: dup\n 235: invokespecial #117 // Method java/util/NoSuchElementException.\"<init>\":()V\n 238: athrow\n 239: aload 5\n 241: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 246: checkcast #52 // class Coord2D\n 249: astore 6\n 251: iconst_0\n 252: istore 7\n 254: aload 6\n 256: invokevirtual #84 // Method Coord2D.getY:()I\n 259: istore 6\n 261: aload 5\n 263: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 268: ifeq 307\n 271: aload 5\n 273: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 278: checkcast #52 // class Coord2D\n 281: astore 7\n 283: iconst_0\n 284: istore 8\n 286: aload 7\n 288: invokevirtual #84 // Method Coord2D.getY:()I\n 291: istore 7\n 293: iload 6\n 295: iload 7\n 297: if_icmple 261\n 300: iload 7\n 302: istore 6\n 304: goto 261\n 307: iload 6\n 309: istore_3\n 310: aload_0\n 311: invokeinterface #102, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 316: checkcast #104 // class java/lang/Iterable\n 319: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 324: astore 6\n 326: aload 6\n 328: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 333: ifne 344\n 336: new #116 // class java/util/NoSuchElementException\n 339: dup\n 340: invokespecial #117 // Method java/util/NoSuchElementException.\"<init>\":()V\n 343: athrow\n 344: aload 6\n 346: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 351: checkcast #52 // class Coord2D\n 354: astore 7\n 356: iconst_0\n 357: istore 8\n 359: aload 7\n 361: invokevirtual #84 // Method Coord2D.getY:()I\n 364: istore 7\n 366: aload 6\n 368: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 373: ifeq 412\n 376: aload 6\n 378: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 383: checkcast #52 // class Coord2D\n 386: astore 8\n 388: iconst_0\n 389: istore 9\n 391: aload 8\n 393: invokevirtual #84 // Method Coord2D.getY:()I\n 396: istore 8\n 398: iload 7\n 400: iload 8\n 402: if_icmpge 366\n 405: iload 8\n 407: istore 7\n 409: goto 366\n 412: iload 7\n 414: istore 4\n 416: iload_1\n 417: istore 5\n 419: iload 5\n 421: iload_2\n 422: if_icmpgt 531\n 425: iload_3\n 426: istore 6\n 428: iload 6\n 430: iload 4\n 432: if_icmpgt 513\n 435: aload_0\n 436: new #52 // class Coord2D\n 439: dup\n 440: iload 5\n 442: iload 6\n 444: invokespecial #124 // Method Coord2D.\"<init>\":(II)V\n 447: iconst_m1\n 448: invokestatic #130 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 451: invokeinterface #134, 3 // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 456: checkcast #74 // class java/lang/Number\n 459: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 462: invokestatic #139 // Method java/lang/String.valueOf:(I)Ljava/lang/String;\n 465: iconst_2\n 466: bipush 32\n 468: invokestatic #145 // Method kotlin/text/StringsKt.padStart:(Ljava/lang/String;IC)Ljava/lang/String;\n 471: astore 7\n 473: new #147 // class java/lang/StringBuilder\n 476: dup\n 477: invokespecial #148 // Method java/lang/StringBuilder.\"<init>\":()V\n 480: aload 7\n 482: invokevirtual #152 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 485: ldc #154 // String |\n 487: invokevirtual #152 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 490: invokevirtual #158 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 493: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 496: swap\n 497: invokevirtual #161 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V\n 500: iload 6\n 502: iload 4\n 504: if_icmpeq 513\n 507: iinc 6, 1\n 510: goto 435\n 513: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 516: invokevirtual #163 // Method java/io/PrintStream.println:()V\n 519: iload 5\n 521: iload_2\n 522: if_icmpeq 531\n 525: iinc 5, 1\n 528: goto 425\n 531: return\n\n private static final int main$shortestPath(java.util.Map<Coord2D, java.lang.Integer>, Coord2D, Coord2D);\n Code:\n 0: iconst_1\n 1: anewarray #183 // class kotlin/Pair\n 4: astore 4\n 6: aload 4\n 8: iconst_0\n 9: aload_1\n 10: iconst_0\n 11: invokestatic #130 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 14: invokestatic #189 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 17: aastore\n 18: aload 4\n 20: invokestatic #195 // Method kotlin/collections/MapsKt.mutableMapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 23: astore_3\n 24: iconst_1\n 25: anewarray #52 // class Coord2D\n 28: astore 5\n 30: aload 5\n 32: iconst_0\n 33: aload_1\n 34: aastore\n 35: aload 5\n 37: invokestatic #201 // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;\n 40: astore 4\n 42: aload 4\n 44: checkcast #203 // class java/util/Collection\n 47: invokeinterface #206, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 52: ifne 59\n 55: iconst_1\n 56: goto 60\n 59: iconst_0\n 60: ifeq 360\n 63: aload 4\n 65: invokeinterface #209, 1 // InterfaceMethod java/util/List.removeFirst:()Ljava/lang/Object;\n 70: dup\n 71: ldc #211 // String removeFirst(...)\n 73: invokestatic #215 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 76: checkcast #52 // class Coord2D\n 79: astore 5\n 81: aload_3\n 82: aload 5\n 84: invokeinterface #66, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 89: dup\n 90: invokestatic #72 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 93: checkcast #74 // class java/lang/Number\n 96: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 99: istore 6\n 101: aload 5\n 103: aload_2\n 104: invokestatic #219 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 107: ifeq 113\n 110: iload 6\n 112: ireturn\n 113: aload 5\n 115: aload_0\n 116: invokestatic #221 // Method main$neighborsOf:(LCoord2D;Ljava/util/Map;)Ljava/util/List;\n 119: checkcast #104 // class java/lang/Iterable\n 122: astore 8\n 124: iconst_0\n 125: istore 9\n 127: aload 8\n 129: astore 10\n 131: new #45 // class java/util/ArrayList\n 134: dup\n 135: invokespecial #48 // Method java/util/ArrayList.\"<init>\":()V\n 138: checkcast #203 // class java/util/Collection\n 141: astore 11\n 143: iconst_0\n 144: istore 12\n 146: aload 10\n 148: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 153: astore 13\n 155: aload 13\n 157: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 162: ifeq 216\n 165: aload 13\n 167: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 172: astore 14\n 174: aload 14\n 176: checkcast #52 // class Coord2D\n 179: astore 15\n 181: iconst_0\n 182: istore 16\n 184: aload_3\n 185: aload 15\n 187: invokeinterface #87, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 192: ifne 199\n 195: iconst_1\n 196: goto 200\n 199: iconst_0\n 200: ifeq 155\n 203: aload 11\n 205: aload 14\n 207: invokeinterface #222, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 212: pop\n 213: goto 155\n 216: aload 11\n 218: checkcast #50 // class java/util/List\n 221: nop\n 222: astore 7\n 224: aload 4\n 226: aload 7\n 228: checkcast #203 // class java/util/Collection\n 231: invokeinterface #226, 2 // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z\n 236: pop\n 237: aload_3\n 238: aload 7\n 240: checkcast #104 // class java/lang/Iterable\n 243: astore 8\n 245: astore 17\n 247: iconst_0\n 248: istore 9\n 250: aload 8\n 252: astore 10\n 254: new #45 // class java/util/ArrayList\n 257: dup\n 258: aload 8\n 260: bipush 10\n 262: invokestatic #230 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 265: invokespecial #232 // Method java/util/ArrayList.\"<init>\":(I)V\n 268: checkcast #203 // class java/util/Collection\n 271: astore 11\n 273: iconst_0\n 274: istore 12\n 276: aload 10\n 278: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 283: astore 13\n 285: aload 13\n 287: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 292: ifeq 342\n 295: aload 13\n 297: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 302: astore 14\n 304: aload 11\n 306: aload 14\n 308: checkcast #52 // class Coord2D\n 311: astore 15\n 313: astore 18\n 315: iconst_0\n 316: istore 16\n 318: aload 15\n 320: iload 6\n 322: iconst_1\n 323: iadd\n 324: invokestatic #130 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 327: invokestatic #189 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 330: aload 18\n 332: swap\n 333: invokeinterface #222, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 338: pop\n 339: goto 285\n 342: aload 11\n 344: checkcast #50 // class java/util/List\n 347: nop\n 348: aload 17\n 350: swap\n 351: checkcast #104 // class java/lang/Iterable\n 354: invokestatic #236 // Method kotlin/collections/MapsKt.putAll:(Ljava/util/Map;Ljava/lang/Iterable;)V\n 357: goto 42\n 360: iconst_m1\n 361: ireturn\n\n private static final kotlin.Triple<Coord2D, Coord2D, java.util.Map<Coord2D, java.lang.Integer>> main$buildHeightMap(java.util.List<java.lang.String>);\n Code:\n 0: aconst_null\n 1: astore_1\n 2: aconst_null\n 3: astore_2\n 4: aload_0\n 5: checkcast #104 // class java/lang/Iterable\n 8: astore 4\n 10: new #45 // class java/util/ArrayList\n 13: dup\n 14: invokespecial #48 // Method java/util/ArrayList.\"<init>\":()V\n 17: checkcast #203 // class java/util/Collection\n 20: astore 5\n 22: iconst_0\n 23: istore 6\n 25: aload 4\n 27: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 32: astore 7\n 34: aload 7\n 36: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 41: ifeq 284\n 44: aload 7\n 46: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 51: astore 8\n 53: iload 6\n 55: iinc 6, 1\n 58: istore 9\n 60: iload 9\n 62: ifge 68\n 65: invokestatic #265 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 68: iload 9\n 70: aload 8\n 72: checkcast #136 // class java/lang/String\n 75: astore 10\n 77: istore 11\n 79: iconst_0\n 80: istore 12\n 82: aload 10\n 84: checkcast #267 // class java/lang/CharSequence\n 87: astore 13\n 89: iconst_0\n 90: istore 14\n 92: aload 13\n 94: astore 15\n 96: new #45 // class java/util/ArrayList\n 99: dup\n 100: aload 13\n 102: invokeinterface #270, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 107: invokespecial #232 // Method java/util/ArrayList.\"<init>\":(I)V\n 110: checkcast #203 // class java/util/Collection\n 113: astore 16\n 115: iconst_0\n 116: istore 17\n 118: iconst_0\n 119: istore 18\n 121: iconst_0\n 122: istore 19\n 124: iload 19\n 126: aload 15\n 128: invokeinterface #270, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 133: if_icmpge 264\n 136: aload 15\n 138: iload 19\n 140: invokeinterface #274, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 145: istore 20\n 147: aload 16\n 149: iload 18\n 151: iinc 18, 1\n 154: iload 20\n 156: istore 21\n 158: istore 22\n 160: astore 23\n 162: iconst_0\n 163: istore 24\n 165: new #52 // class Coord2D\n 168: dup\n 169: iload 11\n 171: iload 22\n 173: invokespecial #124 // Method Coord2D.\"<init>\":(II)V\n 176: iload 21\n 178: lookupswitch { // 2\n 69: 204\n 83: 221\n default: 237\n }\n 204: new #52 // class Coord2D\n 207: dup\n 208: iload 11\n 210: iload 22\n 212: invokespecial #124 // Method Coord2D.\"<init>\":(II)V\n 215: astore_2\n 216: bipush 25\n 218: goto 242\n 221: new #52 // class Coord2D\n 224: dup\n 225: iload 11\n 227: iload 22\n 229: invokespecial #124 // Method Coord2D.\"<init>\":(II)V\n 232: astore_1\n 233: iconst_0\n 234: goto 242\n 237: iload 21\n 239: bipush 97\n 241: isub\n 242: invokestatic #130 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 245: invokestatic #189 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 248: nop\n 249: aload 23\n 251: swap\n 252: invokeinterface #222, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 257: pop\n 258: iinc 19, 1\n 261: goto 124\n 264: aload 16\n 266: checkcast #50 // class java/util/List\n 269: nop\n 270: checkcast #104 // class java/lang/Iterable\n 273: nop\n 274: aload 5\n 276: swap\n 277: invokestatic #277 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 280: pop\n 281: goto 34\n 284: aload 5\n 286: checkcast #50 // class java/util/List\n 289: checkcast #104 // class java/lang/Iterable\n 292: invokestatic #281 // Method kotlin/collections/MapsKt.toMap:(Ljava/lang/Iterable;)Ljava/util/Map;\n 295: astore_3\n 296: new #283 // class kotlin/Triple\n 299: dup\n 300: aload_1\n 301: dup\n 302: ifnonnull 313\n 305: pop\n 306: ldc_w #284 // String start\n 309: invokestatic #288 // Method kotlin/jvm/internal/Intrinsics.throwUninitializedPropertyAccessException:(Ljava/lang/String;)V\n 312: aconst_null\n 313: aload_2\n 314: dup\n 315: ifnonnull 326\n 318: pop\n 319: ldc_w #289 // String end\n 322: invokestatic #288 // Method kotlin/jvm/internal/Intrinsics.throwUninitializedPropertyAccessException:(Ljava/lang/String;)V\n 325: aconst_null\n 326: aload_3\n 327: invokespecial #292 // Method kotlin/Triple.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V\n 330: areturn\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #306 // Method main$buildHeightMap:(Ljava/util/List;)Lkotlin/Triple;\n 4: astore_1\n 5: aload_1\n 6: invokevirtual #309 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 9: checkcast #52 // class Coord2D\n 12: astore_2\n 13: aload_1\n 14: invokevirtual #312 // Method kotlin/Triple.component2:()Ljava/lang/Object;\n 17: checkcast #52 // class Coord2D\n 20: astore_3\n 21: aload_1\n 22: invokevirtual #315 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 25: checkcast #62 // class java/util/Map\n 28: astore 4\n 30: aload 4\n 32: aload_2\n 33: aload_3\n 34: invokestatic #317 // Method main$shortestPath:(Ljava/util/Map;LCoord2D;LCoord2D;)I\n 37: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: invokestatic #306 // Method main$buildHeightMap:(Ljava/util/List;)Lkotlin/Triple;\n 4: astore_1\n 5: aload_1\n 6: invokevirtual #312 // Method kotlin/Triple.component2:()Ljava/lang/Object;\n 9: checkcast #52 // class Coord2D\n 12: astore_2\n 13: aload_1\n 14: invokevirtual #315 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 17: checkcast #62 // class java/util/Map\n 20: astore_3\n 21: aload_3\n 22: astore 4\n 24: iconst_0\n 25: istore 5\n 27: new #319 // class java/util/LinkedHashMap\n 30: dup\n 31: invokespecial #320 // Method java/util/LinkedHashMap.\"<init>\":()V\n 34: astore 6\n 36: aload 4\n 38: invokeinterface #323, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 43: invokeinterface #326, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 48: astore 7\n 50: aload 7\n 52: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 57: ifeq 126\n 60: aload 7\n 62: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 67: checkcast #328 // class java/util/Map$Entry\n 70: astore 8\n 72: aload 8\n 74: invokeinterface #331, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 79: checkcast #74 // class java/lang/Number\n 82: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 85: istore 9\n 87: iconst_0\n 88: istore 10\n 90: iload 9\n 92: ifne 99\n 95: iconst_1\n 96: goto 100\n 99: iconst_0\n 100: ifeq 50\n 103: aload 6\n 105: aload 8\n 107: invokeinterface #334, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 112: aload 8\n 114: invokeinterface #331, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 119: invokevirtual #337 // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 122: pop\n 123: goto 50\n 126: aload 6\n 128: checkcast #62 // class java/util/Map\n 131: invokeinterface #102, 1 // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;\n 136: checkcast #104 // class java/lang/Iterable\n 139: astore 4\n 141: iconst_0\n 142: istore 5\n 144: aload 4\n 146: astore 6\n 148: new #45 // class java/util/ArrayList\n 151: dup\n 152: aload 4\n 154: bipush 10\n 156: invokestatic #230 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 159: invokespecial #232 // Method java/util/ArrayList.\"<init>\":(I)V\n 162: checkcast #203 // class java/util/Collection\n 165: astore 7\n 167: iconst_0\n 168: istore 8\n 170: aload 6\n 172: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 177: astore 9\n 179: aload 9\n 181: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 186: ifeq 234\n 189: aload 9\n 191: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 196: astore 10\n 198: aload 7\n 200: aload 10\n 202: checkcast #52 // class Coord2D\n 205: astore 11\n 207: astore 13\n 209: iconst_0\n 210: istore 12\n 212: aload_3\n 213: aload 11\n 215: aload_2\n 216: invokestatic #317 // Method main$shortestPath:(Ljava/util/Map;LCoord2D;LCoord2D;)I\n 219: invokestatic #130 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 222: aload 13\n 224: swap\n 225: invokeinterface #222, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 230: pop\n 231: goto 179\n 234: aload 7\n 236: checkcast #50 // class java/util/List\n 239: nop\n 240: checkcast #104 // class java/lang/Iterable\n 243: astore 4\n 245: nop\n 246: iconst_0\n 247: istore 5\n 249: aload 4\n 251: astore 6\n 253: new #45 // class java/util/ArrayList\n 256: dup\n 257: invokespecial #48 // Method java/util/ArrayList.\"<init>\":()V\n 260: checkcast #203 // class java/util/Collection\n 263: astore 7\n 265: iconst_0\n 266: istore 8\n 268: aload 6\n 270: invokeinterface #108, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 275: astore 9\n 277: aload 9\n 279: invokeinterface #114, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 284: ifeq 335\n 287: aload 9\n 289: invokeinterface #121, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 294: astore 10\n 296: aload 10\n 298: checkcast #74 // class java/lang/Number\n 301: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 304: istore 11\n 306: iconst_0\n 307: istore 12\n 309: iload 11\n 311: ifle 318\n 314: iconst_1\n 315: goto 319\n 318: iconst_0\n 319: ifeq 277\n 322: aload 7\n 324: aload 10\n 326: invokeinterface #222, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 331: pop\n 332: goto 277\n 335: aload 7\n 337: checkcast #50 // class java/util/List\n 340: nop\n 341: checkcast #104 // class java/lang/Iterable\n 344: invokestatic #341 // Method kotlin/collections/CollectionsKt.minOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 347: checkcast #74 // class java/lang/Number\n 350: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 353: ireturn\n}\n", "javap_err": "" } ]
kmakma__advent-of-kotlin-2022__950ffbc/src/Day08.kt
import kotlin.math.max fun main() { fun part1(input: List<String>): Int { val visible = mutableSetOf<Coord2D>() val grid = input.map { line -> line.map { it.digitToInt() } } val lastX = grid.lastIndex val lastY = grid.first().lastIndex visible.addAll(grid.indices.map { Coord2D(it, 0) }) visible.addAll(grid.indices.map { Coord2D(it, lastX) }) visible.addAll(grid.first().indices.map { Coord2D(0, it) }) visible.addAll(grid.last().indices.map { Coord2D(lastY, it) }) var max: Int for (x in 1 until lastX) { max = -1 for (y in grid[x].indices) { if (grid[x][y] > max) { max = grid[x][y] visible.add(Coord2D(x, y)) } if (max == 9) break } max = -1 for (y in grid[x].indices.reversed()) { if (grid[x][y] > max) { max = grid[x][y] visible.add(Coord2D(x, y)) } if (max == 9) break } } for (y in 1 until lastY) { max = -1 for (x in grid.indices) { if (grid[x][y] > max) { max = grid[x][y] visible.add(Coord2D(x, y)) } if (max == 9) break } max = -1 for (x in grid.indices.reversed()) { if (grid[x][y] > max) { max = grid[x][y] visible.add(Coord2D(x, y)) } if (max == 9) break } } return visible.size } fun lowerIdxScore(grid: List<List<Int>>, a: Int, b: Int): Int { val height = grid[a][b] for (i in a - 1 downTo 0) { if (grid[i][b] >= height) return a - i } return a } fun scenicScore(grid: List<List<Int>>, x: Int, y: Int): Int { val height = grid[x][y] val scores = mutableListOf<Int>() var score = 0 for (a in x - 1 downTo 0) { if (grid[a][y] >= height) { score = x - a break } } if (score > 0) scores.add(score) else scores.add(x) score = 0 for (a in x + 1..grid.lastIndex) { if (grid[a][y] >= height) { score = a - x break } } if (score > 0) scores.add(score) else scores.add(grid.lastIndex - x) score = 0 for (b in y - 1 downTo 0) { if (grid[x][b] >= height) { score = y - b break } } if (score > 0) scores.add(score) else scores.add(y) score = 0 for (b in y + 1..grid[x].lastIndex) { if (grid[x][b] >= height) { score = b - y break } } if (score > 0) scores.add(score) else scores.add(grid[x].lastIndex - y) return scores.product() } fun part2(input: List<String>): Int { val grid = input.map { line -> line.map { it.digitToInt() } } var maxScore = 0 grid.forEachIndexed { x, line -> line.indices.forEach { y -> val score = scenicScore(grid, x, y) maxScore = max(maxScore, score) } } return maxScore } val input = readInput("Day08") println(part1(input)) println(part2(input)) }
[ { "class_path": "kmakma__advent-of-kotlin-2022__950ffbc/Day08Kt.class", "javap": "Compiled from \"Day08.kt\"\npublic final class Day08Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day08\n 2: invokestatic #14 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;\n 5: astore_0\n 6: aload_0\n 7: invokestatic #18 // Method main$part1:(Ljava/util/List;)I\n 10: istore_1\n 11: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 14: iload_1\n 15: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 18: aload_0\n 19: invokestatic #33 // Method main$part2:(Ljava/util/List;)I\n 22: istore_1\n 23: getstatic #24 // Field java/lang/System.out:Ljava/io/PrintStream;\n 26: iload_1\n 27: invokevirtual #30 // Method java/io/PrintStream.println:(I)V\n 30: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #38 // Method main:()V\n 3: return\n\n private static final int main$part1(java.util.List<java.lang.String>);\n Code:\n 0: new #43 // class java/util/LinkedHashSet\n 3: dup\n 4: invokespecial #46 // Method java/util/LinkedHashSet.\"<init>\":()V\n 7: checkcast #48 // class java/util/Set\n 10: astore_1\n 11: aload_0\n 12: checkcast #50 // class java/lang/Iterable\n 15: astore_3\n 16: iconst_0\n 17: istore 4\n 19: aload_3\n 20: astore 5\n 22: new #52 // class java/util/ArrayList\n 25: dup\n 26: aload_3\n 27: bipush 10\n 29: invokestatic #58 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 32: invokespecial #60 // Method java/util/ArrayList.\"<init>\":(I)V\n 35: checkcast #62 // class java/util/Collection\n 38: astore 6\n 40: iconst_0\n 41: istore 7\n 43: aload 5\n 45: invokeinterface #66, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 50: astore 8\n 52: aload 8\n 54: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 59: ifeq 200\n 62: aload 8\n 64: invokeinterface #76, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 69: astore 9\n 71: aload 6\n 73: aload 9\n 75: checkcast #78 // class java/lang/String\n 78: astore 10\n 80: astore 22\n 82: iconst_0\n 83: istore 11\n 85: aload 10\n 87: checkcast #80 // class java/lang/CharSequence\n 90: astore 12\n 92: iconst_0\n 93: istore 13\n 95: aload 12\n 97: astore 14\n 99: new #52 // class java/util/ArrayList\n 102: dup\n 103: aload 12\n 105: invokeinterface #84, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 110: invokespecial #60 // Method java/util/ArrayList.\"<init>\":(I)V\n 113: checkcast #62 // class java/util/Collection\n 116: astore 15\n 118: iconst_0\n 119: istore 16\n 121: iconst_0\n 122: istore 17\n 124: iload 17\n 126: aload 14\n 128: invokeinterface #84, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 133: if_icmpge 181\n 136: aload 14\n 138: iload 17\n 140: invokeinterface #88, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 145: istore 18\n 147: aload 15\n 149: iload 18\n 151: istore 19\n 153: astore 20\n 155: iconst_0\n 156: istore 21\n 158: iload 19\n 160: invokestatic #94 // Method kotlin/text/CharsKt.digitToInt:(C)I\n 163: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 166: aload 20\n 168: swap\n 169: invokeinterface #104, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 174: pop\n 175: iinc 17, 1\n 178: goto 124\n 181: aload 15\n 183: checkcast #106 // class java/util/List\n 186: nop\n 187: nop\n 188: aload 22\n 190: swap\n 191: invokeinterface #104, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 196: pop\n 197: goto 52\n 200: aload 6\n 202: checkcast #106 // class java/util/List\n 205: nop\n 206: astore_2\n 207: aload_2\n 208: invokestatic #109 // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I\n 211: istore_3\n 212: aload_2\n 213: invokestatic #113 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 216: checkcast #106 // class java/util/List\n 219: invokestatic #109 // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I\n 222: istore 4\n 224: aload_1\n 225: aload_2\n 226: checkcast #62 // class java/util/Collection\n 229: invokestatic #117 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;\n 232: checkcast #50 // class java/lang/Iterable\n 235: astore 5\n 237: astore 22\n 239: iconst_0\n 240: istore 6\n 242: aload 5\n 244: astore 7\n 246: new #52 // class java/util/ArrayList\n 249: dup\n 250: aload 5\n 252: bipush 10\n 254: invokestatic #58 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 257: invokespecial #60 // Method java/util/ArrayList.\"<init>\":(I)V\n 260: checkcast #62 // class java/util/Collection\n 263: astore 8\n 265: iconst_0\n 266: istore 9\n 268: aload 7\n 270: invokeinterface #66, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 275: astore 10\n 277: aload 10\n 279: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 284: ifeq 330\n 287: aload 10\n 289: checkcast #119 // class kotlin/collections/IntIterator\n 292: invokevirtual #122 // Method kotlin/collections/IntIterator.nextInt:()I\n 295: istore 11\n 297: aload 8\n 299: iload 11\n 301: istore 12\n 303: astore 23\n 305: iconst_0\n 306: istore 13\n 308: new #124 // class Coord2D\n 311: dup\n 312: iload 12\n 314: iconst_0\n 315: invokespecial #127 // Method Coord2D.\"<init>\":(II)V\n 318: aload 23\n 320: swap\n 321: invokeinterface #104, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 326: pop\n 327: goto 277\n 330: aload 8\n 332: checkcast #106 // class java/util/List\n 335: nop\n 336: aload 22\n 338: swap\n 339: checkcast #62 // class java/util/Collection\n 342: invokeinterface #131, 2 // InterfaceMethod java/util/Set.addAll:(Ljava/util/Collection;)Z\n 347: pop\n 348: aload_1\n 349: aload_2\n 350: checkcast #62 // class java/util/Collection\n 353: invokestatic #117 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;\n 356: checkcast #50 // class java/lang/Iterable\n 359: astore 5\n 361: astore 22\n 363: iconst_0\n 364: istore 6\n 366: aload 5\n 368: astore 7\n 370: new #52 // class java/util/ArrayList\n 373: dup\n 374: aload 5\n 376: bipush 10\n 378: invokestatic #58 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 381: invokespecial #60 // Method java/util/ArrayList.\"<init>\":(I)V\n 384: checkcast #62 // class java/util/Collection\n 387: astore 8\n 389: iconst_0\n 390: istore 9\n 392: aload 7\n 394: invokeinterface #66, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 399: astore 10\n 401: aload 10\n 403: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 408: ifeq 454\n 411: aload 10\n 413: checkcast #119 // class kotlin/collections/IntIterator\n 416: invokevirtual #122 // Method kotlin/collections/IntIterator.nextInt:()I\n 419: istore 11\n 421: aload 8\n 423: iload 11\n 425: istore 12\n 427: astore 23\n 429: iconst_0\n 430: istore 13\n 432: new #124 // class Coord2D\n 435: dup\n 436: iload 12\n 438: iload_3\n 439: invokespecial #127 // Method Coord2D.\"<init>\":(II)V\n 442: aload 23\n 444: swap\n 445: invokeinterface #104, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 450: pop\n 451: goto 401\n 454: aload 8\n 456: checkcast #106 // class java/util/List\n 459: nop\n 460: aload 22\n 462: swap\n 463: checkcast #62 // class java/util/Collection\n 466: invokeinterface #131, 2 // InterfaceMethod java/util/Set.addAll:(Ljava/util/Collection;)Z\n 471: pop\n 472: aload_1\n 473: aload_2\n 474: invokestatic #113 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 477: checkcast #62 // class java/util/Collection\n 480: invokestatic #117 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;\n 483: checkcast #50 // class java/lang/Iterable\n 486: astore 5\n 488: astore 22\n 490: iconst_0\n 491: istore 6\n 493: aload 5\n 495: astore 7\n 497: new #52 // class java/util/ArrayList\n 500: dup\n 501: aload 5\n 503: bipush 10\n 505: invokestatic #58 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 508: invokespecial #60 // Method java/util/ArrayList.\"<init>\":(I)V\n 511: checkcast #62 // class java/util/Collection\n 514: astore 8\n 516: iconst_0\n 517: istore 9\n 519: aload 7\n 521: invokeinterface #66, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 526: astore 10\n 528: aload 10\n 530: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 535: ifeq 581\n 538: aload 10\n 540: checkcast #119 // class kotlin/collections/IntIterator\n 543: invokevirtual #122 // Method kotlin/collections/IntIterator.nextInt:()I\n 546: istore 11\n 548: aload 8\n 550: iload 11\n 552: istore 12\n 554: astore 23\n 556: iconst_0\n 557: istore 13\n 559: new #124 // class Coord2D\n 562: dup\n 563: iconst_0\n 564: iload 12\n 566: invokespecial #127 // Method Coord2D.\"<init>\":(II)V\n 569: aload 23\n 571: swap\n 572: invokeinterface #104, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 577: pop\n 578: goto 528\n 581: aload 8\n 583: checkcast #106 // class java/util/List\n 586: nop\n 587: aload 22\n 589: swap\n 590: checkcast #62 // class java/util/Collection\n 593: invokeinterface #131, 2 // InterfaceMethod java/util/Set.addAll:(Ljava/util/Collection;)Z\n 598: pop\n 599: aload_1\n 600: aload_2\n 601: invokestatic #134 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 604: checkcast #62 // class java/util/Collection\n 607: invokestatic #117 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;\n 610: checkcast #50 // class java/lang/Iterable\n 613: astore 5\n 615: astore 22\n 617: iconst_0\n 618: istore 6\n 620: aload 5\n 622: astore 7\n 624: new #52 // class java/util/ArrayList\n 627: dup\n 628: aload 5\n 630: bipush 10\n 632: invokestatic #58 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 635: invokespecial #60 // Method java/util/ArrayList.\"<init>\":(I)V\n 638: checkcast #62 // class java/util/Collection\n 641: astore 8\n 643: iconst_0\n 644: istore 9\n 646: aload 7\n 648: invokeinterface #66, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 653: astore 10\n 655: aload 10\n 657: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 662: ifeq 709\n 665: aload 10\n 667: checkcast #119 // class kotlin/collections/IntIterator\n 670: invokevirtual #122 // Method kotlin/collections/IntIterator.nextInt:()I\n 673: istore 11\n 675: aload 8\n 677: iload 11\n 679: istore 12\n 681: astore 23\n 683: iconst_0\n 684: istore 13\n 686: new #124 // class Coord2D\n 689: dup\n 690: iload 4\n 692: iload 12\n 694: invokespecial #127 // Method Coord2D.\"<init>\":(II)V\n 697: aload 23\n 699: swap\n 700: invokeinterface #104, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 705: pop\n 706: goto 655\n 709: aload 8\n 711: checkcast #106 // class java/util/List\n 714: nop\n 715: aload 22\n 717: swap\n 718: checkcast #62 // class java/util/Collection\n 721: invokeinterface #131, 2 // InterfaceMethod java/util/Set.addAll:(Ljava/util/Collection;)Z\n 726: pop\n 727: iconst_0\n 728: istore 5\n 730: iconst_1\n 731: istore 6\n 733: iload 6\n 735: iload_3\n 736: if_icmpge 984\n 739: iconst_m1\n 740: istore 5\n 742: iconst_0\n 743: istore 7\n 745: aload_2\n 746: iload 6\n 748: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 753: checkcast #62 // class java/util/Collection\n 756: invokeinterface #141, 1 // InterfaceMethod java/util/Collection.size:()I\n 761: istore 8\n 763: iload 7\n 765: iload 8\n 767: if_icmpge 856\n 770: aload_2\n 771: iload 6\n 773: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 778: checkcast #106 // class java/util/List\n 781: iload 7\n 783: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 788: checkcast #143 // class java/lang/Number\n 791: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 794: iload 5\n 796: if_icmple 843\n 799: aload_2\n 800: iload 6\n 802: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 807: checkcast #106 // class java/util/List\n 810: iload 7\n 812: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 817: checkcast #143 // class java/lang/Number\n 820: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 823: istore 5\n 825: aload_1\n 826: new #124 // class Coord2D\n 829: dup\n 830: iload 6\n 832: iload 7\n 834: invokespecial #127 // Method Coord2D.\"<init>\":(II)V\n 837: invokeinterface #147, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 842: pop\n 843: iload 5\n 845: bipush 9\n 847: if_icmpeq 856\n 850: iinc 7, 1\n 853: goto 763\n 856: iconst_m1\n 857: istore 5\n 859: aload_2\n 860: iload 6\n 862: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 867: checkcast #62 // class java/util/Collection\n 870: invokeinterface #141, 1 // InterfaceMethod java/util/Collection.size:()I\n 875: iconst_m1\n 876: iadd\n 877: istore 7\n 879: iconst_0\n 880: iload 7\n 882: if_icmpgt 978\n 885: iload 7\n 887: istore 8\n 889: iinc 7, -1\n 892: aload_2\n 893: iload 6\n 895: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 900: checkcast #106 // class java/util/List\n 903: iload 8\n 905: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 910: checkcast #143 // class java/lang/Number\n 913: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 916: iload 5\n 918: if_icmple 965\n 921: aload_2\n 922: iload 6\n 924: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 929: checkcast #106 // class java/util/List\n 932: iload 8\n 934: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 939: checkcast #143 // class java/lang/Number\n 942: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 945: istore 5\n 947: aload_1\n 948: new #124 // class Coord2D\n 951: dup\n 952: iload 6\n 954: iload 8\n 956: invokespecial #127 // Method Coord2D.\"<init>\":(II)V\n 959: invokeinterface #147, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 964: pop\n 965: iload 5\n 967: bipush 9\n 969: if_icmpeq 978\n 972: iconst_0\n 973: iload 7\n 975: if_icmple 885\n 978: iinc 6, 1\n 981: goto 733\n 984: iconst_1\n 985: istore 6\n 987: iload 6\n 989: iload 4\n 991: if_icmpge 1225\n 994: iconst_m1\n 995: istore 5\n 997: iconst_0\n 998: istore 7\n 1000: aload_2\n 1001: checkcast #62 // class java/util/Collection\n 1004: invokeinterface #141, 1 // InterfaceMethod java/util/Collection.size:()I\n 1009: istore 8\n 1011: iload 7\n 1013: iload 8\n 1015: if_icmpge 1104\n 1018: aload_2\n 1019: iload 7\n 1021: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1026: checkcast #106 // class java/util/List\n 1029: iload 6\n 1031: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1036: checkcast #143 // class java/lang/Number\n 1039: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 1042: iload 5\n 1044: if_icmple 1091\n 1047: aload_2\n 1048: iload 7\n 1050: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1055: checkcast #106 // class java/util/List\n 1058: iload 6\n 1060: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1065: checkcast #143 // class java/lang/Number\n 1068: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 1071: istore 5\n 1073: aload_1\n 1074: new #124 // class Coord2D\n 1077: dup\n 1078: iload 7\n 1080: iload 6\n 1082: invokespecial #127 // Method Coord2D.\"<init>\":(II)V\n 1085: invokeinterface #147, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 1090: pop\n 1091: iload 5\n 1093: bipush 9\n 1095: if_icmpeq 1104\n 1098: iinc 7, 1\n 1101: goto 1011\n 1104: iconst_m1\n 1105: istore 5\n 1107: aload_2\n 1108: checkcast #62 // class java/util/Collection\n 1111: invokeinterface #141, 1 // InterfaceMethod java/util/Collection.size:()I\n 1116: iconst_m1\n 1117: iadd\n 1118: istore 7\n 1120: iconst_0\n 1121: iload 7\n 1123: if_icmpgt 1219\n 1126: iload 7\n 1128: istore 8\n 1130: iinc 7, -1\n 1133: aload_2\n 1134: iload 8\n 1136: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1141: checkcast #106 // class java/util/List\n 1144: iload 6\n 1146: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1151: checkcast #143 // class java/lang/Number\n 1154: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 1157: iload 5\n 1159: if_icmple 1206\n 1162: aload_2\n 1163: iload 8\n 1165: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1170: checkcast #106 // class java/util/List\n 1173: iload 6\n 1175: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 1180: checkcast #143 // class java/lang/Number\n 1183: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 1186: istore 5\n 1188: aload_1\n 1189: new #124 // class Coord2D\n 1192: dup\n 1193: iload 8\n 1195: iload 6\n 1197: invokespecial #127 // Method Coord2D.\"<init>\":(II)V\n 1200: invokeinterface #147, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 1205: pop\n 1206: iload 5\n 1208: bipush 9\n 1210: if_icmpeq 1219\n 1213: iconst_0\n 1214: iload 7\n 1216: if_icmple 1126\n 1219: iinc 6, 1\n 1222: goto 987\n 1225: aload_1\n 1226: invokeinterface #148, 1 // InterfaceMethod java/util/Set.size:()I\n 1231: ireturn\n\n private static final int main$lowerIdxScore(java.util.List<? extends java.util.List<java.lang.Integer>>, int, int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 7: checkcast #106 // class java/util/List\n 10: iload_2\n 11: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 16: checkcast #143 // class java/lang/Number\n 19: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 22: istore_3\n 23: iload_1\n 24: iconst_1\n 25: isub\n 26: istore 4\n 28: iconst_m1\n 29: iload 4\n 31: if_icmpge 72\n 34: aload_0\n 35: iload 4\n 37: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 42: checkcast #106 // class java/util/List\n 45: iload_2\n 46: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 51: checkcast #143 // class java/lang/Number\n 54: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 57: iload_3\n 58: if_icmplt 66\n 61: iload_1\n 62: iload 4\n 64: isub\n 65: ireturn\n 66: iinc 4, -1\n 69: goto 28\n 72: iload_1\n 73: ireturn\n\n private static final int main$scenicScore(java.util.List<? extends java.util.List<java.lang.Integer>>, int, int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 7: checkcast #106 // class java/util/List\n 10: iload_2\n 11: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 16: checkcast #143 // class java/lang/Number\n 19: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 22: istore_3\n 23: new #52 // class java/util/ArrayList\n 26: dup\n 27: invokespecial #186 // Method java/util/ArrayList.\"<init>\":()V\n 30: checkcast #106 // class java/util/List\n 33: astore 4\n 35: iconst_0\n 36: istore 5\n 38: iload_1\n 39: iconst_1\n 40: isub\n 41: istore 6\n 43: iconst_m1\n 44: iload 6\n 46: if_icmpge 91\n 49: aload_0\n 50: iload 6\n 52: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 57: checkcast #106 // class java/util/List\n 60: iload_2\n 61: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 66: checkcast #143 // class java/lang/Number\n 69: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 72: iload_3\n 73: if_icmplt 85\n 76: iload_1\n 77: iload 6\n 79: isub\n 80: istore 5\n 82: goto 91\n 85: iinc 6, -1\n 88: goto 43\n 91: iload 5\n 93: ifle 111\n 96: aload 4\n 98: iload 5\n 100: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 103: invokeinterface #187, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 108: goto 122\n 111: aload 4\n 113: iload_1\n 114: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 117: invokeinterface #187, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 122: pop\n 123: iconst_0\n 124: istore 5\n 126: iload_1\n 127: iconst_1\n 128: iadd\n 129: istore 6\n 131: aload_0\n 132: invokestatic #109 // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I\n 135: istore 7\n 137: iload 6\n 139: iload 7\n 141: if_icmpgt 193\n 144: aload_0\n 145: iload 6\n 147: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 152: checkcast #106 // class java/util/List\n 155: iload_2\n 156: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 161: checkcast #143 // class java/lang/Number\n 164: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 167: iload_3\n 168: if_icmplt 180\n 171: iload 6\n 173: iload_1\n 174: isub\n 175: istore 5\n 177: goto 193\n 180: iload 6\n 182: iload 7\n 184: if_icmpeq 193\n 187: iinc 6, 1\n 190: goto 144\n 193: iload 5\n 195: ifle 213\n 198: aload 4\n 200: iload 5\n 202: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 205: invokeinterface #187, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 210: goto 229\n 213: aload 4\n 215: aload_0\n 216: invokestatic #109 // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I\n 219: iload_1\n 220: isub\n 221: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 224: invokeinterface #187, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 229: pop\n 230: iconst_0\n 231: istore 5\n 233: iload_2\n 234: iconst_1\n 235: isub\n 236: istore 6\n 238: iconst_m1\n 239: iload 6\n 241: if_icmpge 286\n 244: aload_0\n 245: iload_1\n 246: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 251: checkcast #106 // class java/util/List\n 254: iload 6\n 256: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 261: checkcast #143 // class java/lang/Number\n 264: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 267: iload_3\n 268: if_icmplt 280\n 271: iload_2\n 272: iload 6\n 274: isub\n 275: istore 5\n 277: goto 286\n 280: iinc 6, -1\n 283: goto 238\n 286: iload 5\n 288: ifle 306\n 291: aload 4\n 293: iload 5\n 295: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 298: invokeinterface #187, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 303: goto 317\n 306: aload 4\n 308: iload_2\n 309: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 312: invokeinterface #187, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 317: pop\n 318: iconst_0\n 319: istore 5\n 321: iload_2\n 322: iconst_1\n 323: iadd\n 324: istore 6\n 326: aload_0\n 327: iload_1\n 328: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 333: checkcast #106 // class java/util/List\n 336: invokestatic #109 // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I\n 339: istore 7\n 341: iload 6\n 343: iload 7\n 345: if_icmpgt 397\n 348: aload_0\n 349: iload_1\n 350: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 355: checkcast #106 // class java/util/List\n 358: iload 6\n 360: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 365: checkcast #143 // class java/lang/Number\n 368: invokevirtual #146 // Method java/lang/Number.intValue:()I\n 371: iload_3\n 372: if_icmplt 384\n 375: iload 6\n 377: iload_2\n 378: isub\n 379: istore 5\n 381: goto 397\n 384: iload 6\n 386: iload 7\n 388: if_icmpeq 397\n 391: iinc 6, 1\n 394: goto 348\n 397: iload 5\n 399: ifle 417\n 402: aload 4\n 404: iload 5\n 406: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 409: invokeinterface #187, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 414: goto 442\n 417: aload 4\n 419: aload_0\n 420: iload_1\n 421: invokeinterface #138, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 426: checkcast #106 // class java/util/List\n 429: invokestatic #109 // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I\n 432: iload_2\n 433: isub\n 434: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 437: invokeinterface #187, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 442: pop\n 443: aload 4\n 445: invokestatic #190 // Method UtilsKt.product:(Ljava/util/List;)I\n 448: ireturn\n\n private static final int main$part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #50 // class java/lang/Iterable\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #52 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: bipush 10\n 17: invokestatic #58 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 20: invokespecial #60 // Method java/util/ArrayList.\"<init>\":(I)V\n 23: checkcast #62 // class java/util/Collection\n 26: astore 5\n 28: iconst_0\n 29: istore 6\n 31: aload 4\n 33: invokeinterface #66, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 38: astore 7\n 40: aload 7\n 42: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 47: ifeq 188\n 50: aload 7\n 52: invokeinterface #76, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 57: astore 8\n 59: aload 5\n 61: aload 8\n 63: checkcast #78 // class java/lang/String\n 66: astore 9\n 68: astore 21\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: checkcast #80 // class java/lang/CharSequence\n 78: astore 11\n 80: iconst_0\n 81: istore 12\n 83: aload 11\n 85: astore 13\n 87: new #52 // class java/util/ArrayList\n 90: dup\n 91: aload 11\n 93: invokeinterface #84, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 98: invokespecial #60 // Method java/util/ArrayList.\"<init>\":(I)V\n 101: checkcast #62 // class java/util/Collection\n 104: astore 14\n 106: iconst_0\n 107: istore 15\n 109: iconst_0\n 110: istore 16\n 112: iload 16\n 114: aload 13\n 116: invokeinterface #84, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 121: if_icmpge 169\n 124: aload 13\n 126: iload 16\n 128: invokeinterface #88, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 133: istore 17\n 135: aload 14\n 137: iload 17\n 139: istore 18\n 141: astore 19\n 143: iconst_0\n 144: istore 20\n 146: iload 18\n 148: invokestatic #94 // Method kotlin/text/CharsKt.digitToInt:(C)I\n 151: invokestatic #100 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 154: aload 19\n 156: swap\n 157: invokeinterface #104, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 162: pop\n 163: iinc 16, 1\n 166: goto 112\n 169: aload 14\n 171: checkcast #106 // class java/util/List\n 174: nop\n 175: nop\n 176: aload 21\n 178: swap\n 179: invokeinterface #104, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 184: pop\n 185: goto 40\n 188: aload 5\n 190: checkcast #106 // class java/util/List\n 193: nop\n 194: astore_1\n 195: iconst_0\n 196: istore_2\n 197: aload_1\n 198: checkcast #50 // class java/lang/Iterable\n 201: astore_3\n 202: iconst_0\n 203: istore 4\n 205: iconst_0\n 206: istore 5\n 208: aload_3\n 209: invokeinterface #66, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 214: astore 6\n 216: aload 6\n 218: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 223: ifeq 344\n 226: aload 6\n 228: invokeinterface #76, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 233: astore 7\n 235: iload 5\n 237: iinc 5, 1\n 240: istore 8\n 242: iload 8\n 244: ifge 250\n 247: invokestatic #195 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 250: iload 8\n 252: aload 7\n 254: checkcast #106 // class java/util/List\n 257: astore 9\n 259: istore 10\n 261: iconst_0\n 262: istore 11\n 264: aload 9\n 266: checkcast #62 // class java/util/Collection\n 269: invokestatic #117 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;\n 272: checkcast #50 // class java/lang/Iterable\n 275: astore 12\n 277: iconst_0\n 278: istore 13\n 280: aload 12\n 282: invokeinterface #66, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 287: astore 14\n 289: aload 14\n 291: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 296: ifeq 338\n 299: aload 14\n 301: checkcast #119 // class kotlin/collections/IntIterator\n 304: invokevirtual #122 // Method kotlin/collections/IntIterator.nextInt:()I\n 307: istore 15\n 309: iload 15\n 311: istore 16\n 313: iconst_0\n 314: istore 17\n 316: aload_1\n 317: iload 10\n 319: iload 16\n 321: invokestatic #197 // Method main$scenicScore:(Ljava/util/List;II)I\n 324: istore 18\n 326: iload_2\n 327: iload 18\n 329: invokestatic #202 // Method java/lang/Math.max:(II)I\n 332: istore_2\n 333: nop\n 334: nop\n 335: goto 289\n 338: nop\n 339: nop\n 340: nop\n 341: goto 216\n 344: nop\n 345: iload_2\n 346: ireturn\n}\n", "javap_err": "" } ]
AlBovo__Compiti__56a3131/src/main/kotlin/numberFraction.kt
class NumberFraction(var numerator: Int, denominatorValue: Int){ var denominator = denominatorValue set(value){ require(value != 0){ "The denominator must be different from 0" } field = value } init{ require(denominatorValue != 0){ "The denominator must be different from 0" } } fun product(number: NumberFraction): NumberFraction{ val numberSecond = reduce(number) reduceCurrentFraction() return reduce(NumberFraction(numerator * numberSecond.numerator, denominator * numberSecond.denominator)) } fun sum(number: NumberFraction): NumberFraction{ val numberSecond = reduce(number) reduceCurrentFraction() return reduce(NumberFraction(numerator*numberSecond.denominator + numberSecond.numerator * denominator, denominator*numberSecond.denominator)) } fun isEqual(number: NumberFraction): Boolean { val numberSecond = reduce(number) reduceCurrentFraction() return numerator == numberSecond.numerator && denominator == numberSecond.denominator } fun isPositive() = (denominator * numerator >= 0) fun calculateGCD(numberFirst: Int, numberSecond: Int): Int { require(numberSecond != 0){ "The number must be positive" } var numberFirst1 = numberFirst var numberSecond1 = numberSecond var numberMaximum = if(numberFirst > numberSecond) numberFirst else numberSecond var gcd = 1 for(i in 2..numberMaximum){ if(numberFirst1 == 1 && numberSecond1 == 1){ break } while(numberFirst1%i == 0 && numberSecond1%i == 0){ gcd *= i numberFirst1 /= i numberSecond1 /= i } } return gcd } fun reduce(numberFraction: NumberFraction): NumberFraction{ val gcd = calculateGCD(numberFraction.numerator, numberFraction.denominator) numberFraction.numerator /= gcd numberFraction.denominator /= gcd return numberFraction } fun reduceCurrentFraction(){ val gcd = calculateGCD(numerator, denominator) numerator /= gcd denominator /= gcd } }
[ { "class_path": "AlBovo__Compiti__56a3131/NumberFraction.class", "javap": "Compiled from \"numberFraction.kt\"\npublic final class NumberFraction {\n private int numerator;\n\n private int denominator;\n\n public NumberFraction(int, int);\n Code:\n 0: aload_0\n 1: invokespecial #9 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: iload_1\n 6: putfield #13 // Field numerator:I\n 9: aload_0\n 10: iload_2\n 11: putfield #16 // Field denominator:I\n 14: nop\n 15: iload_2\n 16: ifeq 23\n 19: iconst_1\n 20: goto 24\n 23: iconst_0\n 24: ifne 44\n 27: iconst_0\n 28: istore_3\n 29: ldc #18 // String The denominator must be different from 0\n 31: astore_3\n 32: new #20 // class java/lang/IllegalArgumentException\n 35: dup\n 36: aload_3\n 37: invokevirtual #24 // Method java/lang/Object.toString:()Ljava/lang/String;\n 40: invokespecial #27 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 43: athrow\n 44: nop\n 45: return\n\n public final int getNumerator();\n Code:\n 0: aload_0\n 1: getfield #13 // Field numerator:I\n 4: ireturn\n\n public final void setNumerator(int);\n Code:\n 0: aload_0\n 1: iload_1\n 2: putfield #13 // Field numerator:I\n 5: return\n\n public final int getDenominator();\n Code:\n 0: aload_0\n 1: getfield #16 // Field denominator:I\n 4: ireturn\n\n public final void setDenominator(int);\n Code:\n 0: iload_1\n 1: ifeq 8\n 4: iconst_1\n 5: goto 9\n 8: iconst_0\n 9: ifne 29\n 12: iconst_0\n 13: istore_2\n 14: ldc #18 // String The denominator must be different from 0\n 16: astore_2\n 17: new #20 // class java/lang/IllegalArgumentException\n 20: dup\n 21: aload_2\n 22: invokevirtual #24 // Method java/lang/Object.toString:()Ljava/lang/String;\n 25: invokespecial #27 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 28: athrow\n 29: aload_0\n 30: iload_1\n 31: putfield #16 // Field denominator:I\n 34: return\n\n public final NumberFraction product(NumberFraction);\n Code:\n 0: aload_1\n 1: ldc #45 // String number\n 3: invokestatic #51 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: invokevirtual #54 // Method reduce:(LNumberFraction;)LNumberFraction;\n 11: astore_2\n 12: aload_0\n 13: invokevirtual #57 // Method reduceCurrentFraction:()V\n 16: aload_0\n 17: new #2 // class NumberFraction\n 20: dup\n 21: aload_0\n 22: getfield #13 // Field numerator:I\n 25: aload_2\n 26: getfield #13 // Field numerator:I\n 29: imul\n 30: aload_0\n 31: getfield #16 // Field denominator:I\n 34: aload_2\n 35: getfield #16 // Field denominator:I\n 38: imul\n 39: invokespecial #59 // Method \"<init>\":(II)V\n 42: invokevirtual #54 // Method reduce:(LNumberFraction;)LNumberFraction;\n 45: areturn\n\n public final NumberFraction sum(NumberFraction);\n Code:\n 0: aload_1\n 1: ldc #45 // String number\n 3: invokestatic #51 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: invokevirtual #54 // Method reduce:(LNumberFraction;)LNumberFraction;\n 11: astore_2\n 12: aload_0\n 13: invokevirtual #57 // Method reduceCurrentFraction:()V\n 16: aload_0\n 17: new #2 // class NumberFraction\n 20: dup\n 21: aload_0\n 22: getfield #13 // Field numerator:I\n 25: aload_2\n 26: getfield #16 // Field denominator:I\n 29: imul\n 30: aload_2\n 31: getfield #13 // Field numerator:I\n 34: aload_0\n 35: getfield #16 // Field denominator:I\n 38: imul\n 39: iadd\n 40: aload_0\n 41: getfield #16 // Field denominator:I\n 44: aload_2\n 45: getfield #16 // Field denominator:I\n 48: imul\n 49: invokespecial #59 // Method \"<init>\":(II)V\n 52: invokevirtual #54 // Method reduce:(LNumberFraction;)LNumberFraction;\n 55: areturn\n\n public final boolean isEqual(NumberFraction);\n Code:\n 0: aload_1\n 1: ldc #45 // String number\n 3: invokestatic #51 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: invokevirtual #54 // Method reduce:(LNumberFraction;)LNumberFraction;\n 11: astore_2\n 12: aload_0\n 13: invokevirtual #57 // Method reduceCurrentFraction:()V\n 16: aload_0\n 17: getfield #13 // Field numerator:I\n 20: aload_2\n 21: getfield #13 // Field numerator:I\n 24: if_icmpne 42\n 27: aload_0\n 28: getfield #16 // Field denominator:I\n 31: aload_2\n 32: getfield #16 // Field denominator:I\n 35: if_icmpne 42\n 38: iconst_1\n 39: goto 43\n 42: iconst_0\n 43: ireturn\n\n public final boolean isPositive();\n Code:\n 0: aload_0\n 1: getfield #16 // Field denominator:I\n 4: aload_0\n 5: getfield #13 // Field numerator:I\n 8: imul\n 9: iflt 16\n 12: iconst_1\n 13: goto 17\n 16: iconst_0\n 17: ireturn\n\n public final int calculateGCD(int, int);\n Code:\n 0: iload_2\n 1: ifeq 8\n 4: iconst_1\n 5: goto 9\n 8: iconst_0\n 9: ifne 32\n 12: iconst_0\n 13: istore 4\n 15: ldc #69 // String The number must be positive\n 17: astore 4\n 19: new #20 // class java/lang/IllegalArgumentException\n 22: dup\n 23: aload 4\n 25: invokevirtual #24 // Method java/lang/Object.toString:()Ljava/lang/String;\n 28: invokespecial #27 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 31: athrow\n 32: iload_1\n 33: istore_3\n 34: iload_2\n 35: istore 4\n 37: iload_1\n 38: iload_2\n 39: if_icmple 46\n 42: iload_1\n 43: goto 47\n 46: iload_2\n 47: istore 5\n 49: iconst_1\n 50: istore 6\n 52: iconst_2\n 53: istore 7\n 55: iload 5\n 57: istore 8\n 59: iload 7\n 61: iload 8\n 63: if_icmpgt 130\n 66: iload_3\n 67: iconst_1\n 68: if_icmpne 80\n 71: iload 4\n 73: iconst_1\n 74: if_icmpne 80\n 77: goto 130\n 80: iload_3\n 81: iload 7\n 83: irem\n 84: ifne 117\n 87: iload 4\n 89: iload 7\n 91: irem\n 92: ifne 117\n 95: iload 6\n 97: iload 7\n 99: imul\n 100: istore 6\n 102: iload_3\n 103: iload 7\n 105: idiv\n 106: istore_3\n 107: iload 4\n 109: iload 7\n 111: idiv\n 112: istore 4\n 114: goto 80\n 117: iload 7\n 119: iload 8\n 121: if_icmpeq 130\n 124: iinc 7, 1\n 127: goto 66\n 130: iload 6\n 132: ireturn\n\n public final NumberFraction reduce(NumberFraction);\n Code:\n 0: aload_1\n 1: ldc #78 // String numberFraction\n 3: invokestatic #51 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: getfield #13 // Field numerator:I\n 11: aload_1\n 12: getfield #16 // Field denominator:I\n 15: invokevirtual #80 // Method calculateGCD:(II)I\n 18: istore_2\n 19: aload_1\n 20: aload_1\n 21: getfield #13 // Field numerator:I\n 24: iload_2\n 25: idiv\n 26: putfield #13 // Field numerator:I\n 29: aload_1\n 30: aload_1\n 31: getfield #16 // Field denominator:I\n 34: iload_2\n 35: idiv\n 36: invokevirtual #82 // Method setDenominator:(I)V\n 39: aload_1\n 40: areturn\n\n public final void reduceCurrentFraction();\n Code:\n 0: aload_0\n 1: aload_0\n 2: getfield #13 // Field numerator:I\n 5: aload_0\n 6: getfield #16 // Field denominator:I\n 9: invokevirtual #80 // Method calculateGCD:(II)I\n 12: istore_1\n 13: aload_0\n 14: aload_0\n 15: getfield #13 // Field numerator:I\n 18: iload_1\n 19: idiv\n 20: putfield #13 // Field numerator:I\n 23: aload_0\n 24: aload_0\n 25: getfield #16 // Field denominator:I\n 28: iload_1\n 29: idiv\n 30: invokevirtual #82 // Method setDenominator:(I)V\n 33: return\n}\n", "javap_err": "" } ]
AlBovo__Compiti__56a3131/src/main/kotlin/segtree.kt
import kotlin.math.* class SegmentTree(array: Array<Int>){ private var segment = Array<Int>(0){ 0 } private var size = 0 private var sizeOfInitialArray = 0 init{ size = 1 shl ceil(log2(array.size.toFloat())).toInt() sizeOfInitialArray = array.size segment = Array(size * 2){ 0 } for(i in array.indices){ segment[i + size] = array[i] } for(i in size-1 downTo 1){ segment[i] = segment[i * 2]+segment[i * 2 + 1] } } private fun privateGetSum(node: Int, nodeRangeLeft: Int, nodeRangeRight: Int, queryRangeLeft: Int, queryRangeRight: Int): Int{ // the query range is [queryRangeLeft, queryRangeRight) if(queryRangeLeft >= nodeRangeRight || queryRangeRight <= nodeRangeLeft){ return 0 } if(nodeRangeLeft >= queryRangeLeft && nodeRangeRight <= queryRangeRight){ return segment[node] } val left = privateGetSum(node * 2, nodeRangeLeft, (nodeRangeLeft + nodeRangeRight) / 2, queryRangeLeft, queryRangeRight) val right = privateGetSum(node * 2 + 1, (nodeRangeLeft + nodeRangeRight) / 2, nodeRangeRight, queryRangeLeft ,queryRangeRight) return left + right } private fun privateUpdate(nodePosition: Int, value: Int){ var node = nodePosition + size segment[node] = value node /= 2 while(node > 0){ segment[node] = segment[node * 2] + segment[node * 2 + 1] node /= 2 } } private fun check(){ for(i in segment.indices){ print(segment[i].toString() + " ") } println("") } fun getSum(queryLeft: Int, queryRight: Int): Int{ require(queryLeft >= 0 && queryLeft < segment.size){ "Left end is not correct, it must be greater than -1 and less than the size of the segment size" } require(queryRight >= 0 && queryRight <= segment.size){ "Right end is not correct, it must be greater than -1 and less than the size of the segment size" } require(queryLeft <= queryRight){ "The right end must be greater or equal to the left end" } return privateGetSum(1, 1, size, queryLeft, queryRight) } fun update(nodePosition: Int, value: Int){ require(nodePosition in 0 until sizeOfInitialArray){ "The node isn't in the segment tree" } privateUpdate(nodePosition, value) check() } } fun main(){ val arr = arrayOf(2, 4, 2, 1, 3, 4, 5) val seg = SegmentTree(arr) print(seg.getSum(0, 4)) //seg.update(3, 4) }
[ { "class_path": "AlBovo__Compiti__56a3131/SegtreeKt.class", "javap": "Compiled from \"segtree.kt\"\npublic final class SegtreeKt {\n public static final void main();\n Code:\n 0: bipush 7\n 2: anewarray #8 // class java/lang/Integer\n 5: astore_1\n 6: aload_1\n 7: iconst_0\n 8: iconst_2\n 9: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 12: aastore\n 13: aload_1\n 14: iconst_1\n 15: iconst_4\n 16: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 19: aastore\n 20: aload_1\n 21: iconst_2\n 22: iconst_2\n 23: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 26: aastore\n 27: aload_1\n 28: iconst_3\n 29: iconst_1\n 30: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 33: aastore\n 34: aload_1\n 35: iconst_4\n 36: iconst_3\n 37: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 40: aastore\n 41: aload_1\n 42: iconst_5\n 43: iconst_4\n 44: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 47: aastore\n 48: aload_1\n 49: bipush 6\n 51: iconst_5\n 52: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 55: aastore\n 56: aload_1\n 57: astore_0\n 58: new #14 // class SegmentTree\n 61: dup\n 62: aload_0\n 63: invokespecial #18 // Method SegmentTree.\"<init>\":([Ljava/lang/Integer;)V\n 66: astore_1\n 67: aload_1\n 68: iconst_0\n 69: iconst_4\n 70: invokevirtual #22 // Method SegmentTree.getSum:(II)I\n 73: istore_2\n 74: getstatic #28 // Field java/lang/System.out:Ljava/io/PrintStream;\n 77: iload_2\n 78: invokevirtual #34 // Method java/io/PrintStream.print:(I)V\n 81: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #41 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
DmitrySwan__KotlinEducation__83dbf8b/src/Tasks.kt
fun main() { println( repeatedIntersection(intArrayOf(3, 6, 7, 8, 7, 9), mutableListOf(12, 6, 7, 6, 7, 565)) ) println(countLetters("AAGGDDDFBBBAAABB")) println(groupWords(arrayOf("ate", "tdb", "eat", "ref", "fer", "test"))) } fun repeatedIntersection(array1: IntArray, array2: MutableList<Int>): List<Int> { return array1 .filter { e -> array2.remove(e) } } fun countLetters(input: String): String { var i = 0 var count = 0 var result = "" for (letter in input) { count++ i++ if (i < input.length && letter == input[i]) { continue } result += "${input[i - 1]}$count" count = 0 } return result } fun groupWords(words: Array<String>): List<List<String>> { val map: MutableMap<String, MutableList<String>> = HashMap() for (word in words) { val sum: String = word.toCharArray().sorted().joinToString() map.getOrPut(sum) { mutableListOf() } .add(word) } return map.values.toList() }
[ { "class_path": "DmitrySwan__KotlinEducation__83dbf8b/TasksKt.class", "javap": "Compiled from \"Tasks.kt\"\npublic final class TasksKt {\n public static final void main();\n Code:\n 0: bipush 6\n 2: newarray int\n 4: astore_0\n 5: aload_0\n 6: iconst_0\n 7: iconst_3\n 8: iastore\n 9: aload_0\n 10: iconst_1\n 11: bipush 6\n 13: iastore\n 14: aload_0\n 15: iconst_2\n 16: bipush 7\n 18: iastore\n 19: aload_0\n 20: iconst_3\n 21: bipush 8\n 23: iastore\n 24: aload_0\n 25: iconst_4\n 26: bipush 7\n 28: iastore\n 29: aload_0\n 30: iconst_5\n 31: bipush 9\n 33: iastore\n 34: aload_0\n 35: bipush 6\n 37: anewarray #8 // class java/lang/Integer\n 40: astore_0\n 41: aload_0\n 42: iconst_0\n 43: bipush 12\n 45: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 48: aastore\n 49: aload_0\n 50: iconst_1\n 51: bipush 6\n 53: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 56: aastore\n 57: aload_0\n 58: iconst_2\n 59: bipush 7\n 61: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 64: aastore\n 65: aload_0\n 66: iconst_3\n 67: bipush 6\n 69: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 72: aastore\n 73: aload_0\n 74: iconst_4\n 75: bipush 7\n 77: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 80: aastore\n 81: aload_0\n 82: iconst_5\n 83: sipush 565\n 86: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 89: aastore\n 90: aload_0\n 91: invokestatic #18 // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;\n 94: invokestatic #22 // Method repeatedIntersection:([ILjava/util/List;)Ljava/util/List;\n 97: astore_0\n 98: getstatic #28 // Field java/lang/System.out:Ljava/io/PrintStream;\n 101: aload_0\n 102: invokevirtual #34 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 105: ldc #36 // String AAGGDDDFBBBAAABB\n 107: invokestatic #40 // Method countLetters:(Ljava/lang/String;)Ljava/lang/String;\n 110: getstatic #28 // Field java/lang/System.out:Ljava/io/PrintStream;\n 113: swap\n 114: invokevirtual #34 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 117: bipush 6\n 119: anewarray #42 // class java/lang/String\n 122: astore_0\n 123: aload_0\n 124: iconst_0\n 125: ldc #44 // String ate\n 127: aastore\n 128: aload_0\n 129: iconst_1\n 130: ldc #46 // String tdb\n 132: aastore\n 133: aload_0\n 134: iconst_2\n 135: ldc #48 // String eat\n 137: aastore\n 138: aload_0\n 139: iconst_3\n 140: ldc #50 // String ref\n 142: aastore\n 143: aload_0\n 144: iconst_4\n 145: ldc #52 // String fer\n 147: aastore\n 148: aload_0\n 149: iconst_5\n 150: ldc #54 // String test\n 152: aastore\n 153: aload_0\n 154: invokestatic #58 // Method groupWords:([Ljava/lang/String;)Ljava/util/List;\n 157: getstatic #28 // Field java/lang/System.out:Ljava/io/PrintStream;\n 160: swap\n 161: invokevirtual #34 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 164: return\n\n public static final java.util.List<java.lang.Integer> repeatedIntersection(int[], java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #62 // String array1\n 3: invokestatic #68 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #70 // String array2\n 9: invokestatic #68 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: astore_2\n 14: nop\n 15: iconst_0\n 16: istore_3\n 17: aload_2\n 18: astore 4\n 20: new #72 // class java/util/ArrayList\n 23: dup\n 24: invokespecial #75 // Method java/util/ArrayList.\"<init>\":()V\n 27: checkcast #77 // class java/util/Collection\n 30: astore 5\n 32: iconst_0\n 33: istore 6\n 35: iconst_0\n 36: istore 7\n 38: aload 4\n 40: arraylength\n 41: istore 8\n 43: iload 7\n 45: iload 8\n 47: if_icmpge 97\n 50: aload 4\n 52: iload 7\n 54: iaload\n 55: istore 9\n 57: iload 9\n 59: istore 10\n 61: iconst_0\n 62: istore 11\n 64: aload_1\n 65: iload 10\n 67: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 70: invokeinterface #83, 2 // InterfaceMethod java/util/List.remove:(Ljava/lang/Object;)Z\n 75: ifeq 91\n 78: aload 5\n 80: iload 9\n 82: invokestatic #12 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 85: invokeinterface #86, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 90: pop\n 91: iinc 7, 1\n 94: goto 43\n 97: aload 5\n 99: checkcast #79 // class java/util/List\n 102: nop\n 103: areturn\n\n public static final java.lang.String countLetters(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #101 // String input\n 3: invokestatic #68 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: iconst_0\n 9: istore_2\n 10: ldc #103 // String\n 12: astore_3\n 13: iconst_0\n 14: istore 4\n 16: aload_0\n 17: invokevirtual #107 // Method java/lang/String.length:()I\n 20: istore 5\n 22: iload 4\n 24: iload 5\n 26: if_icmpge 101\n 29: aload_0\n 30: iload 4\n 32: invokevirtual #111 // Method java/lang/String.charAt:(I)C\n 35: istore 6\n 37: iinc 2, 1\n 40: iinc 1, 1\n 43: iload_1\n 44: aload_0\n 45: invokevirtual #107 // Method java/lang/String.length:()I\n 48: if_icmpge 64\n 51: iload 6\n 53: aload_0\n 54: iload_1\n 55: invokevirtual #111 // Method java/lang/String.charAt:(I)C\n 58: if_icmpne 64\n 61: goto 95\n 64: new #113 // class java/lang/StringBuilder\n 67: dup\n 68: invokespecial #114 // Method java/lang/StringBuilder.\"<init>\":()V\n 71: aload_3\n 72: invokevirtual #118 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 75: aload_0\n 76: iload_1\n 77: iconst_1\n 78: isub\n 79: invokevirtual #111 // Method java/lang/String.charAt:(I)C\n 82: invokevirtual #121 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 85: iload_2\n 86: invokevirtual #124 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 89: invokevirtual #128 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 92: astore_3\n 93: iconst_0\n 94: istore_2\n 95: iinc 4, 1\n 98: goto 22\n 101: aload_3\n 102: areturn\n\n public static final java.util.List<java.util.List<java.lang.String>> groupWords(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #137 // String words\n 3: invokestatic #68 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #139 // class java/util/HashMap\n 9: dup\n 10: invokespecial #140 // Method java/util/HashMap.\"<init>\":()V\n 13: checkcast #142 // class java/util/Map\n 16: astore_1\n 17: iconst_0\n 18: istore_2\n 19: aload_0\n 20: arraylength\n 21: istore_3\n 22: iload_2\n 23: iload_3\n 24: if_icmpge 138\n 27: aload_0\n 28: iload_2\n 29: aaload\n 30: astore 4\n 32: aload 4\n 34: invokevirtual #146 // Method java/lang/String.toCharArray:()[C\n 37: dup\n 38: ldc #148 // String toCharArray(...)\n 40: invokestatic #151 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 43: invokestatic #157 // Method kotlin/collections/ArraysKt.sorted:([C)Ljava/util/List;\n 46: checkcast #159 // class java/lang/Iterable\n 49: aconst_null\n 50: aconst_null\n 51: aconst_null\n 52: iconst_0\n 53: aconst_null\n 54: aconst_null\n 55: bipush 63\n 57: aconst_null\n 58: invokestatic #163 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 61: astore 5\n 63: aload_1\n 64: astore 6\n 66: iconst_0\n 67: istore 7\n 69: aload 6\n 71: aload 5\n 73: invokeinterface #167, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 78: astore 8\n 80: aload 8\n 82: ifnonnull 118\n 85: iconst_0\n 86: istore 9\n 88: new #72 // class java/util/ArrayList\n 91: dup\n 92: invokespecial #75 // Method java/util/ArrayList.\"<init>\":()V\n 95: checkcast #79 // class java/util/List\n 98: nop\n 99: astore 9\n 101: aload 6\n 103: aload 5\n 105: aload 9\n 107: invokeinterface #171, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 112: pop\n 113: aload 9\n 115: goto 120\n 118: aload 8\n 120: nop\n 121: checkcast #79 // class java/util/List\n 124: aload 4\n 126: invokeinterface #172, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 131: pop\n 132: iinc 2, 1\n 135: goto 22\n 138: aload_1\n 139: invokeinterface #176, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 144: checkcast #159 // class java/lang/Iterable\n 147: invokestatic #180 // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;\n 150: areturn\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #195 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
UlrichBerntien__Uebungen-Kotlin__0b4c608/KameleBeladen.kt
/** * Programmieraufgabe: * * Kamele beladen * https://www.programmieraufgaben.ch/aufgabe/kamele-beladen/6gddr4zm * * Ein Kamel soll optimal beladen werden. Das Kamel kann maximal 270 kg tragen. * Aktuell sind Waren mit den folgenden Gewichten zu transportieren: 5, 18, 32, * 34, 45, 57, 63, 69, 94, 98 und 121 kg. Nicht alle Gewichte müssen verwendet * werden; die 270 kg sollen aber möglichst gut, wenn nicht sogar ganz ohne * Rest beladen werden. Die Funktion * beladeOptimal(kapazitaet: integer, vorrat: integer[]): integer[] * erhält die maximal tragbare Last (kapazitaet) und eine Menge von * aufzuteilenden Gewichten (vorrat). Das Resultat (hier integer[]) ist die * Auswahl aus dem Vorrat, die der Belastbarkeit möglichst nahe kommt. Gehen * Sie wie folgt rekursiv vor: Für jedes vorhandene Gewicht g aus dem Vorrat * soll das Problem vereinfacht werden. Dazu wird dieses Gewicht probehalber * aufgeladen: * tmpLadung: integer[] * tmpLadung := beladeOptimal(kapazitaet - g, "vorrat ohne g") * Danach wird das beste Resultat tmpLadung + g gesucht und als Array * zurückgegeben. Behandeln Sie in der Methode beladeOptimal() zunächst die * Abbruchbedingungen: * Vorrat leer * alle vorhandenen Gewichte sind zu schwer * nur noch ein Gewicht im Vorrat * * Autor: * <NAME> 2018-06-24 * * Sprache: * Kotlin 1.2.51 */ /** * Bestimmt die optimale Beladung. * @param capacity Die maximale Beladung. * @param pool Die zur Beladung möglichen Elemente. * @return Die optimale Beladung, ein Teilmenge von pool. */ fun optimalLoad(capacity: Int, pool: IntArray): IntArray { var tmpOptimalLoad = 0 var tmpOptimalBag = IntArray(0) for (index in pool.indices) if (pool[index] <= capacity) { val bag = optimalLoad(capacity - pool[index], pool.sliceArray(pool.indices - index)) val total = bag.sum() + pool[index] if (total > tmpOptimalLoad) { tmpOptimalLoad = total tmpOptimalBag = bag + pool[index] } } return tmpOptimalBag } /** * Hauptprogramm. * @param argv Aufrufparamter werden ignotiert. */ fun main(argv: Array<String>) { val capacity = 270 val pool = intArrayOf(18, 32, 34, 45, 57, 63, 69, 94, 98, 121) // Mit mehr Elementen dauert es wesentlioh länger: //val capacity = 1000 //val pool = arrayOf(181, 130, 128, 125, 124, 121, 104, 101, 98, 94, 69, 61, 13) val bag = optimalLoad(capacity, pool) val load = bag.sum() println(""" |Beladung: ${bag.contentToString()} |Summe Beladung: $load |Freie Kapazität: ${capacity - load} """.trimMargin()) }
[ { "class_path": "UlrichBerntien__Uebungen-Kotlin__0b4c608/KameleBeladenKt.class", "javap": "Compiled from \"KameleBeladen.kt\"\npublic final class KameleBeladenKt {\n public static final int[] optimalLoad(int, int[]);\n Code:\n 0: aload_1\n 1: ldc #9 // String pool\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: iconst_0\n 9: newarray int\n 11: astore_3\n 12: iconst_0\n 13: istore 4\n 15: aload_1\n 16: arraylength\n 17: istore 5\n 19: iload 4\n 21: iload 5\n 23: if_icmpge 104\n 26: aload_1\n 27: iload 4\n 29: iaload\n 30: iload_0\n 31: if_icmpgt 98\n 34: iload_0\n 35: aload_1\n 36: iload 4\n 38: iaload\n 39: isub\n 40: aload_1\n 41: aload_1\n 42: invokestatic #21 // Method kotlin/collections/ArraysKt.getIndices:([I)Lkotlin/ranges/IntRange;\n 45: checkcast #23 // class java/lang/Iterable\n 48: iload 4\n 50: invokestatic #29 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 53: invokestatic #35 // Method kotlin/collections/CollectionsKt.minus:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/util/List;\n 56: checkcast #37 // class java/util/Collection\n 59: invokestatic #41 // Method kotlin/collections/ArraysKt.sliceArray:([ILjava/util/Collection;)[I\n 62: invokestatic #43 // Method optimalLoad:(I[I)[I\n 65: astore 6\n 67: aload 6\n 69: invokestatic #47 // Method kotlin/collections/ArraysKt.sum:([I)I\n 72: aload_1\n 73: iload 4\n 75: iaload\n 76: iadd\n 77: istore 7\n 79: iload 7\n 81: iload_2\n 82: if_icmple 98\n 85: iload 7\n 87: istore_2\n 88: aload 6\n 90: aload_1\n 91: iload 4\n 93: iaload\n 94: invokestatic #51 // Method kotlin/collections/ArraysKt.plus:([II)[I\n 97: astore_3\n 98: iinc 4, 1\n 101: goto 19\n 104: aload_3\n 105: areturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #64 // String argv\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: sipush 270\n 9: istore_1\n 10: bipush 10\n 12: newarray int\n 14: astore_3\n 15: aload_3\n 16: iconst_0\n 17: bipush 18\n 19: iastore\n 20: aload_3\n 21: iconst_1\n 22: bipush 32\n 24: iastore\n 25: aload_3\n 26: iconst_2\n 27: bipush 34\n 29: iastore\n 30: aload_3\n 31: iconst_3\n 32: bipush 45\n 34: iastore\n 35: aload_3\n 36: iconst_4\n 37: bipush 57\n 39: iastore\n 40: aload_3\n 41: iconst_5\n 42: bipush 63\n 44: iastore\n 45: aload_3\n 46: bipush 6\n 48: bipush 69\n 50: iastore\n 51: aload_3\n 52: bipush 7\n 54: bipush 94\n 56: iastore\n 57: aload_3\n 58: bipush 8\n 60: bipush 98\n 62: iastore\n 63: aload_3\n 64: bipush 9\n 66: bipush 121\n 68: iastore\n 69: aload_3\n 70: astore_2\n 71: iload_1\n 72: aload_2\n 73: invokestatic #43 // Method optimalLoad:(I[I)[I\n 76: astore_3\n 77: aload_3\n 78: invokestatic #47 // Method kotlin/collections/ArraysKt.sum:([I)I\n 81: istore 4\n 83: new #66 // class java/lang/StringBuilder\n 86: dup\n 87: invokespecial #70 // Method java/lang/StringBuilder.\"<init>\":()V\n 90: ldc #72 // String \\n |Beladung:\n 92: invokevirtual #76 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 95: aload_3\n 96: invokestatic #82 // Method java/util/Arrays.toString:([I)Ljava/lang/String;\n 99: dup\n 100: ldc #84 // String toString(...)\n 102: invokestatic #87 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 105: invokevirtual #76 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 108: ldc #89 // String \\n |Summe Beladung:\n 110: invokevirtual #76 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 113: iload 4\n 115: invokevirtual #92 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 118: ldc #94 // String \\n |Freie Kapazität:\n 120: invokevirtual #76 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 123: iload_1\n 124: iload 4\n 126: isub\n 127: invokevirtual #92 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 130: ldc #96 // String \\n\n 132: invokevirtual #76 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 135: invokevirtual #99 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 138: aconst_null\n 139: iconst_1\n 140: aconst_null\n 141: invokestatic #105 // Method kotlin/text/StringsKt.trimMargin$default:(Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;\n 144: astore 5\n 146: getstatic #111 // Field java/lang/System.out:Ljava/io/PrintStream;\n 149: aload 5\n 151: invokevirtual #117 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 154: return\n}\n", "javap_err": "" } ]
mececeli__Kotlin_Exercises__d05ee9d/src/main/kotlin/ValidParenthese.kt
import java.util.* //Valid Parentheses //Easy //16.9K //871 //Companies //Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. // //An input string is valid if: // //Open brackets must be closed by the same type of brackets. //Open brackets must be closed in the correct order. //Every close bracket has a corresponding open bracket of the same type. // // //Example 1: // //Input: s = "()" //Output: true //Example 2: // //Input: s = "()[]{}" //Output: true //Example 3: // //Input: s = "(]" //Output: false // // //Constraints: // //1 <= s.length <= 104 //s consists of parentheses only '()[]{}'. fun isValidParentheses(s: String): Boolean { if (s.length % 2 == 1) return false val openingBrackets: MutableList<Char> = mutableListOf() val closingBrackets: MutableList<Char> = mutableListOf() s.forEach { char -> if (isOpeningBracket(char)) { openingBrackets.add(char) } else { closingBrackets.add(char) } } if (openingBrackets.size == closingBrackets.size) { openingBrackets.forEachIndexed { index, char -> if (isSameTypeBracket(openingChar = char, closingChar = closingBrackets[index]).not()) { return false } return true } } else { return false } return false } fun isOpeningBracket(char: Char): Boolean = when (char) { '(', '[', '{' -> true else -> false } fun isSameTypeBracket(openingChar: Char, closingChar: Char): Boolean { if (openingChar == '(' && closingChar == ')') return true if (openingChar == '[' && closingChar == ']') return true if (openingChar == '{' && closingChar == '}') return true return false } //----------------------------------------------------------------------------- Stack Solution fun isValidParenthesesStack(s: String): Boolean { if (s.length % 2 != 0) return false val map = mapOf('}' to '{', ')' to '(', ']' to '[') val stack = Stack<Char>() s.forEach { if (it == '}' || it == ')' || it == ']') { if (stack.isEmpty() || stack.peek() != map[it]) return false stack.pop() } else stack.push(it) } return stack.isEmpty() }
[ { "class_path": "mececeli__Kotlin_Exercises__d05ee9d/ValidParentheseKt.class", "javap": "Compiled from \"ValidParenthese.kt\"\npublic final class ValidParentheseKt {\n public static final boolean isValidParentheses(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #9 // String s\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #21 // Method java/lang/String.length:()I\n 10: iconst_2\n 11: irem\n 12: iconst_1\n 13: if_icmpne 18\n 16: iconst_0\n 17: ireturn\n 18: new #23 // class java/util/ArrayList\n 21: dup\n 22: invokespecial #27 // Method java/util/ArrayList.\"<init>\":()V\n 25: checkcast #29 // class java/util/List\n 28: astore_1\n 29: new #23 // class java/util/ArrayList\n 32: dup\n 33: invokespecial #27 // Method java/util/ArrayList.\"<init>\":()V\n 36: checkcast #29 // class java/util/List\n 39: astore_2\n 40: aload_0\n 41: checkcast #31 // class java/lang/CharSequence\n 44: astore_3\n 45: iconst_0\n 46: istore 4\n 48: iconst_0\n 49: istore 5\n 51: iload 5\n 53: aload_3\n 54: invokeinterface #32, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 59: if_icmpge 121\n 62: aload_3\n 63: iload 5\n 65: invokeinterface #36, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 70: istore 6\n 72: iload 6\n 74: istore 7\n 76: iconst_0\n 77: istore 8\n 79: iload 7\n 81: invokestatic #40 // Method isOpeningBracket:(C)Z\n 84: ifeq 101\n 87: aload_1\n 88: iload 7\n 90: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 93: invokeinterface #50, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 98: goto 112\n 101: aload_2\n 102: iload 7\n 104: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 107: invokeinterface #50, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 112: pop\n 113: nop\n 114: nop\n 115: iinc 5, 1\n 118: goto 51\n 121: nop\n 122: aload_1\n 123: invokeinterface #53, 1 // InterfaceMethod java/util/List.size:()I\n 128: aload_2\n 129: invokeinterface #53, 1 // InterfaceMethod java/util/List.size:()I\n 134: if_icmpne 229\n 137: aload_1\n 138: checkcast #55 // class java/lang/Iterable\n 141: astore_3\n 142: iconst_0\n 143: istore 4\n 145: iconst_0\n 146: istore 5\n 148: aload_3\n 149: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 154: astore 6\n 156: aload 6\n 158: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 163: ifeq 225\n 166: aload 6\n 168: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 173: astore 7\n 175: iload 5\n 177: iinc 5, 1\n 180: istore 8\n 182: iload 8\n 184: aload 7\n 186: checkcast #42 // class java/lang/Character\n 189: invokevirtual #73 // Method java/lang/Character.charValue:()C\n 192: istore 9\n 194: istore 10\n 196: iconst_0\n 197: istore 11\n 199: iload 9\n 201: aload_2\n 202: iload 10\n 204: invokeinterface #77, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 209: checkcast #42 // class java/lang/Character\n 212: invokevirtual #73 // Method java/lang/Character.charValue:()C\n 215: invokestatic #81 // Method isSameTypeBracket:(CC)Z\n 218: ifne 223\n 221: iconst_0\n 222: ireturn\n 223: iconst_1\n 224: ireturn\n 225: nop\n 226: goto 231\n 229: iconst_0\n 230: ireturn\n 231: iconst_0\n 232: ireturn\n\n public static final boolean isOpeningBracket(char);\n Code:\n 0: iload_0\n 1: lookupswitch { // 3\n 40: 36\n 91: 36\n 123: 36\n default: 40\n }\n 36: iconst_1\n 37: goto 41\n 40: iconst_0\n 41: ireturn\n\n public static final boolean isSameTypeBracket(char, char);\n Code:\n 0: iload_0\n 1: bipush 40\n 3: if_icmpne 14\n 6: iload_1\n 7: bipush 41\n 9: if_icmpne 14\n 12: iconst_1\n 13: ireturn\n 14: iload_0\n 15: bipush 91\n 17: if_icmpne 28\n 20: iload_1\n 21: bipush 93\n 23: if_icmpne 28\n 26: iconst_1\n 27: ireturn\n 28: iload_0\n 29: bipush 123\n 31: if_icmpne 42\n 34: iload_1\n 35: bipush 125\n 37: if_icmpne 42\n 40: iconst_1\n 41: ireturn\n 42: iconst_0\n 43: ireturn\n\n public static final boolean isValidParenthesesStack(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #9 // String s\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #21 // Method java/lang/String.length:()I\n 10: iconst_2\n 11: irem\n 12: ifeq 17\n 15: iconst_0\n 16: ireturn\n 17: iconst_3\n 18: anewarray #106 // class kotlin/Pair\n 21: astore_2\n 22: aload_2\n 23: iconst_0\n 24: bipush 125\n 26: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 29: bipush 123\n 31: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 34: invokestatic #112 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 37: aastore\n 38: aload_2\n 39: iconst_1\n 40: bipush 41\n 42: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 45: bipush 40\n 47: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 50: invokestatic #112 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 53: aastore\n 54: aload_2\n 55: iconst_2\n 56: bipush 93\n 58: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 61: bipush 91\n 63: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 66: invokestatic #112 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 69: aastore\n 70: aload_2\n 71: invokestatic #118 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 74: astore_1\n 75: new #120 // class java/util/Stack\n 78: dup\n 79: invokespecial #121 // Method java/util/Stack.\"<init>\":()V\n 82: astore_2\n 83: aload_0\n 84: checkcast #31 // class java/lang/CharSequence\n 87: astore_3\n 88: iconst_0\n 89: istore 4\n 91: iconst_0\n 92: istore 5\n 94: iload 5\n 96: aload_3\n 97: invokeinterface #32, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 102: if_icmpge 221\n 105: aload_3\n 106: iload 5\n 108: invokeinterface #36, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 113: istore 6\n 115: iload 6\n 117: istore 7\n 119: iconst_0\n 120: istore 8\n 122: iload 7\n 124: lookupswitch { // 3\n 41: 160\n 93: 160\n 125: 160\n default: 200\n }\n 160: aload_2\n 161: invokevirtual #124 // Method java/util/Stack.isEmpty:()Z\n 164: ifne 188\n 167: aload_2\n 168: invokevirtual #127 // Method java/util/Stack.peek:()Ljava/lang/Object;\n 171: aload_1\n 172: iload 7\n 174: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 177: invokeinterface #132, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 182: invokestatic #136 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 185: ifne 190\n 188: iconst_0\n 189: ireturn\n 190: aload_2\n 191: invokevirtual #139 // Method java/util/Stack.pop:()Ljava/lang/Object;\n 194: checkcast #42 // class java/lang/Character\n 197: goto 212\n 200: aload_2\n 201: iload 7\n 203: invokestatic #46 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 206: invokevirtual #142 // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;\n 209: checkcast #42 // class java/lang/Character\n 212: pop\n 213: nop\n 214: nop\n 215: iinc 5, 1\n 218: goto 94\n 221: nop\n 222: aload_2\n 223: invokevirtual #124 // Method java/util/Stack.isEmpty:()Z\n 226: ireturn\n}\n", "javap_err": "" } ]
mececeli__Kotlin_Exercises__d05ee9d/src/main/kotlin/TwoSum.kt
/** * Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. * You may assume that each input would have exactly one solution, and you may not use the same element twice. * You can return the answer in any order. * * Example 1: * Input: nums = [2,7,11,15], target = 9 * Output: [0,1] * Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]. * Example 2: * * Input: nums = [3,2,4], target = 6 * Output: [1,2] * Example 3: * * Input: nums = [3,3], target = 6 * Output: [0,1] * * Main.kt run * println( * twoSumBest( * nums = intArrayOf(7, 5, 10, 2), * target = 12 * ).contentToString() * ) */ //My solution fun twoSum(nums: IntArray, target: Int): IntArray { var result : IntArray = intArrayOf() nums.forEachIndexed { index, item -> val numberWeLook = target - item if(nums.contains(numberWeLook) && index != nums.indexOf(numberWeLook)) { result = intArrayOf(index, nums.indexOf(numberWeLook)) return result } } return result } //Alternative solution fun twoSumBest(nums: IntArray, target: Int): IntArray { val diffMap = mutableMapOf<Int, Int>() nums.forEachIndexed { index, int -> diffMap[int]?.let { return intArrayOf(it, index) } diffMap[target - int] = index } return intArrayOf() }
[ { "class_path": "mececeli__Kotlin_Exercises__d05ee9d/TwoSumKt.class", "javap": "Compiled from \"TwoSum.kt\"\npublic final class TwoSumKt {\n public static final int[] twoSum(int[], int);\n Code:\n 0: aload_0\n 1: ldc #9 // String nums\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aconst_null\n 7: astore_2\n 8: iconst_0\n 9: newarray int\n 11: astore_2\n 12: aload_0\n 13: astore_3\n 14: iconst_0\n 15: istore 4\n 17: iconst_0\n 18: istore 5\n 20: iconst_0\n 21: istore 6\n 23: aload_3\n 24: arraylength\n 25: istore 7\n 27: iload 6\n 29: iload 7\n 31: if_icmpge 114\n 34: aload_3\n 35: iload 6\n 37: iaload\n 38: istore 8\n 40: iload 5\n 42: iinc 5, 1\n 45: iload 8\n 47: istore 9\n 49: istore 10\n 51: iconst_0\n 52: istore 11\n 54: iload_1\n 55: iload 9\n 57: isub\n 58: istore 12\n 60: aload_0\n 61: iload 12\n 63: invokestatic #21 // Method kotlin/collections/ArraysKt.contains:([II)Z\n 66: ifeq 106\n 69: iload 10\n 71: aload_0\n 72: iload 12\n 74: invokestatic #25 // Method kotlin/collections/ArraysKt.indexOf:([II)I\n 77: if_icmpeq 106\n 80: iconst_2\n 81: newarray int\n 83: astore 13\n 85: aload 13\n 87: iconst_0\n 88: iload 10\n 90: iastore\n 91: aload 13\n 93: iconst_1\n 94: aload_0\n 95: iload 12\n 97: invokestatic #25 // Method kotlin/collections/ArraysKt.indexOf:([II)I\n 100: iastore\n 101: aload 13\n 103: astore_2\n 104: aload_2\n 105: areturn\n 106: nop\n 107: nop\n 108: iinc 6, 1\n 111: goto 27\n 114: nop\n 115: aload_2\n 116: areturn\n\n public static final int[] twoSumBest(int[], int);\n Code:\n 0: aload_0\n 1: ldc #9 // String nums\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #42 // class java/util/LinkedHashMap\n 9: dup\n 10: invokespecial #46 // Method java/util/LinkedHashMap.\"<init>\":()V\n 13: checkcast #48 // class java/util/Map\n 16: astore_2\n 17: aload_0\n 18: astore_3\n 19: iconst_0\n 20: istore 4\n 22: iconst_0\n 23: istore 5\n 25: iconst_0\n 26: istore 6\n 28: aload_3\n 29: arraylength\n 30: istore 7\n 32: iload 6\n 34: iload 7\n 36: if_icmpge 140\n 39: aload_3\n 40: iload 6\n 42: iaload\n 43: istore 8\n 45: iload 5\n 47: iinc 5, 1\n 50: iload 8\n 52: istore 9\n 54: istore 10\n 56: iconst_0\n 57: istore 11\n 59: aload_2\n 60: iload 9\n 62: invokestatic #54 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 65: invokeinterface #58, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 70: checkcast #50 // class java/lang/Integer\n 73: dup\n 74: ifnull 108\n 77: checkcast #60 // class java/lang/Number\n 80: invokevirtual #64 // Method java/lang/Number.intValue:()I\n 83: istore 12\n 85: iconst_0\n 86: istore 13\n 88: iconst_2\n 89: newarray int\n 91: astore 14\n 93: aload 14\n 95: iconst_0\n 96: iload 12\n 98: iastore\n 99: aload 14\n 101: iconst_1\n 102: iload 10\n 104: iastore\n 105: aload 14\n 107: areturn\n 108: pop\n 109: iload 10\n 111: invokestatic #54 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 114: astore 12\n 116: aload_2\n 117: iload_1\n 118: iload 9\n 120: isub\n 121: invokestatic #54 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 124: aload 12\n 126: invokeinterface #68, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 131: pop\n 132: nop\n 133: nop\n 134: iinc 6, 1\n 137: goto 32\n 140: nop\n 141: iconst_0\n 142: newarray int\n 144: areturn\n}\n", "javap_err": "" } ]
duangsuse-valid-projects__Share__e89301b/Others/kt_misc/SortInclude.kt
typealias CategoryMap<K, V> = Set<Map<K, V>> typealias IncludePath = String /** Descending level */ typealias Level = /*Comparable*/ Int class DescendAllocator(private var max: Int = Int.MAX_VALUE) { fun less() = max-- } val kmap: CategoryMap<IncludePath, Level> = DescendAllocator().run { setOf( mapOf( "QObject" to less(), "QScopedPointer" to less(), "QByteArray" to less() ), mapOf( "QIODevice" to less(), "QTimer" to less(), "QAudioOutput" to less() ), mapOf( "QMainWindow" to less(), "QLabel" to less(), "QComboBox" to less(), "QPushButton" to less(), "QSlider" to less() ) ) } fun <T, K> Iterable<T>.histogram(key: (T) -> K): Map<K, List<T>> { val hist: MutableMap<K, MutableList<T>> = mutableMapOf() for (item in this) { hist.getOrPut(key(item), ::mutableListOf).add(item) } return hist } object SortInclude { @JvmStatic fun main(vararg arg: String) { val code = readText() val includes = parse(code) println(includes) println(dump(organize(includes))) } fun dump(includes: Set<List<IncludePath>>): String { return includes.map { it.joinToString("\n") }.joinToString("\n\n") } private fun parse(includeCode: String): List<IncludePath> = includeCode.lines().map { includeRegex.matchEntire(it) ?.groupValues?.get(1) ?: error(it) } private val includeRegex = Regex("#include <(.*)>") fun organize(includes: List<IncludePath>): Set<List<IncludePath>> { val parted = includes.histogram { kmap.find { m -> it in m } ?: homeless } val sorted = parted.map { val (m, inz) = it; inz.sortedByDescending(m::getValue) } return sorted.toSet() } private val homeless: Map<IncludePath, Level> = emptyMap() } fun readText(): String { val text = StringBuilder() while (true) { val line = readLine() if (line == ".") break else text.append(line).append("\n") } text.delete(text.lastIndex, text.lastIndex.inc()) //"\n" return text.toString() }
[ { "class_path": "duangsuse-valid-projects__Share__e89301b/SortInclude.class", "javap": "Compiled from \"SortInclude.kt\"\npublic final class SortInclude {\n public static final SortInclude INSTANCE;\n\n private static final kotlin.text.Regex includeRegex;\n\n private static final java.util.Map<java.lang.String, java.lang.Integer> homeless;\n\n private SortInclude();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public static final void main(java.lang.String...);\n Code:\n 0: aload_0\n 1: ldc #16 // String arg\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: invokestatic #28 // Method SortIncludeKt.readText:()Ljava/lang/String;\n 9: astore_1\n 10: getstatic #31 // Field INSTANCE:LSortInclude;\n 13: aload_1\n 14: invokespecial #35 // Method parse:(Ljava/lang/String;)Ljava/util/List;\n 17: astore_2\n 18: getstatic #41 // Field java/lang/System.out:Ljava/io/PrintStream;\n 21: aload_2\n 22: invokevirtual #47 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 25: getstatic #31 // Field INSTANCE:LSortInclude;\n 28: getstatic #31 // Field INSTANCE:LSortInclude;\n 31: aload_2\n 32: invokevirtual #51 // Method organize:(Ljava/util/List;)Ljava/util/Set;\n 35: invokevirtual #55 // Method dump:(Ljava/util/Set;)Ljava/lang/String;\n 38: getstatic #41 // Field java/lang/System.out:Ljava/io/PrintStream;\n 41: swap\n 42: invokevirtual #47 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 45: return\n\n public final java.lang.String dump(java.util.Set<? extends java.util.List<java.lang.String>>);\n Code:\n 0: aload_1\n 1: ldc #62 // String includes\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: checkcast #64 // class java/lang/Iterable\n 10: astore_2\n 11: iconst_0\n 12: istore_3\n 13: aload_2\n 14: astore 4\n 16: new #66 // class java/util/ArrayList\n 19: dup\n 20: aload_2\n 21: bipush 10\n 23: invokestatic #72 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 26: invokespecial #75 // Method java/util/ArrayList.\"<init>\":(I)V\n 29: checkcast #77 // class java/util/Collection\n 32: astore 5\n 34: iconst_0\n 35: istore 6\n 37: aload 4\n 39: invokeinterface #81, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 44: astore 7\n 46: aload 7\n 48: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 53: ifeq 112\n 56: aload 7\n 58: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 63: astore 8\n 65: aload 5\n 67: aload 8\n 69: checkcast #93 // class java/util/List\n 72: astore 9\n 74: astore 11\n 76: iconst_0\n 77: istore 10\n 79: aload 9\n 81: checkcast #64 // class java/lang/Iterable\n 84: ldc #95 // String \\n\n 86: checkcast #97 // class java/lang/CharSequence\n 89: aconst_null\n 90: aconst_null\n 91: iconst_0\n 92: aconst_null\n 93: aconst_null\n 94: bipush 62\n 96: aconst_null\n 97: invokestatic #101 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 100: aload 11\n 102: swap\n 103: invokeinterface #105, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 108: pop\n 109: goto 46\n 112: aload 5\n 114: checkcast #93 // class java/util/List\n 117: nop\n 118: checkcast #64 // class java/lang/Iterable\n 121: ldc #107 // String \\n\\n\n 123: checkcast #97 // class java/lang/CharSequence\n 126: aconst_null\n 127: aconst_null\n 128: iconst_0\n 129: aconst_null\n 130: aconst_null\n 131: bipush 62\n 133: aconst_null\n 134: invokestatic #101 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 137: areturn\n\n private final java.util.List<java.lang.String> parse(java.lang.String);\n Code:\n 0: aload_1\n 1: checkcast #97 // class java/lang/CharSequence\n 4: invokestatic #129 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;\n 7: checkcast #64 // class java/lang/Iterable\n 10: astore_2\n 11: iconst_0\n 12: istore_3\n 13: aload_2\n 14: astore 4\n 16: new #66 // class java/util/ArrayList\n 19: dup\n 20: aload_2\n 21: bipush 10\n 23: invokestatic #72 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 26: invokespecial #75 // Method java/util/ArrayList.\"<init>\":(I)V\n 29: checkcast #77 // class java/util/Collection\n 32: astore 5\n 34: iconst_0\n 35: istore 6\n 37: aload 4\n 39: invokeinterface #81, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 44: astore 7\n 46: aload 7\n 48: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 53: ifeq 159\n 56: aload 7\n 58: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 63: astore 8\n 65: aload 5\n 67: aload 8\n 69: checkcast #131 // class java/lang/String\n 72: astore 9\n 74: astore 14\n 76: iconst_0\n 77: istore 10\n 79: getstatic #135 // Field includeRegex:Lkotlin/text/Regex;\n 82: aload 9\n 84: checkcast #97 // class java/lang/CharSequence\n 87: invokevirtual #141 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;\n 90: astore 11\n 92: aload 11\n 94: ifnull 134\n 97: aload 11\n 99: invokeinterface #147, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 104: astore 12\n 106: aload 12\n 108: ifnull 134\n 111: aload 12\n 113: iconst_1\n 114: invokeinterface #151, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 119: checkcast #131 // class java/lang/String\n 122: astore 13\n 124: aload 13\n 126: ifnull 134\n 129: aload 13\n 131: goto 147\n 134: new #153 // class java/lang/IllegalStateException\n 137: dup\n 138: aload 9\n 140: invokevirtual #156 // Method java/lang/Object.toString:()Ljava/lang/String;\n 143: invokespecial #159 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 146: athrow\n 147: aload 14\n 149: swap\n 150: invokeinterface #105, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 155: pop\n 156: goto 46\n 159: aload 5\n 161: checkcast #93 // class java/util/List\n 164: nop\n 165: areturn\n\n public final java.util.Set<java.util.List<java.lang.String>> organize(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #62 // String includes\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: checkcast #64 // class java/lang/Iterable\n 10: invokedynamic #181, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 15: invokestatic #185 // Method SortIncludeKt.histogram:(Ljava/lang/Iterable;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;\n 18: astore_2\n 19: aload_2\n 20: astore 4\n 22: iconst_0\n 23: istore 5\n 25: aload 4\n 27: astore 6\n 29: new #66 // class java/util/ArrayList\n 32: dup\n 33: aload 4\n 35: invokeinterface #191, 1 // InterfaceMethod java/util/Map.size:()I\n 40: invokespecial #75 // Method java/util/ArrayList.\"<init>\":(I)V\n 43: checkcast #77 // class java/util/Collection\n 46: astore 7\n 48: iconst_0\n 49: istore 8\n 51: aload 6\n 53: invokeinterface #195, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 58: invokeinterface #196, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 63: astore 9\n 65: aload 9\n 67: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 72: ifeq 162\n 75: aload 9\n 77: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 82: checkcast #198 // class java/util/Map$Entry\n 85: astore 10\n 87: aload 7\n 89: aload 10\n 91: astore 11\n 93: astore 17\n 95: iconst_0\n 96: istore 12\n 98: aload 11\n 100: invokeinterface #201, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 105: checkcast #187 // class java/util/Map\n 108: astore 13\n 110: aload 11\n 112: invokeinterface #204, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 117: checkcast #93 // class java/util/List\n 120: astore 14\n 122: aload 14\n 124: checkcast #64 // class java/lang/Iterable\n 127: astore 15\n 129: iconst_0\n 130: istore 16\n 132: aload 15\n 134: new #206 // class SortInclude$organize$lambda$4$$inlined$sortedByDescending$1\n 137: dup\n 138: aload 13\n 140: invokespecial #209 // Method SortInclude$organize$lambda$4$$inlined$sortedByDescending$1.\"<init>\":(Ljava/util/Map;)V\n 143: checkcast #211 // class java/util/Comparator\n 146: invokestatic #215 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 149: nop\n 150: aload 17\n 152: swap\n 153: invokeinterface #105, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 158: pop\n 159: goto 65\n 162: aload 7\n 164: checkcast #93 // class java/util/List\n 167: nop\n 168: astore_3\n 169: aload_3\n 170: checkcast #64 // class java/lang/Iterable\n 173: invokestatic #219 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 176: areturn\n\n private static final java.util.Map organize$lambda$3(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #229 // String it\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: invokestatic #232 // Method SortIncludeKt.getKmap:()Ljava/util/Set;\n 9: checkcast #64 // class java/lang/Iterable\n 12: astore_1\n 13: aload_1\n 14: invokeinterface #81, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 19: astore_2\n 20: aload_2\n 21: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 26: ifeq 61\n 29: aload_2\n 30: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 35: astore_3\n 36: aload_3\n 37: checkcast #187 // class java/util/Map\n 40: astore 4\n 42: iconst_0\n 43: istore 5\n 45: aload 4\n 47: aload_0\n 48: invokeinterface #235, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 53: nop\n 54: ifeq 20\n 57: aload_3\n 58: goto 62\n 61: aconst_null\n 62: checkcast #187 // class java/util/Map\n 65: dup\n 66: ifnonnull 73\n 69: pop\n 70: getstatic #238 // Field homeless:Ljava/util/Map;\n 73: areturn\n\n static {};\n Code:\n 0: new #2 // class SortInclude\n 3: dup\n 4: invokespecial #241 // Method \"<init>\":()V\n 7: putstatic #31 // Field INSTANCE:LSortInclude;\n 10: new #137 // class kotlin/text/Regex\n 13: dup\n 14: ldc #243 // String #include <(.*)>\n 16: invokespecial #244 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 19: putstatic #135 // Field includeRegex:Lkotlin/text/Regex;\n 22: invokestatic #250 // Method kotlin/collections/MapsKt.emptyMap:()Ljava/util/Map;\n 25: putstatic #238 // Field homeless:Ljava/util/Map;\n 28: return\n}\n", "javap_err": "" }, { "class_path": "duangsuse-valid-projects__Share__e89301b/SortIncludeKt.class", "javap": "Compiled from \"SortInclude.kt\"\npublic final class SortIncludeKt {\n private static final java.util.Set<java.util.Map<java.lang.String, java.lang.Integer>> kmap;\n\n public static final java.util.Set<java.util.Map<java.lang.String, java.lang.Integer>> getKmap();\n Code:\n 0: getstatic #12 // Field kmap:Ljava/util/Set;\n 3: areturn\n\n public static final <T, K> java.util.Map<K, java.util.List<T>> histogram(java.lang.Iterable<? extends T>, kotlin.jvm.functions.Function1<? super T, ? extends K>);\n Code:\n 0: aload_0\n 1: ldc #17 // String <this>\n 3: invokestatic #23 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #25 // String key\n 9: invokestatic #23 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: new #27 // class java/util/LinkedHashMap\n 15: dup\n 16: invokespecial #31 // Method java/util/LinkedHashMap.\"<init>\":()V\n 19: checkcast #33 // class java/util/Map\n 22: astore_2\n 23: aload_0\n 24: invokeinterface #39, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 29: astore_3\n 30: aload_3\n 31: invokeinterface #45, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 36: ifeq 129\n 39: aload_3\n 40: invokeinterface #49, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 45: astore 4\n 47: aload_2\n 48: astore 5\n 50: aload_1\n 51: aload 4\n 53: invokeinterface #55, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 58: astore 6\n 60: iconst_0\n 61: istore 7\n 63: aload 5\n 65: aload 6\n 67: invokeinterface #58, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 72: astore 8\n 74: aload 8\n 76: ifnonnull 112\n 79: iconst_0\n 80: istore 9\n 82: new #60 // class java/util/ArrayList\n 85: dup\n 86: invokespecial #61 // Method java/util/ArrayList.\"<init>\":()V\n 89: checkcast #63 // class java/util/List\n 92: nop\n 93: astore 9\n 95: aload 5\n 97: aload 6\n 99: aload 9\n 101: invokeinterface #67, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 106: pop\n 107: aload 9\n 109: goto 114\n 112: aload 8\n 114: nop\n 115: checkcast #63 // class java/util/List\n 118: aload 4\n 120: invokeinterface #71, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 125: pop\n 126: goto 30\n 129: aload_2\n 130: areturn\n\n public static final java.lang.String readText();\n Code:\n 0: new #89 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #90 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: astore_0\n 8: nop\n 9: invokestatic #95 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 12: astore_1\n 13: aload_1\n 14: ldc #97 // String .\n 16: invokestatic #101 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 19: ifne 36\n 22: aload_0\n 23: aload_1\n 24: invokevirtual #105 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 27: ldc #107 // String \\n\n 29: invokevirtual #105 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 32: pop\n 33: goto 8\n 36: aload_0\n 37: aload_0\n 38: checkcast #109 // class java/lang/CharSequence\n 41: invokestatic #115 // Method kotlin/text/StringsKt.getLastIndex:(Ljava/lang/CharSequence;)I\n 44: aload_0\n 45: checkcast #109 // class java/lang/CharSequence\n 48: invokestatic #115 // Method kotlin/text/StringsKt.getLastIndex:(Ljava/lang/CharSequence;)I\n 51: iconst_1\n 52: iadd\n 53: invokevirtual #119 // Method java/lang/StringBuilder.delete:(II)Ljava/lang/StringBuilder;\n 56: pop\n 57: aload_0\n 58: invokevirtual #122 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 61: dup\n 62: ldc #124 // String toString(...)\n 64: invokestatic #127 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 67: areturn\n\n static {};\n Code:\n 0: new #136 // class DescendAllocator\n 3: dup\n 4: iconst_0\n 5: iconst_1\n 6: aconst_null\n 7: invokespecial #139 // Method DescendAllocator.\"<init>\":(IILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 10: astore_0\n 11: iconst_0\n 12: istore_1\n 13: iconst_3\n 14: anewarray #33 // class java/util/Map\n 17: astore_2\n 18: aload_2\n 19: iconst_0\n 20: iconst_3\n 21: anewarray #141 // class kotlin/Pair\n 24: astore_3\n 25: aload_3\n 26: iconst_0\n 27: ldc #143 // String QObject\n 29: aload_0\n 30: invokevirtual #147 // Method DescendAllocator.less:()I\n 33: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 36: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 39: aastore\n 40: aload_3\n 41: iconst_1\n 42: ldc #161 // String QScopedPointer\n 44: aload_0\n 45: invokevirtual #147 // Method DescendAllocator.less:()I\n 48: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 51: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 54: aastore\n 55: aload_3\n 56: iconst_2\n 57: ldc #163 // String QByteArray\n 59: aload_0\n 60: invokevirtual #147 // Method DescendAllocator.less:()I\n 63: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 66: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 69: aastore\n 70: aload_3\n 71: invokestatic #169 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 74: aastore\n 75: aload_2\n 76: iconst_1\n 77: iconst_3\n 78: anewarray #141 // class kotlin/Pair\n 81: astore_3\n 82: aload_3\n 83: iconst_0\n 84: ldc #171 // String QIODevice\n 86: aload_0\n 87: invokevirtual #147 // Method DescendAllocator.less:()I\n 90: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 93: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 96: aastore\n 97: aload_3\n 98: iconst_1\n 99: ldc #173 // String QTimer\n 101: aload_0\n 102: invokevirtual #147 // Method DescendAllocator.less:()I\n 105: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 108: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 111: aastore\n 112: aload_3\n 113: iconst_2\n 114: ldc #175 // String QAudioOutput\n 116: aload_0\n 117: invokevirtual #147 // Method DescendAllocator.less:()I\n 120: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 123: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 126: aastore\n 127: aload_3\n 128: invokestatic #169 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 131: aastore\n 132: aload_2\n 133: iconst_2\n 134: iconst_5\n 135: anewarray #141 // class kotlin/Pair\n 138: astore_3\n 139: aload_3\n 140: iconst_0\n 141: ldc #177 // String QMainWindow\n 143: aload_0\n 144: invokevirtual #147 // Method DescendAllocator.less:()I\n 147: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 150: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 153: aastore\n 154: aload_3\n 155: iconst_1\n 156: ldc #179 // String QLabel\n 158: aload_0\n 159: invokevirtual #147 // Method DescendAllocator.less:()I\n 162: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 165: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 168: aastore\n 169: aload_3\n 170: iconst_2\n 171: ldc #181 // String QComboBox\n 173: aload_0\n 174: invokevirtual #147 // Method DescendAllocator.less:()I\n 177: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 180: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 183: aastore\n 184: aload_3\n 185: iconst_3\n 186: ldc #183 // String QPushButton\n 188: aload_0\n 189: invokevirtual #147 // Method DescendAllocator.less:()I\n 192: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 195: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 198: aastore\n 199: aload_3\n 200: iconst_4\n 201: ldc #185 // String QSlider\n 203: aload_0\n 204: invokevirtual #147 // Method DescendAllocator.less:()I\n 207: invokestatic #153 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 210: invokestatic #159 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 213: aastore\n 214: aload_3\n 215: invokestatic #169 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 218: aastore\n 219: aload_2\n 220: invokestatic #191 // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;\n 223: nop\n 224: nop\n 225: putstatic #12 // Field kmap:Ljava/util/Set;\n 228: return\n}\n", "javap_err": "" }, { "class_path": "duangsuse-valid-projects__Share__e89301b/SortInclude$organize$lambda$4$$inlined$sortedByDescending$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class SortInclude$organize$lambda$4$$inlined$sortedByDescending$1<T> implements java.util.Comparator {\n final java.util.Map $receiver$inlined;\n\n public SortInclude$organize$lambda$4$$inlined$sortedByDescending$1(java.util.Map);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #18 // Field $receiver$inlined:Ljava/util/Map;\n 5: aload_0\n 6: invokespecial #21 // Method java/lang/Object.\"<init>\":()V\n 9: return\n\n public final int compare(T, T);\n Code:\n 0: aload_2\n 1: checkcast #28 // class java/lang/String\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_0\n 9: getfield #18 // Field $receiver$inlined:Ljava/util/Map;\n 12: aload_3\n 13: invokestatic #34 // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;\n 16: checkcast #36 // class java/lang/Number\n 19: invokevirtual #40 // Method java/lang/Number.intValue:()I\n 22: invokestatic #46 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: checkcast #48 // class java/lang/Comparable\n 28: aload_1\n 29: checkcast #28 // class java/lang/String\n 32: astore_3\n 33: astore 5\n 35: iconst_0\n 36: istore 4\n 38: aload_0\n 39: getfield #18 // Field $receiver$inlined:Ljava/util/Map;\n 42: aload_3\n 43: invokestatic #34 // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;\n 46: checkcast #36 // class java/lang/Number\n 49: invokevirtual #40 // Method java/lang/Number.intValue:()I\n 52: invokestatic #46 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 55: aload 5\n 57: swap\n 58: checkcast #48 // class java/lang/Comparable\n 61: invokestatic #54 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 64: ireturn\n}\n", "javap_err": "" } ]
US-ADDA__PI1_kotlin__b83e4fd/src/main/kotlin/Exercise3.kt
import java.util.stream.Stream class Exercise3 { companion object { fun functional(start: Int, end: Int): List<Pair<Int, Int>> { return Stream .iterate( Pair(0, start), // Cuando empieza. { it.first < end }, // Cuando termina. { Pair(it.first + 1, if (it.first % 3 == 1) it.second + 1 else it.second + it.first) }) // Siguiente .toList().sortedBy { it.first } } fun iterativeWhile(start: Int, end: Int): List<Pair<Int, Int>> { var current: Pair<Int, Int> = Pair(0, start) val result: MutableList<Pair<Int, Int>> = mutableListOf() while (current.first < end) { result += Pair(current.first, current.second) current = Pair( current.first + 1, if (current.first % 3 == 1) current.second + 1 else current.second + current.first ) } return result.sortedBy { it.first } } fun recursiveFinal(start: Int, end: Int): List<Pair<Int, Int>> { return recursiveFinal(end, mutableListOf(), Pair(0, start)).sortedBy { it.first } } private fun recursiveFinal(end: Int, list: List<Pair<Int, Int>>, current: Pair<Int, Int>): List<Pair<Int, Int>> { if (current.first < end) return recursiveFinal( end, list + current, Pair( current.first + 1, if (current.first % 3 == 1) current.second + 1 else current.second + current.first ) ) return list } fun recursiveNoFinal(start: Int, end: Int): List<Pair<Int, Int>> { return recursiveNoFinal(end, Pair(0, start)).sortedBy { it.first } } private fun recursiveNoFinal(end: Int, current: Pair<Int, Int>): List<Pair<Int, Int>> { if (current.first < end) return recursiveNoFinal( end, Pair( current.first + 1, if (current.first % 3 == 1) current.second + 1 else current.second + current.first ) ) + current return listOf() } } }
[ { "class_path": "US-ADDA__PI1_kotlin__b83e4fd/Exercise3$Companion$functional$$inlined$sortedBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class Exercise3$Companion$functional$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public Exercise3$Companion$functional$$inlined$sortedBy$1();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_1\n 1: checkcast #23 // class kotlin/Pair\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 12: checkcast #29 // class java/lang/Integer\n 15: checkcast #31 // class java/lang/Comparable\n 18: aload_2\n 19: checkcast #23 // class kotlin/Pair\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 32: checkcast #29 // class java/lang/Integer\n 35: aload 5\n 37: swap\n 38: checkcast #31 // class java/lang/Comparable\n 41: invokestatic #37 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" }, { "class_path": "US-ADDA__PI1_kotlin__b83e4fd/Exercise3$Companion$recursiveNoFinal$$inlined$sortedBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class Exercise3$Companion$recursiveNoFinal$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public Exercise3$Companion$recursiveNoFinal$$inlined$sortedBy$1();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_1\n 1: checkcast #23 // class kotlin/Pair\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 12: checkcast #29 // class java/lang/Integer\n 15: checkcast #31 // class java/lang/Comparable\n 18: aload_2\n 19: checkcast #23 // class kotlin/Pair\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 32: checkcast #29 // class java/lang/Integer\n 35: aload 5\n 37: swap\n 38: checkcast #31 // class java/lang/Comparable\n 41: invokestatic #37 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" }, { "class_path": "US-ADDA__PI1_kotlin__b83e4fd/Exercise3$Companion.class", "javap": "Compiled from \"Exercise3.kt\"\npublic final class Exercise3$Companion {\n private Exercise3$Companion();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> functional(int, int);\n Code:\n 0: new #16 // class kotlin/Pair\n 3: dup\n 4: iconst_0\n 5: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 8: iload_1\n 9: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 12: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 15: iload_2\n 16: invokedynamic #45, 0 // InvokeDynamic #0:invoke:(I)Lkotlin/jvm/functions/Function1;\n 21: invokedynamic #56, 0 // InvokeDynamic #1:test:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Predicate;\n 26: invokedynamic #66, 0 // InvokeDynamic #2:apply:()Ljava/util/function/UnaryOperator;\n 31: invokestatic #72 // InterfaceMethod java/util/stream/Stream.iterate:(Ljava/lang/Object;Ljava/util/function/Predicate;Ljava/util/function/UnaryOperator;)Ljava/util/stream/Stream;\n 34: invokeinterface #76, 1 // InterfaceMethod java/util/stream/Stream.toList:()Ljava/util/List;\n 39: astore_3\n 40: aload_3\n 41: ldc #78 // String toList(...)\n 43: invokestatic #84 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 46: aload_3\n 47: checkcast #86 // class java/lang/Iterable\n 50: astore_3\n 51: nop\n 52: iconst_0\n 53: istore 4\n 55: aload_3\n 56: new #88 // class Exercise3$Companion$functional$$inlined$sortedBy$1\n 59: dup\n 60: invokespecial #89 // Method Exercise3$Companion$functional$$inlined$sortedBy$1.\"<init>\":()V\n 63: checkcast #91 // class java/util/Comparator\n 66: invokestatic #97 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 69: areturn\n\n public final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> iterativeWhile(int, int);\n Code:\n 0: new #16 // class kotlin/Pair\n 3: dup\n 4: iconst_0\n 5: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 8: iload_1\n 9: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 12: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 15: astore_3\n 16: new #106 // class java/util/ArrayList\n 19: dup\n 20: invokespecial #107 // Method java/util/ArrayList.\"<init>\":()V\n 23: checkcast #109 // class java/util/List\n 26: astore 4\n 28: aload_3\n 29: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 32: checkcast #115 // class java/lang/Number\n 35: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 38: iload_2\n 39: if_icmpge 149\n 42: aload 4\n 44: checkcast #121 // class java/util/Collection\n 47: new #16 // class kotlin/Pair\n 50: dup\n 51: aload_3\n 52: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 55: aload_3\n 56: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 59: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 62: invokeinterface #127, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 67: pop\n 68: new #16 // class kotlin/Pair\n 71: dup\n 72: aload_3\n 73: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 76: checkcast #115 // class java/lang/Number\n 79: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 82: iconst_1\n 83: iadd\n 84: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 87: aload_3\n 88: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 91: checkcast #115 // class java/lang/Number\n 94: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 97: iconst_3\n 98: irem\n 99: iconst_1\n 100: if_icmpne 118\n 103: aload_3\n 104: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 107: checkcast #115 // class java/lang/Number\n 110: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 113: iconst_1\n 114: iadd\n 115: goto 139\n 118: aload_3\n 119: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 122: checkcast #115 // class java/lang/Number\n 125: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 128: aload_3\n 129: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 132: checkcast #115 // class java/lang/Number\n 135: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 138: iadd\n 139: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 142: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 145: astore_3\n 146: goto 28\n 149: aload 4\n 151: checkcast #86 // class java/lang/Iterable\n 154: astore 5\n 156: iconst_0\n 157: istore 6\n 159: aload 5\n 161: new #129 // class Exercise3$Companion$iterativeWhile$$inlined$sortedBy$1\n 164: dup\n 165: invokespecial #130 // Method Exercise3$Companion$iterativeWhile$$inlined$sortedBy$1.\"<init>\":()V\n 168: checkcast #91 // class java/util/Comparator\n 171: invokestatic #97 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 174: areturn\n\n public final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> recursiveFinal(int, int);\n Code:\n 0: aload_0\n 1: iload_2\n 2: new #106 // class java/util/ArrayList\n 5: dup\n 6: invokespecial #107 // Method java/util/ArrayList.\"<init>\":()V\n 9: checkcast #109 // class java/util/List\n 12: new #16 // class kotlin/Pair\n 15: dup\n 16: iconst_0\n 17: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 20: iload_1\n 21: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 24: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 27: invokespecial #138 // Method recursiveFinal:(ILjava/util/List;Lkotlin/Pair;)Ljava/util/List;\n 30: checkcast #86 // class java/lang/Iterable\n 33: astore_3\n 34: iconst_0\n 35: istore 4\n 37: aload_3\n 38: new #140 // class Exercise3$Companion$recursiveFinal$$inlined$sortedBy$1\n 41: dup\n 42: invokespecial #141 // Method Exercise3$Companion$recursiveFinal$$inlined$sortedBy$1.\"<init>\":()V\n 45: checkcast #91 // class java/util/Comparator\n 48: invokestatic #97 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 51: areturn\n\n private final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> recursiveFinal(int, java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, kotlin.Pair<java.lang.Integer, java.lang.Integer>);\n Code:\n 0: aload_3\n 1: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 4: checkcast #115 // class java/lang/Number\n 7: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 10: iload_1\n 11: if_icmpge 105\n 14: aload_0\n 15: iload_1\n 16: aload_2\n 17: checkcast #121 // class java/util/Collection\n 20: aload_3\n 21: invokestatic #146 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;\n 24: new #16 // class kotlin/Pair\n 27: dup\n 28: aload_3\n 29: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 32: checkcast #115 // class java/lang/Number\n 35: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 38: iconst_1\n 39: iadd\n 40: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 43: aload_3\n 44: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 47: checkcast #115 // class java/lang/Number\n 50: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 53: iconst_3\n 54: irem\n 55: iconst_1\n 56: if_icmpne 74\n 59: aload_3\n 60: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 63: checkcast #115 // class java/lang/Number\n 66: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 69: iconst_1\n 70: iadd\n 71: goto 95\n 74: aload_3\n 75: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 78: checkcast #115 // class java/lang/Number\n 81: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 84: aload_3\n 85: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 88: checkcast #115 // class java/lang/Number\n 91: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 94: iadd\n 95: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 98: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 101: invokespecial #138 // Method recursiveFinal:(ILjava/util/List;Lkotlin/Pair;)Ljava/util/List;\n 104: areturn\n 105: aload_2\n 106: areturn\n\n public final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> recursiveNoFinal(int, int);\n Code:\n 0: aload_0\n 1: iload_2\n 2: new #16 // class kotlin/Pair\n 5: dup\n 6: iconst_0\n 7: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 10: iload_1\n 11: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 14: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 17: invokespecial #151 // Method recursiveNoFinal:(ILkotlin/Pair;)Ljava/util/List;\n 20: checkcast #86 // class java/lang/Iterable\n 23: astore_3\n 24: iconst_0\n 25: istore 4\n 27: aload_3\n 28: new #153 // class Exercise3$Companion$recursiveNoFinal$$inlined$sortedBy$1\n 31: dup\n 32: invokespecial #154 // Method Exercise3$Companion$recursiveNoFinal$$inlined$sortedBy$1.\"<init>\":()V\n 35: checkcast #91 // class java/util/Comparator\n 38: invokestatic #97 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 41: areturn\n\n private final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> recursiveNoFinal(int, kotlin.Pair<java.lang.Integer, java.lang.Integer>);\n Code:\n 0: aload_2\n 1: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 4: checkcast #115 // class java/lang/Number\n 7: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 10: iload_1\n 11: if_icmpge 104\n 14: aload_0\n 15: iload_1\n 16: new #16 // class kotlin/Pair\n 19: dup\n 20: aload_2\n 21: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 24: checkcast #115 // class java/lang/Number\n 27: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 30: iconst_1\n 31: iadd\n 32: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 35: aload_2\n 36: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 39: checkcast #115 // class java/lang/Number\n 42: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 45: iconst_3\n 46: irem\n 47: iconst_1\n 48: if_icmpne 66\n 51: aload_2\n 52: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 55: checkcast #115 // class java/lang/Number\n 58: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 61: iconst_1\n 62: iadd\n 63: goto 87\n 66: aload_2\n 67: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 70: checkcast #115 // class java/lang/Number\n 73: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 76: aload_2\n 77: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 80: checkcast #115 // class java/lang/Number\n 83: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 86: iadd\n 87: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 90: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 93: invokespecial #151 // Method recursiveNoFinal:(ILkotlin/Pair;)Ljava/util/List;\n 96: checkcast #121 // class java/util/Collection\n 99: aload_2\n 100: invokestatic #146 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;\n 103: areturn\n 104: invokestatic #158 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 107: areturn\n\n private static final boolean functional$lambda$0(int, kotlin.Pair);\n Code:\n 0: aload_1\n 1: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 4: checkcast #115 // class java/lang/Number\n 7: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 10: iload_0\n 11: if_icmpge 18\n 14: iconst_1\n 15: goto 19\n 18: iconst_0\n 19: ireturn\n\n private static final boolean functional$lambda$1(kotlin.jvm.functions.Function1, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokeinterface #164, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 7: checkcast #166 // class java/lang/Boolean\n 10: invokevirtual #170 // Method java/lang/Boolean.booleanValue:()Z\n 13: ireturn\n\n private static final kotlin.Pair functional$lambda$2(kotlin.Pair);\n Code:\n 0: new #16 // class kotlin/Pair\n 3: dup\n 4: aload_0\n 5: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 8: checkcast #115 // class java/lang/Number\n 11: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 14: iconst_1\n 15: iadd\n 16: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 19: aload_0\n 20: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 23: checkcast #115 // class java/lang/Number\n 26: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 29: iconst_3\n 30: irem\n 31: iconst_1\n 32: if_icmpne 50\n 35: aload_0\n 36: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 39: checkcast #115 // class java/lang/Number\n 42: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 45: iconst_1\n 46: iadd\n 47: goto 71\n 50: aload_0\n 51: invokevirtual #124 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 54: checkcast #115 // class java/lang/Number\n 57: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 60: aload_0\n 61: invokevirtual #113 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 64: checkcast #115 // class java/lang/Number\n 67: invokevirtual #119 // Method java/lang/Number.intValue:()I\n 70: iadd\n 71: invokestatic #22 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 74: invokespecial #25 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 77: areturn\n\n public Exercise3$Companion(kotlin.jvm.internal.DefaultConstructorMarker);\n Code:\n 0: aload_0\n 1: invokespecial #176 // Method \"<init>\":()V\n 4: return\n}\n", "javap_err": "" }, { "class_path": "US-ADDA__PI1_kotlin__b83e4fd/Exercise3$Companion$recursiveFinal$$inlined$sortedBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class Exercise3$Companion$recursiveFinal$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public Exercise3$Companion$recursiveFinal$$inlined$sortedBy$1();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_1\n 1: checkcast #23 // class kotlin/Pair\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 12: checkcast #29 // class java/lang/Integer\n 15: checkcast #31 // class java/lang/Comparable\n 18: aload_2\n 19: checkcast #23 // class kotlin/Pair\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 32: checkcast #29 // class java/lang/Integer\n 35: aload 5\n 37: swap\n 38: checkcast #31 // class java/lang/Comparable\n 41: invokestatic #37 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" }, { "class_path": "US-ADDA__PI1_kotlin__b83e4fd/Exercise3$Companion$iterativeWhile$$inlined$sortedBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class Exercise3$Companion$iterativeWhile$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public Exercise3$Companion$iterativeWhile$$inlined$sortedBy$1();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_1\n 1: checkcast #23 // class kotlin/Pair\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 12: checkcast #29 // class java/lang/Integer\n 15: checkcast #31 // class java/lang/Comparable\n 18: aload_2\n 19: checkcast #23 // class kotlin/Pair\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 32: checkcast #29 // class java/lang/Integer\n 35: aload 5\n 37: swap\n 38: checkcast #31 // class java/lang/Comparable\n 41: invokestatic #37 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" }, { "class_path": "US-ADDA__PI1_kotlin__b83e4fd/Exercise3.class", "javap": "Compiled from \"Exercise3.kt\"\npublic final class Exercise3 {\n public static final Exercise3$Companion Companion;\n\n public Exercise3();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n static {};\n Code:\n 0: new #13 // class Exercise3$Companion\n 3: dup\n 4: aconst_null\n 5: invokespecial #16 // Method Exercise3$Companion.\"<init>\":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V\n 8: putstatic #20 // Field Companion:LExercise3$Companion;\n 11: return\n}\n", "javap_err": "" } ]
US-ADDA__PI1_kotlin__b83e4fd/src/main/kotlin/Exercise4.kt
import java.util.stream.Stream import kotlin.math.absoluteValue import kotlin.math.pow class Exercise4 { companion object { fun functional(n: Double, e: Double): Double { val pair = Stream.iterate( Pair(0.0, n) // Definimos el comienzo como 0 (nos dicen que se calcula la raíz cúbica de un número positivo) y el valor del que queremos saber la raíz cúbica. ) { val middle = it.first.plus(it.second).div(2) // Calculamos el valor medio. // Analizamos donde puede estar aplicando búsqueda binaria (de inicio a medio y de medio a fin). if (middle.pow(3) > n && it.first.pow(3) < n) Pair(it.first, middle) else if (middle.pow(3) < n && it.second.pow(3) > n) Pair(middle, it.second) else it }.filter { it.first.plus(it.second).div(2).pow(3).minus(n).absoluteValue < e.pow(3) }.findFirst() // Indicamos que termine cuando el error al cubo sea mayor que la resta del medio al cubo con el valor del que qeremos saber su rai´z cúbica .orElse(Pair(0.0, 0.0)) return pair.first.plus(pair.second).div(2) } fun iterativeWhile(n: Double, e: Double): Double { var current = Pair(0.0, n) var middle = n.div(2) while (middle.pow(3).minus(n).absoluteValue > e.pow(3)) { current = if (middle.pow(3) > n && current.first.pow(3) < n) Pair(current.first, middle) else if (middle.pow(3) < n && current.second.pow(3) > n) Pair(middle, current.second) else current middle = current.first.plus(current.second).div(2) } return middle } fun recursiveFinal(n: Double, e: Double): Double { return recursiveFinal(n, e, Pair(0.0, n), n.div(2)) } private fun recursiveFinal(n: Double, e: Double, current: Pair<Double, Double>, middle: Double): Double { return if (middle.pow(3).minus(n).absoluteValue <= e.pow(3)) middle else { val auxCurrent = if (middle.pow(3) > n && current.first.pow(3) < n) Pair(current.first, middle) else if (middle.pow(3) < n && current.second.pow(3) > n) Pair(middle, current.second) else current val auxMiddle = auxCurrent.first.plus(auxCurrent.second).div(2) recursiveFinal(n, e, auxCurrent, auxMiddle) } } } }
[ { "class_path": "US-ADDA__PI1_kotlin__b83e4fd/Exercise4$Companion.class", "javap": "Compiled from \"Exercise4.kt\"\npublic final class Exercise4$Companion {\n private Exercise4$Companion();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final double functional(double, double);\n Code:\n 0: new #14 // class kotlin/Pair\n 3: dup\n 4: dconst_0\n 5: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 8: dload_1\n 9: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 12: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 15: dload_1\n 16: invokedynamic #43, 0 // InvokeDynamic #0:apply:(D)Ljava/util/function/UnaryOperator;\n 21: invokestatic #49 // InterfaceMethod java/util/stream/Stream.iterate:(Ljava/lang/Object;Ljava/util/function/UnaryOperator;)Ljava/util/stream/Stream;\n 24: dload_1\n 25: dload_3\n 26: invokedynamic #60, 0 // InvokeDynamic #1:invoke:(DD)Lkotlin/jvm/functions/Function1;\n 31: invokedynamic #71, 0 // InvokeDynamic #2:test:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/Predicate;\n 36: invokeinterface #75, 2 // InterfaceMethod java/util/stream/Stream.filter:(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;\n 41: invokeinterface #79, 1 // InterfaceMethod java/util/stream/Stream.findFirst:()Ljava/util/Optional;\n 46: new #14 // class kotlin/Pair\n 49: dup\n 50: dconst_0\n 51: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 54: dconst_0\n 55: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 58: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 61: invokevirtual #84 // Method java/util/Optional.orElse:(Ljava/lang/Object;)Ljava/lang/Object;\n 64: checkcast #14 // class kotlin/Pair\n 67: astore 5\n 69: aload 5\n 71: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 74: checkcast #90 // class java/lang/Number\n 77: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 80: aload 5\n 82: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 85: checkcast #90 // class java/lang/Number\n 88: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 91: dadd\n 92: iconst_2\n 93: i2d\n 94: ddiv\n 95: dreturn\n\n public final double iterativeWhile(double, double);\n Code:\n 0: new #14 // class kotlin/Pair\n 3: dup\n 4: dconst_0\n 5: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 8: dload_1\n 9: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 12: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 15: astore 5\n 17: dload_1\n 18: iconst_2\n 19: i2d\n 20: ddiv\n 21: dstore 6\n 23: dload 6\n 25: iconst_3\n 26: i2d\n 27: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 30: dload_1\n 31: dsub\n 32: invokestatic #112 // Method java/lang/Math.abs:(D)D\n 35: dload_3\n 36: iconst_3\n 37: i2d\n 38: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 41: dcmpl\n 42: ifle 186\n 45: dload 6\n 47: iconst_3\n 48: i2d\n 49: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 52: dload_1\n 53: dcmpl\n 54: ifle 98\n 57: aload 5\n 59: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 62: checkcast #90 // class java/lang/Number\n 65: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 68: iconst_3\n 69: i2d\n 70: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 73: dload_1\n 74: dcmpg\n 75: ifge 98\n 78: new #14 // class kotlin/Pair\n 81: dup\n 82: aload 5\n 84: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 87: dload 6\n 89: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 92: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 95: goto 153\n 98: dload 6\n 100: iconst_3\n 101: i2d\n 102: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 105: dload_1\n 106: dcmpg\n 107: ifge 151\n 110: aload 5\n 112: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 115: checkcast #90 // class java/lang/Number\n 118: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 121: iconst_3\n 122: i2d\n 123: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 126: dload_1\n 127: dcmpl\n 128: ifle 151\n 131: new #14 // class kotlin/Pair\n 134: dup\n 135: dload 6\n 137: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 140: aload 5\n 142: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 145: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 148: goto 153\n 151: aload 5\n 153: astore 5\n 155: aload 5\n 157: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 160: checkcast #90 // class java/lang/Number\n 163: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 166: aload 5\n 168: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 171: checkcast #90 // class java/lang/Number\n 174: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 177: dadd\n 178: iconst_2\n 179: i2d\n 180: ddiv\n 181: dstore 6\n 183: goto 23\n 186: dload 6\n 188: dreturn\n\n public final double recursiveFinal(double, double);\n Code:\n 0: aload_0\n 1: dload_1\n 2: dload_3\n 3: new #14 // class kotlin/Pair\n 6: dup\n 7: dconst_0\n 8: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 11: dload_1\n 12: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 15: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 18: dload_1\n 19: iconst_2\n 20: i2d\n 21: ddiv\n 22: invokespecial #118 // Method recursiveFinal:(DDLkotlin/Pair;D)D\n 25: dreturn\n\n private final double recursiveFinal(double, double, kotlin.Pair<java.lang.Double, java.lang.Double>, double);\n Code:\n 0: dload 6\n 2: iconst_3\n 3: i2d\n 4: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 7: dload_1\n 8: dsub\n 9: invokestatic #112 // Method java/lang/Math.abs:(D)D\n 12: dload_3\n 13: iconst_3\n 14: i2d\n 15: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 18: dcmpg\n 19: ifgt 27\n 22: dload 6\n 24: goto 175\n 27: dload 6\n 29: iconst_3\n 30: i2d\n 31: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 34: dload_1\n 35: dcmpl\n 36: ifle 80\n 39: aload 5\n 41: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 44: checkcast #90 // class java/lang/Number\n 47: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 50: iconst_3\n 51: i2d\n 52: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 55: dload_1\n 56: dcmpg\n 57: ifge 80\n 60: new #14 // class kotlin/Pair\n 63: dup\n 64: aload 5\n 66: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 69: dload 6\n 71: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 74: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 77: goto 135\n 80: dload 6\n 82: iconst_3\n 83: i2d\n 84: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 87: dload_1\n 88: dcmpg\n 89: ifge 133\n 92: aload 5\n 94: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 97: checkcast #90 // class java/lang/Number\n 100: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 103: iconst_3\n 104: i2d\n 105: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 108: dload_1\n 109: dcmpl\n 110: ifle 133\n 113: new #14 // class kotlin/Pair\n 116: dup\n 117: dload 6\n 119: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 122: aload 5\n 124: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 127: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 130: goto 135\n 133: aload 5\n 135: astore 8\n 137: aload 8\n 139: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 142: checkcast #90 // class java/lang/Number\n 145: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 148: aload 8\n 150: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 153: checkcast #90 // class java/lang/Number\n 156: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 159: dadd\n 160: iconst_2\n 161: i2d\n 162: ddiv\n 163: dstore 9\n 165: aload_0\n 166: dload_1\n 167: dload_3\n 168: aload 8\n 170: dload 9\n 172: invokespecial #118 // Method recursiveFinal:(DDLkotlin/Pair;D)D\n 175: dreturn\n\n private static final kotlin.Pair functional$lambda$0(double, kotlin.Pair);\n Code:\n 0: aload_2\n 1: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 4: checkcast #90 // class java/lang/Number\n 7: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 10: aload_2\n 11: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 14: checkcast #90 // class java/lang/Number\n 17: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 20: dadd\n 21: iconst_2\n 22: i2d\n 23: ddiv\n 24: dstore_3\n 25: dload_3\n 26: iconst_3\n 27: i2d\n 28: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 31: dload_0\n 32: dcmpl\n 33: ifle 74\n 36: aload_2\n 37: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 40: checkcast #90 // class java/lang/Number\n 43: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 46: iconst_3\n 47: i2d\n 48: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 51: dload_0\n 52: dcmpg\n 53: ifge 74\n 56: new #14 // class kotlin/Pair\n 59: dup\n 60: aload_2\n 61: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 64: dload_3\n 65: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 68: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 71: goto 124\n 74: dload_3\n 75: iconst_3\n 76: i2d\n 77: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 80: dload_0\n 81: dcmpg\n 82: ifge 123\n 85: aload_2\n 86: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 89: checkcast #90 // class java/lang/Number\n 92: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 95: iconst_3\n 96: i2d\n 97: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 100: dload_0\n 101: dcmpl\n 102: ifle 123\n 105: new #14 // class kotlin/Pair\n 108: dup\n 109: dload_3\n 110: invokestatic #20 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 113: aload_2\n 114: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 117: invokespecial #23 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 120: goto 124\n 123: aload_2\n 124: areturn\n\n private static final boolean functional$lambda$1(double, double, kotlin.Pair);\n Code:\n 0: aload 4\n 2: invokevirtual #88 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 5: checkcast #90 // class java/lang/Number\n 8: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 11: aload 4\n 13: invokevirtual #97 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 16: checkcast #90 // class java/lang/Number\n 19: invokevirtual #94 // Method java/lang/Number.doubleValue:()D\n 22: dadd\n 23: iconst_2\n 24: i2d\n 25: ddiv\n 26: iconst_3\n 27: i2d\n 28: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 31: dload_0\n 32: dsub\n 33: invokestatic #112 // Method java/lang/Math.abs:(D)D\n 36: dload_2\n 37: iconst_3\n 38: i2d\n 39: invokestatic #108 // Method java/lang/Math.pow:(DD)D\n 42: dcmpg\n 43: ifge 50\n 46: iconst_1\n 47: goto 51\n 50: iconst_0\n 51: ireturn\n\n private static final boolean functional$lambda$2(kotlin.jvm.functions.Function1, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokeinterface #128, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 7: checkcast #130 // class java/lang/Boolean\n 10: invokevirtual #134 // Method java/lang/Boolean.booleanValue:()Z\n 13: ireturn\n\n public Exercise4$Companion(kotlin.jvm.internal.DefaultConstructorMarker);\n Code:\n 0: aload_0\n 1: invokespecial #140 // Method \"<init>\":()V\n 4: return\n}\n", "javap_err": "" }, { "class_path": "US-ADDA__PI1_kotlin__b83e4fd/Exercise4.class", "javap": "Compiled from \"Exercise4.kt\"\npublic final class Exercise4 {\n public static final Exercise4$Companion Companion;\n\n public Exercise4();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n static {};\n Code:\n 0: new #13 // class Exercise4$Companion\n 3: dup\n 4: aconst_null\n 5: invokespecial #16 // Method Exercise4$Companion.\"<init>\":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V\n 8: putstatic #20 // Field Companion:LExercise4$Companion;\n 11: return\n}\n", "javap_err": "" } ]
arukuka__software-for-SamurAI-Coding-2018-19__04db0da/player/greedy.kt
import java.util.* import java.io.* import kotlin.math.* const val SEARCHDEPTH = 7 const val SPEEDLIMIT = 1000 const val searchDepth = SEARCHDEPTH const val speedLimitSquared = SPEEDLIMIT * SPEEDLIMIT var nextSeq = 1 data class IntVec(val x : Int, val y : Int) { operator fun plus(v : IntVec) : IntVec { return IntVec(x + v.x, y + v.y) } operator fun compareTo(other : IntVec) : Int { return if (y == other.y) other.x - x else y - other.y } } data class RaceCourse(val thinkTime : Int, val stepLimit : Int, val width : Int, val length : Int, val vision : Int) { constructor(input : java.util.Scanner) :this(input.nextInt(), input.nextInt(), input.nextInt(), input.nextInt(), input.nextInt()) {} } fun addSquares(x : Int, y0 : Int, y1 : Int, squares : MutableList<IntVec>) { for (y in (if (y1 > y0) y0..y1 else y0 downTo y1)) squares.add(IntVec(x, y)) } data class Movement(val from : IntVec, val to : IntVec) { fun touchedSquares() : MutableList<IntVec> { val r : MutableList<IntVec> = mutableListOf() if (to.x == from.x) addSquares(from.x, from.y, to.y, r) else { val a : Double = (to.y - from.y).toDouble() / (to.x - from.x).toDouble() val sgnx = if (from.x < to.x) 1 else -1 var y1 = a * sgnx / 2.0 + from.y + 0.5 var iy1 = (if (to.y > from.y) floor(y1) else ceil(y1) - 1).toInt() addSquares(from.x, from.y, iy1, r) for (x in (if (sgnx > 0) (from.x + sgnx)..(to.x - 1) else (from.x + sgnx).downTo(to.x + 1))) { val y0 = a * (x - from.x - sgnx / 2.0) + from.y + 0.5 y1 = a * (x - from.x + sgnx / 2.0) + from.y + 0.5 val iy0 = (if (to.y > from.y) ceil(y0) - 1 else floor(y0)).toInt() iy1 = (if (to.y > from.y) floor(y1) else ceil(y1) - 1).toInt() addSquares(x, iy0, iy1, r) } val y0 = a * (to.x - from.x - sgnx / 2.0) + from.y + 0.5 val iy0 = (if (to.y > from.y) ceil(y0) - 1 else floor(y0)).toInt() addSquares(to.x, iy0, to.y, r) } return r } } data class PlayerState(val position : IntVec, val velocity : IntVec) { constructor (input : java.util.Scanner) : this(IntVec(input.nextInt(), input.nextInt()), IntVec(input.nextInt(), input.nextInt())) {} operator fun compareTo(other : PlayerState) : Int { val c1 = position.compareTo(other.position) return if (c1 == 0) velocity.compareTo(other.velocity) else c1 } } data class RaceInfo(val stepNumber : Int, val timeLeft : Int, val me : PlayerState, val opponent : PlayerState, val squares : List<List<Int>>) { constructor(input : java.util.Scanner, course : RaceCourse) :this(input.nextInt(), input.nextInt(), PlayerState(input), PlayerState(input), Array(course.length, {Array(course.width, {input.nextInt()}).asList()}).asList()) {} } data class Candidate(val course : RaceCourse, val step : Int, val state : PlayerState, val from : Candidate?, val how : IntVec) : Comparable<Candidate> { val seq = nextSeq init { nextSeq += 1 } val goaled = state.position.y >= course.length val goalTime = if (goaled) (step + course.length - state.position.y - 0.5) / state.velocity.y else 0.0 operator override fun compareTo(other : Candidate) : Int { if (goaled) { if (!other.goaled || other.goalTime > goalTime) return -1 else if (other.goalTime < goalTime) return 1 else return 0 } else if (state == other.state) return step - other.step else return other.state.compareTo(state) } override fun toString() : String { return "#${seq}: ${step}@(${state.position.x},${state.position.y})+(${state.velocity.x},${state.velocity.y}) <- #${from?.seq ?: 0}" } } fun plan(info : RaceInfo, course : RaceCourse) : IntVec { val candidates = PriorityQueue<Candidate>() val initial = PlayerState(info.me.position, info.me.velocity) val initialCand = Candidate(course, 0, initial, null, IntVec(0, 0)) val reached = mutableMapOf(initial to initialCand) var best = initialCand candidates.add(initialCand) while (!candidates.isEmpty()) { val c = candidates.poll() for (cay in 1 downTo -1) { for (cax in -1..1) { val accel = IntVec(cax, cay) var velo = c.state.velocity + accel if (velo.x * velo.x + velo.y * velo.y <= speedLimitSquared) { val pos = c.state.position + velo if (0 <= pos.x && pos.x < course.width) { val move = Movement(c.state.position, pos) val touched = move.touchedSquares() if (pos != info.opponent.position && touched.all { s -> 0 > s.y || s.y >= course.length || info.squares[s.y][s.x] != 1}) { if (0 <= pos.y && pos.y < course.length && info.squares[pos.y][pos.x] == 2) { velo = IntVec(0, 0) } val nextState = PlayerState(pos, velo) val nextCand = Candidate(course, c.step + 1, nextState, c, accel) if (!nextCand.goaled && c.step < searchDepth && (!reached.containsKey(nextState) || reached[nextState]!!.step > c.step + 1)) { candidates.add(nextCand) reached[nextState] = nextCand if (nextCand < best) best = nextCand } } } } } } } if (best == initialCand) { var ax = 0 var ay = 0 if (info.me.velocity.x < 0) ax += 1 else if (info.me.velocity.x > 0) ax -= 1 if (info.me.velocity.y < 0) ay += 1 else if (info.me.velocity.y > 0) ay -= 1 return IntVec(ax, ay) } var c : Candidate = best while (c.from != initialCand) { c = c.from!! } return c.how } fun main(args : Array<String>) { val input = java.util.Scanner(System.`in`) val course = RaceCourse(input) println(0) System.out.flush() try { while (true) { val info = RaceInfo(input, course) val accel = plan(info, course) println("${accel.x} ${accel.y}") System.out.flush() } } catch (e : Exception) { } }
[ { "class_path": "arukuka__software-for-SamurAI-Coding-2018-19__04db0da/GreedyKt.class", "javap": "Compiled from \"greedy.kt\"\npublic final class GreedyKt {\n public static final int SEARCHDEPTH;\n\n public static final int SPEEDLIMIT;\n\n public static final int searchDepth;\n\n public static final int speedLimitSquared;\n\n private static int nextSeq;\n\n public static final int getNextSeq();\n Code:\n 0: getstatic #10 // Field nextSeq:I\n 3: ireturn\n\n public static final void setNextSeq(int);\n Code:\n 0: iload_0\n 1: putstatic #10 // Field nextSeq:I\n 4: return\n\n public static final void addSquares(int, int, int, java.util.List<IntVec>);\n Code:\n 0: aload_3\n 1: ldc #19 // String squares\n 3: invokestatic #25 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iload_2\n 7: iload_1\n 8: if_icmple 26\n 11: new #27 // class kotlin/ranges/IntRange\n 14: dup\n 15: iload_1\n 16: iload_2\n 17: invokespecial #31 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 20: checkcast #33 // class kotlin/ranges/IntProgression\n 23: goto 31\n 26: iload_1\n 27: iload_2\n 28: invokestatic #39 // Method kotlin/ranges/RangesKt.downTo:(II)Lkotlin/ranges/IntProgression;\n 31: astore 4\n 33: aload 4\n 35: invokevirtual #42 // Method kotlin/ranges/IntProgression.getFirst:()I\n 38: istore 5\n 40: aload 4\n 42: invokevirtual #45 // Method kotlin/ranges/IntProgression.getLast:()I\n 45: istore 6\n 47: aload 4\n 49: invokevirtual #48 // Method kotlin/ranges/IntProgression.getStep:()I\n 52: istore 7\n 54: iload 7\n 56: ifle 66\n 59: iload 5\n 61: iload 6\n 63: if_icmple 78\n 66: iload 7\n 68: ifge 112\n 71: iload 6\n 73: iload 5\n 75: if_icmpgt 112\n 78: aload_3\n 79: new #50 // class IntVec\n 82: dup\n 83: iload_0\n 84: iload 5\n 86: invokespecial #51 // Method IntVec.\"<init>\":(II)V\n 89: invokeinterface #57, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 94: pop\n 95: iload 5\n 97: iload 6\n 99: if_icmpeq 112\n 102: iload 5\n 104: iload 7\n 106: iadd\n 107: istore 5\n 109: goto 78\n 112: return\n\n public static final IntVec plan(RaceInfo, RaceCourse);\n Code:\n 0: aload_0\n 1: ldc #66 // String info\n 3: invokestatic #25 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #68 // String course\n 9: invokestatic #25 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: new #70 // class java/util/PriorityQueue\n 15: dup\n 16: invokespecial #73 // Method java/util/PriorityQueue.\"<init>\":()V\n 19: astore_2\n 20: new #75 // class PlayerState\n 23: dup\n 24: aload_0\n 25: invokevirtual #81 // Method RaceInfo.getMe:()LPlayerState;\n 28: invokevirtual #85 // Method PlayerState.getPosition:()LIntVec;\n 31: aload_0\n 32: invokevirtual #81 // Method RaceInfo.getMe:()LPlayerState;\n 35: invokevirtual #88 // Method PlayerState.getVelocity:()LIntVec;\n 38: invokespecial #91 // Method PlayerState.\"<init>\":(LIntVec;LIntVec;)V\n 41: astore_3\n 42: new #93 // class Candidate\n 45: dup\n 46: aload_1\n 47: iconst_0\n 48: aload_3\n 49: aconst_null\n 50: new #50 // class IntVec\n 53: dup\n 54: iconst_0\n 55: iconst_0\n 56: invokespecial #51 // Method IntVec.\"<init>\":(II)V\n 59: invokespecial #96 // Method Candidate.\"<init>\":(LRaceCourse;ILPlayerState;LCandidate;LIntVec;)V\n 62: astore 4\n 64: iconst_1\n 65: anewarray #98 // class kotlin/Pair\n 68: astore 6\n 70: aload 6\n 72: iconst_0\n 73: aload_3\n 74: aload 4\n 76: invokestatic #104 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 79: aastore\n 80: aload 6\n 82: invokestatic #110 // Method kotlin/collections/MapsKt.mutableMapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 85: astore 5\n 87: aload 4\n 89: astore 6\n 91: aload_2\n 92: aload 4\n 94: invokevirtual #111 // Method java/util/PriorityQueue.add:(Ljava/lang/Object;)Z\n 97: pop\n 98: aload_2\n 99: invokevirtual #115 // Method java/util/PriorityQueue.isEmpty:()Z\n 102: ifne 622\n 105: aload_2\n 106: invokevirtual #119 // Method java/util/PriorityQueue.poll:()Ljava/lang/Object;\n 109: checkcast #93 // class Candidate\n 112: astore 7\n 114: iconst_1\n 115: istore 8\n 117: bipush -2\n 119: iload 8\n 121: if_icmpge 98\n 124: iconst_m1\n 125: istore 9\n 127: iload 9\n 129: iconst_2\n 130: if_icmpge 616\n 133: new #50 // class IntVec\n 136: dup\n 137: iload 9\n 139: iload 8\n 141: invokespecial #51 // Method IntVec.\"<init>\":(II)V\n 144: astore 10\n 146: aload 7\n 148: invokevirtual #122 // Method Candidate.getState:()LPlayerState;\n 151: invokevirtual #88 // Method PlayerState.getVelocity:()LIntVec;\n 154: aload 10\n 156: invokevirtual #126 // Method IntVec.plus:(LIntVec;)LIntVec;\n 159: astore 11\n 161: aload 11\n 163: invokevirtual #129 // Method IntVec.getX:()I\n 166: aload 11\n 168: invokevirtual #129 // Method IntVec.getX:()I\n 171: imul\n 172: aload 11\n 174: invokevirtual #132 // Method IntVec.getY:()I\n 177: aload 11\n 179: invokevirtual #132 // Method IntVec.getY:()I\n 182: imul\n 183: iadd\n 184: ldc #133 // int 1000000\n 186: if_icmpgt 610\n 189: aload 7\n 191: invokevirtual #122 // Method Candidate.getState:()LPlayerState;\n 194: invokevirtual #85 // Method PlayerState.getPosition:()LIntVec;\n 197: aload 11\n 199: invokevirtual #126 // Method IntVec.plus:(LIntVec;)LIntVec;\n 202: astore 12\n 204: iconst_0\n 205: aload 12\n 207: invokevirtual #129 // Method IntVec.getX:()I\n 210: if_icmpgt 610\n 213: aload 12\n 215: invokevirtual #129 // Method IntVec.getX:()I\n 218: aload_1\n 219: invokevirtual #138 // Method RaceCourse.getWidth:()I\n 222: if_icmpge 610\n 225: new #140 // class Movement\n 228: dup\n 229: aload 7\n 231: invokevirtual #122 // Method Candidate.getState:()LPlayerState;\n 234: invokevirtual #85 // Method PlayerState.getPosition:()LIntVec;\n 237: aload 12\n 239: invokespecial #141 // Method Movement.\"<init>\":(LIntVec;LIntVec;)V\n 242: astore 13\n 244: aload 13\n 246: invokevirtual #145 // Method Movement.touchedSquares:()Ljava/util/List;\n 249: astore 14\n 251: aload 12\n 253: aload_0\n 254: invokevirtual #148 // Method RaceInfo.getOpponent:()LPlayerState;\n 257: invokevirtual #85 // Method PlayerState.getPosition:()LIntVec;\n 260: invokestatic #152 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 263: ifne 610\n 266: aload 14\n 268: checkcast #154 // class java/lang/Iterable\n 271: astore 15\n 273: iconst_0\n 274: istore 16\n 276: aload 15\n 278: instanceof #156 // class java/util/Collection\n 281: ifeq 301\n 284: aload 15\n 286: checkcast #156 // class java/util/Collection\n 289: invokeinterface #157, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 294: ifeq 301\n 297: iconst_1\n 298: goto 410\n 301: aload 15\n 303: invokeinterface #161, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 308: astore 17\n 310: aload 17\n 312: invokeinterface #166, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 317: ifeq 409\n 320: aload 17\n 322: invokeinterface #169, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 327: astore 18\n 329: aload 18\n 331: checkcast #50 // class IntVec\n 334: astore 19\n 336: iconst_0\n 337: istore 20\n 339: iconst_0\n 340: aload 19\n 342: invokevirtual #132 // Method IntVec.getY:()I\n 345: if_icmpgt 397\n 348: aload 19\n 350: invokevirtual #132 // Method IntVec.getY:()I\n 353: aload_1\n 354: invokevirtual #172 // Method RaceCourse.getLength:()I\n 357: if_icmpge 397\n 360: aload_0\n 361: invokevirtual #175 // Method RaceInfo.getSquares:()Ljava/util/List;\n 364: aload 19\n 366: invokevirtual #132 // Method IntVec.getY:()I\n 369: invokeinterface #179, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 374: checkcast #53 // class java/util/List\n 377: aload 19\n 379: invokevirtual #129 // Method IntVec.getX:()I\n 382: invokeinterface #179, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 387: checkcast #181 // class java/lang/Number\n 390: invokevirtual #184 // Method java/lang/Number.intValue:()I\n 393: iconst_1\n 394: if_icmpeq 401\n 397: iconst_1\n 398: goto 402\n 401: iconst_0\n 402: ifne 310\n 405: iconst_0\n 406: goto 410\n 409: iconst_1\n 410: ifeq 610\n 413: iconst_0\n 414: aload 12\n 416: invokevirtual #132 // Method IntVec.getY:()I\n 419: if_icmpgt 482\n 422: aload 12\n 424: invokevirtual #132 // Method IntVec.getY:()I\n 427: aload_1\n 428: invokevirtual #172 // Method RaceCourse.getLength:()I\n 431: if_icmpge 482\n 434: aload_0\n 435: invokevirtual #175 // Method RaceInfo.getSquares:()Ljava/util/List;\n 438: aload 12\n 440: invokevirtual #132 // Method IntVec.getY:()I\n 443: invokeinterface #179, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 448: checkcast #53 // class java/util/List\n 451: aload 12\n 453: invokevirtual #129 // Method IntVec.getX:()I\n 456: invokeinterface #179, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 461: checkcast #181 // class java/lang/Number\n 464: invokevirtual #184 // Method java/lang/Number.intValue:()I\n 467: iconst_2\n 468: if_icmpne 482\n 471: new #50 // class IntVec\n 474: dup\n 475: iconst_0\n 476: iconst_0\n 477: invokespecial #51 // Method IntVec.\"<init>\":(II)V\n 480: astore 11\n 482: new #75 // class PlayerState\n 485: dup\n 486: aload 12\n 488: aload 11\n 490: invokespecial #91 // Method PlayerState.\"<init>\":(LIntVec;LIntVec;)V\n 493: astore 15\n 495: new #93 // class Candidate\n 498: dup\n 499: aload_1\n 500: aload 7\n 502: invokevirtual #185 // Method Candidate.getStep:()I\n 505: iconst_1\n 506: iadd\n 507: aload 15\n 509: aload 7\n 511: aload 10\n 513: invokespecial #96 // Method Candidate.\"<init>\":(LRaceCourse;ILPlayerState;LCandidate;LIntVec;)V\n 516: astore 16\n 518: aload 16\n 520: invokevirtual #188 // Method Candidate.getGoaled:()Z\n 523: ifne 610\n 526: aload 7\n 528: invokevirtual #185 // Method Candidate.getStep:()I\n 531: bipush 7\n 533: if_icmpge 610\n 536: aload 5\n 538: aload 15\n 540: invokeinterface #193, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 545: ifeq 577\n 548: aload 5\n 550: aload 15\n 552: invokeinterface #196, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 557: dup\n 558: invokestatic #200 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 561: checkcast #93 // class Candidate\n 564: invokevirtual #185 // Method Candidate.getStep:()I\n 567: aload 7\n 569: invokevirtual #185 // Method Candidate.getStep:()I\n 572: iconst_1\n 573: iadd\n 574: if_icmple 610\n 577: aload_2\n 578: aload 16\n 580: invokevirtual #111 // Method java/util/PriorityQueue.add:(Ljava/lang/Object;)Z\n 583: pop\n 584: aload 5\n 586: aload 15\n 588: aload 16\n 590: invokeinterface #204, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 595: pop\n 596: aload 16\n 598: aload 6\n 600: invokevirtual #208 // Method Candidate.compareTo:(LCandidate;)I\n 603: ifge 610\n 606: aload 16\n 608: astore 6\n 610: iinc 9, 1\n 613: goto 127\n 616: iinc 8, -1\n 619: goto 117\n 622: aload 6\n 624: aload 4\n 626: invokestatic #152 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 629: ifeq 720\n 632: iconst_0\n 633: istore 7\n 635: iconst_0\n 636: istore 8\n 638: aload_0\n 639: invokevirtual #81 // Method RaceInfo.getMe:()LPlayerState;\n 642: invokevirtual #88 // Method PlayerState.getVelocity:()LIntVec;\n 645: invokevirtual #129 // Method IntVec.getX:()I\n 648: ifge 657\n 651: iinc 7, 1\n 654: goto 673\n 657: aload_0\n 658: invokevirtual #81 // Method RaceInfo.getMe:()LPlayerState;\n 661: invokevirtual #88 // Method PlayerState.getVelocity:()LIntVec;\n 664: invokevirtual #129 // Method IntVec.getX:()I\n 667: ifle 673\n 670: iinc 7, -1\n 673: aload_0\n 674: invokevirtual #81 // Method RaceInfo.getMe:()LPlayerState;\n 677: invokevirtual #88 // Method PlayerState.getVelocity:()LIntVec;\n 680: invokevirtual #132 // Method IntVec.getY:()I\n 683: ifge 692\n 686: iinc 8, 1\n 689: goto 708\n 692: aload_0\n 693: invokevirtual #81 // Method RaceInfo.getMe:()LPlayerState;\n 696: invokevirtual #88 // Method PlayerState.getVelocity:()LIntVec;\n 699: invokevirtual #132 // Method IntVec.getY:()I\n 702: ifle 708\n 705: iinc 8, -1\n 708: new #50 // class IntVec\n 711: dup\n 712: iload 7\n 714: iload 8\n 716: invokespecial #51 // Method IntVec.\"<init>\":(II)V\n 719: areturn\n 720: aload 6\n 722: astore 7\n 724: aload 7\n 726: invokevirtual #212 // Method Candidate.getFrom:()LCandidate;\n 729: aload 4\n 731: invokestatic #152 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 734: ifne 751\n 737: aload 7\n 739: invokevirtual #212 // Method Candidate.getFrom:()LCandidate;\n 742: dup\n 743: invokestatic #200 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 746: astore 7\n 748: goto 724\n 751: aload 7\n 753: invokevirtual #215 // Method Candidate.getHow:()LIntVec;\n 756: areturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #253 // String args\n 3: invokestatic #25 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #255 // class java/util/Scanner\n 9: dup\n 10: getstatic #261 // Field java/lang/System.in:Ljava/io/InputStream;\n 13: invokespecial #264 // Method java/util/Scanner.\"<init>\":(Ljava/io/InputStream;)V\n 16: astore_1\n 17: new #135 // class RaceCourse\n 20: dup\n 21: aload_1\n 22: invokespecial #267 // Method RaceCourse.\"<init>\":(Ljava/util/Scanner;)V\n 25: astore_2\n 26: iconst_0\n 27: istore_3\n 28: getstatic #271 // Field java/lang/System.out:Ljava/io/PrintStream;\n 31: iload_3\n 32: invokevirtual #276 // Method java/io/PrintStream.println:(I)V\n 35: getstatic #271 // Field java/lang/System.out:Ljava/io/PrintStream;\n 38: invokevirtual #279 // Method java/io/PrintStream.flush:()V\n 41: nop\n 42: nop\n 43: new #77 // class RaceInfo\n 46: dup\n 47: aload_1\n 48: aload_2\n 49: invokespecial #282 // Method RaceInfo.\"<init>\":(Ljava/util/Scanner;LRaceCourse;)V\n 52: astore_3\n 53: aload_3\n 54: aload_2\n 55: invokestatic #284 // Method plan:(LRaceInfo;LRaceCourse;)LIntVec;\n 58: astore 4\n 60: new #286 // class java/lang/StringBuilder\n 63: dup\n 64: invokespecial #287 // Method java/lang/StringBuilder.\"<init>\":()V\n 67: aload 4\n 69: invokevirtual #129 // Method IntVec.getX:()I\n 72: invokevirtual #291 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 75: bipush 32\n 77: invokevirtual #294 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 80: aload 4\n 82: invokevirtual #132 // Method IntVec.getY:()I\n 85: invokevirtual #291 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 88: invokevirtual #298 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 91: getstatic #271 // Field java/lang/System.out:Ljava/io/PrintStream;\n 94: swap\n 95: invokevirtual #300 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 98: getstatic #271 // Field java/lang/System.out:Ljava/io/PrintStream;\n 101: invokevirtual #279 // Method java/io/PrintStream.flush:()V\n 104: goto 42\n 107: astore_3\n 108: return\n Exception table:\n from to target type\n 41 107 107 Class java/lang/Exception\n\n static {};\n Code:\n 0: iconst_1\n 1: putstatic #10 // Field nextSeq:I\n 4: return\n}\n", "javap_err": "" } ]
darian-catalin-cucer__divide-and-conquer-algorithms__1cea70d/kt.kt
fun quickSort(arr: IntArray, low: Int, high: Int) { if (low < high) { val pivotIndex = partition(arr, low, high) quickSort(arr, low, pivotIndex - 1) quickSort(arr, pivotIndex + 1, high) } } fun partition(arr: IntArray, low: Int, high: Int): Int { val pivot = arr[high] var i = low - 1 for (j in low until high) { if (arr[j] <= pivot) { i++ val temp = arr[i] arr[i] = arr[j] arr[j] = temp } } val temp = arr[i + 1] arr[i + 1] = arr[high] arr[high] = temp return i + 1 } //The code above implements the QuickSort algorithm, a classic divide-and-conquer algorithm for sorting an array. The quickSort function takes in an array arr, a low index low, and a high index high, and sorts the subarray arr[low..high] in place. The partition function is used to divide the subarray into two parts: elements smaller than the pivot and elements greater than the pivot. The pivot is chosen as the last element of the subarray. The partition function rearranges the elements so that all elements smaller than the pivot are before it, and all elements greater than the pivot are after it. The pivot index is then returned, which becomes the boundary between the two subarrays in the subsequent recursive calls to quickSort. The QuickSort algorithm sorts the array by repeatedly dividing it into smaller subarrays and sorting those subarrays until they are small enough to be sorted directly.
[ { "class_path": "darian-catalin-cucer__divide-and-conquer-algorithms__1cea70d/KtKt.class", "javap": "Compiled from \"kt.kt\"\npublic final class KtKt {\n public static final void quickSort(int[], int, int);\n Code:\n 0: aload_0\n 1: ldc #9 // String arr\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iload_1\n 7: iload_2\n 8: if_icmpge 34\n 11: aload_0\n 12: iload_1\n 13: iload_2\n 14: invokestatic #19 // Method partition:([III)I\n 17: istore_3\n 18: aload_0\n 19: iload_1\n 20: iload_3\n 21: iconst_1\n 22: isub\n 23: invokestatic #21 // Method quickSort:([III)V\n 26: aload_0\n 27: iload_3\n 28: iconst_1\n 29: iadd\n 30: iload_2\n 31: invokestatic #21 // Method quickSort:([III)V\n 34: return\n\n public static final int partition(int[], int, int);\n Code:\n 0: aload_0\n 1: ldc #9 // String arr\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: iload_2\n 8: iaload\n 9: istore_3\n 10: iload_1\n 11: iconst_1\n 12: isub\n 13: istore 4\n 15: iload_1\n 16: istore 5\n 18: iload 5\n 20: iload_2\n 21: if_icmpge 61\n 24: aload_0\n 25: iload 5\n 27: iaload\n 28: iload_3\n 29: if_icmpgt 55\n 32: iinc 4, 1\n 35: aload_0\n 36: iload 4\n 38: iaload\n 39: istore 6\n 41: aload_0\n 42: iload 4\n 44: aload_0\n 45: iload 5\n 47: iaload\n 48: iastore\n 49: aload_0\n 50: iload 5\n 52: iload 6\n 54: iastore\n 55: iinc 5, 1\n 58: goto 18\n 61: aload_0\n 62: iload 4\n 64: iconst_1\n 65: iadd\n 66: iaload\n 67: istore 5\n 69: aload_0\n 70: iload 4\n 72: iconst_1\n 73: iadd\n 74: aload_0\n 75: iload_2\n 76: iaload\n 77: iastore\n 78: aload_0\n 79: iload_2\n 80: iload 5\n 82: iastore\n 83: iload 4\n 85: iconst_1\n 86: iadd\n 87: ireturn\n}\n", "javap_err": "" } ]
sirech__exercism-kotlin__253f463/sublist/src/main/kotlin/Relationship.kt
enum class Relationship { EQUAL, SUBLIST, SUPERLIST, UNEQUAL } private enum class Case { EMPTY_CASE, FIRST_BIGGER_OR_EQUAL, FIRST_SMALLER } fun <T> List<T>.relationshipTo(other: List<T>): Relationship { return when (case(this, other)) { Case.EMPTY_CASE -> emptyCase(this, other) Case.FIRST_BIGGER_OR_EQUAL -> generalCase(this, other, Relationship.SUPERLIST) Case.FIRST_SMALLER -> generalCase(other, this, Relationship.SUBLIST) } } private fun <T> case(first: List<T>, second: List<T>): Case { if (first.isEmpty() || second.isEmpty()) return Case.EMPTY_CASE if (first.size >= second.size) return Case.FIRST_BIGGER_OR_EQUAL return Case.FIRST_SMALLER } private fun <T> emptyCase(first: List<T>, second: List<T>): Relationship { if (first.isEmpty() && second.isEmpty()) return Relationship.EQUAL if (first.isEmpty()) return Relationship.SUBLIST return Relationship.SUPERLIST } private fun <T> generalCase(first: List<T>, second: List<T>, case: Relationship): Relationship { for (i in 0..(first.size - second.size)) { for (j in 0 until second.size) { if (first[i+j] != second[j]) { break; } if (j + 1 == second.size) { if (first.size == second.size) return Relationship.EQUAL return case; } } } return Relationship.UNEQUAL }
[ { "class_path": "sirech__exercism-kotlin__253f463/RelationshipKt.class", "javap": "Compiled from \"Relationship.kt\"\npublic final class RelationshipKt {\n public static final <T> Relationship relationshipTo(java.util.List<? extends T>, java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: ldc #10 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #18 // String other\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: aload_1\n 14: invokestatic #22 // Method case:(Ljava/util/List;Ljava/util/List;)LCase;\n 17: getstatic #28 // Field RelationshipKt$WhenMappings.$EnumSwitchMapping$0:[I\n 20: swap\n 21: invokevirtual #34 // Method Case.ordinal:()I\n 24: iaload\n 25: tableswitch { // 1 to 3\n 1: 52\n 2: 60\n 3: 71\n default: 82\n }\n 52: aload_0\n 53: aload_1\n 54: invokestatic #37 // Method emptyCase:(Ljava/util/List;Ljava/util/List;)LRelationship;\n 57: goto 90\n 60: aload_0\n 61: aload_1\n 62: getstatic #43 // Field Relationship.SUPERLIST:LRelationship;\n 65: invokestatic #47 // Method generalCase:(Ljava/util/List;Ljava/util/List;LRelationship;)LRelationship;\n 68: goto 90\n 71: aload_1\n 72: aload_0\n 73: getstatic #50 // Field Relationship.SUBLIST:LRelationship;\n 76: invokestatic #47 // Method generalCase:(Ljava/util/List;Ljava/util/List;LRelationship;)LRelationship;\n 79: goto 90\n 82: new #52 // class kotlin/NoWhenBranchMatchedException\n 85: dup\n 86: invokespecial #56 // Method kotlin/NoWhenBranchMatchedException.\"<init>\":()V\n 89: athrow\n 90: areturn\n\n private static final <T> Case case(java.util.List<? extends T>, java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: invokeinterface #65, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 6: ifne 18\n 9: aload_1\n 10: invokeinterface #65, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 15: ifeq 22\n 18: getstatic #69 // Field Case.EMPTY_CASE:LCase;\n 21: areturn\n 22: aload_0\n 23: invokeinterface #72, 1 // InterfaceMethod java/util/List.size:()I\n 28: aload_1\n 29: invokeinterface #72, 1 // InterfaceMethod java/util/List.size:()I\n 34: if_icmplt 41\n 37: getstatic #75 // Field Case.FIRST_BIGGER_OR_EQUAL:LCase;\n 40: areturn\n 41: getstatic #78 // Field Case.FIRST_SMALLER:LCase;\n 44: areturn\n\n private static final <T> Relationship emptyCase(java.util.List<? extends T>, java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: invokeinterface #65, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 6: ifeq 22\n 9: aload_1\n 10: invokeinterface #65, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 15: ifeq 22\n 18: getstatic #83 // Field Relationship.EQUAL:LRelationship;\n 21: areturn\n 22: aload_0\n 23: invokeinterface #65, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 28: ifeq 35\n 31: getstatic #50 // Field Relationship.SUBLIST:LRelationship;\n 34: areturn\n 35: getstatic #43 // Field Relationship.SUPERLIST:LRelationship;\n 38: areturn\n\n private static final <T> Relationship generalCase(java.util.List<? extends T>, java.util.List<? extends T>, Relationship);\n Code:\n 0: iconst_0\n 1: istore_3\n 2: aload_0\n 3: invokeinterface #72, 1 // InterfaceMethod java/util/List.size:()I\n 8: aload_1\n 9: invokeinterface #72, 1 // InterfaceMethod java/util/List.size:()I\n 14: isub\n 15: istore 4\n 17: iload_3\n 18: iload 4\n 20: if_icmpgt 120\n 23: iconst_0\n 24: istore 5\n 26: aload_1\n 27: invokeinterface #72, 1 // InterfaceMethod java/util/List.size:()I\n 32: istore 6\n 34: iload 5\n 36: iload 6\n 38: if_icmpge 108\n 41: aload_0\n 42: iload_3\n 43: iload 5\n 45: iadd\n 46: invokeinterface #88, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 51: aload_1\n 52: iload 5\n 54: invokeinterface #88, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 59: invokestatic #92 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 62: ifne 68\n 65: goto 108\n 68: iload 5\n 70: iconst_1\n 71: iadd\n 72: aload_1\n 73: invokeinterface #72, 1 // InterfaceMethod java/util/List.size:()I\n 78: if_icmpne 102\n 81: aload_0\n 82: invokeinterface #72, 1 // InterfaceMethod java/util/List.size:()I\n 87: aload_1\n 88: invokeinterface #72, 1 // InterfaceMethod java/util/List.size:()I\n 93: if_icmpne 100\n 96: getstatic #83 // Field Relationship.EQUAL:LRelationship;\n 99: areturn\n 100: aload_2\n 101: areturn\n 102: iinc 5, 1\n 105: goto 34\n 108: iload_3\n 109: iload 4\n 111: if_icmpeq 120\n 114: iinc 3, 1\n 117: goto 23\n 120: getstatic #95 // Field Relationship.UNEQUAL:LRelationship;\n 123: areturn\n}\n", "javap_err": "" }, { "class_path": "sirech__exercism-kotlin__253f463/RelationshipKt$WhenMappings.class", "javap": "Compiled from \"Relationship.kt\"\npublic final class RelationshipKt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Case.values:()[LCase;\n 3: arraylength\n 4: newarray int\n 6: astore_0\n 7: nop\n 8: aload_0\n 9: getstatic #18 // Field Case.EMPTY_CASE:LCase;\n 12: invokevirtual #22 // Method Case.ordinal:()I\n 15: iconst_1\n 16: iastore\n 17: goto 21\n 20: astore_1\n 21: nop\n 22: aload_0\n 23: getstatic #25 // Field Case.FIRST_BIGGER_OR_EQUAL:LCase;\n 26: invokevirtual #22 // Method Case.ordinal:()I\n 29: iconst_2\n 30: iastore\n 31: goto 35\n 34: astore_1\n 35: nop\n 36: aload_0\n 37: getstatic #28 // Field Case.FIRST_SMALLER:LCase;\n 40: invokevirtual #22 // Method Case.ordinal:()I\n 43: iconst_3\n 44: iastore\n 45: goto 49\n 48: astore_1\n 49: aload_0\n 50: putstatic #32 // Field $EnumSwitchMapping$0:[I\n 53: return\n Exception table:\n from to target type\n 7 17 20 Class java/lang/NoSuchFieldError\n 21 31 34 Class java/lang/NoSuchFieldError\n 35 45 48 Class java/lang/NoSuchFieldError\n}\n", "javap_err": "" }, { "class_path": "sirech__exercism-kotlin__253f463/Relationship.class", "javap": "Compiled from \"Relationship.kt\"\npublic final class Relationship extends java.lang.Enum<Relationship> {\n public static final Relationship EQUAL;\n\n public static final Relationship SUBLIST;\n\n public static final Relationship SUPERLIST;\n\n public static final Relationship UNEQUAL;\n\n private static final Relationship[] $VALUES;\n\n private static final kotlin.enums.EnumEntries $ENTRIES;\n\n private Relationship();\n Code:\n 0: aload_0\n 1: aload_1\n 2: iload_2\n 3: invokespecial #10 // Method java/lang/Enum.\"<init>\":(Ljava/lang/String;I)V\n 6: return\n\n public static Relationship[] values();\n Code:\n 0: getstatic #22 // Field $VALUES:[LRelationship;\n 3: invokevirtual #28 // Method java/lang/Object.clone:()Ljava/lang/Object;\n 6: checkcast #29 // class \"[LRelationship;\"\n 9: areturn\n\n public static Relationship valueOf(java.lang.String);\n Code:\n 0: ldc #2 // class Relationship\n 2: aload_0\n 3: invokestatic #34 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;\n 6: checkcast #2 // class Relationship\n 9: areturn\n\n public static kotlin.enums.EnumEntries<Relationship> getEntries();\n Code:\n 0: getstatic #43 // Field $ENTRIES:Lkotlin/enums/EnumEntries;\n 3: areturn\n\n private static final Relationship[] $values();\n Code:\n 0: iconst_4\n 1: anewarray #2 // class Relationship\n 4: astore_0\n 5: aload_0\n 6: iconst_0\n 7: getstatic #47 // Field EQUAL:LRelationship;\n 10: aastore\n 11: aload_0\n 12: iconst_1\n 13: getstatic #50 // Field SUBLIST:LRelationship;\n 16: aastore\n 17: aload_0\n 18: iconst_2\n 19: getstatic #53 // Field SUPERLIST:LRelationship;\n 22: aastore\n 23: aload_0\n 24: iconst_3\n 25: getstatic #56 // Field UNEQUAL:LRelationship;\n 28: aastore\n 29: aload_0\n 30: areturn\n\n static {};\n Code:\n 0: new #2 // class Relationship\n 3: dup\n 4: ldc #58 // String EQUAL\n 6: iconst_0\n 7: invokespecial #59 // Method \"<init>\":(Ljava/lang/String;I)V\n 10: putstatic #47 // Field EQUAL:LRelationship;\n 13: new #2 // class Relationship\n 16: dup\n 17: ldc #60 // String SUBLIST\n 19: iconst_1\n 20: invokespecial #59 // Method \"<init>\":(Ljava/lang/String;I)V\n 23: putstatic #50 // Field SUBLIST:LRelationship;\n 26: new #2 // class Relationship\n 29: dup\n 30: ldc #61 // String SUPERLIST\n 32: iconst_2\n 33: invokespecial #59 // Method \"<init>\":(Ljava/lang/String;I)V\n 36: putstatic #53 // Field SUPERLIST:LRelationship;\n 39: new #2 // class Relationship\n 42: dup\n 43: ldc #62 // String UNEQUAL\n 45: iconst_3\n 46: invokespecial #59 // Method \"<init>\":(Ljava/lang/String;I)V\n 49: putstatic #56 // Field UNEQUAL:LRelationship;\n 52: invokestatic #64 // Method $values:()[LRelationship;\n 55: putstatic #22 // Field $VALUES:[LRelationship;\n 58: getstatic #22 // Field $VALUES:[LRelationship;\n 61: checkcast #66 // class \"[Ljava/lang/Enum;\"\n 64: invokestatic #72 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;\n 67: putstatic #43 // Field $ENTRIES:Lkotlin/enums/EnumEntries;\n 70: return\n}\n", "javap_err": "" } ]
fasiha__advent-of-code-2020__59edfcb/aoc2020kot/src/main/kotlin/main.kt
import kotlin.math.PI import kotlin.math.cos import kotlin.math.roundToInt import kotlin.math.sin // From https://stackoverflow.com/a/53018129 fun getResourceAsText(path: String): String { return object {}.javaClass.getResource(path)?.readText() ?: throw Exception("Unable to read file") } fun getResourceAsBytes(path: String): ByteArray { return object {}.javaClass.getResource(path)?.readBytes() ?: throw Exception("Unable to read file") } fun getResourceAsInts(path: String): Sequence<Int> { return getResourceAsText(path).trim().lineSequence().map { it.toInt() } } fun getResourceAsLongs(path: String): Sequence<Long> { return getResourceAsText(path).trim().lineSequence().map { it.toLong() } } fun problem1a(expenses: Sequence<Long> = getResourceAsLongs("1.txt"), targetSum: Long = 2020): Pair<Long, List<Long>>? { val seen: MutableSet<Long> = mutableSetOf() for (x in expenses) { if (seen.contains(targetSum - x)) { return Pair((targetSum - x) * x, listOf(targetSum - x, x)) } seen += x } return null } fun problem1b(): Pair<Int, List<Int>>? { val targetSum = 2020 val expenses = getResourceAsInts("1.txt") val seen: MutableSet<Int> = mutableSetOf() for (x in expenses) { for (y in seen) { if (seen.contains(targetSum - (x + y))) { return Pair(x * y * (targetSum - (x + y)), listOf(x, y, targetSum - (x + y))) } } seen += x } return null } fun problem2a(a: Boolean): Int { val re = "([0-9]+)-([0-9]+) (.): (.+)".toRegex() fun isValid(lo: Int, hi: Int, ch: String, pw: String): Boolean { val count = ch.toRegex().findAll(pw).count() return count in lo..hi } fun isValidB(i: Int, j: Int, ch: String, pw: String): Boolean { return (pw[i - 1] == ch[0]).xor(pw[j - 1] == ch[0]) } val valid = if (a) ::isValid else ::isValidB val contents = getResourceAsText("2.txt") return contents.trim().lineSequence().mapNotNull { re.find(it)?.destructured } .filter { (lo, hi, ch, pw) -> valid(lo.toInt(), hi.toInt(), ch, pw) }.count() } fun problem3a(right: Int, down: Int): Int { val map = getResourceAsText("3.txt").trim().lines() val width = map[0].length val tree = '#' var nTrees = 0 var row = 0 var col = 0 while (row < map.size) { nTrees += if (map[row][col % width] == tree) 1 else 0 row += down col += right } return nTrees } fun problem3b(): Long { return listOf( problem3a(1, 1), problem3a(3, 1), problem3a(5, 1), problem3a(7, 1), problem3a(1, 2) ).fold(1L) { acc, i -> acc * i } } fun problem4a(): Int { val contents = getResourceAsText("4.txt").trim().splitToSequence("\n\n") val listOfKeys = contents.map { it .split("\\s".toRegex()) .map { kv -> kv.splitToSequence(':').first() } .toSet() } return listOfKeys.count { it.containsAll(listOf("byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid")) } } fun <T> listToPair(l: List<T>): Pair<T, T> { return Pair(l[0], l[1]) } fun problem4b(): Int { val requiredFields = listOf("byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid") val okEyeColors = setOf("amb", "blu", "brn", "gry", "grn", "hzl", "oth") val contents = getResourceAsText("4.txt").trim().splitToSequence("\n\n") val passports = contents.map { it .split("\\s".toRegex()) .associate { kv -> listToPair(kv.split(":")) } } val validPassports = passports.filter { requiredFields.all { k -> it.containsKey(k) } } fun isValid(m: Map<String, String>): Boolean { val hgt = m["hgt"]!! val hgtOk = (hgt.endsWith("cm") && hgt.dropLast(2).toInt() in 150..193) || (hgt.endsWith("in") && hgt.dropLast(2).toInt() in 59..76) return hgtOk && (m["byr"]?.toInt() in 1920..2002) && (m["iyr"]?.toInt() in 2010..2020) && (m["eyr"]?.toInt() in 2020..2030) && (m["hcl"]!!.contains("^#[a-f0-9]{6}$".toRegex())) && (okEyeColors.contains(m["ecl"]!!)) && (m["pid"]!!.contains("^[0-9]{9}$".toRegex())) } return validPassports.count(::isValid) } fun strToBinary(s: String, zeroChar: Char): Int { return s.toCharArray().fold(0) { acc, i -> (acc shl 1) + if (i == zeroChar) 0 else 1 } // Does toCharArray *create* a new array? Or is it a view? // Because, an alternative: `chars` returns IntSequence, so // return s.chars().map{if (it == zeroChar.toInt()) 0 else 1}.reduce{ acc, i -> (acc shl 1) + i }.asInt } fun problem5a(): Int { val lines = getResourceAsText("5.txt").trim().lineSequence() return lines.maxOfOrNull { strToBinary(it.take(7), 'F') * 8 + strToBinary(it.takeLast(3), 'L') }!! } fun problem5b(): Int { val lines = getResourceAsText("5.txt").trim().lineSequence() val sorted = lines.map { strToBinary(it.take(7), 'F') * 8 + strToBinary(it.takeLast(3), 'L') }.sorted() for ((curr, next) in sorted.zipWithNext()) { if (curr + 1 != next) return curr + 1 } return -1 } fun problem6a(): Int { val groups = getResourceAsText("6.txt").trim().splitToSequence("\n\n") return groups.sumOf { it.replace("\n", "").toSet().size } } fun problem6b(): Int { val groups = getResourceAsText("6.txt").trim().splitToSequence("\n\n") return groups.sumOf { it.splitToSequence("\n") .map { person -> person.toSet() } .reduce { acc, i -> acc intersect i } .size } } fun problem7a(): Int { fun outerToInner(rule: String): Sequence<Pair<String, String>> { val split = rule.split(" bags contain") val parent = split[0] // don't need null check? return "[0-9]+ ([a-z ]+?) bag".toRegex().findAll(split[1]).map { Pair(parent, it.destructured.component1()) } } val innerToOuters = getResourceAsText("7.txt").trim().lineSequence().flatMap(::outerToInner).groupBy({ it.second }, { it.first }) val ancestors: MutableSet<String> = mutableSetOf() fun recur(inner: String) { val outers = innerToOuters[inner].orEmpty() ancestors += outers outers.forEach(::recur) } recur("shiny gold") return ancestors.size } data class BagContent(val num: Int, val color: String) fun problem7b(): Int { fun outerToInners(rule: String): Pair<String, List<BagContent>> { val split = rule.split(" bags contain") assert(split.size >= 2) { "two sides to the rule expected" } val parent = split[0] // don't need null check? Guess not. Either this will throw or the assert above return Pair( parent, "([0-9]+) ([a-z ]+?) bag" .toRegex() .findAll(split[1]) .map { BagContent(it.destructured.component1().toInt(), it.destructured.component2()) } .toList() ) } val outerToInners = getResourceAsText("7.txt").trim().lineSequence().associate(::outerToInners) fun recur(outer: String): Int { val inners = outerToInners[outer].orEmpty() return inners.sumOf { it.num + it.num * recur(it.color) } } return recur("shiny gold") } enum class Op { Acc, Jmp, Nop } data class OpCode(val op: Op, val arg: Int) fun loadProgram8(): List<OpCode> { return getResourceAsText("8.txt").trim().lines().map { val (op, arg) = it.split(" ") OpCode( when (op) { "nop" -> Op.Nop "acc" -> Op.Acc "jmp" -> Op.Jmp else -> throw Error("unknown") }, arg.toInt() ) } } enum class FinalState { Terminated, InfiniteLoop } fun problem8a(program: List<OpCode> = loadProgram8()): Pair<FinalState, Int> { val linesVisited = mutableSetOf<Int>() var programCounter = 0 var acc = 0 while (programCounter < program.size) { if (linesVisited.contains(programCounter)) return Pair(FinalState.InfiniteLoop, acc) else linesVisited.add(programCounter) val (op, arg) = program[programCounter] when (op) { Op.Acc -> { acc += arg programCounter++ } Op.Jmp -> programCounter += arg Op.Nop -> programCounter++ } } return Pair(FinalState.Terminated, acc) } fun problem8b(): Int { val program = loadProgram8() for ((idx, op) in program.withIndex()) { if (op.op == Op.Nop || op.op == Op.Jmp) { val newProgram = program.toMutableList() newProgram[idx] = OpCode(if (op.op == Op.Nop) Op.Jmp else Op.Nop, op.arg) val (newState, newAcc) = problem8a(newProgram) if (newState == FinalState.Terminated) return newAcc } } throw Error("no solution found") } // Kotlin Sad 1: no nested destructure // 2: windowed returns a List of Lists? No Sequence? Is that inefficient? // Question: is List.asSequence() expensive? // Definitely annoying: `if(x != null) return x.max()` doesn't work: Kotlin doesn't know x is non-null there. Similarly `if(m.containsKey(idx)) return m[idx]!!` // ^^ But --- wait https://kotlinlang.org/docs/basic-syntax.html#nullable-values-and-null-checks `x and y are automatically cast to non-nullable after null check` // subList does bound-checking. I miss python lst[5:1000000] would just work // Why does "asd".toCharArray().mapNotNull not exist? fun problem9a(numbers: Sequence<Long> = getResourceAsLongs("9.txt")): Long { val preamble = 25 return numbers .windowed(1 + preamble) .first { problem1a(it.dropLast(1).asSequence(), it.last()) == null } .last() } fun problem9b(): Long { val numbers = getResourceAsLongs("9.txt").toList() val target = problem9a(numbers.asSequence()) // is this stupid, going from seq -> list -> seq? for (win in 2..numbers.size) { val solution = numbers.windowed(win).firstOrNull { it.sum() == target } if (solution != null) return solution.maxOrNull()!! + solution.minOrNull()!! } error("unable to find solution") } fun problem10a(): Int { return getResourceAsInts("10.txt") .sorted() .zipWithNext { a, b -> b - a } .groupingBy { it } .eachCount() .values .fold(1) { acc, it -> acc * (it + 1) } } fun problem10b(): Long { val list0 = listOf(0) + getResourceAsInts("10.txt").sorted() val list = list0 + (list0.last() + 3) val m = mutableMapOf<Int, Long>() fun recur(idx: Int = 0): Long { if (idx + 1 == list.size) return 1 if (m.containsKey(idx)) return m[idx]!! val cur = list[idx] val next = list.drop(idx + 1).takeWhile { it <= cur + 3 }.size // drop & takeWhile since subList checks bounds val numDescendants = (idx + 1..idx + next).sumOf(::recur) m += idx to numDescendants return numDescendants } return recur() } data class DoubleBuffer( val get: (Int, Int) -> Byte, val set: (Int, Int, Byte) -> Unit, val flip: () -> Unit, val getBuffer: () -> ByteArray, val getLineOfSight: (Int, Int, (Byte) -> Boolean) -> List<Byte>, val height: Int, val width: Int, ) fun prepareBytes(aBuffer: ByteArray): DoubleBuffer { // FIXME: BOM 0xEF,0xBB,0xBF https://en.wikipedia.org/wiki/Byte_order_mark val newline = aBuffer.indexOf('\n'.toByte()) assert(newline > 0) { "file must contain newlines" } val (width, padding) = when (aBuffer[newline - 1]) { '\r'.toByte() -> Pair(newline - 1, 2) else -> Pair(newline, 1) } val lastIdx = aBuffer.indexOfLast { !(it == '\n'.toByte() || it == '\r'.toByte()) } + 1 val height = (lastIdx + padding) / (width + padding) val bBuffer = aBuffer.copyOf() var readBufferA = true // which buffer, a or b, is the read-ready copy? The other will be written to until flip()ed val rowColToIndex = { row: Int, col: Int -> row * (width + padding) + col } val get = { row: Int, col: Int -> (if (readBufferA) aBuffer else bBuffer)[rowColToIndex(row, col)] } val set = { row: Int, col: Int, new: Byte -> (if (readBufferA) bBuffer else aBuffer)[rowColToIndex(row, col)] = new } val flip = { readBufferA = !readBufferA } val getBuffer = { if (readBufferA) aBuffer else bBuffer } val getLineOfSight = { row: Int, col: Int, f: (Byte) -> Boolean -> val inBounds = { r: Int, c: Int -> r >= 0 && c >= 0 && r < height && c < width } val buf = if (readBufferA) aBuffer else bBuffer val ret = mutableListOf<Byte>() for (dr in -1..1) { for (dc in -1..1) { if (dc == 0 && dr == 0) continue var r = row + dr var c = col + dc while (inBounds(r, c)) { val char = buf[rowColToIndex(r, c)] if (f(char)) { ret += char break } c += dc r += dr } } } ret } return DoubleBuffer(get, set, flip, getBuffer, getLineOfSight, height, width) } fun problem11(partA: Boolean): Int { val buffer = prepareBytes(getResourceAsBytes("11.txt")) val occupiedThreshold = if (partA) 4 else 5 val predicate = if (partA) ({ true }) else ({ b: Byte -> b != '.'.toByte() }) while (true) { var changed = false for (row in 0 until buffer.height) { for (col in 0 until buffer.width) { val seat = buffer.get(row, col) if (seat != '.'.toByte()) { val ring = buffer.getLineOfSight(row, col, predicate) val occupied = ring.count { it == '#'.toByte() } if (seat == 'L'.toByte() && occupied == 0) { buffer.set(row, col, '#'.toByte()) changed = true } else if (seat == '#'.toByte() && occupied >= occupiedThreshold) { buffer.set(row, col, 'L'.toByte()) changed = true } else { buffer.set(row, col, seat) } } } } buffer.flip() // all done reading from one buffer and writing to the other: flip which one is readable if (!changed) break } return buffer.getBuffer().count { it == '#'.toByte() } } fun bytesToLinesSequence(bytes: ByteArray): Sequence<ByteArray> { return sequence { val lineFeed = '\n'.toByte() val carriageReturn = '\r'.toByte() var newlineSize = 1 // unix var slice = bytes.sliceArray(bytes.indices) val searchIdx = slice.indexOf(lineFeed) if (searchIdx < 0) { yield(slice) } else { if (searchIdx > 0 && slice[searchIdx - 1] == carriageReturn) newlineSize = 2 // Windows yield(slice.sliceArray(0..searchIdx - newlineSize)) slice = slice.sliceArray(searchIdx + 1 until slice.size) while (slice.isNotEmpty()) { val searchIdx = slice.indexOf(lineFeed) if (searchIdx < 0) { yield(slice) break } yield(slice.sliceArray(0..searchIdx - newlineSize)) slice = slice.sliceArray(searchIdx + 1 until slice.size) } } } } fun prob12(): Int { val faceToDelta = mapOf('N' to Pair(0, 1), 'S' to Pair(0, -1), 'E' to Pair(1, 0), 'W' to Pair(-1, 0)) val faces = listOf('N', 'E', 'S', 'W') var x = 0 var y = 0 var faceIdx = faces.indexOf('E') for (line in bytesToLinesSequence(getResourceAsBytes("12.txt"))) { val instruction = line[0].toChar() val arg = String(line.sliceArray(1 until line.size), Charsets.US_ASCII).toInt() when (instruction) { 'N' -> y += arg 'S' -> y -= arg 'W' -> x -= arg 'E' -> x += arg 'L' -> faceIdx = (4 + faceIdx - arg / 90) % 4 'R' -> faceIdx = (4 + faceIdx + arg / 90) % 4 'F' -> { val (dx, dy) = faceToDelta[faces[faceIdx]]!! x += dx * arg y += dy * arg } } } return kotlin.math.abs(x) + kotlin.math.abs(y) } // See https://mathworld.wolfram.com/RotationMatrix.html fun rotate(x: Int, y: Int, deg: Int): Pair<Int, Int> { val t = PI / 180.0 * deg; val cosT = cos(t) val sinT = sin(t) return Pair((cosT * x - sinT * y).roundToInt(), (sinT * x + cosT * y).roundToInt()) } fun prob12b(): Int { var x = 0 var y = 0 var dx = 10 // waypoint var dy = 1 // waypoint for (line in bytesToLinesSequence(getResourceAsBytes("12.txt"))) { val instruction = line[0].toChar() val arg = String(line.sliceArray(1 until line.size), Charsets.US_ASCII).toInt() when (instruction) { 'N' -> dy += arg 'S' -> dy -= arg 'W' -> dx -= arg 'E' -> dx += arg 'L', 'R' -> { val (x1, y1) = rotate(dx, dy, if (instruction == 'L') arg else -arg) // L: clockwise dx = x1 dy = y1 } 'F' -> { x += dx * arg y += dy * arg } } } return kotlin.math.abs(x) + kotlin.math.abs(y) } fun prob13(): Int { val lines = getResourceAsText("13.txt").lines() val earliest = lines[0].toInt() val busses = lines[1].split(',').filter { it != "x" }.map { it.toInt() } // Can we write the following loop using sequences? // `generateSequence(earliest) {it+1 }.first{ time -> busses.any { bus -> (time % bus) == 0 }}!!` but without // having to redo the last mod checks? var t = earliest while (true) { val bus = busses.find { t % it == 0 } if (bus != null) { return bus * (t - earliest) } t++ } } // Find x such that `x % a.component2() == a.component1()` AND `x % b.component2() == b.component1()` // That is, the first element of each pair is congruent to x modulo the second element of the pair // Step one of the sieve algorithm per https://en.wikipedia.org/wiki/Chinese_remainder_theorem#Computation,i fun chineseRemainderTheoremPair(a: Pair<Long, Long>, b: Pair<Long, Long>): Long { var congruence: Long = a.component1() val mod = a.component2() val secondCongruence = b.component1() val secondMod = b.component2() assert(congruence > 0 && mod > 0 && secondCongruence > 0 && secondMod > 0) { "positive only" } while (true) { if ((congruence % secondMod) == secondCongruence) return congruence congruence += mod } } fun prob13b(): Long { val list = getResourceAsText("13.txt").lines()[1].split(',') val equivalences = list .mapIndexedNotNull { i, stringModulo -> when (stringModulo) { "x" -> null else -> { val mod = stringModulo.toLong() val push = (list.size / mod + 1) * mod // push the modulo to be greater than the biggest index i // without this, we might end up with `mod - i % mod` being negative when index is big enough Pair((push - i.toLong()) % mod, mod) } } } .sortedByDescending { (_, n) -> n } // x = equivalences[0][0] % equivalences[0][1] = equivalences[1][0] % equivalences[1][1] = ... // In other words, the first element is congruent with x modulo the second element. // In the language of https://en.wikipedia.org/wiki/Chinese_remainder_theorem#Computation, // equivalences[i] = Pair(a_i, n_i) val sol = equivalences.reduce { acc, pair -> val newCongruent = chineseRemainderTheoremPair(acc, pair) Pair(newCongruent, acc.component2() * pair.component2()) } return sol.component1() } fun prob14(): Long { // Pair(OrMask (1s), AndMask (0s)) // OrMask's binary representation has 1s wherever the bitmask has a '1' character and 0s otherwise // AndMask in binary has 0s wherever the bitmask is '0' but 1s otherwise // This way, `foo OR OrMask AND AndMask` will apply the overall mask. fun stringToMasks(s: String): Pair<Long, Long> { return s.toCharArray().foldIndexed(Pair(0L, 0L)) { idx, (orMask, andMask), x -> val bit = 1L shl (s.length - idx - 1) Pair(orMask + if (x == '1') bit else 0, andMask + if (x == '0') 0 else bit) } } val mem = mutableMapOf<Int, Long>() var mask = Pair(0L, 0L) for (line in getResourceAsText("14.txt").trim().lineSequence()) { if (line.startsWith("ma")) { mask = stringToMasks(line.drop(7)) } else { val group = "mem\\[(?<idx>[0-9]+)\\] = (?<value>.*)".toRegex().find(line)!!.groupValues val idx = group[1].toInt() val value = group[2].toLong() mem[idx] = (value or mask.component1()) and mask.component2() } } return mem.values.sum() } /** * Given a list of numbers representing how many options each dimension has, * generates a sequence whose each step is a list of numbers representing * the chosen index for each dimension. * * If you're choosing between 4 shirts, 5 pants, and 3 pairs of shoes, * `cartesianProduct(listOf(4, 5, 3))` will start at `(0, 0, 0)` and end at * `(3, 4, 2)` and will enumerate each option. * * from https://github.com/fasiha/cartesian-product-generator/issues/3 */ fun cartesianProduct(lengthArr: List<Int>): Sequence<List<Int>> { val idx = lengthArr.map { 0 }.toMutableList() var carry = 0 return sequence<List<Int>> { while (carry == 0) { yield(idx) carry = 1 for (i in idx.indices) { idx[i] += carry if (idx[i] >= lengthArr[i]) { idx[i] = 0 carry = 1 } else { carry = 0 break } } } } } fun prob14b(): Long { // We now have three things to generate from each mask string: // - an OrMask whose binary has 1s where the input char is 1 // - an AndMask whose binary has 0s when the input char is X, since we want to zero out the floats // - a floats list consisting of 2**index for each index whose character was X fun stringToMasks(s: String): Triple<Long, Long, List<Long>> { return s.toCharArray().foldIndexed(Triple(0L, 0L, listOf())) { idx, (orMask, andMask, floats), x -> val bit = 1L shl (s.length - idx - 1) Triple( orMask + if (x == '1') bit else 0, andMask + if (x == 'X') 0 else bit, if (x == 'X') floats + bit else floats ) } } val mem = mutableMapOf<Long, Long>() var mask = Triple(0L, 0L, listOf<Long>()) for (line in getResourceAsText("14.txt").trim().lineSequence()) { if (line.startsWith("ma")) { mask = stringToMasks(line.drop(7)) } else { val (orMask, andMask, floatMask) = mask val group = "mem\\[(?<idx>[0-9]+)\\] = (?<value>.*)".toRegex().find(line)!!.groupValues val value = group[2].toLong() val idx = group[1].toLong() val newIdx = (idx or orMask) and andMask for (float in cartesianProduct(floatMask.map { 2 })) { // each element of float will be 0 or 1, whether to turn the floating bit on or off val floatIdx = newIdx + float.zip(floatMask).sumOf { (use, bit) -> use * bit } // we're using multiplication as a shortcut to `if(use>0) bit else 0` mem[floatIdx] = value } } } return mem.values.sum() } fun prob15(partA: Boolean): Int { val input = listOf(0, 5, 4, 1, 10, 14, 7) val spoken = input.withIndex().associate { it.value to listOf(it.index + 1) }.toMutableMap() var lastSpoken = input.last() for (turn in input.size + 1..(if (partA) 2020 else 30_000_000)) { val prev = spoken[lastSpoken]!! lastSpoken = if (prev.size == 1) { 0 } else { // prev is list of 2 prev[1] - prev[0] } if (!spoken.containsKey(lastSpoken)) { spoken[lastSpoken] = listOf(turn) } else { val newPrevious = spoken[lastSpoken]!! spoken[lastSpoken] = listOf(newPrevious.last(), turn) } } return lastSpoken } fun main(args: Array<String>) { println("Problem 1a: ${problem1a()}") println("Problem 1b: ${problem1b()}") println("Problem 2a: ${problem2a(true)}") println("Problem 2b: ${problem2a(!true)}") println("Problem 3a: ${problem3a(3, 1)}") println("Problem 3b: ${problem3b()}") println("Problem 4a: ${problem4a()}") println("Problem 4b: ${problem4b()}") println("Problem 5a: ${problem5a()}") println("Problem 5b: ${problem5b()}") println("Problem 6a: ${problem6a()}") println("Problem 6b: ${problem6b()}") println("Problem 7a: ${problem7a()}") println("Problem 7b: ${problem7b()}") println("Problem 8a: ${problem8a()}") println("Problem 8b: ${problem8b()}") println("Problem 9a: ${problem9a()}") println("Problem 9b: ${problem9b()}") println("Problem 10a: ${problem10a()}") println("Problem 10b: ${problem10b()}") // println("Problem 11a: ${problem11(true)}") // println("Problem 11b: ${problem11(false)}") println("Problem 12: ${prob12()}") println("Problem 12b: ${prob12b()}") println("Problem 13: ${prob13()}") println("Problem 13b: ${prob13b()}") println("Problem 14: ${prob14()}") println("Problem 14b: ${prob14b()}") println("Problem 15: ${prob15(true)}") // println("Problem 15b: ${prob15(false)}") }
[ { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$problem10a$$inlined$groupingBy$1.class", "javap": "Compiled from \"_Sequences.kt\"\npublic final class MainKt$problem10a$$inlined$groupingBy$1 implements kotlin.collections.Grouping<java.lang.Integer, java.lang.Integer> {\n final kotlin.sequences.Sequence $this_groupingBy;\n\n public MainKt$problem10a$$inlined$groupingBy$1(kotlin.sequences.Sequence);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #18 // Field $this_groupingBy:Lkotlin/sequences/Sequence;\n 5: aload_0\n 6: invokespecial #21 // Method java/lang/Object.\"<init>\":()V\n 9: return\n\n public java.util.Iterator<java.lang.Integer> sourceIterator();\n Code:\n 0: aload_0\n 1: getfield #18 // Field $this_groupingBy:Lkotlin/sequences/Sequence;\n 4: invokeinterface #32, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 9: areturn\n\n public java.lang.Integer keyOf(java.lang.Integer);\n Code:\n 0: aload_1\n 1: checkcast #37 // class java/lang/Number\n 4: invokevirtual #41 // Method java/lang/Number.intValue:()I\n 7: istore_2\n 8: iconst_0\n 9: istore_3\n 10: iload_2\n 11: invokestatic #47 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 14: areturn\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$WhenMappings.class", "javap": "Compiled from \"main.kt\"\npublic final class MainKt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Op.values:()[LOp;\n 3: arraylength\n 4: newarray int\n 6: astore_0\n 7: nop\n 8: aload_0\n 9: getstatic #18 // Field Op.Acc:LOp;\n 12: invokevirtual #22 // Method Op.ordinal:()I\n 15: iconst_1\n 16: iastore\n 17: goto 21\n 20: astore_1\n 21: nop\n 22: aload_0\n 23: getstatic #25 // Field Op.Jmp:LOp;\n 26: invokevirtual #22 // Method Op.ordinal:()I\n 29: iconst_2\n 30: iastore\n 31: goto 35\n 34: astore_1\n 35: nop\n 36: aload_0\n 37: getstatic #28 // Field Op.Nop:LOp;\n 40: invokevirtual #22 // Method Op.ordinal:()I\n 43: iconst_3\n 44: iastore\n 45: goto 49\n 48: astore_1\n 49: aload_0\n 50: putstatic #32 // Field $EnumSwitchMapping$0:[I\n 53: return\n Exception table:\n from to target type\n 7 17 20 Class java/lang/NoSuchFieldError\n 21 31 34 Class java/lang/NoSuchFieldError\n 35 45 48 Class java/lang/NoSuchFieldError\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$getResourceAsBytes$1.class", "javap": "Compiled from \"main.kt\"\npublic final class MainKt$getResourceAsBytes$1 {\n MainKt$getResourceAsBytes$1();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$problem2a$valid$1.class", "javap": "Compiled from \"main.kt\"\nfinal class MainKt$problem2a$valid$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function4<java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.Boolean> {\n public static final MainKt$problem2a$valid$1 INSTANCE;\n\n MainKt$problem2a$valid$1();\n Code:\n 0: aload_0\n 1: iconst_4\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String isValid\n 6: ldc #15 // String problem2a$isValid(IILjava/lang/String;Ljava/lang/String;)Z\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Boolean invoke(int, int, java.lang.String, java.lang.String);\n Code:\n 0: aload_3\n 1: ldc #24 // String p2\n 3: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload 4\n 8: ldc #32 // String p3\n 10: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 13: iload_1\n 14: iload_2\n 15: aload_3\n 16: aload 4\n 18: invokestatic #38 // Method MainKt.access$problem2a$isValid:(IILjava/lang/String;Ljava/lang/String;)Z\n 21: invokestatic #44 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;\n 24: areturn\n\n public java.lang.Object invoke(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/lang/Number\n 5: invokevirtual #55 // Method java/lang/Number.intValue:()I\n 8: aload_2\n 9: checkcast #51 // class java/lang/Number\n 12: invokevirtual #55 // Method java/lang/Number.intValue:()I\n 15: aload_3\n 16: checkcast #57 // class java/lang/String\n 19: aload 4\n 21: checkcast #57 // class java/lang/String\n 24: invokevirtual #59 // Method invoke:(IILjava/lang/String;Ljava/lang/String;)Ljava/lang/Boolean;\n 27: areturn\n\n static {};\n Code:\n 0: new #2 // class MainKt$problem2a$valid$1\n 3: dup\n 4: invokespecial #64 // Method \"<init>\":()V\n 7: putstatic #67 // Field INSTANCE:LMainKt$problem2a$valid$1;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$cartesianProduct$1.class", "javap": "Compiled from \"main.kt\"\nfinal class MainKt$cartesianProduct$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super java.util.List<? extends java.lang.Integer>>, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {\n int label;\n\n private java.lang.Object L$0;\n\n final kotlin.jvm.internal.Ref$IntRef $carry;\n\n final java.util.List<java.lang.Integer> $idx;\n\n final java.util.List<java.lang.Integer> $lengthArr;\n\n MainKt$cartesianProduct$1(kotlin.jvm.internal.Ref$IntRef, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, kotlin.coroutines.Continuation<? super MainKt$cartesianProduct$1>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #14 // Field $carry:Lkotlin/jvm/internal/Ref$IntRef;\n 5: aload_0\n 6: aload_2\n 7: putfield #18 // Field $idx:Ljava/util/List;\n 10: aload_0\n 11: aload_3\n 12: putfield #21 // Field $lengthArr:Ljava/util/List;\n 15: aload_0\n 16: iconst_2\n 17: aload 4\n 19: invokespecial #24 // Method kotlin/coroutines/jvm/internal/RestrictedSuspendLambda.\"<init>\":(ILkotlin/coroutines/Continuation;)V\n 22: return\n\n public final java.lang.Object invokeSuspend(java.lang.Object);\n Code:\n 0: invokestatic #49 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;\n 3: astore 7\n 5: aload_0\n 6: getfield #53 // Field label:I\n 9: tableswitch { // 0 to 1\n 0: 32\n 1: 85\n default: 256\n }\n 32: aload_1\n 33: invokestatic #59 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 36: aload_0\n 37: getfield #62 // Field L$0:Ljava/lang/Object;\n 40: checkcast #64 // class kotlin/sequences/SequenceScope\n 43: astore_2\n 44: aload_0\n 45: getfield #14 // Field $carry:Lkotlin/jvm/internal/Ref$IntRef;\n 48: getfield #69 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 51: ifne 252\n 54: aload_2\n 55: aload_0\n 56: getfield #18 // Field $idx:Ljava/util/List;\n 59: aload_0\n 60: checkcast #71 // class kotlin/coroutines/Continuation\n 63: aload_0\n 64: aload_2\n 65: putfield #62 // Field L$0:Ljava/lang/Object;\n 68: aload_0\n 69: iconst_1\n 70: putfield #53 // Field label:I\n 73: invokevirtual #75 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 76: dup\n 77: aload 7\n 79: if_acmpne 98\n 82: aload 7\n 84: areturn\n 85: aload_0\n 86: getfield #62 // Field L$0:Ljava/lang/Object;\n 89: checkcast #64 // class kotlin/sequences/SequenceScope\n 92: astore_2\n 93: aload_1\n 94: invokestatic #59 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 97: aload_1\n 98: pop\n 99: aload_0\n 100: getfield #14 // Field $carry:Lkotlin/jvm/internal/Ref$IntRef;\n 103: iconst_1\n 104: putfield #69 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 107: iconst_0\n 108: istore_3\n 109: aload_0\n 110: getfield #18 // Field $idx:Ljava/util/List;\n 113: checkcast #77 // class java/util/Collection\n 116: invokeinterface #81, 1 // InterfaceMethod java/util/Collection.size:()I\n 121: istore 4\n 123: iload_3\n 124: iload 4\n 126: if_icmpge 44\n 129: aload_0\n 130: getfield #18 // Field $idx:Ljava/util/List;\n 133: astore 5\n 135: iload_3\n 136: istore 6\n 138: aload 5\n 140: iload 6\n 142: aload 5\n 144: iload 6\n 146: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 151: checkcast #89 // class java/lang/Number\n 154: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 157: aload_0\n 158: getfield #14 // Field $carry:Lkotlin/jvm/internal/Ref$IntRef;\n 161: getfield #69 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 164: iadd\n 165: invokestatic #98 // Method kotlin/coroutines/jvm/internal/Boxing.boxInt:(I)Ljava/lang/Integer;\n 168: invokeinterface #102, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 173: pop\n 174: aload_0\n 175: getfield #18 // Field $idx:Ljava/util/List;\n 178: iload_3\n 179: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 184: checkcast #89 // class java/lang/Number\n 187: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 190: aload_0\n 191: getfield #21 // Field $lengthArr:Ljava/util/List;\n 194: iload_3\n 195: invokeinterface #87, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 200: checkcast #89 // class java/lang/Number\n 203: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 206: if_icmplt 235\n 209: aload_0\n 210: getfield #18 // Field $idx:Ljava/util/List;\n 213: iload_3\n 214: iconst_0\n 215: invokestatic #98 // Method kotlin/coroutines/jvm/internal/Boxing.boxInt:(I)Ljava/lang/Integer;\n 218: invokeinterface #102, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 223: pop\n 224: aload_0\n 225: getfield #14 // Field $carry:Lkotlin/jvm/internal/Ref$IntRef;\n 228: iconst_1\n 229: putfield #69 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 232: goto 246\n 235: aload_0\n 236: getfield #14 // Field $carry:Lkotlin/jvm/internal/Ref$IntRef;\n 239: iconst_0\n 240: putfield #69 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 243: goto 44\n 246: iinc 3, 1\n 249: goto 123\n 252: getstatic #108 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 255: areturn\n 256: new #110 // class java/lang/IllegalStateException\n 259: dup\n 260: ldc #112 // String call to \\'resume\\' before \\'invoke\\' with coroutine\n 262: invokespecial #115 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 265: athrow\n\n public final kotlin.coroutines.Continuation<kotlin.Unit> create(java.lang.Object, kotlin.coroutines.Continuation<?>);\n Code:\n 0: new #2 // class MainKt$cartesianProduct$1\n 3: dup\n 4: aload_0\n 5: getfield #14 // Field $carry:Lkotlin/jvm/internal/Ref$IntRef;\n 8: aload_0\n 9: getfield #18 // Field $idx:Ljava/util/List;\n 12: aload_0\n 13: getfield #21 // Field $lengthArr:Ljava/util/List;\n 16: aload_2\n 17: invokespecial #124 // Method \"<init>\":(Lkotlin/jvm/internal/Ref$IntRef;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;)V\n 20: astore_3\n 21: aload_3\n 22: aload_1\n 23: putfield #62 // Field L$0:Ljava/lang/Object;\n 26: aload_3\n 27: checkcast #71 // class kotlin/coroutines/Continuation\n 30: areturn\n\n public final java.lang.Object invoke(kotlin.sequences.SequenceScope<? super java.util.List<java.lang.Integer>>, kotlin.coroutines.Continuation<? super kotlin.Unit>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokevirtual #130 // Method create:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;\n 6: checkcast #2 // class MainKt$cartesianProduct$1\n 9: getstatic #108 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 12: invokevirtual #132 // Method invokeSuspend:(Ljava/lang/Object;)Ljava/lang/Object;\n 15: areturn\n\n public java.lang.Object invoke(java.lang.Object, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #64 // class kotlin/sequences/SequenceScope\n 5: aload_2\n 6: checkcast #71 // class kotlin/coroutines/Continuation\n 9: invokevirtual #137 // Method invoke:(Lkotlin/sequences/SequenceScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 12: areturn\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$bytesToLinesSequence$1.class", "javap": "Compiled from \"main.kt\"\nfinal class MainKt$bytesToLinesSequence$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super byte[]>, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {\n java.lang.Object L$1;\n\n int I$0;\n\n int I$1;\n\n int I$2;\n\n int label;\n\n private java.lang.Object L$0;\n\n final byte[] $bytes;\n\n MainKt$bytesToLinesSequence$1(byte[], kotlin.coroutines.Continuation<? super MainKt$bytesToLinesSequence$1>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #14 // Field $bytes:[B\n 5: aload_0\n 6: iconst_2\n 7: aload_2\n 8: invokespecial #17 // Method kotlin/coroutines/jvm/internal/RestrictedSuspendLambda.\"<init>\":(ILkotlin/coroutines/Continuation;)V\n 11: return\n\n public final java.lang.Object invokeSuspend(java.lang.Object);\n Code:\n 0: invokestatic #56 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;\n 3: astore 9\n 5: aload_0\n 6: getfield #59 // Field label:I\n 9: tableswitch { // 0 to 4\n 0: 44\n 1: 120\n 2: 217\n 3: 344\n 4: 421\n default: 485\n }\n 44: aload_1\n 45: invokestatic #65 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 48: aload_0\n 49: getfield #67 // Field L$0:Ljava/lang/Object;\n 52: checkcast #69 // class kotlin/sequences/SequenceScope\n 55: astore_2\n 56: bipush 10\n 58: istore_3\n 59: bipush 13\n 61: istore 4\n 63: iconst_1\n 64: istore 5\n 66: aload_0\n 67: getfield #14 // Field $bytes:[B\n 70: aload_0\n 71: getfield #14 // Field $bytes:[B\n 74: invokestatic #75 // Method kotlin/collections/ArraysKt.getIndices:([B)Lkotlin/ranges/IntRange;\n 77: invokestatic #79 // Method kotlin/collections/ArraysKt.sliceArray:([BLkotlin/ranges/IntRange;)[B\n 80: astore 6\n 82: aload 6\n 84: iload_3\n 85: i2b\n 86: invokestatic #83 // Method kotlin/collections/ArraysKt.indexOf:([BB)I\n 89: istore 7\n 91: iload 7\n 93: ifge 129\n 96: aload_2\n 97: aload 6\n 99: aload_0\n 100: checkcast #85 // class kotlin/coroutines/Continuation\n 103: aload_0\n 104: iconst_1\n 105: putfield #59 // Field label:I\n 108: invokevirtual #89 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 111: dup\n 112: aload 9\n 114: if_acmpne 125\n 117: aload 9\n 119: areturn\n 120: aload_1\n 121: invokestatic #65 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 124: aload_1\n 125: pop\n 126: goto 481\n 129: iload 7\n 131: ifle 149\n 134: aload 6\n 136: iload 7\n 138: iconst_1\n 139: isub\n 140: baload\n 141: iload 4\n 143: if_icmpne 149\n 146: iconst_2\n 147: istore 5\n 149: aload_2\n 150: aload 6\n 152: new #91 // class kotlin/ranges/IntRange\n 155: dup\n 156: iconst_0\n 157: iload 7\n 159: iload 5\n 161: isub\n 162: invokespecial #94 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 165: invokestatic #79 // Method kotlin/collections/ArraysKt.sliceArray:([BLkotlin/ranges/IntRange;)[B\n 168: aload_0\n 169: checkcast #85 // class kotlin/coroutines/Continuation\n 172: aload_0\n 173: aload_2\n 174: putfield #67 // Field L$0:Ljava/lang/Object;\n 177: aload_0\n 178: aload 6\n 180: putfield #96 // Field L$1:Ljava/lang/Object;\n 183: aload_0\n 184: iload_3\n 185: putfield #98 // Field I$0:I\n 188: aload_0\n 189: iload 5\n 191: putfield #100 // Field I$1:I\n 194: aload_0\n 195: iload 7\n 197: putfield #102 // Field I$2:I\n 200: aload_0\n 201: iconst_2\n 202: putfield #59 // Field label:I\n 205: invokevirtual #89 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 208: dup\n 209: aload 9\n 211: if_acmpne 256\n 214: aload 9\n 216: areturn\n 217: aload_0\n 218: getfield #102 // Field I$2:I\n 221: istore 7\n 223: aload_0\n 224: getfield #100 // Field I$1:I\n 227: istore 5\n 229: aload_0\n 230: getfield #98 // Field I$0:I\n 233: istore_3\n 234: aload_0\n 235: getfield #96 // Field L$1:Ljava/lang/Object;\n 238: checkcast #103 // class \"[B\"\n 241: astore 6\n 243: aload_0\n 244: getfield #67 // Field L$0:Ljava/lang/Object;\n 247: checkcast #69 // class kotlin/sequences/SequenceScope\n 250: astore_2\n 251: aload_1\n 252: invokestatic #65 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 255: aload_1\n 256: pop\n 257: aload 6\n 259: iload 7\n 261: iconst_1\n 262: iadd\n 263: aload 6\n 265: arraylength\n 266: invokestatic #109 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 269: invokestatic #79 // Method kotlin/collections/ArraysKt.sliceArray:([BLkotlin/ranges/IntRange;)[B\n 272: astore 6\n 274: aload 6\n 276: arraylength\n 277: ifne 284\n 280: iconst_1\n 281: goto 285\n 284: iconst_0\n 285: ifne 292\n 288: iconst_1\n 289: goto 293\n 292: iconst_0\n 293: ifeq 481\n 296: aload 6\n 298: iload_3\n 299: i2b\n 300: invokestatic #83 // Method kotlin/collections/ArraysKt.indexOf:([BB)I\n 303: istore 8\n 305: iload 8\n 307: ifge 353\n 310: aload_2\n 311: aload 6\n 313: aload_0\n 314: checkcast #85 // class kotlin/coroutines/Continuation\n 317: aload_0\n 318: aconst_null\n 319: putfield #67 // Field L$0:Ljava/lang/Object;\n 322: aload_0\n 323: aconst_null\n 324: putfield #96 // Field L$1:Ljava/lang/Object;\n 327: aload_0\n 328: iconst_3\n 329: putfield #59 // Field label:I\n 332: invokevirtual #89 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 335: dup\n 336: aload 9\n 338: if_acmpne 349\n 341: aload 9\n 343: areturn\n 344: aload_1\n 345: invokestatic #65 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 348: aload_1\n 349: pop\n 350: goto 481\n 353: aload_2\n 354: aload 6\n 356: new #91 // class kotlin/ranges/IntRange\n 359: dup\n 360: iconst_0\n 361: iload 8\n 363: iload 5\n 365: isub\n 366: invokespecial #94 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 369: invokestatic #79 // Method kotlin/collections/ArraysKt.sliceArray:([BLkotlin/ranges/IntRange;)[B\n 372: aload_0\n 373: checkcast #85 // class kotlin/coroutines/Continuation\n 376: aload_0\n 377: aload_2\n 378: putfield #67 // Field L$0:Ljava/lang/Object;\n 381: aload_0\n 382: aload 6\n 384: putfield #96 // Field L$1:Ljava/lang/Object;\n 387: aload_0\n 388: iload_3\n 389: putfield #98 // Field I$0:I\n 392: aload_0\n 393: iload 5\n 395: putfield #100 // Field I$1:I\n 398: aload_0\n 399: iload 8\n 401: putfield #102 // Field I$2:I\n 404: aload_0\n 405: iconst_4\n 406: putfield #59 // Field label:I\n 409: invokevirtual #89 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 412: dup\n 413: aload 9\n 415: if_acmpne 460\n 418: aload 9\n 420: areturn\n 421: aload_0\n 422: getfield #102 // Field I$2:I\n 425: istore 8\n 427: aload_0\n 428: getfield #100 // Field I$1:I\n 431: istore 5\n 433: aload_0\n 434: getfield #98 // Field I$0:I\n 437: istore_3\n 438: aload_0\n 439: getfield #96 // Field L$1:Ljava/lang/Object;\n 442: checkcast #103 // class \"[B\"\n 445: astore 6\n 447: aload_0\n 448: getfield #67 // Field L$0:Ljava/lang/Object;\n 451: checkcast #69 // class kotlin/sequences/SequenceScope\n 454: astore_2\n 455: aload_1\n 456: invokestatic #65 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 459: aload_1\n 460: pop\n 461: aload 6\n 463: iload 8\n 465: iconst_1\n 466: iadd\n 467: aload 6\n 469: arraylength\n 470: invokestatic #109 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 473: invokestatic #79 // Method kotlin/collections/ArraysKt.sliceArray:([BLkotlin/ranges/IntRange;)[B\n 476: astore 6\n 478: goto 274\n 481: getstatic #115 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 484: areturn\n 485: new #117 // class java/lang/IllegalStateException\n 488: dup\n 489: ldc #119 // String call to \\'resume\\' before \\'invoke\\' with coroutine\n 491: invokespecial #122 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 494: athrow\n\n public final kotlin.coroutines.Continuation<kotlin.Unit> create(java.lang.Object, kotlin.coroutines.Continuation<?>);\n Code:\n 0: new #2 // class MainKt$bytesToLinesSequence$1\n 3: dup\n 4: aload_0\n 5: getfield #14 // Field $bytes:[B\n 8: aload_2\n 9: invokespecial #133 // Method \"<init>\":([BLkotlin/coroutines/Continuation;)V\n 12: astore_3\n 13: aload_3\n 14: aload_1\n 15: putfield #67 // Field L$0:Ljava/lang/Object;\n 18: aload_3\n 19: checkcast #85 // class kotlin/coroutines/Continuation\n 22: areturn\n\n public final java.lang.Object invoke(kotlin.sequences.SequenceScope<? super byte[]>, kotlin.coroutines.Continuation<? super kotlin.Unit>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokevirtual #139 // Method create:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;\n 6: checkcast #2 // class MainKt$bytesToLinesSequence$1\n 9: getstatic #115 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 12: invokevirtual #141 // Method invokeSuspend:(Ljava/lang/Object;)Ljava/lang/Object;\n 15: areturn\n\n public java.lang.Object invoke(java.lang.Object, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #69 // class kotlin/sequences/SequenceScope\n 5: aload_2\n 6: checkcast #85 // class kotlin/coroutines/Continuation\n 9: invokevirtual #146 // Method invoke:(Lkotlin/sequences/SequenceScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 12: areturn\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$prob13b$$inlined$sortedByDescending$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class MainKt$prob13b$$inlined$sortedByDescending$1<T> implements java.util.Comparator {\n public MainKt$prob13b$$inlined$sortedByDescending$1();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_2\n 1: checkcast #23 // class kotlin/Pair\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 12: checkcast #29 // class java/lang/Number\n 15: invokevirtual #33 // Method java/lang/Number.longValue:()J\n 18: lstore 5\n 20: lload 5\n 22: invokestatic #39 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 25: checkcast #41 // class java/lang/Comparable\n 28: aload_1\n 29: checkcast #23 // class kotlin/Pair\n 32: astore_3\n 33: astore 7\n 35: iconst_0\n 36: istore 4\n 38: aload_3\n 39: invokevirtual #27 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 42: checkcast #29 // class java/lang/Number\n 45: invokevirtual #33 // Method java/lang/Number.longValue:()J\n 48: lstore 5\n 50: lload 5\n 52: invokestatic #39 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 55: aload 7\n 57: swap\n 58: checkcast #41 // class java/lang/Comparable\n 61: invokestatic #47 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 64: ireturn\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$getResourceAsText$1.class", "javap": "Compiled from \"main.kt\"\npublic final class MainKt$getResourceAsText$1 {\n MainKt$getResourceAsText$1();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$problem2a$valid$2.class", "javap": "Compiled from \"main.kt\"\nfinal class MainKt$problem2a$valid$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function4<java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.Boolean> {\n public static final MainKt$problem2a$valid$2 INSTANCE;\n\n MainKt$problem2a$valid$2();\n Code:\n 0: aload_0\n 1: iconst_4\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String isValidB\n 6: ldc #15 // String problem2a$isValidB(IILjava/lang/String;Ljava/lang/String;)Z\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final java.lang.Boolean invoke(int, int, java.lang.String, java.lang.String);\n Code:\n 0: aload_3\n 1: ldc #24 // String p2\n 3: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload 4\n 8: ldc #32 // String p3\n 10: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 13: iload_1\n 14: iload_2\n 15: aload_3\n 16: aload 4\n 18: invokestatic #38 // Method MainKt.access$problem2a$isValidB:(IILjava/lang/String;Ljava/lang/String;)Z\n 21: invokestatic #44 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;\n 24: areturn\n\n public java.lang.Object invoke(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #51 // class java/lang/Number\n 5: invokevirtual #55 // Method java/lang/Number.intValue:()I\n 8: aload_2\n 9: checkcast #51 // class java/lang/Number\n 12: invokevirtual #55 // Method java/lang/Number.intValue:()I\n 15: aload_3\n 16: checkcast #57 // class java/lang/String\n 19: aload 4\n 21: checkcast #57 // class java/lang/String\n 24: invokevirtual #59 // Method invoke:(IILjava/lang/String;Ljava/lang/String;)Ljava/lang/Boolean;\n 27: areturn\n\n static {};\n Code:\n 0: new #2 // class MainKt$problem2a$valid$2\n 3: dup\n 4: invokespecial #64 // Method \"<init>\":()V\n 7: putstatic #67 // Field INSTANCE:LMainKt$problem2a$valid$2;\n 10: return\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt.class", "javap": "Compiled from \"main.kt\"\npublic final class MainKt {\n public static final java.lang.String getResourceAsText(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #9 // String path\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #17 // class MainKt$getResourceAsText$1\n 9: dup\n 10: invokespecial #21 // Method MainKt$getResourceAsText$1.\"<init>\":()V\n 13: invokevirtual #25 // Method java/lang/Object.getClass:()Ljava/lang/Class;\n 16: aload_0\n 17: invokevirtual #31 // Method java/lang/Class.getResource:(Ljava/lang/String;)Ljava/net/URL;\n 20: dup\n 21: ifnull 46\n 24: astore_1\n 25: getstatic #37 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;\n 28: astore_2\n 29: aload_1\n 30: invokestatic #43 // Method kotlin/io/TextStreamsKt.readBytes:(Ljava/net/URL;)[B\n 33: astore_3\n 34: new #45 // class java/lang/String\n 37: dup\n 38: aload_3\n 39: aload_2\n 40: invokespecial #48 // Method java/lang/String.\"<init>\":([BLjava/nio/charset/Charset;)V\n 43: goto 57\n 46: pop\n 47: new #50 // class java/lang/Exception\n 50: dup\n 51: ldc #52 // String Unable to read file\n 53: invokespecial #55 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 56: athrow\n 57: areturn\n\n public static final byte[] getResourceAsBytes(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #9 // String path\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #66 // class MainKt$getResourceAsBytes$1\n 9: dup\n 10: invokespecial #67 // Method MainKt$getResourceAsBytes$1.\"<init>\":()V\n 13: invokevirtual #25 // Method java/lang/Object.getClass:()Ljava/lang/Class;\n 16: aload_0\n 17: invokevirtual #31 // Method java/lang/Class.getResource:(Ljava/lang/String;)Ljava/net/URL;\n 20: dup\n 21: ifnull 31\n 24: invokestatic #43 // Method kotlin/io/TextStreamsKt.readBytes:(Ljava/net/URL;)[B\n 27: dup\n 28: ifnonnull 42\n 31: pop\n 32: new #50 // class java/lang/Exception\n 35: dup\n 36: ldc #52 // String Unable to read file\n 38: invokespecial #55 // Method java/lang/Exception.\"<init>\":(Ljava/lang/String;)V\n 41: athrow\n 42: areturn\n\n public static final kotlin.sequences.Sequence<java.lang.Integer> getResourceAsInts(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #9 // String path\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 10: checkcast #74 // class java/lang/CharSequence\n 13: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 16: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 19: checkcast #74 // class java/lang/CharSequence\n 22: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 25: invokedynamic #108, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 30: invokestatic #114 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 33: areturn\n\n public static final kotlin.sequences.Sequence<java.lang.Long> getResourceAsLongs(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #9 // String path\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 10: checkcast #74 // class java/lang/CharSequence\n 13: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 16: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 19: checkcast #74 // class java/lang/CharSequence\n 22: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 25: invokedynamic #124, 0 // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;\n 30: invokestatic #114 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 33: areturn\n\n public static final kotlin.Pair<java.lang.Long, java.util.List<java.lang.Long>> problem1a(kotlin.sequences.Sequence<java.lang.Long>, long);\n Code:\n 0: aload_0\n 1: ldc #130 // String expenses\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #132 // class java/util/LinkedHashSet\n 9: dup\n 10: invokespecial #133 // Method java/util/LinkedHashSet.\"<init>\":()V\n 13: checkcast #135 // class java/util/Set\n 16: astore_3\n 17: aload_0\n 18: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 23: astore 4\n 25: aload 4\n 27: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 32: ifeq 137\n 35: aload 4\n 37: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 42: checkcast #153 // class java/lang/Number\n 45: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 48: lstore 5\n 50: aload_3\n 51: lload_1\n 52: lload 5\n 54: lsub\n 55: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 58: invokeinterface #167, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 63: ifeq 115\n 66: new #169 // class kotlin/Pair\n 69: dup\n 70: lload_1\n 71: lload 5\n 73: lsub\n 74: lload 5\n 76: lmul\n 77: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 80: iconst_2\n 81: anewarray #159 // class java/lang/Long\n 84: astore 7\n 86: aload 7\n 88: iconst_0\n 89: lload_1\n 90: lload 5\n 92: lsub\n 93: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 96: aastore\n 97: aload 7\n 99: iconst_1\n 100: lload 5\n 102: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 105: aastore\n 106: aload 7\n 108: invokestatic #175 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 111: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 114: areturn\n 115: lload 5\n 117: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 120: astore 8\n 122: aload_3\n 123: checkcast #180 // class java/util/Collection\n 126: aload 8\n 128: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 133: pop\n 134: goto 25\n 137: aconst_null\n 138: areturn\n\n public static kotlin.Pair problem1a$default(kotlin.sequences.Sequence, long, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_1\n 2: iand\n 3: ifeq 12\n 6: ldc #193 // String 1.txt\n 8: invokestatic #195 // Method getResourceAsLongs:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 11: astore_0\n 12: iload_3\n 13: iconst_2\n 14: iand\n 15: ifeq 22\n 18: ldc2_w #196 // long 2020l\n 21: lstore_1\n 22: aload_0\n 23: lload_1\n 24: invokestatic #199 // Method problem1a:(Lkotlin/sequences/Sequence;J)Lkotlin/Pair;\n 27: areturn\n\n public static final kotlin.Pair<java.lang.Integer, java.util.List<java.lang.Integer>> problem1b();\n Code:\n 0: sipush 2020\n 3: istore_0\n 4: ldc #193 // String 1.txt\n 6: invokestatic #204 // Method getResourceAsInts:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 9: astore_1\n 10: new #132 // class java/util/LinkedHashSet\n 13: dup\n 14: invokespecial #133 // Method java/util/LinkedHashSet.\"<init>\":()V\n 17: checkcast #135 // class java/util/Set\n 20: astore_2\n 21: aload_1\n 22: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 27: astore_3\n 28: aload_3\n 29: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 34: ifeq 192\n 37: aload_3\n 38: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 43: checkcast #153 // class java/lang/Number\n 46: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 49: istore 4\n 51: aload_2\n 52: invokeinterface #209, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 57: astore 5\n 59: aload 5\n 61: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 66: ifeq 170\n 69: aload 5\n 71: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 76: checkcast #153 // class java/lang/Number\n 79: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 82: istore 6\n 84: aload_2\n 85: iload_0\n 86: iload 4\n 88: iload 6\n 90: iadd\n 91: isub\n 92: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 95: invokeinterface #167, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 100: ifeq 59\n 103: new #169 // class kotlin/Pair\n 106: dup\n 107: iload 4\n 109: iload 6\n 111: imul\n 112: iload_0\n 113: iload 4\n 115: iload 6\n 117: iadd\n 118: isub\n 119: imul\n 120: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 123: iconst_3\n 124: anewarray #211 // class java/lang/Integer\n 127: astore 7\n 129: aload 7\n 131: iconst_0\n 132: iload 4\n 134: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 137: aastore\n 138: aload 7\n 140: iconst_1\n 141: iload 6\n 143: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 146: aastore\n 147: aload 7\n 149: iconst_2\n 150: iload_0\n 151: iload 4\n 153: iload 6\n 155: iadd\n 156: isub\n 157: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 160: aastore\n 161: aload 7\n 163: invokestatic #175 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 166: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 169: areturn\n 170: iload 4\n 172: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 175: astore 6\n 177: aload_2\n 178: checkcast #180 // class java/util/Collection\n 181: aload 6\n 183: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 188: pop\n 189: goto 28\n 192: aconst_null\n 193: areturn\n\n public static final int problem2a(boolean);\n Code:\n 0: new #220 // class kotlin/text/Regex\n 3: dup\n 4: ldc #222 // String ([0-9]+)-([0-9]+) (.): (.+)\n 6: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 9: astore_1\n 10: iload_0\n 11: ifeq 23\n 14: getstatic #229 // Field MainKt$problem2a$valid$1.INSTANCE:LMainKt$problem2a$valid$1;\n 17: checkcast #231 // class kotlin/reflect/KFunction\n 20: goto 29\n 23: getstatic #236 // Field MainKt$problem2a$valid$2.INSTANCE:LMainKt$problem2a$valid$2;\n 26: checkcast #231 // class kotlin/reflect/KFunction\n 29: astore_2\n 30: ldc #238 // String 2.txt\n 32: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 35: astore_3\n 36: aload_3\n 37: checkcast #74 // class java/lang/CharSequence\n 40: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 43: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 46: checkcast #74 // class java/lang/CharSequence\n 49: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 52: aload_1\n 53: invokedynamic #248, 0 // InvokeDynamic #2:invoke:(Lkotlin/text/Regex;)Lkotlin/jvm/functions/Function1;\n 58: invokestatic #251 // Method kotlin/sequences/SequencesKt.mapNotNull:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 61: aload_2\n 62: invokedynamic #261, 0 // InvokeDynamic #3:invoke:(Lkotlin/reflect/KFunction;)Lkotlin/jvm/functions/Function1;\n 67: invokestatic #264 // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 70: invokestatic #268 // Method kotlin/sequences/SequencesKt.count:(Lkotlin/sequences/Sequence;)I\n 73: ireturn\n\n public static final int problem3a(int, int);\n Code:\n 0: ldc_w #279 // String 3.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: invokestatic #283 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;\n 21: astore_2\n 22: aload_2\n 23: iconst_0\n 24: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 29: checkcast #45 // class java/lang/String\n 32: invokevirtual #292 // Method java/lang/String.length:()I\n 35: istore_3\n 36: bipush 35\n 38: istore 4\n 40: iconst_0\n 41: istore 5\n 43: iconst_0\n 44: istore 6\n 46: iconst_0\n 47: istore 7\n 49: iload 6\n 51: aload_2\n 52: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 57: if_icmpge 108\n 60: iload 5\n 62: aload_2\n 63: iload 6\n 65: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 70: checkcast #45 // class java/lang/String\n 73: iload 7\n 75: iload_3\n 76: irem\n 77: invokevirtual #299 // Method java/lang/String.charAt:(I)C\n 80: iload 4\n 82: if_icmpne 89\n 85: iconst_1\n 86: goto 90\n 89: iconst_0\n 90: iadd\n 91: istore 5\n 93: iload 6\n 95: iload_1\n 96: iadd\n 97: istore 6\n 99: iload 7\n 101: iload_0\n 102: iadd\n 103: istore 7\n 105: goto 49\n 108: iload 5\n 110: ireturn\n\n public static final long problem3b();\n Code:\n 0: iconst_5\n 1: anewarray #211 // class java/lang/Integer\n 4: astore_0\n 5: aload_0\n 6: iconst_0\n 7: iconst_1\n 8: iconst_1\n 9: invokestatic #311 // Method problem3a:(II)I\n 12: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 15: aastore\n 16: aload_0\n 17: iconst_1\n 18: iconst_3\n 19: iconst_1\n 20: invokestatic #311 // Method problem3a:(II)I\n 23: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 26: aastore\n 27: aload_0\n 28: iconst_2\n 29: iconst_5\n 30: iconst_1\n 31: invokestatic #311 // Method problem3a:(II)I\n 34: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 37: aastore\n 38: aload_0\n 39: iconst_3\n 40: bipush 7\n 42: iconst_1\n 43: invokestatic #311 // Method problem3a:(II)I\n 46: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 49: aastore\n 50: aload_0\n 51: iconst_4\n 52: iconst_1\n 53: iconst_2\n 54: invokestatic #311 // Method problem3a:(II)I\n 57: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 60: aastore\n 61: aload_0\n 62: invokestatic #175 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 65: checkcast #313 // class java/lang/Iterable\n 68: astore_0\n 69: lconst_1\n 70: lstore_1\n 71: iconst_0\n 72: istore_3\n 73: lload_1\n 74: lstore 4\n 76: aload_0\n 77: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 82: astore 6\n 84: aload 6\n 86: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 91: ifeq 131\n 94: aload 6\n 96: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 101: astore 7\n 103: lload 4\n 105: aload 7\n 107: checkcast #153 // class java/lang/Number\n 110: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 113: istore 8\n 115: lstore 9\n 117: iconst_0\n 118: istore 11\n 120: lload 9\n 122: iload 8\n 124: i2l\n 125: lmul\n 126: lstore 4\n 128: goto 84\n 131: lload 4\n 133: lreturn\n\n public static final int problem4a();\n Code:\n 0: ldc_w #327 // String 4.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: iconst_1\n 19: anewarray #45 // class java/lang/String\n 22: astore_1\n 23: aload_1\n 24: iconst_0\n 25: ldc_w #329 // String \\n\\n\n 28: aastore\n 29: aload_1\n 30: iconst_0\n 31: iconst_0\n 32: bipush 6\n 34: aconst_null\n 35: invokestatic #333 // Method kotlin/text/StringsKt.splitToSequence$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 38: astore_0\n 39: aload_0\n 40: invokedynamic #340, 0 // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function1;\n 45: invokestatic #114 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 48: astore_1\n 49: aload_1\n 50: astore_2\n 51: iconst_0\n 52: istore_3\n 53: iconst_0\n 54: istore 4\n 56: aload_2\n 57: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 62: astore 5\n 64: aload 5\n 66: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 71: ifeq 182\n 74: aload 5\n 76: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 81: astore 6\n 83: aload 6\n 85: checkcast #135 // class java/util/Set\n 88: astore 7\n 90: iconst_0\n 91: istore 8\n 93: aload 7\n 95: bipush 7\n 97: anewarray #45 // class java/lang/String\n 100: astore 9\n 102: aload 9\n 104: iconst_0\n 105: ldc_w #342 // String byr\n 108: aastore\n 109: aload 9\n 111: iconst_1\n 112: ldc_w #344 // String iyr\n 115: aastore\n 116: aload 9\n 118: iconst_2\n 119: ldc_w #346 // String eyr\n 122: aastore\n 123: aload 9\n 125: iconst_3\n 126: ldc_w #348 // String hgt\n 129: aastore\n 130: aload 9\n 132: iconst_4\n 133: ldc_w #350 // String hcl\n 136: aastore\n 137: aload 9\n 139: iconst_5\n 140: ldc_w #352 // String ecl\n 143: aastore\n 144: aload 9\n 146: bipush 6\n 148: ldc_w #354 // String pid\n 151: aastore\n 152: aload 9\n 154: invokestatic #175 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 157: checkcast #180 // class java/util/Collection\n 160: invokeinterface #358, 2 // InterfaceMethod java/util/Set.containsAll:(Ljava/util/Collection;)Z\n 165: ifeq 64\n 168: iinc 4, 1\n 171: iload 4\n 173: ifge 64\n 176: invokestatic #361 // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V\n 179: goto 64\n 182: iload 4\n 184: ireturn\n\n public static final <T> kotlin.Pair<T, T> listToPair(java.util.List<? extends T>);\n Code:\n 0: aload_0\n 1: ldc_w #372 // String l\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: new #169 // class kotlin/Pair\n 10: dup\n 11: aload_0\n 12: iconst_0\n 13: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 18: aload_0\n 19: iconst_1\n 20: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 25: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 28: areturn\n\n public static final int problem4b();\n Code:\n 0: bipush 7\n 2: anewarray #45 // class java/lang/String\n 5: astore_1\n 6: aload_1\n 7: iconst_0\n 8: ldc_w #342 // String byr\n 11: aastore\n 12: aload_1\n 13: iconst_1\n 14: ldc_w #344 // String iyr\n 17: aastore\n 18: aload_1\n 19: iconst_2\n 20: ldc_w #346 // String eyr\n 23: aastore\n 24: aload_1\n 25: iconst_3\n 26: ldc_w #348 // String hgt\n 29: aastore\n 30: aload_1\n 31: iconst_4\n 32: ldc_w #350 // String hcl\n 35: aastore\n 36: aload_1\n 37: iconst_5\n 38: ldc_w #352 // String ecl\n 41: aastore\n 42: aload_1\n 43: bipush 6\n 45: ldc_w #354 // String pid\n 48: aastore\n 49: aload_1\n 50: invokestatic #175 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 53: astore_0\n 54: bipush 7\n 56: anewarray #45 // class java/lang/String\n 59: astore_2\n 60: aload_2\n 61: iconst_0\n 62: ldc_w #375 // String amb\n 65: aastore\n 66: aload_2\n 67: iconst_1\n 68: ldc_w #377 // String blu\n 71: aastore\n 72: aload_2\n 73: iconst_2\n 74: ldc_w #379 // String brn\n 77: aastore\n 78: aload_2\n 79: iconst_3\n 80: ldc_w #381 // String gry\n 83: aastore\n 84: aload_2\n 85: iconst_4\n 86: ldc_w #383 // String grn\n 89: aastore\n 90: aload_2\n 91: iconst_5\n 92: ldc_w #385 // String hzl\n 95: aastore\n 96: aload_2\n 97: bipush 6\n 99: ldc_w #387 // String oth\n 102: aastore\n 103: aload_2\n 104: invokestatic #393 // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;\n 107: astore_1\n 108: ldc_w #327 // String 4.txt\n 111: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 114: checkcast #74 // class java/lang/CharSequence\n 117: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 120: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 123: checkcast #74 // class java/lang/CharSequence\n 126: iconst_1\n 127: anewarray #45 // class java/lang/String\n 130: astore_3\n 131: aload_3\n 132: iconst_0\n 133: ldc_w #329 // String \\n\\n\n 136: aastore\n 137: aload_3\n 138: iconst_0\n 139: iconst_0\n 140: bipush 6\n 142: aconst_null\n 143: invokestatic #333 // Method kotlin/text/StringsKt.splitToSequence$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 146: astore_2\n 147: aload_2\n 148: invokedynamic #400, 0 // InvokeDynamic #5:invoke:()Lkotlin/jvm/functions/Function1;\n 153: invokestatic #114 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 156: astore_3\n 157: aload_3\n 158: aload_0\n 159: invokedynamic #410, 0 // InvokeDynamic #6:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function1;\n 164: invokestatic #264 // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 167: astore 4\n 169: aload 4\n 171: astore 5\n 173: iconst_0\n 174: istore 6\n 176: iconst_0\n 177: istore 7\n 179: aload 5\n 181: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 186: astore 8\n 188: aload 8\n 190: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 195: ifeq 240\n 198: aload 8\n 200: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 205: astore 9\n 207: aload 9\n 209: checkcast #412 // class java/util/Map\n 212: astore 10\n 214: iconst_0\n 215: istore 11\n 217: aload_1\n 218: aload 10\n 220: invokestatic #416 // Method problem4b$isValid$12:(Ljava/util/Set;Ljava/util/Map;)Z\n 223: ifeq 188\n 226: iinc 7, 1\n 229: iload 7\n 231: ifge 188\n 234: invokestatic #361 // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V\n 237: goto 188\n 240: iload 7\n 242: ireturn\n\n public static final int strToBinary(java.lang.String, char);\n Code:\n 0: aload_0\n 1: ldc_w #427 // String s\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: invokevirtual #431 // Method java/lang/String.toCharArray:()[C\n 11: dup\n 12: ldc_w #433 // String toCharArray(...)\n 15: invokestatic #436 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 18: astore_2\n 19: iconst_0\n 20: istore_3\n 21: iconst_0\n 22: istore 4\n 24: iload_3\n 25: istore 5\n 27: iconst_0\n 28: istore 6\n 30: aload_2\n 31: arraylength\n 32: istore 7\n 34: iload 6\n 36: iload 7\n 38: if_icmpge 82\n 41: aload_2\n 42: iload 6\n 44: caload\n 45: istore 8\n 47: iload 5\n 49: iload 8\n 51: istore 9\n 53: istore 10\n 55: iconst_0\n 56: istore 11\n 58: iload 10\n 60: iconst_1\n 61: ishl\n 62: iload 9\n 64: iload_1\n 65: if_icmpne 72\n 68: iconst_0\n 69: goto 73\n 72: iconst_1\n 73: iadd\n 74: istore 5\n 76: iinc 6, 1\n 79: goto 34\n 82: iload 5\n 84: ireturn\n\n public static final int problem5a();\n Code:\n 0: ldc_w #443 // String 5.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 21: astore_0\n 22: aload_0\n 23: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 28: astore_1\n 29: aload_1\n 30: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 35: ifne 42\n 38: aconst_null\n 39: goto 156\n 42: aload_1\n 43: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 48: checkcast #45 // class java/lang/String\n 51: astore_2\n 52: iconst_0\n 53: istore_3\n 54: aload_2\n 55: bipush 7\n 57: invokestatic #447 // Method kotlin/text/StringsKt.take:(Ljava/lang/String;I)Ljava/lang/String;\n 60: bipush 70\n 62: invokestatic #449 // Method strToBinary:(Ljava/lang/String;C)I\n 65: bipush 8\n 67: imul\n 68: aload_2\n 69: iconst_3\n 70: invokestatic #452 // Method kotlin/text/StringsKt.takeLast:(Ljava/lang/String;I)Ljava/lang/String;\n 73: bipush 76\n 75: invokestatic #449 // Method strToBinary:(Ljava/lang/String;C)I\n 78: iadd\n 79: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 82: checkcast #454 // class java/lang/Comparable\n 85: astore_2\n 86: aload_1\n 87: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 92: ifeq 155\n 95: aload_1\n 96: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 101: checkcast #45 // class java/lang/String\n 104: astore_3\n 105: iconst_0\n 106: istore 4\n 108: aload_3\n 109: bipush 7\n 111: invokestatic #447 // Method kotlin/text/StringsKt.take:(Ljava/lang/String;I)Ljava/lang/String;\n 114: bipush 70\n 116: invokestatic #449 // Method strToBinary:(Ljava/lang/String;C)I\n 119: bipush 8\n 121: imul\n 122: aload_3\n 123: iconst_3\n 124: invokestatic #452 // Method kotlin/text/StringsKt.takeLast:(Ljava/lang/String;I)Ljava/lang/String;\n 127: bipush 76\n 129: invokestatic #449 // Method strToBinary:(Ljava/lang/String;C)I\n 132: iadd\n 133: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 136: checkcast #454 // class java/lang/Comparable\n 139: astore_3\n 140: aload_2\n 141: aload_3\n 142: invokeinterface #458, 2 // InterfaceMethod java/lang/Comparable.compareTo:(Ljava/lang/Object;)I\n 147: ifge 86\n 150: aload_3\n 151: astore_2\n 152: goto 86\n 155: aload_2\n 156: dup\n 157: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 160: checkcast #153 // class java/lang/Number\n 163: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 166: ireturn\n\n public static final int problem5b();\n Code:\n 0: ldc_w #443 // String 5.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 21: astore_0\n 22: aload_0\n 23: invokedynamic #469, 0 // InvokeDynamic #7:invoke:()Lkotlin/jvm/functions/Function1;\n 28: invokestatic #114 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 31: invokestatic #473 // Method kotlin/sequences/SequencesKt.sorted:(Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;\n 34: astore_1\n 35: aload_1\n 36: invokestatic #476 // Method kotlin/sequences/SequencesKt.zipWithNext:(Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;\n 39: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 44: astore_2\n 45: aload_2\n 46: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 102\n 54: aload_2\n 55: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 60: checkcast #169 // class kotlin/Pair\n 63: astore_3\n 64: aload_3\n 65: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 68: checkcast #153 // class java/lang/Number\n 71: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 74: istore 4\n 76: aload_3\n 77: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 80: checkcast #153 // class java/lang/Number\n 83: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 86: istore 5\n 88: iload 4\n 90: iconst_1\n 91: iadd\n 92: iload 5\n 94: if_icmpeq 45\n 97: iload 4\n 99: iconst_1\n 100: iadd\n 101: ireturn\n 102: iconst_m1\n 103: ireturn\n\n public static final int problem6a();\n Code:\n 0: ldc_w #486 // String 6.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: iconst_1\n 19: anewarray #45 // class java/lang/String\n 22: astore_1\n 23: aload_1\n 24: iconst_0\n 25: ldc_w #329 // String \\n\\n\n 28: aastore\n 29: aload_1\n 30: iconst_0\n 31: iconst_0\n 32: bipush 6\n 34: aconst_null\n 35: invokestatic #333 // Method kotlin/text/StringsKt.splitToSequence$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 38: astore_0\n 39: aload_0\n 40: astore_1\n 41: iconst_0\n 42: istore_2\n 43: aload_1\n 44: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 49: astore_3\n 50: aload_3\n 51: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 56: ifeq 116\n 59: aload_3\n 60: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 65: astore 4\n 67: iload_2\n 68: aload 4\n 70: checkcast #45 // class java/lang/String\n 73: astore 5\n 75: istore 7\n 77: iconst_0\n 78: istore 6\n 80: aload 5\n 82: ldc_w #488 // String \\n\n 85: ldc_w #490 // String\n 88: iconst_0\n 89: iconst_4\n 90: aconst_null\n 91: invokestatic #494 // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;\n 94: checkcast #74 // class java/lang/CharSequence\n 97: invokestatic #498 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;\n 100: invokeinterface #499, 1 // InterfaceMethod java/util/Set.size:()I\n 105: istore 8\n 107: iload 7\n 109: iload 8\n 111: iadd\n 112: istore_2\n 113: goto 50\n 116: iload_2\n 117: ireturn\n\n public static final int problem6b();\n Code:\n 0: ldc_w #486 // String 6.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: iconst_1\n 19: anewarray #45 // class java/lang/String\n 22: astore_1\n 23: aload_1\n 24: iconst_0\n 25: ldc_w #329 // String \\n\\n\n 28: aastore\n 29: aload_1\n 30: iconst_0\n 31: iconst_0\n 32: bipush 6\n 34: aconst_null\n 35: invokestatic #333 // Method kotlin/text/StringsKt.splitToSequence$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 38: astore_0\n 39: aload_0\n 40: astore_1\n 41: iconst_0\n 42: istore_2\n 43: aload_1\n 44: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 49: astore_3\n 50: aload_3\n 51: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 56: ifeq 232\n 59: aload_3\n 60: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 65: astore 4\n 67: iload_2\n 68: aload 4\n 70: checkcast #45 // class java/lang/String\n 73: astore 5\n 75: istore 14\n 77: iconst_0\n 78: istore 6\n 80: aload 5\n 82: checkcast #74 // class java/lang/CharSequence\n 85: iconst_1\n 86: anewarray #45 // class java/lang/String\n 89: astore 7\n 91: aload 7\n 93: iconst_0\n 94: ldc_w #488 // String \\n\n 97: aastore\n 98: aload 7\n 100: iconst_0\n 101: iconst_0\n 102: bipush 6\n 104: aconst_null\n 105: invokestatic #333 // Method kotlin/text/StringsKt.splitToSequence$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 108: invokedynamic #507, 0 // InvokeDynamic #8:invoke:()Lkotlin/jvm/functions/Function1;\n 113: invokestatic #114 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 116: astore 7\n 118: nop\n 119: iconst_0\n 120: istore 8\n 122: aload 7\n 124: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 129: astore 9\n 131: aload 9\n 133: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 138: ifne 152\n 141: new #509 // class java/lang/UnsupportedOperationException\n 144: dup\n 145: ldc_w #511 // String Empty sequence can\\'t be reduced.\n 148: invokespecial #512 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 151: athrow\n 152: aload 9\n 154: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 159: astore 10\n 161: aload 9\n 163: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 168: ifeq 211\n 171: aload 10\n 173: aload 9\n 175: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 180: checkcast #135 // class java/util/Set\n 183: astore 11\n 185: checkcast #135 // class java/util/Set\n 188: astore 12\n 190: iconst_0\n 191: istore 13\n 193: aload 12\n 195: checkcast #313 // class java/lang/Iterable\n 198: aload 11\n 200: checkcast #313 // class java/lang/Iterable\n 203: invokestatic #516 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 206: astore 10\n 208: goto 161\n 211: aload 10\n 213: checkcast #135 // class java/util/Set\n 216: invokeinterface #499, 1 // InterfaceMethod java/util/Set.size:()I\n 221: istore 15\n 223: iload 14\n 225: iload 15\n 227: iadd\n 228: istore_2\n 229: goto 50\n 232: iload_2\n 233: ireturn\n\n public static final int problem7a();\n Code:\n 0: ldc_w #525 // String 7.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 21: getstatic #530 // Field MainKt$problem7a$innerToOuters$1.INSTANCE:LMainKt$problem7a$innerToOuters$1;\n 24: checkcast #532 // class kotlin/jvm/functions/Function1\n 27: invokestatic #535 // Method kotlin/sequences/SequencesKt.flatMap:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 30: astore_1\n 31: iconst_0\n 32: istore_2\n 33: aload_1\n 34: astore_3\n 35: new #537 // class java/util/LinkedHashMap\n 38: dup\n 39: invokespecial #538 // Method java/util/LinkedHashMap.\"<init>\":()V\n 42: checkcast #412 // class java/util/Map\n 45: astore 4\n 47: iconst_0\n 48: istore 5\n 50: aload_3\n 51: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 56: astore 6\n 58: aload 6\n 60: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 65: ifeq 194\n 68: aload 6\n 70: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 75: astore 7\n 77: aload 7\n 79: checkcast #169 // class kotlin/Pair\n 82: astore 8\n 84: iconst_0\n 85: istore 9\n 87: aload 8\n 89: invokevirtual #541 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 92: checkcast #45 // class java/lang/String\n 95: astore 10\n 97: aload 4\n 99: astore 11\n 101: iconst_0\n 102: istore 12\n 104: aload 11\n 106: aload 10\n 108: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 113: astore 13\n 115: aload 13\n 117: ifnonnull 152\n 120: iconst_0\n 121: istore 14\n 123: new #545 // class java/util/ArrayList\n 126: dup\n 127: invokespecial #546 // Method java/util/ArrayList.\"<init>\":()V\n 130: checkcast #285 // class java/util/List\n 133: astore 14\n 135: aload 11\n 137: aload 10\n 139: aload 14\n 141: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 146: pop\n 147: aload 14\n 149: goto 154\n 152: aload 13\n 154: nop\n 155: checkcast #285 // class java/util/List\n 158: astore 8\n 160: aload 8\n 162: aload 7\n 164: checkcast #169 // class kotlin/Pair\n 167: astore 9\n 169: astore 16\n 171: iconst_0\n 172: istore 15\n 174: aload 9\n 176: invokevirtual #553 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 179: checkcast #45 // class java/lang/String\n 182: aload 16\n 184: swap\n 185: invokeinterface #554, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 190: pop\n 191: goto 58\n 194: aload 4\n 196: nop\n 197: astore_0\n 198: new #132 // class java/util/LinkedHashSet\n 201: dup\n 202: invokespecial #133 // Method java/util/LinkedHashSet.\"<init>\":()V\n 205: checkcast #135 // class java/util/Set\n 208: astore_1\n 209: aload_0\n 210: aload_1\n 211: ldc_w #556 // String shiny gold\n 214: invokestatic #560 // Method problem7a$recur:(Ljava/util/Map;Ljava/util/Set;Ljava/lang/String;)V\n 217: aload_1\n 218: invokeinterface #499, 1 // InterfaceMethod java/util/Set.size:()I\n 223: ireturn\n\n public static final int problem7b();\n Code:\n 0: ldc_w #525 // String 7.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 21: astore_1\n 22: iconst_0\n 23: istore_2\n 24: aload_1\n 25: astore_3\n 26: new #537 // class java/util/LinkedHashMap\n 29: dup\n 30: invokespecial #538 // Method java/util/LinkedHashMap.\"<init>\":()V\n 33: checkcast #412 // class java/util/Map\n 36: astore 4\n 38: iconst_0\n 39: istore 5\n 41: aload_3\n 42: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 47: astore 6\n 49: aload 6\n 51: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 56: ifeq 110\n 59: aload 6\n 61: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 66: astore 7\n 68: aload 4\n 70: astore 8\n 72: aload 7\n 74: checkcast #45 // class java/lang/String\n 77: astore 9\n 79: iconst_0\n 80: istore 10\n 82: aload 9\n 84: invokestatic #583 // Method problem7b$outerToInners:(Ljava/lang/String;)Lkotlin/Pair;\n 87: astore 9\n 89: aload 8\n 91: aload 9\n 93: invokevirtual #553 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 96: aload 9\n 98: invokevirtual #541 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 101: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 106: pop\n 107: goto 49\n 110: aload 4\n 112: nop\n 113: astore_0\n 114: aload_0\n 115: ldc_w #556 // String shiny gold\n 118: invokestatic #587 // Method problem7b$recur$28:(Ljava/util/Map;Ljava/lang/String;)I\n 121: ireturn\n\n public static final java.util.List<OpCode> loadProgram8();\n Code:\n 0: ldc_w #598 // String 8.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 12: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 15: checkcast #74 // class java/lang/CharSequence\n 18: invokestatic #283 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;\n 21: checkcast #313 // class java/lang/Iterable\n 24: astore_0\n 25: iconst_0\n 26: istore_1\n 27: aload_0\n 28: astore_2\n 29: new #545 // class java/util/ArrayList\n 32: dup\n 33: aload_0\n 34: bipush 10\n 36: invokestatic #602 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 39: invokespecial #605 // Method java/util/ArrayList.\"<init>\":(I)V\n 42: checkcast #180 // class java/util/Collection\n 45: astore_3\n 46: iconst_0\n 47: istore 4\n 49: aload_2\n 50: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 55: astore 5\n 57: aload 5\n 59: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 64: ifeq 281\n 67: aload 5\n 69: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 74: astore 6\n 76: aload_3\n 77: aload 6\n 79: checkcast #45 // class java/lang/String\n 82: astore 7\n 84: astore 13\n 86: iconst_0\n 87: istore 8\n 89: aload 7\n 91: checkcast #74 // class java/lang/CharSequence\n 94: iconst_1\n 95: anewarray #45 // class java/lang/String\n 98: astore 9\n 100: aload 9\n 102: iconst_0\n 103: ldc_w #607 // String\n 106: aastore\n 107: aload 9\n 109: iconst_0\n 110: iconst_0\n 111: bipush 6\n 113: aconst_null\n 114: invokestatic #611 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 117: astore 10\n 119: aload 10\n 121: iconst_0\n 122: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 127: checkcast #45 // class java/lang/String\n 130: astore 9\n 132: aload 10\n 134: iconst_1\n 135: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 140: checkcast #45 // class java/lang/String\n 143: astore 11\n 145: new #613 // class OpCode\n 148: dup\n 149: aload 9\n 151: astore 12\n 153: aload 12\n 155: invokevirtual #616 // Method java/lang/String.hashCode:()I\n 158: lookupswitch { // 3\n 96385: 192\n 105357: 206\n 109263: 220\n default: 249\n }\n 192: aload 12\n 194: ldc_w #617 // String acc\n 197: invokevirtual #620 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 200: ifne 237\n 203: goto 249\n 206: aload 12\n 208: ldc_w #622 // String jmp\n 211: invokevirtual #620 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 214: ifne 243\n 217: goto 249\n 220: aload 12\n 222: ldc_w #624 // String nop\n 225: invokevirtual #620 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 228: ifeq 249\n 231: getstatic #630 // Field Op.Nop:LOp;\n 234: goto 260\n 237: getstatic #633 // Field Op.Acc:LOp;\n 240: goto 260\n 243: getstatic #636 // Field Op.Jmp:LOp;\n 246: goto 260\n 249: new #638 // class java/lang/Error\n 252: dup\n 253: ldc_w #640 // String unknown\n 256: invokespecial #641 // Method java/lang/Error.\"<init>\":(Ljava/lang/String;)V\n 259: athrow\n 260: aload 11\n 262: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 265: invokespecial #647 // Method OpCode.\"<init>\":(LOp;I)V\n 268: nop\n 269: aload 13\n 271: swap\n 272: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 277: pop\n 278: goto 57\n 281: aload_3\n 282: checkcast #285 // class java/util/List\n 285: nop\n 286: areturn\n\n public static final kotlin.Pair<FinalState, java.lang.Integer> problem8a(java.util.List<OpCode>);\n Code:\n 0: aload_0\n 1: ldc_w #660 // String program\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: new #132 // class java/util/LinkedHashSet\n 10: dup\n 11: invokespecial #133 // Method java/util/LinkedHashSet.\"<init>\":()V\n 14: checkcast #135 // class java/util/Set\n 17: astore_1\n 18: iconst_0\n 19: istore_2\n 20: iconst_0\n 21: istore_3\n 22: iload_2\n 23: aload_0\n 24: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 29: if_icmpge 169\n 32: aload_1\n 33: iload_2\n 34: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 37: invokeinterface #167, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 42: ifeq 60\n 45: new #169 // class kotlin/Pair\n 48: dup\n 49: getstatic #666 // Field FinalState.InfiniteLoop:LFinalState;\n 52: iload_3\n 53: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 56: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 59: areturn\n 60: aload_1\n 61: iload_2\n 62: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 65: invokeinterface #667, 2 // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z\n 70: pop\n 71: aload_0\n 72: iload_2\n 73: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 78: checkcast #613 // class OpCode\n 81: astore 4\n 83: aload 4\n 85: invokevirtual #670 // Method OpCode.component1:()LOp;\n 88: astore 5\n 90: aload 4\n 92: invokevirtual #672 // Method OpCode.component2:()I\n 95: istore 6\n 97: aload 5\n 99: getstatic #678 // Field MainKt$WhenMappings.$EnumSwitchMapping$0:[I\n 102: swap\n 103: invokevirtual #681 // Method Op.ordinal:()I\n 106: iaload\n 107: tableswitch { // 1 to 3\n 1: 132\n 2: 145\n 3: 153\n default: 161\n }\n 132: iload_3\n 133: iload 6\n 135: iadd\n 136: istore_3\n 137: iload_2\n 138: iinc 2, 1\n 141: pop\n 142: goto 22\n 145: iload_2\n 146: iload 6\n 148: iadd\n 149: istore_2\n 150: goto 22\n 153: iload_2\n 154: iinc 2, 1\n 157: pop\n 158: goto 22\n 161: new #683 // class kotlin/NoWhenBranchMatchedException\n 164: dup\n 165: invokespecial #684 // Method kotlin/NoWhenBranchMatchedException.\"<init>\":()V\n 168: athrow\n 169: new #169 // class kotlin/Pair\n 172: dup\n 173: getstatic #687 // Field FinalState.Terminated:LFinalState;\n 176: iload_3\n 177: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 180: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 183: areturn\n\n public static kotlin.Pair problem8a$default(java.util.List, int, java.lang.Object);\n Code:\n 0: iload_1\n 1: iconst_1\n 2: iand\n 3: ifeq 10\n 6: invokestatic #693 // Method loadProgram8:()Ljava/util/List;\n 9: astore_0\n 10: aload_0\n 11: invokestatic #695 // Method problem8a:(Ljava/util/List;)Lkotlin/Pair;\n 14: areturn\n\n public static final int problem8b();\n Code:\n 0: invokestatic #693 // Method loadProgram8:()Ljava/util/List;\n 3: astore_0\n 4: aload_0\n 5: checkcast #313 // class java/lang/Iterable\n 8: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 13: astore_1\n 14: iconst_0\n 15: istore_2\n 16: aload_1\n 17: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 22: ifeq 155\n 25: iload_2\n 26: istore_3\n 27: iload_2\n 28: iconst_1\n 29: iadd\n 30: istore_2\n 31: aload_1\n 32: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 37: checkcast #613 // class OpCode\n 40: astore 4\n 42: aload 4\n 44: invokevirtual #699 // Method OpCode.getOp:()LOp;\n 47: getstatic #630 // Field Op.Nop:LOp;\n 50: if_acmpeq 64\n 53: aload 4\n 55: invokevirtual #699 // Method OpCode.getOp:()LOp;\n 58: getstatic #636 // Field Op.Jmp:LOp;\n 61: if_acmpne 16\n 64: aload_0\n 65: checkcast #180 // class java/util/Collection\n 68: invokestatic #703 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 71: astore 5\n 73: aload 5\n 75: iload_3\n 76: new #613 // class OpCode\n 79: dup\n 80: aload 4\n 82: invokevirtual #699 // Method OpCode.getOp:()LOp;\n 85: getstatic #630 // Field Op.Nop:LOp;\n 88: if_acmpne 97\n 91: getstatic #636 // Field Op.Jmp:LOp;\n 94: goto 100\n 97: getstatic #630 // Field Op.Nop:LOp;\n 100: aload 4\n 102: invokevirtual #706 // Method OpCode.getArg:()I\n 105: invokespecial #647 // Method OpCode.\"<init>\":(LOp;I)V\n 108: invokeinterface #710, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 113: pop\n 114: aload 5\n 116: invokestatic #695 // Method problem8a:(Ljava/util/List;)Lkotlin/Pair;\n 119: astore 6\n 121: aload 6\n 123: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 126: checkcast #662 // class FinalState\n 129: astore 7\n 131: aload 6\n 133: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 136: checkcast #153 // class java/lang/Number\n 139: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 142: istore 8\n 144: aload 7\n 146: getstatic #687 // Field FinalState.Terminated:LFinalState;\n 149: if_acmpne 16\n 152: iload 8\n 154: ireturn\n 155: new #638 // class java/lang/Error\n 158: dup\n 159: ldc_w #712 // String no solution found\n 162: invokespecial #641 // Method java/lang/Error.\"<init>\":(Ljava/lang/String;)V\n 165: athrow\n\n public static final long problem9a(kotlin.sequences.Sequence<java.lang.Long>);\n Code:\n 0: aload_0\n 1: ldc_w #722 // String numbers\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: bipush 25\n 9: istore_1\n 10: aload_0\n 11: iconst_1\n 12: iload_1\n 13: iadd\n 14: iconst_0\n 15: iconst_0\n 16: bipush 6\n 18: aconst_null\n 19: invokestatic #726 // Method kotlin/sequences/SequencesKt.windowed$default:(Lkotlin/sequences/Sequence;IIZILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 22: astore_2\n 23: nop\n 24: iconst_0\n 25: istore_3\n 26: aload_2\n 27: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 32: astore 4\n 34: aload 4\n 36: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 41: ifeq 105\n 44: aload 4\n 46: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 51: astore 5\n 53: aload 5\n 55: checkcast #285 // class java/util/List\n 58: astore 6\n 60: iconst_0\n 61: istore 7\n 63: aload 6\n 65: iconst_1\n 66: invokestatic #730 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;\n 69: checkcast #313 // class java/lang/Iterable\n 72: invokestatic #734 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;\n 75: aload 6\n 77: invokestatic #738 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 80: checkcast #153 // class java/lang/Number\n 83: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 86: invokestatic #199 // Method problem1a:(Lkotlin/sequences/Sequence;J)Lkotlin/Pair;\n 89: ifnonnull 96\n 92: iconst_1\n 93: goto 97\n 96: iconst_0\n 97: ifeq 34\n 100: aload 5\n 102: goto 116\n 105: new #740 // class java/util/NoSuchElementException\n 108: dup\n 109: ldc_w #742 // String Sequence contains no element matching the predicate.\n 112: invokespecial #743 // Method java/util/NoSuchElementException.\"<init>\":(Ljava/lang/String;)V\n 115: athrow\n 116: checkcast #285 // class java/util/List\n 119: invokestatic #738 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 122: checkcast #153 // class java/lang/Number\n 125: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 128: lreturn\n\n public static long problem9a$default(kotlin.sequences.Sequence, int, java.lang.Object);\n Code:\n 0: iload_1\n 1: iconst_1\n 2: iand\n 3: ifeq 13\n 6: ldc_w #751 // String 9.txt\n 9: invokestatic #195 // Method getResourceAsLongs:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 12: astore_0\n 13: aload_0\n 14: invokestatic #753 // Method problem9a:(Lkotlin/sequences/Sequence;)J\n 17: lreturn\n\n public static final long problem9b();\n Code:\n 0: ldc_w #751 // String 9.txt\n 3: invokestatic #195 // Method getResourceAsLongs:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 6: invokestatic #758 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 9: astore_0\n 10: aload_0\n 11: checkcast #313 // class java/lang/Iterable\n 14: invokestatic #734 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;\n 17: invokestatic #753 // Method problem9a:(Lkotlin/sequences/Sequence;)J\n 20: lstore_1\n 21: iconst_2\n 22: istore_3\n 23: aload_0\n 24: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 29: istore 4\n 31: iload_3\n 32: iload 4\n 34: if_icmpgt 183\n 37: aload_0\n 38: checkcast #313 // class java/lang/Iterable\n 41: iload_3\n 42: iconst_0\n 43: iconst_0\n 44: bipush 6\n 46: aconst_null\n 47: invokestatic #761 // Method kotlin/collections/CollectionsKt.windowed$default:(Ljava/lang/Iterable;IIZILjava/lang/Object;)Ljava/util/List;\n 50: checkcast #313 // class java/lang/Iterable\n 53: astore 6\n 55: iconst_0\n 56: istore 7\n 58: aload 6\n 60: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 65: astore 8\n 67: aload 8\n 69: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 74: ifeq 122\n 77: aload 8\n 79: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 84: astore 9\n 86: aload 9\n 88: checkcast #285 // class java/util/List\n 91: astore 10\n 93: iconst_0\n 94: istore 11\n 96: aload 10\n 98: checkcast #313 // class java/lang/Iterable\n 101: invokestatic #765 // Method kotlin/collections/CollectionsKt.sumOfLong:(Ljava/lang/Iterable;)J\n 104: lload_1\n 105: lcmp\n 106: ifne 113\n 109: iconst_1\n 110: goto 114\n 113: iconst_0\n 114: ifeq 67\n 117: aload 9\n 119: goto 123\n 122: aconst_null\n 123: checkcast #285 // class java/util/List\n 126: astore 5\n 128: aload 5\n 130: dup\n 131: ifnull 170\n 134: checkcast #313 // class java/lang/Iterable\n 137: invokestatic #769 // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 140: dup\n 141: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 144: checkcast #153 // class java/lang/Number\n 147: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 150: aload 5\n 152: checkcast #313 // class java/lang/Iterable\n 155: invokestatic #772 // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 158: dup\n 159: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 162: checkcast #153 // class java/lang/Number\n 165: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 168: ladd\n 169: lreturn\n 170: pop\n 171: iload_3\n 172: iload 4\n 174: if_icmpeq 183\n 177: iinc 3, 1\n 180: goto 37\n 183: new #774 // class java/lang/IllegalStateException\n 186: dup\n 187: ldc_w #776 // String unable to find solution\n 190: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 193: invokespecial #777 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 196: athrow\n\n public static final int problem10a();\n Code:\n 0: ldc_w #786 // String 10.txt\n 3: invokestatic #204 // Method getResourceAsInts:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 6: invokestatic #473 // Method kotlin/sequences/SequencesKt.sorted:(Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;\n 9: invokedynamic #796, 0 // InvokeDynamic #9:invoke:()Lkotlin/jvm/functions/Function2;\n 14: invokestatic #799 // Method kotlin/sequences/SequencesKt.zipWithNext:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;\n 17: astore_0\n 18: nop\n 19: iconst_0\n 20: istore_1\n 21: new #801 // class MainKt$problem10a$$inlined$groupingBy$1\n 24: dup\n 25: aload_0\n 26: invokespecial #804 // Method MainKt$problem10a$$inlined$groupingBy$1.\"<init>\":(Lkotlin/sequences/Sequence;)V\n 29: checkcast #806 // class kotlin/collections/Grouping\n 32: invokestatic #812 // Method kotlin/collections/GroupingKt.eachCount:(Lkotlin/collections/Grouping;)Ljava/util/Map;\n 35: invokeinterface #816, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 40: checkcast #313 // class java/lang/Iterable\n 43: astore_0\n 44: iconst_1\n 45: istore_1\n 46: iconst_0\n 47: istore_2\n 48: iload_1\n 49: istore_3\n 50: aload_0\n 51: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 56: astore 4\n 58: aload 4\n 60: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 65: ifeq 104\n 68: aload 4\n 70: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 75: astore 5\n 77: iload_3\n 78: aload 5\n 80: checkcast #153 // class java/lang/Number\n 83: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 86: istore 6\n 88: istore 7\n 90: iconst_0\n 91: istore 8\n 93: iload 7\n 95: iload 6\n 97: iconst_1\n 98: iadd\n 99: imul\n 100: istore_3\n 101: goto 58\n 104: iload_3\n 105: ireturn\n\n public static final long problem10b();\n Code:\n 0: iconst_0\n 1: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 4: invokestatic #823 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;\n 7: checkcast #180 // class java/util/Collection\n 10: ldc_w #786 // String 10.txt\n 13: invokestatic #204 // Method getResourceAsInts:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 16: invokestatic #473 // Method kotlin/sequences/SequencesKt.sorted:(Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;\n 19: invokestatic #827 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Lkotlin/sequences/Sequence;)Ljava/util/List;\n 22: astore_0\n 23: aload_0\n 24: checkcast #180 // class java/util/Collection\n 27: aload_0\n 28: invokestatic #738 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 31: checkcast #153 // class java/lang/Number\n 34: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 37: iconst_3\n 38: iadd\n 39: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 42: invokestatic #830 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;\n 45: astore_1\n 46: new #537 // class java/util/LinkedHashMap\n 49: dup\n 50: invokespecial #538 // Method java/util/LinkedHashMap.\"<init>\":()V\n 53: checkcast #412 // class java/util/Map\n 56: astore_2\n 57: aload_1\n 58: aload_2\n 59: iconst_0\n 60: iconst_4\n 61: aconst_null\n 62: invokestatic #834 // Method problem10b$recur$37$default:(Ljava/util/List;Ljava/util/Map;IILjava/lang/Object;)J\n 65: lreturn\n\n public static final DoubleBuffer prepareBytes(byte[]);\n Code:\n 0: aload_0\n 1: ldc_w #841 // String aBuffer\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: bipush 10\n 10: invokestatic #847 // Method kotlin/collections/ArraysKt.indexOf:([BB)I\n 13: istore_1\n 14: iload_1\n 15: ifle 22\n 18: iconst_1\n 19: goto 23\n 22: iconst_0\n 23: istore_2\n 24: getstatic #852 // Field kotlin/_Assertions.ENABLED:Z\n 27: ifeq 49\n 30: iload_2\n 31: ifne 49\n 34: iconst_0\n 35: istore_3\n 36: ldc_w #854 // String file must contain newlines\n 39: astore_3\n 40: new #856 // class java/lang/AssertionError\n 43: dup\n 44: aload_3\n 45: invokespecial #858 // Method java/lang/AssertionError.\"<init>\":(Ljava/lang/Object;)V\n 48: athrow\n 49: aload_0\n 50: iload_1\n 51: iconst_1\n 52: isub\n 53: baload\n 54: bipush 13\n 56: if_icmpne 79\n 59: new #169 // class kotlin/Pair\n 62: dup\n 63: iload_1\n 64: iconst_1\n 65: isub\n 66: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 69: iconst_2\n 70: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 73: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 76: goto 94\n 79: new #169 // class kotlin/Pair\n 82: dup\n 83: iload_1\n 84: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 87: iconst_1\n 88: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 91: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 94: astore_2\n 95: aload_2\n 96: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 99: checkcast #153 // class java/lang/Number\n 102: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 105: istore_3\n 106: aload_2\n 107: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 110: checkcast #153 // class java/lang/Number\n 113: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 116: istore 4\n 118: aload_0\n 119: astore 6\n 121: iconst_0\n 122: istore 7\n 124: aload 6\n 126: arraylength\n 127: iconst_m1\n 128: iadd\n 129: istore 8\n 131: iconst_0\n 132: iload 8\n 134: if_icmpgt 187\n 137: iload 8\n 139: istore 9\n 141: iinc 8, -1\n 144: aload 6\n 146: iload 9\n 148: baload\n 149: istore 10\n 151: iconst_0\n 152: istore 11\n 154: iload 10\n 156: bipush 10\n 158: if_icmpeq 172\n 161: iload 10\n 163: bipush 13\n 165: if_icmpeq 172\n 168: iconst_1\n 169: goto 173\n 172: iconst_0\n 173: ifeq 181\n 176: iload 9\n 178: goto 188\n 181: iconst_0\n 182: iload 8\n 184: if_icmple 137\n 187: iconst_m1\n 188: iconst_1\n 189: iadd\n 190: istore 5\n 192: iload 5\n 194: iload 4\n 196: iadd\n 197: iload_3\n 198: iload 4\n 200: iadd\n 201: idiv\n 202: istore 6\n 204: aload_0\n 205: dup\n 206: arraylength\n 207: invokestatic #864 // Method java/util/Arrays.copyOf:([BI)[B\n 210: dup\n 211: ldc_w #866 // String copyOf(...)\n 214: invokestatic #436 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 217: astore 7\n 219: new #868 // class kotlin/jvm/internal/Ref$BooleanRef\n 222: dup\n 223: invokespecial #869 // Method kotlin/jvm/internal/Ref$BooleanRef.\"<init>\":()V\n 226: astore 8\n 228: aload 8\n 230: iconst_1\n 231: putfield #872 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 234: iload_3\n 235: iload 4\n 237: invokedynamic #880, 0 // InvokeDynamic #10:invoke:(II)Lkotlin/jvm/functions/Function2;\n 242: astore 9\n 244: aload 8\n 246: aload_0\n 247: aload 7\n 249: aload 9\n 251: invokedynamic #890, 0 // InvokeDynamic #11:invoke:(Lkotlin/jvm/internal/Ref$BooleanRef;[B[BLkotlin/jvm/functions/Function2;)Lkotlin/jvm/functions/Function2;\n 256: astore 10\n 258: aload 8\n 260: aload 7\n 262: aload_0\n 263: aload 9\n 265: invokedynamic #902, 0 // InvokeDynamic #12:invoke:(Lkotlin/jvm/internal/Ref$BooleanRef;[B[BLkotlin/jvm/functions/Function2;)Lkotlin/jvm/functions/Function3;\n 270: astore 11\n 272: aload 8\n 274: invokedynamic #913, 0 // InvokeDynamic #13:invoke:(Lkotlin/jvm/internal/Ref$BooleanRef;)Lkotlin/jvm/functions/Function0;\n 279: astore 12\n 281: aload 8\n 283: aload_0\n 284: aload 7\n 286: invokedynamic #923, 0 // InvokeDynamic #14:invoke:(Lkotlin/jvm/internal/Ref$BooleanRef;[B[B)Lkotlin/jvm/functions/Function0;\n 291: astore 13\n 293: aload 8\n 295: aload_0\n 296: aload 7\n 298: aload 9\n 300: iload 6\n 302: iload_3\n 303: invokedynamic #933, 0 // InvokeDynamic #15:invoke:(Lkotlin/jvm/internal/Ref$BooleanRef;[B[BLkotlin/jvm/functions/Function2;II)Lkotlin/jvm/functions/Function3;\n 308: astore 14\n 310: new #935 // class DoubleBuffer\n 313: dup\n 314: aload 10\n 316: aload 11\n 318: aload 12\n 320: aload 13\n 322: aload 14\n 324: iload 6\n 326: iload_3\n 327: invokespecial #938 // Method DoubleBuffer.\"<init>\":(Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function3;II)V\n 330: areturn\n\n public static final int problem11(boolean);\n Code:\n 0: ldc_w #961 // String 11.txt\n 3: invokestatic #963 // Method getResourceAsBytes:(Ljava/lang/String;)[B\n 6: invokestatic #965 // Method prepareBytes:([B)LDoubleBuffer;\n 9: astore_1\n 10: iload_0\n 11: ifeq 18\n 14: iconst_4\n 15: goto 19\n 18: iconst_5\n 19: istore_2\n 20: iload_0\n 21: ifeq 32\n 24: invokedynamic #973, 0 // InvokeDynamic #16:invoke:()Lkotlin/jvm/functions/Function1;\n 29: goto 37\n 32: invokedynamic #978, 0 // InvokeDynamic #17:invoke:()Lkotlin/jvm/functions/Function1;\n 37: astore_3\n 38: nop\n 39: iconst_0\n 40: istore 4\n 42: iconst_0\n 43: istore 5\n 45: aload_1\n 46: invokevirtual #981 // Method DoubleBuffer.getHeight:()I\n 49: istore 6\n 51: iload 5\n 53: iload 6\n 55: if_icmpge 369\n 58: iconst_0\n 59: istore 7\n 61: aload_1\n 62: invokevirtual #984 // Method DoubleBuffer.getWidth:()I\n 65: istore 8\n 67: iload 7\n 69: iload 8\n 71: if_icmpge 363\n 74: aload_1\n 75: invokevirtual #987 // Method DoubleBuffer.getGet:()Lkotlin/jvm/functions/Function2;\n 78: iload 5\n 80: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 83: iload 7\n 85: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 88: invokeinterface #991, 3 // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 93: checkcast #153 // class java/lang/Number\n 96: invokevirtual #995 // Method java/lang/Number.byteValue:()B\n 99: istore 9\n 101: iload 9\n 103: bipush 46\n 105: if_icmpeq 357\n 108: aload_1\n 109: invokevirtual #999 // Method DoubleBuffer.getGetLineOfSight:()Lkotlin/jvm/functions/Function3;\n 112: iload 5\n 114: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 117: iload 7\n 119: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 122: aload_3\n 123: invokeinterface #1003, 4 // InterfaceMethod kotlin/jvm/functions/Function3.invoke:(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 128: checkcast #285 // class java/util/List\n 131: astore 10\n 133: aload 10\n 135: checkcast #313 // class java/lang/Iterable\n 138: astore 12\n 140: iconst_0\n 141: istore 13\n 143: aload 12\n 145: instanceof #180 // class java/util/Collection\n 148: ifeq 168\n 151: aload 12\n 153: checkcast #180 // class java/util/Collection\n 156: invokeinterface #1006, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 161: ifeq 168\n 164: iconst_0\n 165: goto 243\n 168: iconst_0\n 169: istore 14\n 171: aload 12\n 173: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 178: astore 15\n 180: aload 15\n 182: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 187: ifeq 241\n 190: aload 15\n 192: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 197: astore 16\n 199: aload 16\n 201: checkcast #153 // class java/lang/Number\n 204: invokevirtual #995 // Method java/lang/Number.byteValue:()B\n 207: istore 17\n 209: iconst_0\n 210: istore 18\n 212: iload 17\n 214: bipush 35\n 216: if_icmpne 223\n 219: iconst_1\n 220: goto 224\n 223: iconst_0\n 224: ifeq 180\n 227: iinc 14, 1\n 230: iload 14\n 232: ifge 180\n 235: invokestatic #361 // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V\n 238: goto 180\n 241: iload 14\n 243: istore 11\n 245: iload 9\n 247: bipush 76\n 249: if_icmpne 288\n 252: iload 11\n 254: ifne 288\n 257: aload_1\n 258: invokevirtual #1009 // Method DoubleBuffer.getSet:()Lkotlin/jvm/functions/Function3;\n 261: iload 5\n 263: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 266: iload 7\n 268: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 271: bipush 35\n 273: invokestatic #1014 // Method java/lang/Byte.valueOf:(B)Ljava/lang/Byte;\n 276: invokeinterface #1003, 4 // InterfaceMethod kotlin/jvm/functions/Function3.invoke:(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 281: pop\n 282: iconst_1\n 283: istore 4\n 285: goto 357\n 288: iload 9\n 290: bipush 35\n 292: if_icmpne 332\n 295: iload 11\n 297: iload_2\n 298: if_icmplt 332\n 301: aload_1\n 302: invokevirtual #1009 // Method DoubleBuffer.getSet:()Lkotlin/jvm/functions/Function3;\n 305: iload 5\n 307: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 310: iload 7\n 312: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 315: bipush 76\n 317: invokestatic #1014 // Method java/lang/Byte.valueOf:(B)Ljava/lang/Byte;\n 320: invokeinterface #1003, 4 // InterfaceMethod kotlin/jvm/functions/Function3.invoke:(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 325: pop\n 326: iconst_1\n 327: istore 4\n 329: goto 357\n 332: aload_1\n 333: invokevirtual #1009 // Method DoubleBuffer.getSet:()Lkotlin/jvm/functions/Function3;\n 336: iload 5\n 338: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 341: iload 7\n 343: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 346: iload 9\n 348: invokestatic #1014 // Method java/lang/Byte.valueOf:(B)Ljava/lang/Byte;\n 351: invokeinterface #1003, 4 // InterfaceMethod kotlin/jvm/functions/Function3.invoke:(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 356: pop\n 357: iinc 7, 1\n 360: goto 67\n 363: iinc 5, 1\n 366: goto 51\n 369: aload_1\n 370: invokevirtual #1018 // Method DoubleBuffer.getFlip:()Lkotlin/jvm/functions/Function0;\n 373: invokeinterface #1022, 1 // InterfaceMethod kotlin/jvm/functions/Function0.invoke:()Ljava/lang/Object;\n 378: pop\n 379: iload 4\n 381: ifne 38\n 384: goto 387\n 387: aload_1\n 388: invokevirtual #1025 // Method DoubleBuffer.getGetBuffer:()Lkotlin/jvm/functions/Function0;\n 391: invokeinterface #1022, 1 // InterfaceMethod kotlin/jvm/functions/Function0.invoke:()Ljava/lang/Object;\n 396: checkcast #62 // class \"[B\"\n 399: astore 4\n 401: iconst_0\n 402: istore 5\n 404: iconst_0\n 405: istore 6\n 407: iconst_0\n 408: istore 7\n 410: aload 4\n 412: arraylength\n 413: istore 8\n 415: iload 7\n 417: iload 8\n 419: if_icmpge 460\n 422: aload 4\n 424: iload 7\n 426: baload\n 427: istore 9\n 429: iload 9\n 431: istore 10\n 433: iconst_0\n 434: istore 11\n 436: iload 10\n 438: bipush 35\n 440: if_icmpne 447\n 443: iconst_1\n 444: goto 448\n 447: iconst_0\n 448: ifeq 454\n 451: iinc 6, 1\n 454: iinc 7, 1\n 457: goto 415\n 460: iload 6\n 462: ireturn\n\n public static final kotlin.sequences.Sequence<byte[]> bytesToLinesSequence(byte[]);\n Code:\n 0: aload_0\n 1: ldc_w #1042 // String bytes\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: new #1044 // class MainKt$bytesToLinesSequence$1\n 10: dup\n 11: aload_0\n 12: aconst_null\n 13: invokespecial #1047 // Method MainKt$bytesToLinesSequence$1.\"<init>\":([BLkotlin/coroutines/Continuation;)V\n 16: checkcast #989 // class kotlin/jvm/functions/Function2\n 19: invokestatic #1051 // Method kotlin/sequences/SequencesKt.sequence:(Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;\n 22: areturn\n\n public static final int prob12();\n Code:\n 0: iconst_4\n 1: anewarray #169 // class kotlin/Pair\n 4: astore_1\n 5: aload_1\n 6: iconst_0\n 7: bipush 78\n 9: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 12: new #169 // class kotlin/Pair\n 15: dup\n 16: iconst_0\n 17: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 20: iconst_1\n 21: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 24: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 27: invokestatic #1063 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 30: aastore\n 31: aload_1\n 32: iconst_1\n 33: bipush 83\n 35: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 38: new #169 // class kotlin/Pair\n 41: dup\n 42: iconst_0\n 43: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 46: iconst_m1\n 47: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 50: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 53: invokestatic #1063 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 56: aastore\n 57: aload_1\n 58: iconst_2\n 59: bipush 69\n 61: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 64: new #169 // class kotlin/Pair\n 67: dup\n 68: iconst_1\n 69: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 72: iconst_0\n 73: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 76: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 79: invokestatic #1063 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 82: aastore\n 83: aload_1\n 84: iconst_3\n 85: bipush 87\n 87: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 90: new #169 // class kotlin/Pair\n 93: dup\n 94: iconst_m1\n 95: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 98: iconst_0\n 99: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 102: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 105: invokestatic #1063 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 108: aastore\n 109: aload_1\n 110: invokestatic #1069 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 113: astore_0\n 114: iconst_4\n 115: anewarray #1054 // class java/lang/Character\n 118: astore_2\n 119: aload_2\n 120: iconst_0\n 121: bipush 78\n 123: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 126: aastore\n 127: aload_2\n 128: iconst_1\n 129: bipush 69\n 131: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 134: aastore\n 135: aload_2\n 136: iconst_2\n 137: bipush 83\n 139: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 142: aastore\n 143: aload_2\n 144: iconst_3\n 145: bipush 87\n 147: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 150: aastore\n 151: aload_2\n 152: invokestatic #175 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 155: astore_1\n 156: iconst_0\n 157: istore_2\n 158: iconst_0\n 159: istore_3\n 160: aload_1\n 161: bipush 69\n 163: invokestatic #1057 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 166: invokeinterface #1071, 2 // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I\n 171: istore 4\n 173: ldc_w #1073 // String 12.txt\n 176: invokestatic #963 // Method getResourceAsBytes:(Ljava/lang/String;)[B\n 179: invokestatic #1075 // Method bytesToLinesSequence:([B)Lkotlin/sequences/Sequence;\n 182: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 187: astore 5\n 189: aload 5\n 191: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 196: ifeq 446\n 199: aload 5\n 201: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 206: checkcast #62 // class \"[B\"\n 209: astore 6\n 211: aload 6\n 213: iconst_0\n 214: baload\n 215: i2c\n 216: istore 7\n 218: new #45 // class java/lang/String\n 221: dup\n 222: aload 6\n 224: iconst_1\n 225: aload 6\n 227: arraylength\n 228: invokestatic #1081 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 231: invokestatic #1085 // Method kotlin/collections/ArraysKt.sliceArray:([BLkotlin/ranges/IntRange;)[B\n 234: getstatic #1088 // Field kotlin/text/Charsets.US_ASCII:Ljava/nio/charset/Charset;\n 237: invokespecial #48 // Method java/lang/String.\"<init>\":([BLjava/nio/charset/Charset;)V\n 240: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 243: istore 8\n 245: iload 7\n 247: lookupswitch { // 7\n 69: 336\n 70: 378\n 76: 344\n 78: 312\n 82: 361\n 83: 320\n 87: 328\n default: 443\n }\n 312: iload_3\n 313: iload 8\n 315: iadd\n 316: istore_3\n 317: goto 189\n 320: iload_3\n 321: iload 8\n 323: isub\n 324: istore_3\n 325: goto 189\n 328: iload_2\n 329: iload 8\n 331: isub\n 332: istore_2\n 333: goto 189\n 336: iload_2\n 337: iload 8\n 339: iadd\n 340: istore_2\n 341: goto 189\n 344: iconst_4\n 345: iload 4\n 347: iadd\n 348: iload 8\n 350: bipush 90\n 352: idiv\n 353: isub\n 354: iconst_4\n 355: irem\n 356: istore 4\n 358: goto 189\n 361: iconst_4\n 362: iload 4\n 364: iadd\n 365: iload 8\n 367: bipush 90\n 369: idiv\n 370: iadd\n 371: iconst_4\n 372: irem\n 373: istore 4\n 375: goto 189\n 378: aload_0\n 379: aload_1\n 380: iload 4\n 382: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 387: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 392: dup\n 393: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 396: checkcast #169 // class kotlin/Pair\n 399: astore 9\n 401: aload 9\n 403: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 406: checkcast #153 // class java/lang/Number\n 409: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 412: istore 10\n 414: aload 9\n 416: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 419: checkcast #153 // class java/lang/Number\n 422: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 425: istore 11\n 427: iload_2\n 428: iload 10\n 430: iload 8\n 432: imul\n 433: iadd\n 434: istore_2\n 435: iload_3\n 436: iload 11\n 438: iload 8\n 440: imul\n 441: iadd\n 442: istore_3\n 443: goto 189\n 446: iload_2\n 447: invokestatic #1094 // Method java/lang/Math.abs:(I)I\n 450: iload_3\n 451: invokestatic #1094 // Method java/lang/Math.abs:(I)I\n 454: iadd\n 455: ireturn\n\n public static final kotlin.Pair<java.lang.Integer, java.lang.Integer> rotate(int, int, int);\n Code:\n 0: ldc2_w #1105 // double 0.017453292519943295d\n 3: iload_2\n 4: i2d\n 5: dmul\n 6: dstore_3\n 7: dload_3\n 8: invokestatic #1110 // Method java/lang/Math.cos:(D)D\n 11: dstore 5\n 13: dload_3\n 14: invokestatic #1113 // Method java/lang/Math.sin:(D)D\n 17: dstore 7\n 19: new #169 // class kotlin/Pair\n 22: dup\n 23: dload 5\n 25: iload_0\n 26: i2d\n 27: dmul\n 28: dload 7\n 30: iload_1\n 31: i2d\n 32: dmul\n 33: dsub\n 34: invokestatic #1119 // Method kotlin/math/MathKt.roundToInt:(D)I\n 37: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 40: dload 7\n 42: iload_0\n 43: i2d\n 44: dmul\n 45: dload 5\n 47: iload_1\n 48: i2d\n 49: dmul\n 50: dadd\n 51: invokestatic #1119 // Method kotlin/math/MathKt.roundToInt:(D)I\n 54: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 57: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 60: areturn\n\n public static final int prob12b();\n Code:\n 0: iconst_0\n 1: istore_0\n 2: iconst_0\n 3: istore_1\n 4: bipush 10\n 6: istore_2\n 7: iconst_1\n 8: istore_3\n 9: ldc_w #1073 // String 12.txt\n 12: invokestatic #963 // Method getResourceAsBytes:(Ljava/lang/String;)[B\n 15: invokestatic #1075 // Method bytesToLinesSequence:([B)Lkotlin/sequences/Sequence;\n 18: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 23: astore 4\n 25: aload 4\n 27: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 32: ifeq 254\n 35: aload 4\n 37: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 42: checkcast #62 // class \"[B\"\n 45: astore 5\n 47: aload 5\n 49: iconst_0\n 50: baload\n 51: i2c\n 52: istore 6\n 54: new #45 // class java/lang/String\n 57: dup\n 58: aload 5\n 60: iconst_1\n 61: aload 5\n 63: arraylength\n 64: invokestatic #1081 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 67: invokestatic #1085 // Method kotlin/collections/ArraysKt.sliceArray:([BLkotlin/ranges/IntRange;)[B\n 70: getstatic #1088 // Field kotlin/text/Charsets.US_ASCII:Ljava/nio/charset/Charset;\n 73: invokespecial #48 // Method java/lang/String.\"<init>\":([BLjava/nio/charset/Charset;)V\n 76: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 79: istore 7\n 81: iload 6\n 83: lookupswitch { // 7\n 69: 172\n 70: 237\n 76: 180\n 78: 148\n 82: 180\n 83: 156\n 87: 164\n default: 251\n }\n 148: iload_3\n 149: iload 7\n 151: iadd\n 152: istore_3\n 153: goto 25\n 156: iload_3\n 157: iload 7\n 159: isub\n 160: istore_3\n 161: goto 25\n 164: iload_2\n 165: iload 7\n 167: isub\n 168: istore_2\n 169: goto 25\n 172: iload_2\n 173: iload 7\n 175: iadd\n 176: istore_2\n 177: goto 25\n 180: iload_2\n 181: iload_3\n 182: iload 6\n 184: bipush 76\n 186: if_icmpne 194\n 189: iload 7\n 191: goto 197\n 194: iload 7\n 196: ineg\n 197: invokestatic #1127 // Method rotate:(III)Lkotlin/Pair;\n 200: astore 8\n 202: aload 8\n 204: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 207: checkcast #153 // class java/lang/Number\n 210: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 213: istore 9\n 215: aload 8\n 217: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 220: checkcast #153 // class java/lang/Number\n 223: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 226: istore 10\n 228: iload 9\n 230: istore_2\n 231: iload 10\n 233: istore_3\n 234: goto 25\n 237: iload_0\n 238: iload_2\n 239: iload 7\n 241: imul\n 242: iadd\n 243: istore_0\n 244: iload_1\n 245: iload_3\n 246: iload 7\n 248: imul\n 249: iadd\n 250: istore_1\n 251: goto 25\n 254: iload_0\n 255: invokestatic #1094 // Method java/lang/Math.abs:(I)I\n 258: iload_1\n 259: invokestatic #1094 // Method java/lang/Math.abs:(I)I\n 262: iadd\n 263: ireturn\n\n public static final int prob13();\n Code:\n 0: ldc_w #1132 // String 13.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #283 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;\n 12: astore_0\n 13: aload_0\n 14: iconst_0\n 15: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 20: checkcast #45 // class java/lang/String\n 23: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 26: istore_1\n 27: aload_0\n 28: iconst_1\n 29: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 34: checkcast #74 // class java/lang/CharSequence\n 37: iconst_1\n 38: newarray char\n 40: astore_3\n 41: aload_3\n 42: iconst_0\n 43: bipush 44\n 45: castore\n 46: aload_3\n 47: iconst_0\n 48: iconst_0\n 49: bipush 6\n 51: aconst_null\n 52: invokestatic #1135 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;\n 55: checkcast #313 // class java/lang/Iterable\n 58: astore_3\n 59: iconst_0\n 60: istore 4\n 62: aload_3\n 63: astore 5\n 65: new #545 // class java/util/ArrayList\n 68: dup\n 69: invokespecial #546 // Method java/util/ArrayList.\"<init>\":()V\n 72: checkcast #180 // class java/util/Collection\n 75: astore 6\n 77: iconst_0\n 78: istore 7\n 80: aload 5\n 82: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 87: astore 8\n 89: aload 8\n 91: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 96: ifeq 150\n 99: aload 8\n 101: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 106: astore 9\n 108: aload 9\n 110: checkcast #45 // class java/lang/String\n 113: astore 10\n 115: iconst_0\n 116: istore 11\n 118: aload 10\n 120: ldc_w #1136 // String x\n 123: invokestatic #1140 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 126: ifne 133\n 129: iconst_1\n 130: goto 134\n 133: iconst_0\n 134: ifeq 89\n 137: aload 6\n 139: aload 9\n 141: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 146: pop\n 147: goto 89\n 150: aload 6\n 152: checkcast #285 // class java/util/List\n 155: nop\n 156: checkcast #313 // class java/lang/Iterable\n 159: astore_3\n 160: nop\n 161: iconst_0\n 162: istore 4\n 164: aload_3\n 165: astore 5\n 167: new #545 // class java/util/ArrayList\n 170: dup\n 171: aload_3\n 172: bipush 10\n 174: invokestatic #602 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 177: invokespecial #605 // Method java/util/ArrayList.\"<init>\":(I)V\n 180: checkcast #180 // class java/util/Collection\n 183: astore 6\n 185: iconst_0\n 186: istore 7\n 188: aload 5\n 190: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 195: astore 8\n 197: aload 8\n 199: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 204: ifeq 251\n 207: aload 8\n 209: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 214: astore 9\n 216: aload 6\n 218: aload 9\n 220: checkcast #45 // class java/lang/String\n 223: astore 10\n 225: astore 12\n 227: iconst_0\n 228: istore 11\n 230: aload 10\n 232: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 235: nop\n 236: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 239: aload 12\n 241: swap\n 242: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 247: pop\n 248: goto 197\n 251: aload 6\n 253: checkcast #285 // class java/util/List\n 256: nop\n 257: astore_2\n 258: iconst_0\n 259: istore_3\n 260: iload_1\n 261: istore_3\n 262: nop\n 263: aload_2\n 264: checkcast #313 // class java/lang/Iterable\n 267: astore 6\n 269: aload 6\n 271: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 276: astore 7\n 278: aload 7\n 280: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 285: ifeq 330\n 288: aload 7\n 290: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 295: astore 8\n 297: aload 8\n 299: checkcast #153 // class java/lang/Number\n 302: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 305: istore 9\n 307: iconst_0\n 308: istore 10\n 310: iload_3\n 311: iload 9\n 313: irem\n 314: ifne 321\n 317: iconst_1\n 318: goto 322\n 321: iconst_0\n 322: ifeq 278\n 325: aload 8\n 327: goto 331\n 330: aconst_null\n 331: checkcast #211 // class java/lang/Integer\n 334: astore 4\n 336: aload 4\n 338: ifnull 351\n 341: aload 4\n 343: invokevirtual #1141 // Method java/lang/Integer.intValue:()I\n 346: iload_3\n 347: iload_1\n 348: isub\n 349: imul\n 350: ireturn\n 351: iload_3\n 352: istore 5\n 354: iload 5\n 356: iconst_1\n 357: iadd\n 358: istore_3\n 359: goto 262\n\n public static final long chineseRemainderTheoremPair(kotlin.Pair<java.lang.Long, java.lang.Long>, kotlin.Pair<java.lang.Long, java.lang.Long>);\n Code:\n 0: aload_0\n 1: ldc_w #1156 // String a\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_1\n 8: ldc_w #1158 // String b\n 11: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 14: aload_0\n 15: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 18: checkcast #153 // class java/lang/Number\n 21: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 24: lstore_2\n 25: aload_0\n 26: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 29: checkcast #153 // class java/lang/Number\n 32: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 35: lstore 4\n 37: aload_1\n 38: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 41: checkcast #153 // class java/lang/Number\n 44: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 47: lstore 6\n 49: aload_1\n 50: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 53: checkcast #153 // class java/lang/Number\n 56: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 59: lstore 8\n 61: lload_2\n 62: lconst_0\n 63: lcmp\n 64: ifle 92\n 67: lload 4\n 69: lconst_0\n 70: lcmp\n 71: ifle 92\n 74: lload 6\n 76: lconst_0\n 77: lcmp\n 78: ifle 92\n 81: lload 8\n 83: lconst_0\n 84: lcmp\n 85: ifle 92\n 88: iconst_1\n 89: goto 93\n 92: iconst_0\n 93: istore 10\n 95: getstatic #852 // Field kotlin/_Assertions.ENABLED:Z\n 98: ifeq 124\n 101: iload 10\n 103: ifne 124\n 106: iconst_0\n 107: istore 11\n 109: ldc_w #1160 // String positive only\n 112: astore 11\n 114: new #856 // class java/lang/AssertionError\n 117: dup\n 118: aload 11\n 120: invokespecial #858 // Method java/lang/AssertionError.\"<init>\":(Ljava/lang/Object;)V\n 123: athrow\n 124: nop\n 125: lload_2\n 126: lload 8\n 128: lrem\n 129: lload 6\n 131: lcmp\n 132: ifne 137\n 135: lload_2\n 136: lreturn\n 137: lload_2\n 138: lload 4\n 140: ladd\n 141: lstore_2\n 142: goto 124\n\n public static final long prob13b();\n Code:\n 0: ldc_w #1132 // String 13.txt\n 3: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 6: checkcast #74 // class java/lang/CharSequence\n 9: invokestatic #283 // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;\n 12: iconst_1\n 13: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 18: checkcast #74 // class java/lang/CharSequence\n 21: iconst_1\n 22: newarray char\n 24: astore_1\n 25: aload_1\n 26: iconst_0\n 27: bipush 44\n 29: castore\n 30: aload_1\n 31: iconst_0\n 32: iconst_0\n 33: bipush 6\n 35: aconst_null\n 36: invokestatic #1135 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;\n 39: astore_0\n 40: aload_0\n 41: checkcast #313 // class java/lang/Iterable\n 44: astore_2\n 45: nop\n 46: iconst_0\n 47: istore_3\n 48: aload_2\n 49: astore 4\n 51: new #545 // class java/util/ArrayList\n 54: dup\n 55: invokespecial #546 // Method java/util/ArrayList.\"<init>\":()V\n 58: checkcast #180 // class java/util/Collection\n 61: astore 5\n 63: iconst_0\n 64: istore 6\n 66: aload 4\n 68: astore 7\n 70: iconst_0\n 71: istore 8\n 73: iconst_0\n 74: istore 9\n 76: aload 7\n 78: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 83: astore 10\n 85: aload 10\n 87: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 92: ifeq 235\n 95: aload 10\n 97: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 102: astore 11\n 104: iload 9\n 106: iinc 9, 1\n 109: istore 12\n 111: iload 12\n 113: ifge 119\n 116: invokestatic #1169 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 119: iload 12\n 121: aload 11\n 123: astore 13\n 125: istore 14\n 127: iconst_0\n 128: istore 15\n 130: iload 14\n 132: aload 13\n 134: checkcast #45 // class java/lang/String\n 137: astore 16\n 139: istore 17\n 141: iconst_0\n 142: istore 18\n 144: aload 16\n 146: ldc_w #1136 // String x\n 149: invokestatic #1140 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 152: ifeq 159\n 155: aconst_null\n 156: goto 207\n 159: aload 16\n 161: invokestatic #1172 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 164: lstore 19\n 166: aload_0\n 167: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 172: i2l\n 173: lload 19\n 175: ldiv\n 176: lconst_1\n 177: ladd\n 178: lload 19\n 180: lmul\n 181: lstore 21\n 183: new #169 // class kotlin/Pair\n 186: dup\n 187: lload 21\n 189: iload 17\n 191: i2l\n 192: lsub\n 193: lload 19\n 195: lrem\n 196: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 199: lload 19\n 201: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 204: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 207: nop\n 208: dup\n 209: ifnull 230\n 212: astore 23\n 214: iconst_0\n 215: istore 24\n 217: aload 5\n 219: aload 23\n 221: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 226: pop\n 227: goto 231\n 230: pop\n 231: nop\n 232: goto 85\n 235: nop\n 236: aload 5\n 238: checkcast #285 // class java/util/List\n 241: nop\n 242: checkcast #313 // class java/lang/Iterable\n 245: astore_2\n 246: nop\n 247: iconst_0\n 248: istore_3\n 249: aload_2\n 250: new #1174 // class MainKt$prob13b$$inlined$sortedByDescending$1\n 253: dup\n 254: invokespecial #1175 // Method MainKt$prob13b$$inlined$sortedByDescending$1.\"<init>\":()V\n 257: checkcast #1177 // class java/util/Comparator\n 260: invokestatic #1181 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 263: astore_1\n 264: aload_1\n 265: checkcast #313 // class java/lang/Iterable\n 268: astore_3\n 269: iconst_0\n 270: istore 4\n 272: aload_3\n 273: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 278: astore 5\n 280: aload 5\n 282: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 287: ifne 301\n 290: new #509 // class java/lang/UnsupportedOperationException\n 293: dup\n 294: ldc_w #1183 // String Empty collection can\\'t be reduced.\n 297: invokespecial #512 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 300: athrow\n 301: aload 5\n 303: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 308: astore 6\n 310: aload 5\n 312: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 317: ifeq 394\n 320: aload 6\n 322: aload 5\n 324: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 329: checkcast #169 // class kotlin/Pair\n 332: astore 7\n 334: checkcast #169 // class kotlin/Pair\n 337: astore 8\n 339: iconst_0\n 340: istore 9\n 342: aload 8\n 344: aload 7\n 346: invokestatic #1185 // Method chineseRemainderTheoremPair:(Lkotlin/Pair;Lkotlin/Pair;)J\n 349: lstore 10\n 351: new #169 // class kotlin/Pair\n 354: dup\n 355: lload 10\n 357: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 360: aload 8\n 362: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 365: checkcast #153 // class java/lang/Number\n 368: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 371: aload 7\n 373: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 376: checkcast #153 // class java/lang/Number\n 379: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 382: lmul\n 383: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 386: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 389: astore 6\n 391: goto 310\n 394: aload 6\n 396: checkcast #169 // class kotlin/Pair\n 399: astore_2\n 400: aload_2\n 401: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 404: checkcast #153 // class java/lang/Number\n 407: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 410: lreturn\n\n public static final long prob14();\n Code:\n 0: new #537 // class java/util/LinkedHashMap\n 3: dup\n 4: invokespecial #538 // Method java/util/LinkedHashMap.\"<init>\":()V\n 7: checkcast #412 // class java/util/Map\n 10: astore_0\n 11: new #169 // class kotlin/Pair\n 14: dup\n 15: lconst_0\n 16: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 19: lconst_0\n 20: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 23: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 26: astore_1\n 27: ldc_w #1210 // String 14.txt\n 30: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 33: checkcast #74 // class java/lang/CharSequence\n 36: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 39: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 42: checkcast #74 // class java/lang/CharSequence\n 45: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 48: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 53: astore_2\n 54: aload_2\n 55: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 60: ifeq 208\n 63: aload_2\n 64: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 69: checkcast #45 // class java/lang/String\n 72: astore_3\n 73: aload_3\n 74: ldc_w #1212 // String ma\n 77: iconst_0\n 78: iconst_2\n 79: aconst_null\n 80: invokestatic #1216 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 83: ifeq 99\n 86: aload_3\n 87: bipush 7\n 89: invokestatic #1219 // Method kotlin/text/StringsKt.drop:(Ljava/lang/String;I)Ljava/lang/String;\n 92: invokestatic #1222 // Method prob14$stringToMasks:(Ljava/lang/String;)Lkotlin/Pair;\n 95: astore_1\n 96: goto 54\n 99: new #220 // class kotlin/text/Regex\n 102: dup\n 103: ldc_w #1224 // String mem\\\\[(?<idx>[0-9]+)\\\\] = (?<value>.*)\n 106: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 109: aload_3\n 110: checkcast #74 // class java/lang/CharSequence\n 113: iconst_0\n 114: iconst_2\n 115: aconst_null\n 116: invokestatic #1228 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;\n 119: dup\n 120: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 123: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 128: astore 4\n 130: aload 4\n 132: iconst_1\n 133: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 138: checkcast #45 // class java/lang/String\n 141: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 144: istore 5\n 146: aload 4\n 148: iconst_2\n 149: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 154: checkcast #45 // class java/lang/String\n 157: invokestatic #1172 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 160: lstore 6\n 162: iload 5\n 164: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 167: astore 8\n 169: aload_0\n 170: aload 8\n 172: lload 6\n 174: aload_1\n 175: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 178: checkcast #153 // class java/lang/Number\n 181: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 184: lor\n 185: aload_1\n 186: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 189: checkcast #153 // class java/lang/Number\n 192: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 195: land\n 196: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 199: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 204: pop\n 205: goto 54\n 208: aload_0\n 209: invokeinterface #816, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 214: checkcast #313 // class java/lang/Iterable\n 217: invokestatic #765 // Method kotlin/collections/CollectionsKt.sumOfLong:(Ljava/lang/Iterable;)J\n 220: lreturn\n\n public static final kotlin.sequences.Sequence<java.util.List<java.lang.Integer>> cartesianProduct(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc_w #1242 // String lengthArr\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: checkcast #313 // class java/lang/Iterable\n 11: astore_2\n 12: iconst_0\n 13: istore_3\n 14: aload_2\n 15: astore 4\n 17: new #545 // class java/util/ArrayList\n 20: dup\n 21: aload_2\n 22: bipush 10\n 24: invokestatic #602 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 27: invokespecial #605 // Method java/util/ArrayList.\"<init>\":(I)V\n 30: checkcast #180 // class java/util/Collection\n 33: astore 5\n 35: iconst_0\n 36: istore 6\n 38: aload 4\n 40: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 45: astore 7\n 47: aload 7\n 49: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 54: ifeq 99\n 57: aload 7\n 59: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 64: astore 8\n 66: aload 5\n 68: aload 8\n 70: checkcast #153 // class java/lang/Number\n 73: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 76: istore 9\n 78: astore 11\n 80: iconst_0\n 81: istore 10\n 83: iconst_0\n 84: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 87: aload 11\n 89: swap\n 90: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 95: pop\n 96: goto 47\n 99: aload 5\n 101: checkcast #285 // class java/util/List\n 104: nop\n 105: checkcast #180 // class java/util/Collection\n 108: invokestatic #703 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 111: astore_1\n 112: new #1244 // class kotlin/jvm/internal/Ref$IntRef\n 115: dup\n 116: invokespecial #1245 // Method kotlin/jvm/internal/Ref$IntRef.\"<init>\":()V\n 119: astore_2\n 120: new #1247 // class MainKt$cartesianProduct$1\n 123: dup\n 124: aload_2\n 125: aload_1\n 126: aload_0\n 127: aconst_null\n 128: invokespecial #1250 // Method MainKt$cartesianProduct$1.\"<init>\":(Lkotlin/jvm/internal/Ref$IntRef;Ljava/util/List;Ljava/util/List;Lkotlin/coroutines/Continuation;)V\n 131: checkcast #989 // class kotlin/jvm/functions/Function2\n 134: invokestatic #1051 // Method kotlin/sequences/SequencesKt.sequence:(Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;\n 137: areturn\n\n public static final long prob14b();\n Code:\n 0: new #537 // class java/util/LinkedHashMap\n 3: dup\n 4: invokespecial #538 // Method java/util/LinkedHashMap.\"<init>\":()V\n 7: checkcast #412 // class java/util/Map\n 10: astore_0\n 11: new #1256 // class kotlin/Triple\n 14: dup\n 15: lconst_0\n 16: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 19: lconst_0\n 20: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 23: invokestatic #1259 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 26: invokespecial #1262 // Method kotlin/Triple.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V\n 29: astore_1\n 30: ldc_w #1210 // String 14.txt\n 33: invokestatic #72 // Method getResourceAsText:(Ljava/lang/String;)Ljava/lang/String;\n 36: checkcast #74 // class java/lang/CharSequence\n 39: invokestatic #80 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 42: invokevirtual #84 // Method java/lang/Object.toString:()Ljava/lang/String;\n 45: checkcast #74 // class java/lang/CharSequence\n 48: invokestatic #88 // Method kotlin/text/StringsKt.lineSequence:(Ljava/lang/CharSequence;)Lkotlin/sequences/Sequence;\n 51: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 56: astore_2\n 57: aload_2\n 58: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 63: ifeq 499\n 66: aload_2\n 67: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 72: checkcast #45 // class java/lang/String\n 75: astore_3\n 76: aload_3\n 77: ldc_w #1212 // String ma\n 80: iconst_0\n 81: iconst_2\n 82: aconst_null\n 83: invokestatic #1216 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 86: ifeq 102\n 89: aload_3\n 90: bipush 7\n 92: invokestatic #1219 // Method kotlin/text/StringsKt.drop:(Ljava/lang/String;I)Ljava/lang/String;\n 95: invokestatic #1266 // Method prob14b$stringToMasks$61:(Ljava/lang/String;)Lkotlin/Triple;\n 98: astore_1\n 99: goto 57\n 102: aload_1\n 103: astore 4\n 105: aload 4\n 107: invokevirtual #1267 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 110: checkcast #153 // class java/lang/Number\n 113: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 116: lstore 5\n 118: aload 4\n 120: invokevirtual #1268 // Method kotlin/Triple.component2:()Ljava/lang/Object;\n 123: checkcast #153 // class java/lang/Number\n 126: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 129: lstore 7\n 131: aload 4\n 133: invokevirtual #1271 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 136: checkcast #285 // class java/util/List\n 139: astore 9\n 141: new #220 // class kotlin/text/Regex\n 144: dup\n 145: ldc_w #1224 // String mem\\\\[(?<idx>[0-9]+)\\\\] = (?<value>.*)\n 148: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 151: aload_3\n 152: checkcast #74 // class java/lang/CharSequence\n 155: iconst_0\n 156: iconst_2\n 157: aconst_null\n 158: invokestatic #1228 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;\n 161: dup\n 162: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 165: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 170: astore 10\n 172: aload 10\n 174: iconst_2\n 175: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 180: checkcast #45 // class java/lang/String\n 183: invokestatic #1172 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 186: lstore 11\n 188: aload 10\n 190: iconst_1\n 191: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 196: checkcast #45 // class java/lang/String\n 199: invokestatic #1172 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 202: lstore 13\n 204: lload 13\n 206: lload 5\n 208: lor\n 209: lload 7\n 211: land\n 212: lstore 15\n 214: aload 9\n 216: checkcast #313 // class java/lang/Iterable\n 219: astore 18\n 221: iconst_0\n 222: istore 19\n 224: aload 18\n 226: astore 20\n 228: new #545 // class java/util/ArrayList\n 231: dup\n 232: aload 18\n 234: bipush 10\n 236: invokestatic #602 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 239: invokespecial #605 // Method java/util/ArrayList.\"<init>\":(I)V\n 242: checkcast #180 // class java/util/Collection\n 245: astore 21\n 247: iconst_0\n 248: istore 22\n 250: aload 20\n 252: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 257: astore 23\n 259: aload 23\n 261: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 266: ifeq 311\n 269: aload 23\n 271: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 276: astore 24\n 278: aload 21\n 280: aload 24\n 282: checkcast #153 // class java/lang/Number\n 285: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 288: lstore 25\n 290: astore 31\n 292: iconst_0\n 293: istore 27\n 295: iconst_2\n 296: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 299: aload 31\n 301: swap\n 302: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 307: pop\n 308: goto 259\n 311: aload 21\n 313: checkcast #285 // class java/util/List\n 316: nop\n 317: invokestatic #1273 // Method cartesianProduct:(Ljava/util/List;)Lkotlin/sequences/Sequence;\n 320: invokeinterface #141, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 325: astore 17\n 327: aload 17\n 329: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 334: ifeq 57\n 337: aload 17\n 339: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 344: checkcast #285 // class java/util/List\n 347: astore 18\n 349: lload 15\n 351: aload 18\n 353: checkcast #313 // class java/lang/Iterable\n 356: aload 9\n 358: checkcast #313 // class java/lang/Iterable\n 361: invokestatic #1277 // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;\n 364: checkcast #313 // class java/lang/Iterable\n 367: astore 21\n 369: lstore 31\n 371: lconst_0\n 372: lstore 22\n 374: aload 21\n 376: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 381: astore 24\n 383: aload 24\n 385: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 390: ifeq 460\n 393: aload 24\n 395: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 400: astore 25\n 402: lload 22\n 404: aload 25\n 406: checkcast #169 // class kotlin/Pair\n 409: astore 26\n 411: lstore 33\n 413: iconst_0\n 414: istore 27\n 416: aload 26\n 418: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 421: checkcast #153 // class java/lang/Number\n 424: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 427: istore 28\n 429: aload 26\n 431: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 434: checkcast #153 // class java/lang/Number\n 437: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 440: lstore 29\n 442: iload 28\n 444: i2l\n 445: lload 29\n 447: lmul\n 448: lstore 35\n 450: lload 33\n 452: lload 35\n 454: ladd\n 455: lstore 22\n 457: goto 383\n 460: lload 22\n 462: lstore 33\n 464: lload 31\n 466: lload 33\n 468: ladd\n 469: lstore 19\n 471: lload 19\n 473: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 476: astore 22\n 478: lload 11\n 480: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 483: astore 23\n 485: aload_0\n 486: aload 22\n 488: aload 23\n 490: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 495: pop\n 496: goto 327\n 499: aload_0\n 500: invokeinterface #816, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 505: checkcast #313 // class java/lang/Iterable\n 508: invokestatic #765 // Method kotlin/collections/CollectionsKt.sumOfLong:(Ljava/lang/Iterable;)J\n 511: lreturn\n\n public static final int prob15(boolean);\n Code:\n 0: bipush 7\n 2: anewarray #211 // class java/lang/Integer\n 5: astore_2\n 6: aload_2\n 7: iconst_0\n 8: iconst_0\n 9: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 12: aastore\n 13: aload_2\n 14: iconst_1\n 15: iconst_5\n 16: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 19: aastore\n 20: aload_2\n 21: iconst_2\n 22: iconst_4\n 23: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 26: aastore\n 27: aload_2\n 28: iconst_3\n 29: iconst_1\n 30: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 33: aastore\n 34: aload_2\n 35: iconst_4\n 36: bipush 10\n 38: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 41: aastore\n 42: aload_2\n 43: iconst_5\n 44: bipush 14\n 46: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 49: aastore\n 50: aload_2\n 51: bipush 6\n 53: bipush 7\n 55: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 58: aastore\n 59: aload_2\n 60: invokestatic #175 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 63: astore_1\n 64: aload_1\n 65: checkcast #313 // class java/lang/Iterable\n 68: invokestatic #1293 // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;\n 71: astore_3\n 72: iconst_0\n 73: istore 4\n 75: aload_3\n 76: bipush 10\n 78: invokestatic #602 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 81: invokestatic #1296 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 84: bipush 16\n 86: invokestatic #1299 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I\n 89: istore 5\n 91: aload_3\n 92: astore 6\n 94: new #537 // class java/util/LinkedHashMap\n 97: dup\n 98: iload 5\n 100: invokespecial #1300 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 103: checkcast #412 // class java/util/Map\n 106: astore 7\n 108: iconst_0\n 109: istore 8\n 111: aload 6\n 113: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 118: astore 9\n 120: aload 9\n 122: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 127: ifeq 197\n 130: aload 9\n 132: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 137: astore 10\n 139: aload 7\n 141: astore 11\n 143: aload 10\n 145: checkcast #1302 // class kotlin/collections/IndexedValue\n 148: astore 12\n 150: iconst_0\n 151: istore 13\n 153: aload 12\n 155: invokevirtual #1305 // Method kotlin/collections/IndexedValue.getValue:()Ljava/lang/Object;\n 158: aload 12\n 160: invokevirtual #1308 // Method kotlin/collections/IndexedValue.getIndex:()I\n 163: iconst_1\n 164: iadd\n 165: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 168: invokestatic #823 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;\n 171: invokestatic #1063 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 174: astore 12\n 176: aload 11\n 178: aload 12\n 180: invokevirtual #553 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 183: aload 12\n 185: invokevirtual #541 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 188: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 193: pop\n 194: goto 120\n 197: aload 7\n 199: nop\n 200: invokestatic #1312 // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;\n 203: astore_2\n 204: aload_1\n 205: invokestatic #738 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 208: checkcast #153 // class java/lang/Number\n 211: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 214: istore_3\n 215: aload_1\n 216: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 221: iconst_1\n 222: iadd\n 223: istore 4\n 225: iload_0\n 226: ifeq 235\n 229: sipush 2020\n 232: goto 238\n 235: ldc_w #1313 // int 30000000\n 238: istore 5\n 240: iload 4\n 242: iload 5\n 244: if_icmpgt 434\n 247: aload_2\n 248: iload_3\n 249: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 252: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 257: dup\n 258: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 261: checkcast #285 // class java/util/List\n 264: astore 6\n 266: aload 6\n 268: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 273: iconst_1\n 274: if_icmpne 281\n 277: iconst_0\n 278: goto 310\n 281: aload 6\n 283: iconst_1\n 284: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 289: checkcast #153 // class java/lang/Number\n 292: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 295: aload 6\n 297: iconst_0\n 298: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 303: checkcast #153 // class java/lang/Number\n 306: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 309: isub\n 310: istore_3\n 311: aload_2\n 312: iload_3\n 313: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 316: invokeinterface #1316, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 321: ifne 350\n 324: iload_3\n 325: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 328: astore 8\n 330: aload_2\n 331: aload 8\n 333: iload 4\n 335: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 338: invokestatic #823 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;\n 341: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 346: pop\n 347: goto 421\n 350: aload_2\n 351: iload_3\n 352: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 355: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 360: dup\n 361: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 364: checkcast #285 // class java/util/List\n 367: astore 7\n 369: aload_2\n 370: astore 8\n 372: iload_3\n 373: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 376: astore 9\n 378: iconst_2\n 379: anewarray #211 // class java/lang/Integer\n 382: astore 10\n 384: aload 10\n 386: iconst_0\n 387: aload 7\n 389: invokestatic #738 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 392: aastore\n 393: aload 10\n 395: iconst_1\n 396: iload 4\n 398: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 401: aastore\n 402: aload 10\n 404: invokestatic #175 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 407: astore 10\n 409: aload 8\n 411: aload 9\n 413: aload 10\n 415: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 420: pop\n 421: iload 4\n 423: iload 5\n 425: if_icmpeq 434\n 428: iinc 4, 1\n 431: goto 247\n 434: iload_3\n 435: ireturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc_w #1331 // String args\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: new #1333 // class java/lang/StringBuilder\n 10: dup\n 11: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 14: ldc_w #1336 // String Problem 1a:\n 17: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 20: aconst_null\n 21: lconst_0\n 22: iconst_3\n 23: aconst_null\n 24: invokestatic #1342 // Method problem1a$default:(Lkotlin/sequences/Sequence;JILjava/lang/Object;)Lkotlin/Pair;\n 27: invokevirtual #1345 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 30: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 33: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 36: swap\n 37: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 40: new #1333 // class java/lang/StringBuilder\n 43: dup\n 44: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 47: ldc_w #1359 // String Problem 1b:\n 50: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 53: invokestatic #1361 // Method problem1b:()Lkotlin/Pair;\n 56: invokevirtual #1345 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 59: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 62: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 65: swap\n 66: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 69: new #1333 // class java/lang/StringBuilder\n 72: dup\n 73: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 76: ldc_w #1363 // String Problem 2a:\n 79: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 82: iconst_1\n 83: invokestatic #1365 // Method problem2a:(Z)I\n 86: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 89: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 92: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 95: swap\n 96: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 99: new #1333 // class java/lang/StringBuilder\n 102: dup\n 103: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 106: ldc_w #1370 // String Problem 2b:\n 109: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 112: iconst_0\n 113: invokestatic #1365 // Method problem2a:(Z)I\n 116: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 119: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 122: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 125: swap\n 126: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 129: new #1333 // class java/lang/StringBuilder\n 132: dup\n 133: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 136: ldc_w #1372 // String Problem 3a:\n 139: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 142: iconst_3\n 143: iconst_1\n 144: invokestatic #311 // Method problem3a:(II)I\n 147: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 150: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 153: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 156: swap\n 157: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 160: new #1333 // class java/lang/StringBuilder\n 163: dup\n 164: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 167: ldc_w #1374 // String Problem 3b:\n 170: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 173: invokestatic #1376 // Method problem3b:()J\n 176: invokevirtual #1379 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 179: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 182: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 185: swap\n 186: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 189: new #1333 // class java/lang/StringBuilder\n 192: dup\n 193: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 196: ldc_w #1381 // String Problem 4a:\n 199: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 202: invokestatic #1383 // Method problem4a:()I\n 205: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 208: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 211: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 214: swap\n 215: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 218: new #1333 // class java/lang/StringBuilder\n 221: dup\n 222: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 225: ldc_w #1385 // String Problem 4b:\n 228: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 231: invokestatic #1387 // Method problem4b:()I\n 234: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 237: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 240: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 243: swap\n 244: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 247: new #1333 // class java/lang/StringBuilder\n 250: dup\n 251: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 254: ldc_w #1389 // String Problem 5a:\n 257: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 260: invokestatic #1391 // Method problem5a:()I\n 263: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 266: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 269: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 272: swap\n 273: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 276: new #1333 // class java/lang/StringBuilder\n 279: dup\n 280: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 283: ldc_w #1393 // String Problem 5b:\n 286: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 289: invokestatic #1395 // Method problem5b:()I\n 292: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 295: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 298: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 301: swap\n 302: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 305: new #1333 // class java/lang/StringBuilder\n 308: dup\n 309: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 312: ldc_w #1397 // String Problem 6a:\n 315: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 318: invokestatic #1399 // Method problem6a:()I\n 321: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 324: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 327: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 330: swap\n 331: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 334: new #1333 // class java/lang/StringBuilder\n 337: dup\n 338: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 341: ldc_w #1401 // String Problem 6b:\n 344: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 347: invokestatic #1403 // Method problem6b:()I\n 350: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 353: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 356: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 359: swap\n 360: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 363: new #1333 // class java/lang/StringBuilder\n 366: dup\n 367: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 370: ldc_w #1405 // String Problem 7a:\n 373: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 376: invokestatic #1407 // Method problem7a:()I\n 379: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 382: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 385: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 388: swap\n 389: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 392: new #1333 // class java/lang/StringBuilder\n 395: dup\n 396: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 399: ldc_w #1409 // String Problem 7b:\n 402: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 405: invokestatic #1411 // Method problem7b:()I\n 408: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 411: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 414: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 417: swap\n 418: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 421: new #1333 // class java/lang/StringBuilder\n 424: dup\n 425: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 428: ldc_w #1413 // String Problem 8a:\n 431: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 434: aconst_null\n 435: iconst_1\n 436: aconst_null\n 437: invokestatic #1415 // Method problem8a$default:(Ljava/util/List;ILjava/lang/Object;)Lkotlin/Pair;\n 440: invokevirtual #1345 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 443: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 446: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 449: swap\n 450: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 453: new #1333 // class java/lang/StringBuilder\n 456: dup\n 457: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 460: ldc_w #1417 // String Problem 8b:\n 463: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 466: invokestatic #1419 // Method problem8b:()I\n 469: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 472: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 475: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 478: swap\n 479: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 482: new #1333 // class java/lang/StringBuilder\n 485: dup\n 486: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 489: ldc_w #1421 // String Problem 9a:\n 492: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 495: aconst_null\n 496: iconst_1\n 497: aconst_null\n 498: invokestatic #1423 // Method problem9a$default:(Lkotlin/sequences/Sequence;ILjava/lang/Object;)J\n 501: invokevirtual #1379 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 504: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 507: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 510: swap\n 511: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 514: new #1333 // class java/lang/StringBuilder\n 517: dup\n 518: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 521: ldc_w #1425 // String Problem 9b:\n 524: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 527: invokestatic #1427 // Method problem9b:()J\n 530: invokevirtual #1379 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 533: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 536: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 539: swap\n 540: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 543: new #1333 // class java/lang/StringBuilder\n 546: dup\n 547: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 550: ldc_w #1429 // String Problem 10a:\n 553: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 556: invokestatic #1431 // Method problem10a:()I\n 559: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 562: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 565: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 568: swap\n 569: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 572: new #1333 // class java/lang/StringBuilder\n 575: dup\n 576: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 579: ldc_w #1433 // String Problem 10b:\n 582: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 585: invokestatic #1435 // Method problem10b:()J\n 588: invokevirtual #1379 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 591: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 594: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 597: swap\n 598: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 601: new #1333 // class java/lang/StringBuilder\n 604: dup\n 605: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 608: ldc_w #1437 // String Problem 12:\n 611: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 614: invokestatic #1439 // Method prob12:()I\n 617: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 620: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 623: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 626: swap\n 627: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 630: new #1333 // class java/lang/StringBuilder\n 633: dup\n 634: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 637: ldc_w #1441 // String Problem 12b:\n 640: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 643: invokestatic #1443 // Method prob12b:()I\n 646: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 649: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 652: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 655: swap\n 656: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 659: new #1333 // class java/lang/StringBuilder\n 662: dup\n 663: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 666: ldc_w #1445 // String Problem 13:\n 669: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 672: invokestatic #1447 // Method prob13:()I\n 675: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 678: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 681: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 684: swap\n 685: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 688: new #1333 // class java/lang/StringBuilder\n 691: dup\n 692: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 695: ldc_w #1449 // String Problem 13b:\n 698: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 701: invokestatic #1451 // Method prob13b:()J\n 704: invokevirtual #1379 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 707: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 710: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 713: swap\n 714: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 717: new #1333 // class java/lang/StringBuilder\n 720: dup\n 721: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 724: ldc_w #1453 // String Problem 14:\n 727: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 730: invokestatic #1455 // Method prob14:()J\n 733: invokevirtual #1379 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 736: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 739: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 742: swap\n 743: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 746: new #1333 // class java/lang/StringBuilder\n 749: dup\n 750: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 753: ldc_w #1457 // String Problem 14b:\n 756: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 759: invokestatic #1459 // Method prob14b:()J\n 762: invokevirtual #1379 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 765: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 768: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 771: swap\n 772: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 775: new #1333 // class java/lang/StringBuilder\n 778: dup\n 779: invokespecial #1334 // Method java/lang/StringBuilder.\"<init>\":()V\n 782: ldc_w #1461 // String Problem 15:\n 785: invokevirtual #1340 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 788: iconst_1\n 789: invokestatic #1463 // Method prob15:(Z)I\n 792: invokevirtual #1368 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 795: invokevirtual #1346 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 798: getstatic #1352 // Field java/lang/System.out:Ljava/io/PrintStream;\n 801: swap\n 802: invokevirtual #1357 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 805: return\n\n private static final int getResourceAsInts$lambda$0(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 11: ireturn\n\n private static final long getResourceAsLongs$lambda$1(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: invokestatic #1172 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 11: lreturn\n\n private static final boolean problem2a$isValid(int, int, java.lang.String, java.lang.String);\n Code:\n 0: new #220 // class kotlin/text/Regex\n 3: dup\n 4: aload_2\n 5: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 8: aload_3\n 9: checkcast #74 // class java/lang/CharSequence\n 12: iconst_0\n 13: iconst_2\n 14: aconst_null\n 15: invokestatic #1471 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 18: invokestatic #268 // Method kotlin/sequences/SequencesKt.count:(Lkotlin/sequences/Sequence;)I\n 21: istore 4\n 23: iload_0\n 24: iload 4\n 26: if_icmpgt 43\n 29: iload 4\n 31: iload_1\n 32: if_icmpgt 39\n 35: iconst_1\n 36: goto 44\n 39: iconst_0\n 40: goto 44\n 43: iconst_0\n 44: ireturn\n\n private static final boolean problem2a$isValidB(int, int, java.lang.String, java.lang.String);\n Code:\n 0: aload_3\n 1: iload_0\n 2: iconst_1\n 3: isub\n 4: invokevirtual #299 // Method java/lang/String.charAt:(I)C\n 7: aload_2\n 8: iconst_0\n 9: invokevirtual #299 // Method java/lang/String.charAt:(I)C\n 12: if_icmpne 19\n 15: iconst_1\n 16: goto 20\n 19: iconst_0\n 20: aload_3\n 21: iload_1\n 22: iconst_1\n 23: isub\n 24: invokevirtual #299 // Method java/lang/String.charAt:(I)C\n 27: aload_2\n 28: iconst_0\n 29: invokevirtual #299 // Method java/lang/String.charAt:(I)C\n 32: if_icmpne 39\n 35: iconst_1\n 36: goto 40\n 39: iconst_0\n 40: ixor\n 41: ireturn\n\n private static final kotlin.text.MatchResult$Destructured problem2a$lambda$2(kotlin.text.Regex, java.lang.String);\n Code:\n 0: aload_1\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: aload_1\n 9: checkcast #74 // class java/lang/CharSequence\n 12: iconst_0\n 13: iconst_2\n 14: aconst_null\n 15: invokestatic #1228 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;\n 18: dup\n 19: ifnull 30\n 22: invokeinterface #1481, 1 // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;\n 27: goto 32\n 30: pop\n 31: aconst_null\n 32: areturn\n\n private static final boolean problem2a$lambda$3(kotlin.reflect.KFunction, kotlin.text.MatchResult$Destructured);\n Code:\n 0: aload_1\n 1: ldc_w #1486 // String <destruct>\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_1\n 8: invokevirtual #1490 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 11: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 16: iconst_1\n 17: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 22: checkcast #45 // class java/lang/String\n 25: astore_2\n 26: aload_1\n 27: invokevirtual #1490 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 30: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 35: iconst_2\n 36: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 41: checkcast #45 // class java/lang/String\n 44: astore_3\n 45: aload_1\n 46: invokevirtual #1490 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 49: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 54: iconst_3\n 55: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 60: checkcast #45 // class java/lang/String\n 63: astore 4\n 65: aload_1\n 66: invokevirtual #1490 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 69: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 74: iconst_4\n 75: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 80: checkcast #45 // class java/lang/String\n 83: astore 5\n 85: aload_0\n 86: checkcast #1492 // class kotlin/jvm/functions/Function4\n 89: aload_2\n 90: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 93: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 96: aload_3\n 97: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 100: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 103: aload 4\n 105: aload 5\n 107: invokeinterface #1495, 5 // InterfaceMethod kotlin/jvm/functions/Function4.invoke:(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 112: checkcast #1497 // class java/lang/Boolean\n 115: invokevirtual #1500 // Method java/lang/Boolean.booleanValue:()Z\n 118: ireturn\n\n private static final java.util.Set problem4a$lambda$6(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: checkcast #74 // class java/lang/CharSequence\n 11: astore_1\n 12: new #220 // class kotlin/text/Regex\n 15: dup\n 16: ldc_w #1503 // String \\\\s\n 19: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 22: astore_2\n 23: iconst_0\n 24: istore_3\n 25: aload_2\n 26: aload_1\n 27: iload_3\n 28: invokevirtual #1507 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 31: checkcast #313 // class java/lang/Iterable\n 34: astore_1\n 35: nop\n 36: iconst_0\n 37: istore_2\n 38: aload_1\n 39: astore_3\n 40: new #545 // class java/util/ArrayList\n 43: dup\n 44: aload_1\n 45: bipush 10\n 47: invokestatic #602 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 50: invokespecial #605 // Method java/util/ArrayList.\"<init>\":(I)V\n 53: checkcast #180 // class java/util/Collection\n 56: astore 4\n 58: iconst_0\n 59: istore 5\n 61: aload_3\n 62: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 67: astore 6\n 69: aload 6\n 71: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 76: ifeq 146\n 79: aload 6\n 81: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 86: astore 7\n 88: aload 4\n 90: aload 7\n 92: checkcast #45 // class java/lang/String\n 95: astore 8\n 97: astore 11\n 99: iconst_0\n 100: istore 9\n 102: aload 8\n 104: checkcast #74 // class java/lang/CharSequence\n 107: iconst_1\n 108: newarray char\n 110: astore 10\n 112: aload 10\n 114: iconst_0\n 115: bipush 58\n 117: castore\n 118: aload 10\n 120: iconst_0\n 121: iconst_0\n 122: bipush 6\n 124: aconst_null\n 125: invokestatic #1510 // Method kotlin/text/StringsKt.splitToSequence$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 128: invokestatic #1514 // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;\n 131: checkcast #45 // class java/lang/String\n 134: aload 11\n 136: swap\n 137: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 142: pop\n 143: goto 69\n 146: aload 4\n 148: checkcast #285 // class java/util/List\n 151: nop\n 152: checkcast #313 // class java/lang/Iterable\n 155: invokestatic #1517 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;\n 158: areturn\n\n private static final java.util.Map problem4b$lambda$9(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: checkcast #74 // class java/lang/CharSequence\n 11: astore_1\n 12: new #220 // class kotlin/text/Regex\n 15: dup\n 16: ldc_w #1503 // String \\\\s\n 19: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 22: astore_2\n 23: iconst_0\n 24: istore_3\n 25: aload_2\n 26: aload_1\n 27: iload_3\n 28: invokevirtual #1507 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 31: checkcast #313 // class java/lang/Iterable\n 34: astore_1\n 35: nop\n 36: iconst_0\n 37: istore_2\n 38: aload_1\n 39: bipush 10\n 41: invokestatic #602 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 44: invokestatic #1296 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 47: bipush 16\n 49: invokestatic #1299 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I\n 52: istore_3\n 53: aload_1\n 54: astore 4\n 56: new #537 // class java/util/LinkedHashMap\n 59: dup\n 60: iload_3\n 61: invokespecial #1300 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 64: checkcast #412 // class java/util/Map\n 67: astore 5\n 69: iconst_0\n 70: istore 6\n 72: aload 4\n 74: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 79: astore 7\n 81: aload 7\n 83: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 88: ifeq 168\n 91: aload 7\n 93: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 98: astore 8\n 100: aload 5\n 102: astore 9\n 104: aload 8\n 106: checkcast #45 // class java/lang/String\n 109: astore 10\n 111: iconst_0\n 112: istore 11\n 114: aload 10\n 116: checkcast #74 // class java/lang/CharSequence\n 119: iconst_1\n 120: anewarray #45 // class java/lang/String\n 123: astore 12\n 125: aload 12\n 127: iconst_0\n 128: ldc_w #1521 // String :\n 131: aastore\n 132: aload 12\n 134: iconst_0\n 135: iconst_0\n 136: bipush 6\n 138: aconst_null\n 139: invokestatic #611 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 142: invokestatic #1523 // Method listToPair:(Ljava/util/List;)Lkotlin/Pair;\n 145: astore 10\n 147: aload 9\n 149: aload 10\n 151: invokevirtual #553 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 154: aload 10\n 156: invokevirtual #541 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 159: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 164: pop\n 165: goto 81\n 168: aload 5\n 170: nop\n 171: areturn\n\n private static final boolean problem4b$lambda$11(java.util.List, java.util.Map);\n Code:\n 0: aload_1\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: checkcast #313 // class java/lang/Iterable\n 11: astore_2\n 12: iconst_0\n 13: istore_3\n 14: aload_2\n 15: instanceof #180 // class java/util/Collection\n 18: ifeq 37\n 21: aload_2\n 22: checkcast #180 // class java/util/Collection\n 25: invokeinterface #1006, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 30: ifeq 37\n 33: iconst_1\n 34: goto 90\n 37: aload_2\n 38: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 43: astore 4\n 45: aload 4\n 47: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 52: ifeq 89\n 55: aload 4\n 57: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 62: astore 5\n 64: aload 5\n 66: checkcast #45 // class java/lang/String\n 69: astore 6\n 71: iconst_0\n 72: istore 7\n 74: aload_1\n 75: aload 6\n 77: invokeinterface #1316, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 82: ifne 45\n 85: iconst_0\n 86: goto 90\n 89: iconst_1\n 90: ireturn\n\n private static final boolean problem4b$isValid$12(java.util.Set<java.lang.String>, java.util.Map<java.lang.String, java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc_w #348 // String hgt\n 4: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 9: dup\n 10: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 13: checkcast #45 // class java/lang/String\n 16: astore_2\n 17: aload_2\n 18: ldc_w #1532 // String cm\n 21: iconst_0\n 22: iconst_2\n 23: aconst_null\n 24: invokestatic #1535 // Method kotlin/text/StringsKt.endsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 27: ifeq 68\n 30: aload_2\n 31: iconst_2\n 32: invokestatic #1537 // Method kotlin/text/StringsKt.dropLast:(Ljava/lang/String;I)Ljava/lang/String;\n 35: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 38: istore 4\n 40: sipush 150\n 43: iload 4\n 45: if_icmpgt 64\n 48: iload 4\n 50: sipush 194\n 53: if_icmpge 60\n 56: iconst_1\n 57: goto 65\n 60: iconst_0\n 61: goto 65\n 64: iconst_0\n 65: ifne 117\n 68: aload_2\n 69: ldc_w #1539 // String in\n 72: iconst_0\n 73: iconst_2\n 74: aconst_null\n 75: invokestatic #1535 // Method kotlin/text/StringsKt.endsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 78: ifeq 121\n 81: aload_2\n 82: iconst_2\n 83: invokestatic #1537 // Method kotlin/text/StringsKt.dropLast:(Ljava/lang/String;I)Ljava/lang/String;\n 86: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 89: istore 4\n 91: bipush 59\n 93: iload 4\n 95: if_icmpgt 113\n 98: iload 4\n 100: bipush 77\n 102: if_icmpge 109\n 105: iconst_1\n 106: goto 114\n 109: iconst_0\n 110: goto 114\n 113: iconst_0\n 114: ifeq 121\n 117: iconst_1\n 118: goto 122\n 121: iconst_0\n 122: istore_3\n 123: iload_3\n 124: ifeq 435\n 127: new #1541 // class kotlin/ranges/IntRange\n 130: dup\n 131: sipush 1920\n 134: sipush 2002\n 137: invokespecial #1544 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 140: astore 4\n 142: aload_1\n 143: ldc_w #342 // String byr\n 146: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 151: checkcast #45 // class java/lang/String\n 154: dup\n 155: ifnull 167\n 158: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 161: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 164: goto 169\n 167: pop\n 168: aconst_null\n 169: astore 5\n 171: aload 5\n 173: ifnull 193\n 176: aload 4\n 178: aload 5\n 180: invokevirtual #1141 // Method java/lang/Integer.intValue:()I\n 183: invokevirtual #1547 // Method kotlin/ranges/IntRange.contains:(I)Z\n 186: ifeq 193\n 189: iconst_1\n 190: goto 194\n 193: iconst_0\n 194: ifeq 435\n 197: new #1541 // class kotlin/ranges/IntRange\n 200: dup\n 201: sipush 2010\n 204: sipush 2020\n 207: invokespecial #1544 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 210: astore 4\n 212: aload_1\n 213: ldc_w #344 // String iyr\n 216: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 221: checkcast #45 // class java/lang/String\n 224: dup\n 225: ifnull 237\n 228: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 231: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 234: goto 239\n 237: pop\n 238: aconst_null\n 239: astore 5\n 241: aload 5\n 243: ifnull 263\n 246: aload 4\n 248: aload 5\n 250: invokevirtual #1141 // Method java/lang/Integer.intValue:()I\n 253: invokevirtual #1547 // Method kotlin/ranges/IntRange.contains:(I)Z\n 256: ifeq 263\n 259: iconst_1\n 260: goto 264\n 263: iconst_0\n 264: ifeq 435\n 267: new #1541 // class kotlin/ranges/IntRange\n 270: dup\n 271: sipush 2020\n 274: sipush 2030\n 277: invokespecial #1544 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 280: astore 4\n 282: aload_1\n 283: ldc_w #346 // String eyr\n 286: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 291: checkcast #45 // class java/lang/String\n 294: dup\n 295: ifnull 307\n 298: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 301: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 304: goto 309\n 307: pop\n 308: aconst_null\n 309: astore 5\n 311: aload 5\n 313: ifnull 333\n 316: aload 4\n 318: aload 5\n 320: invokevirtual #1141 // Method java/lang/Integer.intValue:()I\n 323: invokevirtual #1547 // Method kotlin/ranges/IntRange.contains:(I)Z\n 326: ifeq 333\n 329: iconst_1\n 330: goto 334\n 333: iconst_0\n 334: ifeq 435\n 337: aload_1\n 338: ldc_w #350 // String hcl\n 341: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 346: dup\n 347: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 350: checkcast #74 // class java/lang/CharSequence\n 353: astore 4\n 355: new #220 // class kotlin/text/Regex\n 358: dup\n 359: ldc_w #1549 // String ^#[a-f0-9]{6}$\n 362: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 365: aload 4\n 367: invokevirtual #1553 // Method kotlin/text/Regex.containsMatchIn:(Ljava/lang/CharSequence;)Z\n 370: ifeq 435\n 373: aload_0\n 374: aload_1\n 375: ldc_w #352 // String ecl\n 378: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 383: dup\n 384: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 387: invokeinterface #167, 2 // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z\n 392: ifeq 435\n 395: aload_1\n 396: ldc_w #354 // String pid\n 399: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 404: dup\n 405: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 408: checkcast #74 // class java/lang/CharSequence\n 411: astore 4\n 413: new #220 // class kotlin/text/Regex\n 416: dup\n 417: ldc_w #1555 // String ^[0-9]{9}$\n 420: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 423: aload 4\n 425: invokevirtual #1553 // Method kotlin/text/Regex.containsMatchIn:(Ljava/lang/CharSequence;)Z\n 428: ifeq 435\n 431: iconst_1\n 432: goto 436\n 435: iconst_0\n 436: ireturn\n\n private static final int problem5b$lambda$15(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: bipush 7\n 10: invokestatic #447 // Method kotlin/text/StringsKt.take:(Ljava/lang/String;I)Ljava/lang/String;\n 13: bipush 70\n 15: invokestatic #449 // Method strToBinary:(Ljava/lang/String;C)I\n 18: bipush 8\n 20: imul\n 21: aload_0\n 22: iconst_3\n 23: invokestatic #452 // Method kotlin/text/StringsKt.takeLast:(Ljava/lang/String;I)Ljava/lang/String;\n 26: bipush 76\n 28: invokestatic #449 // Method strToBinary:(Ljava/lang/String;C)I\n 31: iadd\n 32: ireturn\n\n private static final java.util.Set problem6b$lambda$19$lambda$17(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc_w #1558 // String person\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: checkcast #74 // class java/lang/CharSequence\n 11: invokestatic #498 // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;\n 14: areturn\n\n private static final kotlin.Pair problem7a$outerToInner$lambda$20(java.lang.String, kotlin.text.MatchResult);\n Code:\n 0: aload_1\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: new #169 // class kotlin/Pair\n 10: dup\n 11: aload_0\n 12: aload_1\n 13: invokeinterface #1481, 1 // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;\n 18: invokevirtual #1490 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 21: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 26: iconst_1\n 27: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 32: checkcast #45 // class java/lang/String\n 35: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 38: areturn\n\n private static final kotlin.sequences.Sequence<kotlin.Pair<java.lang.String, java.lang.String>> problem7a$outerToInner(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #74 // class java/lang/CharSequence\n 4: iconst_1\n 5: anewarray #45 // class java/lang/String\n 8: astore_2\n 9: aload_2\n 10: iconst_0\n 11: ldc_w #1566 // String bags contain\n 14: aastore\n 15: aload_2\n 16: iconst_0\n 17: iconst_0\n 18: bipush 6\n 20: aconst_null\n 21: invokestatic #611 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 24: astore_1\n 25: aload_1\n 26: iconst_0\n 27: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 32: checkcast #45 // class java/lang/String\n 35: astore_2\n 36: new #220 // class kotlin/text/Regex\n 39: dup\n 40: ldc_w #1568 // String [0-9]+ ([a-z ]+?) bag\n 43: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 46: aload_1\n 47: iconst_1\n 48: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 53: checkcast #74 // class java/lang/CharSequence\n 56: iconst_0\n 57: iconst_2\n 58: aconst_null\n 59: invokestatic #1471 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 62: aload_2\n 63: invokedynamic #1576, 0 // InvokeDynamic #18:invoke:(Ljava/lang/String;)Lkotlin/jvm/functions/Function1;\n 68: invokestatic #114 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 71: areturn\n\n private static final void problem7a$recur(java.util.Map<java.lang.String, ? extends java.util.List<java.lang.String>>, java.util.Set<java.lang.String>, java.lang.String);\n Code:\n 0: aload_0\n 1: aload_2\n 2: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 7: checkcast #285 // class java/util/List\n 10: dup\n 11: ifnonnull 18\n 14: pop\n 15: invokestatic #1259 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 18: astore_3\n 19: aload_1\n 20: checkcast #180 // class java/util/Collection\n 23: aload_3\n 24: checkcast #313 // class java/lang/Iterable\n 27: invokestatic #1583 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 30: pop\n 31: aload_3\n 32: checkcast #313 // class java/lang/Iterable\n 35: astore 4\n 37: iconst_0\n 38: istore 5\n 40: aload 4\n 42: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 47: astore 6\n 49: aload 6\n 51: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 56: ifeq 89\n 59: aload 6\n 61: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 66: astore 7\n 68: aload 7\n 70: checkcast #45 // class java/lang/String\n 73: astore 8\n 75: iconst_0\n 76: istore 9\n 78: aload_0\n 79: aload_1\n 80: aload 8\n 82: invokestatic #560 // Method problem7a$recur:(Ljava/util/Map;Ljava/util/Set;Ljava/lang/String;)V\n 85: nop\n 86: goto 49\n 89: nop\n 90: return\n\n private static final BagContent problem7b$outerToInners$lambda$25(kotlin.text.MatchResult);\n Code:\n 0: aload_0\n 1: ldc_w #1465 // String it\n 4: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: new #1592 // class BagContent\n 10: dup\n 11: aload_0\n 12: invokeinterface #1481, 1 // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;\n 17: invokevirtual #1490 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 20: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 25: iconst_1\n 26: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 31: checkcast #45 // class java/lang/String\n 34: invokestatic #644 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 37: aload_0\n 38: invokeinterface #1481, 1 // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;\n 43: invokevirtual #1490 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 46: invokeinterface #1233, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 51: iconst_2\n 52: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 57: checkcast #45 // class java/lang/String\n 60: invokespecial #1595 // Method BagContent.\"<init>\":(ILjava/lang/String;)V\n 63: areturn\n\n private static final kotlin.Pair<java.lang.String, java.util.List<BagContent>> problem7b$outerToInners(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #74 // class java/lang/CharSequence\n 4: iconst_1\n 5: anewarray #45 // class java/lang/String\n 8: astore_2\n 9: aload_2\n 10: iconst_0\n 11: ldc_w #1566 // String bags contain\n 14: aastore\n 15: aload_2\n 16: iconst_0\n 17: iconst_0\n 18: bipush 6\n 20: aconst_null\n 21: invokestatic #611 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 24: astore_1\n 25: aload_1\n 26: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 31: iconst_2\n 32: if_icmplt 39\n 35: iconst_1\n 36: goto 40\n 39: iconst_0\n 40: istore_2\n 41: getstatic #852 // Field kotlin/_Assertions.ENABLED:Z\n 44: ifeq 66\n 47: iload_2\n 48: ifne 66\n 51: iconst_0\n 52: istore_3\n 53: ldc_w #1598 // String two sides to the rule expected\n 56: astore_3\n 57: new #856 // class java/lang/AssertionError\n 60: dup\n 61: aload_3\n 62: invokespecial #858 // Method java/lang/AssertionError.\"<init>\":(Ljava/lang/Object;)V\n 65: athrow\n 66: aload_1\n 67: iconst_0\n 68: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 73: checkcast #45 // class java/lang/String\n 76: astore_2\n 77: new #169 // class kotlin/Pair\n 80: dup\n 81: aload_2\n 82: new #220 // class kotlin/text/Regex\n 85: dup\n 86: ldc_w #1600 // String ([0-9]+) ([a-z ]+?) bag\n 89: invokespecial #223 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 92: aload_1\n 93: iconst_1\n 94: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 99: checkcast #74 // class java/lang/CharSequence\n 102: iconst_0\n 103: iconst_2\n 104: aconst_null\n 105: invokestatic #1471 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;\n 108: invokedynamic #1605, 0 // InvokeDynamic #19:invoke:()Lkotlin/jvm/functions/Function1;\n 113: invokestatic #114 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;\n 116: invokestatic #758 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 119: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 122: areturn\n\n private static final int problem7b$recur$28(java.util.Map<java.lang.String, ? extends java.util.List<BagContent>>, java.lang.String);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 7: checkcast #285 // class java/util/List\n 10: dup\n 11: ifnonnull 18\n 14: pop\n 15: invokestatic #1259 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 18: astore_2\n 19: aload_2\n 20: checkcast #313 // class java/lang/Iterable\n 23: astore_3\n 24: iconst_0\n 25: istore 4\n 27: aload_3\n 28: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 33: astore 5\n 35: aload 5\n 37: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 42: ifeq 101\n 45: aload 5\n 47: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 52: astore 6\n 54: iload 4\n 56: aload 6\n 58: checkcast #1592 // class BagContent\n 61: astore 7\n 63: istore 9\n 65: iconst_0\n 66: istore 8\n 68: aload 7\n 70: invokevirtual #1611 // Method BagContent.getNum:()I\n 73: aload 7\n 75: invokevirtual #1611 // Method BagContent.getNum:()I\n 78: aload_0\n 79: aload 7\n 81: invokevirtual #1614 // Method BagContent.getColor:()Ljava/lang/String;\n 84: invokestatic #587 // Method problem7b$recur$28:(Ljava/util/Map;Ljava/lang/String;)I\n 87: imul\n 88: iadd\n 89: istore 10\n 91: iload 9\n 93: iload 10\n 95: iadd\n 96: istore 4\n 98: goto 35\n 101: iload 4\n 103: ireturn\n\n private static final int problem10a$lambda$32(int, int);\n Code:\n 0: iload_1\n 1: iload_0\n 2: isub\n 3: ireturn\n\n private static final long problem10b$recur$37(java.util.List<java.lang.Integer>, java.util.Map<java.lang.Integer, java.lang.Long>, int);\n Code:\n 0: iload_2\n 1: iconst_1\n 2: iadd\n 3: aload_0\n 4: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 9: if_icmpne 14\n 12: lconst_1\n 13: lreturn\n 14: aload_1\n 15: iload_2\n 16: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 19: invokeinterface #1316, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 24: ifeq 48\n 27: aload_1\n 28: iload_2\n 29: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 32: invokeinterface #543, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 37: dup\n 38: invokestatic #462 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 41: checkcast #153 // class java/lang/Number\n 44: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 47: lreturn\n 48: aload_0\n 49: iload_2\n 50: invokeinterface #289, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 55: checkcast #153 // class java/lang/Number\n 58: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 61: istore_3\n 62: aload_0\n 63: checkcast #313 // class java/lang/Iterable\n 66: iload_2\n 67: iconst_1\n 68: iadd\n 69: invokestatic #1624 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;\n 72: checkcast #313 // class java/lang/Iterable\n 75: astore 5\n 77: iconst_0\n 78: istore 6\n 80: new #545 // class java/util/ArrayList\n 83: dup\n 84: invokespecial #546 // Method java/util/ArrayList.\"<init>\":()V\n 87: astore 7\n 89: aload 5\n 91: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 96: astore 8\n 98: aload 8\n 100: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 105: ifeq 160\n 108: aload 8\n 110: invokeinterface #151, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 115: astore 9\n 117: aload 9\n 119: checkcast #153 // class java/lang/Number\n 122: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 125: istore 10\n 127: iconst_0\n 128: istore 11\n 130: iload 10\n 132: iload_3\n 133: iconst_3\n 134: iadd\n 135: if_icmpgt 142\n 138: iconst_1\n 139: goto 143\n 142: iconst_0\n 143: ifne 149\n 146: goto 160\n 149: aload 7\n 151: aload 9\n 153: invokevirtual #1625 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 156: pop\n 157: goto 98\n 160: aload 7\n 162: checkcast #285 // class java/util/List\n 165: invokeinterface #295, 1 // InterfaceMethod java/util/List.size:()I\n 170: istore 4\n 172: new #1541 // class kotlin/ranges/IntRange\n 175: dup\n 176: iload_2\n 177: iconst_1\n 178: iadd\n 179: iload_2\n 180: iload 4\n 182: iadd\n 183: invokespecial #1544 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 186: checkcast #313 // class java/lang/Iterable\n 189: astore 7\n 191: lconst_0\n 192: lstore 8\n 194: aload 7\n 196: invokeinterface #314, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 201: astore 10\n 203: aload 10\n 205: invokeinterface #147, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 210: ifeq 253\n 213: aload 10\n 215: checkcast #1627 // class kotlin/collections/IntIterator\n 218: invokevirtual #1630 // Method kotlin/collections/IntIterator.nextInt:()I\n 221: istore 11\n 223: lload 8\n 225: iload 11\n 227: istore 12\n 229: lstore 14\n 231: iconst_0\n 232: istore 13\n 234: aload_0\n 235: aload_1\n 236: iload 12\n 238: invokestatic #1632 // Method problem10b$recur$37:(Ljava/util/List;Ljava/util/Map;I)J\n 241: lstore 16\n 243: lload 14\n 245: lload 16\n 247: ladd\n 248: lstore 8\n 250: goto 203\n 253: lload 8\n 255: lstore 5\n 257: aload_1\n 258: astore 7\n 260: iload_2\n 261: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 264: lload 5\n 266: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 269: invokestatic #1063 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 272: astore 8\n 274: aload 7\n 276: aload 8\n 278: invokevirtual #553 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 281: aload 8\n 283: invokevirtual #541 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 286: invokeinterface #550, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 291: pop\n 292: lload 5\n 294: lreturn\n\n static long problem10b$recur$37$default(java.util.List, java.util.Map, int, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_4\n 2: iand\n 3: ifeq 8\n 6: iconst_0\n 7: istore_2\n 8: aload_0\n 9: aload_1\n 10: iload_2\n 11: invokestatic #1632 // Method problem10b$recur$37:(Ljava/util/List;Ljava/util/Map;I)J\n 14: lreturn\n\n private static final int prepareBytes$lambda$40(int, int, int, int);\n Code:\n 0: iload_2\n 1: iload_0\n 2: iload_1\n 3: iadd\n 4: imul\n 5: iload_3\n 6: iadd\n 7: ireturn\n\n private static final byte prepareBytes$lambda$41(kotlin.jvm.internal.Ref$BooleanRef, byte[], byte[], kotlin.jvm.functions.Function2, int, int);\n Code:\n 0: aload_0\n 1: getfield #872 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 4: ifeq 11\n 7: aload_1\n 8: goto 12\n 11: aload_2\n 12: aload_3\n 13: iload 4\n 15: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 18: iload 5\n 20: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 23: invokeinterface #991, 3 // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 28: checkcast #153 // class java/lang/Number\n 31: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 34: baload\n 35: ireturn\n\n private static final kotlin.Unit prepareBytes$lambda$42(kotlin.jvm.internal.Ref$BooleanRef, byte[], byte[], kotlin.jvm.functions.Function2, int, int, byte);\n Code:\n 0: aload_0\n 1: getfield #872 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 4: ifeq 11\n 7: aload_1\n 8: goto 12\n 11: aload_2\n 12: aload_3\n 13: iload 4\n 15: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 18: iload 5\n 20: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 23: invokeinterface #991, 3 // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 28: checkcast #153 // class java/lang/Number\n 31: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 34: iload 6\n 36: bastore\n 37: getstatic #1652 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 40: areturn\n\n private static final kotlin.Unit prepareBytes$lambda$43(kotlin.jvm.internal.Ref$BooleanRef);\n Code:\n 0: aload_0\n 1: aload_0\n 2: getfield #872 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 5: ifne 12\n 8: iconst_1\n 9: goto 13\n 12: iconst_0\n 13: putfield #872 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 16: getstatic #1652 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 19: areturn\n\n private static final byte[] prepareBytes$lambda$44(kotlin.jvm.internal.Ref$BooleanRef, byte[], byte[]);\n Code:\n 0: aload_0\n 1: getfield #872 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 4: ifeq 11\n 7: aload_1\n 8: goto 12\n 11: aload_2\n 12: areturn\n\n private static final boolean prepareBytes$lambda$46$lambda$45(int, int, int, int);\n Code:\n 0: iload_2\n 1: iflt 22\n 4: iload_3\n 5: iflt 22\n 8: iload_2\n 9: iload_0\n 10: if_icmpge 22\n 13: iload_3\n 14: iload_1\n 15: if_icmpge 22\n 18: iconst_1\n 19: goto 23\n 22: iconst_0\n 23: ireturn\n\n private static final java.util.List prepareBytes$lambda$46(kotlin.jvm.internal.Ref$BooleanRef, byte[], byte[], kotlin.jvm.functions.Function2, int, int, int, int, kotlin.jvm.functions.Function1);\n Code:\n 0: aload 8\n 2: ldc_w #1660 // String f\n 5: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 8: iload 4\n 10: iload 5\n 12: invokedynamic #1666, 0 // InvokeDynamic #20:invoke:(II)Lkotlin/jvm/functions/Function2;\n 17: astore 9\n 19: aload_0\n 20: getfield #872 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 23: ifeq 30\n 26: aload_1\n 27: goto 31\n 30: aload_2\n 31: astore 10\n 33: new #545 // class java/util/ArrayList\n 36: dup\n 37: invokespecial #546 // Method java/util/ArrayList.\"<init>\":()V\n 40: checkcast #285 // class java/util/List\n 43: astore 11\n 45: iconst_m1\n 46: istore 12\n 48: iload 12\n 50: iconst_2\n 51: if_icmpge 213\n 54: iconst_m1\n 55: istore 13\n 57: iload 13\n 59: iconst_2\n 60: if_icmpge 207\n 63: iload 13\n 65: ifne 73\n 68: iload 12\n 70: ifeq 201\n 73: iload 6\n 75: iload 12\n 77: iadd\n 78: istore 14\n 80: iload 7\n 82: iload 13\n 84: iadd\n 85: istore 15\n 87: aload 9\n 89: iload 14\n 91: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 94: iload 15\n 96: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 99: invokeinterface #991, 3 // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 104: checkcast #1497 // class java/lang/Boolean\n 107: invokevirtual #1500 // Method java/lang/Boolean.booleanValue:()Z\n 110: ifeq 201\n 113: aload 10\n 115: aload_3\n 116: iload 14\n 118: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 121: iload 15\n 123: invokestatic #214 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 126: invokeinterface #991, 3 // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 131: checkcast #153 // class java/lang/Number\n 134: invokevirtual #208 // Method java/lang/Number.intValue:()I\n 137: baload\n 138: istore 16\n 140: aload 8\n 142: iload 16\n 144: invokestatic #1014 // Method java/lang/Byte.valueOf:(B)Ljava/lang/Byte;\n 147: invokeinterface #1668, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 152: checkcast #1497 // class java/lang/Boolean\n 155: invokevirtual #1500 // Method java/lang/Boolean.booleanValue:()Z\n 158: ifeq 184\n 161: iload 16\n 163: invokestatic #1014 // Method java/lang/Byte.valueOf:(B)Ljava/lang/Byte;\n 166: astore 17\n 168: aload 11\n 170: checkcast #180 // class java/util/Collection\n 173: aload 17\n 175: invokeinterface #183, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 180: pop\n 181: goto 201\n 184: iload 15\n 186: iload 13\n 188: iadd\n 189: istore 15\n 191: iload 14\n 193: iload 12\n 195: iadd\n 196: istore 14\n 198: goto 87\n 201: iinc 13, 1\n 204: goto 57\n 207: iinc 12, 1\n 210: goto 48\n 213: aload 11\n 215: areturn\n\n private static final boolean problem11$lambda$47(byte);\n Code:\n 0: iconst_1\n 1: ireturn\n\n private static final boolean problem11$lambda$48(byte);\n Code:\n 0: iload_0\n 1: bipush 46\n 3: if_icmpeq 10\n 6: iconst_1\n 7: goto 11\n 10: iconst_0\n 11: ireturn\n\n private static final kotlin.Pair<java.lang.Long, java.lang.Long> prob14$stringToMasks(java.lang.String);\n Code:\n 0: aload_0\n 1: invokevirtual #431 // Method java/lang/String.toCharArray:()[C\n 4: dup\n 5: ldc_w #433 // String toCharArray(...)\n 8: invokestatic #436 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 11: astore_1\n 12: new #169 // class kotlin/Pair\n 15: dup\n 16: lconst_0\n 17: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 20: lconst_0\n 21: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 24: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 27: astore_2\n 28: iconst_0\n 29: istore_3\n 30: iconst_0\n 31: istore 4\n 33: aload_2\n 34: astore 5\n 36: iconst_0\n 37: istore 6\n 39: aload_1\n 40: arraylength\n 41: istore 7\n 43: iload 6\n 45: iload 7\n 47: if_icmpge 166\n 50: aload_1\n 51: iload 6\n 53: caload\n 54: istore 8\n 56: iload 4\n 58: iinc 4, 1\n 61: aload 5\n 63: iload 8\n 65: istore 9\n 67: astore 10\n 69: istore 11\n 71: iconst_0\n 72: istore 12\n 74: aload 10\n 76: invokevirtual #479 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 79: checkcast #153 // class java/lang/Number\n 82: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 85: lstore 13\n 87: aload 10\n 89: invokevirtual #482 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 92: checkcast #153 // class java/lang/Number\n 95: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 98: lstore 15\n 100: lconst_1\n 101: aload_0\n 102: invokevirtual #292 // Method java/lang/String.length:()I\n 105: iload 11\n 107: isub\n 108: iconst_1\n 109: isub\n 110: lshl\n 111: lstore 17\n 113: new #169 // class kotlin/Pair\n 116: dup\n 117: lload 13\n 119: iload 9\n 121: bipush 49\n 123: if_icmpne 131\n 126: lload 17\n 128: goto 132\n 131: lconst_0\n 132: ladd\n 133: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 136: lload 15\n 138: iload 9\n 140: bipush 48\n 142: if_icmpne 149\n 145: lconst_0\n 146: goto 151\n 149: lload 17\n 151: ladd\n 152: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 155: invokespecial #178 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 158: astore 5\n 160: iinc 6, 1\n 163: goto 43\n 166: aload 5\n 168: areturn\n\n private static final kotlin.Triple<java.lang.Long, java.lang.Long, java.util.List<java.lang.Long>> prob14b$stringToMasks$61(java.lang.String);\n Code:\n 0: aload_0\n 1: invokevirtual #431 // Method java/lang/String.toCharArray:()[C\n 4: dup\n 5: ldc_w #433 // String toCharArray(...)\n 8: invokestatic #436 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 11: astore_1\n 12: new #1256 // class kotlin/Triple\n 15: dup\n 16: lconst_0\n 17: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 20: lconst_0\n 21: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 24: invokestatic #1259 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 27: invokespecial #1262 // Method kotlin/Triple.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V\n 30: astore_2\n 31: iconst_0\n 32: istore_3\n 33: iconst_0\n 34: istore 4\n 36: aload_2\n 37: astore 5\n 39: iconst_0\n 40: istore 6\n 42: aload_1\n 43: arraylength\n 44: istore 7\n 46: iload 6\n 48: iload 7\n 50: if_icmpge 205\n 53: aload_1\n 54: iload 6\n 56: caload\n 57: istore 8\n 59: iload 4\n 61: iinc 4, 1\n 64: aload 5\n 66: iload 8\n 68: istore 9\n 70: astore 10\n 72: istore 11\n 74: iconst_0\n 75: istore 12\n 77: aload 10\n 79: invokevirtual #1267 // Method kotlin/Triple.component1:()Ljava/lang/Object;\n 82: checkcast #153 // class java/lang/Number\n 85: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 88: lstore 13\n 90: aload 10\n 92: invokevirtual #1268 // Method kotlin/Triple.component2:()Ljava/lang/Object;\n 95: checkcast #153 // class java/lang/Number\n 98: invokevirtual #157 // Method java/lang/Number.longValue:()J\n 101: lstore 15\n 103: aload 10\n 105: invokevirtual #1271 // Method kotlin/Triple.component3:()Ljava/lang/Object;\n 108: checkcast #285 // class java/util/List\n 111: astore 17\n 113: lconst_1\n 114: aload_0\n 115: invokevirtual #292 // Method java/lang/String.length:()I\n 118: iload 11\n 120: isub\n 121: iconst_1\n 122: isub\n 123: lshl\n 124: lstore 18\n 126: new #1256 // class kotlin/Triple\n 129: dup\n 130: lload 13\n 132: iload 9\n 134: bipush 49\n 136: if_icmpne 144\n 139: lload 18\n 141: goto 145\n 144: lconst_0\n 145: ladd\n 146: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 149: lload 15\n 151: iload 9\n 153: bipush 88\n 155: if_icmpne 162\n 158: lconst_0\n 159: goto 164\n 162: lload 18\n 164: ladd\n 165: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 168: iload 9\n 170: bipush 88\n 172: if_icmpne 191\n 175: aload 17\n 177: checkcast #180 // class java/util/Collection\n 180: lload 18\n 182: invokestatic #163 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 185: invokestatic #830 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;\n 188: goto 193\n 191: aload 17\n 193: invokespecial #1262 // Method kotlin/Triple.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V\n 196: nop\n 197: astore 5\n 199: iinc 6, 1\n 202: goto 46\n 205: aload 5\n 207: areturn\n\n public static final boolean access$problem2a$isValid(int, int, java.lang.String, java.lang.String);\n Code:\n 0: iload_0\n 1: iload_1\n 2: aload_2\n 3: aload_3\n 4: invokestatic #1684 // Method problem2a$isValid:(IILjava/lang/String;Ljava/lang/String;)Z\n 7: ireturn\n\n public static final boolean access$problem2a$isValidB(int, int, java.lang.String, java.lang.String);\n Code:\n 0: iload_0\n 1: iload_1\n 2: aload_2\n 3: aload_3\n 4: invokestatic #1687 // Method problem2a$isValidB:(IILjava/lang/String;Ljava/lang/String;)Z\n 7: ireturn\n\n public static final kotlin.sequences.Sequence access$problem7a$outerToInner(java.lang.String);\n Code:\n 0: aload_0\n 1: invokestatic #1690 // Method problem7a$outerToInner:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 4: areturn\n}\n", "javap_err": "" }, { "class_path": "fasiha__advent-of-code-2020__59edfcb/MainKt$problem7a$innerToOuters$1.class", "javap": "Compiled from \"main.kt\"\nfinal class MainKt$problem7a$innerToOuters$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, kotlin.sequences.Sequence<? extends kotlin.Pair<? extends java.lang.String, ? extends java.lang.String>>> {\n public static final MainKt$problem7a$innerToOuters$1 INSTANCE;\n\n MainKt$problem7a$innerToOuters$1();\n Code:\n 0: aload_0\n 1: iconst_1\n 2: ldc #11 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 4: ldc #13 // String outerToInner\n 6: ldc #15 // String problem7a$outerToInner(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 8: iconst_0\n 9: invokespecial #18 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 12: return\n\n public final kotlin.sequences.Sequence<kotlin.Pair<java.lang.String, java.lang.String>> invoke(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #25 // String p0\n 3: invokestatic #31 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: invokestatic #36 // Method MainKt.access$problem7a$outerToInner:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 10: areturn\n\n public java.lang.Object invoke(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #40 // class java/lang/String\n 5: invokevirtual #42 // Method invoke:(Ljava/lang/String;)Lkotlin/sequences/Sequence;\n 8: areturn\n\n static {};\n Code:\n 0: new #2 // class MainKt$problem7a$innerToOuters$1\n 3: dup\n 4: invokespecial #47 // Method \"<init>\":()V\n 7: putstatic #50 // Field INSTANCE:LMainKt$problem7a$innerToOuters$1;\n 10: return\n}\n", "javap_err": "" } ]
nishtahir__scratchpad__51115e3/src/main/kotlin/Extensions.kt
import java.util.* import java.util.concurrent.locks.Lock fun isValidTriangle(values: List<Int>): Boolean = values[0] + values[1] > values[2] && values[0] + values[2] > values[1] && values[1] + values[2] > values[0] inline fun <reified T> List<T>.grouped(by: Int): List<List<T>> { require(by > 0) { "Groupings can't be less than 1" } return if (isEmpty()) { emptyList() } else { (0..lastIndex / by).map { val fromIndex = it * by val toIndex = Math.min(fromIndex + by, this.size) subList(fromIndex, toIndex) } } } /** * Not a very good transpose function. Works for squares though... */ inline fun <reified T> transpose(values: List<List<T>>): List<List<T>> { return values.indices.map { i -> values[0].indices.map { values[it][i] } } } fun randomSequence(upper: Int = 10, lower: Int = 0): List<Int> { return (lower..upper).distinct().toMutableList().apply { Collections.shuffle(this) } } fun <T> List<T>.pickRandom(num: Int = 4): List<T> { return randomSequence(upper = this.size, lower = 0).take(num).map { this[it] } }
[ { "class_path": "nishtahir__scratchpad__51115e3/ExtensionsKt.class", "javap": "Compiled from \"Extensions.kt\"\npublic final class ExtensionsKt {\n public static final boolean isValidTriangle(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #10 // String values\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: iconst_0\n 8: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 13: checkcast #24 // class java/lang/Number\n 16: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 19: aload_0\n 20: iconst_1\n 21: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 26: checkcast #24 // class java/lang/Number\n 29: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 32: iadd\n 33: aload_0\n 34: iconst_2\n 35: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 40: checkcast #24 // class java/lang/Number\n 43: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 46: if_icmple 139\n 49: aload_0\n 50: iconst_0\n 51: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 56: checkcast #24 // class java/lang/Number\n 59: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 62: aload_0\n 63: iconst_2\n 64: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 69: checkcast #24 // class java/lang/Number\n 72: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 75: iadd\n 76: aload_0\n 77: iconst_1\n 78: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 83: checkcast #24 // class java/lang/Number\n 86: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 89: if_icmple 139\n 92: aload_0\n 93: iconst_1\n 94: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 99: checkcast #24 // class java/lang/Number\n 102: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 105: aload_0\n 106: iconst_2\n 107: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 112: checkcast #24 // class java/lang/Number\n 115: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 118: iadd\n 119: aload_0\n 120: iconst_0\n 121: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 126: checkcast #24 // class java/lang/Number\n 129: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 132: if_icmple 139\n 135: iconst_1\n 136: goto 140\n 139: iconst_0\n 140: ireturn\n\n public static final <T> java.util.List<java.util.List<T>> grouped(java.util.List<? extends T>, int);\n Code:\n 0: aload_0\n 1: ldc #34 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: iload_1\n 9: ifle 16\n 12: iconst_1\n 13: goto 17\n 16: iconst_0\n 17: ifne 40\n 20: iconst_0\n 21: istore 4\n 23: ldc #36 // String Groupings can\\'t be less than 1\n 25: astore 4\n 27: new #38 // class java/lang/IllegalArgumentException\n 30: dup\n 31: aload 4\n 33: invokevirtual #42 // Method java/lang/Object.toString:()Ljava/lang/String;\n 36: invokespecial #46 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 39: athrow\n 40: aload_0\n 41: invokeinterface #50, 1 // InterfaceMethod java/util/List.isEmpty:()Z\n 46: ifeq 55\n 49: invokestatic #56 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 52: goto 189\n 55: new #58 // class kotlin/ranges/IntRange\n 58: dup\n 59: iconst_0\n 60: aload_0\n 61: invokestatic #62 // Method kotlin/collections/CollectionsKt.getLastIndex:(Ljava/util/List;)I\n 64: iload_1\n 65: idiv\n 66: invokespecial #65 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 69: checkcast #67 // class java/lang/Iterable\n 72: astore_3\n 73: iconst_0\n 74: istore 4\n 76: aload_3\n 77: astore 5\n 79: new #69 // class java/util/ArrayList\n 82: dup\n 83: aload_3\n 84: bipush 10\n 86: invokestatic #73 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 89: invokespecial #76 // Method java/util/ArrayList.\"<init>\":(I)V\n 92: checkcast #78 // class java/util/Collection\n 95: astore 6\n 97: iconst_0\n 98: istore 7\n 100: aload 5\n 102: invokeinterface #82, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 107: astore 8\n 109: aload 8\n 111: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 116: ifeq 183\n 119: aload 8\n 121: checkcast #89 // class kotlin/collections/IntIterator\n 124: invokevirtual #92 // Method kotlin/collections/IntIterator.nextInt:()I\n 127: istore 9\n 129: aload 6\n 131: iload 9\n 133: istore 10\n 135: astore 14\n 137: iconst_0\n 138: istore 11\n 140: iload 10\n 142: iload_1\n 143: imul\n 144: istore 12\n 146: iload 12\n 148: iload_1\n 149: iadd\n 150: aload_0\n 151: invokeinterface #95, 1 // InterfaceMethod java/util/List.size:()I\n 156: invokestatic #101 // Method java/lang/Math.min:(II)I\n 159: istore 13\n 161: aload_0\n 162: iload 12\n 164: iload 13\n 166: invokeinterface #105, 3 // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;\n 171: aload 14\n 173: swap\n 174: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 179: pop\n 180: goto 109\n 183: aload 6\n 185: checkcast #18 // class java/util/List\n 188: nop\n 189: areturn\n\n public static final <T> java.util.List<java.util.List<T>> transpose(java.util.List<? extends java.util.List<? extends T>>);\n Code:\n 0: aload_0\n 1: ldc #10 // String values\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: aload_0\n 9: checkcast #78 // class java/util/Collection\n 12: invokestatic #133 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;\n 15: checkcast #67 // class java/lang/Iterable\n 18: astore_2\n 19: iconst_0\n 20: istore_3\n 21: aload_2\n 22: astore 4\n 24: new #69 // class java/util/ArrayList\n 27: dup\n 28: aload_2\n 29: bipush 10\n 31: invokestatic #73 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 34: invokespecial #76 // Method java/util/ArrayList.\"<init>\":(I)V\n 37: checkcast #78 // class java/util/Collection\n 40: astore 5\n 42: iconst_0\n 43: istore 6\n 45: aload 4\n 47: invokeinterface #82, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 52: astore 7\n 54: aload 7\n 56: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 61: ifeq 221\n 64: aload 7\n 66: checkcast #89 // class kotlin/collections/IntIterator\n 69: invokevirtual #92 // Method kotlin/collections/IntIterator.nextInt:()I\n 72: istore 8\n 74: aload 5\n 76: iload 8\n 78: istore 9\n 80: astore 21\n 82: iconst_0\n 83: istore 10\n 85: aload_0\n 86: iconst_0\n 87: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 92: checkcast #78 // class java/util/Collection\n 95: invokestatic #133 // Method kotlin/collections/CollectionsKt.getIndices:(Ljava/util/Collection;)Lkotlin/ranges/IntRange;\n 98: checkcast #67 // class java/lang/Iterable\n 101: astore 11\n 103: iconst_0\n 104: istore 12\n 106: aload 11\n 108: astore 13\n 110: new #69 // class java/util/ArrayList\n 113: dup\n 114: aload 11\n 116: bipush 10\n 118: invokestatic #73 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 121: invokespecial #76 // Method java/util/ArrayList.\"<init>\":(I)V\n 124: checkcast #78 // class java/util/Collection\n 127: astore 14\n 129: iconst_0\n 130: istore 15\n 132: aload 13\n 134: invokeinterface #82, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 139: astore 16\n 141: aload 16\n 143: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 148: ifeq 202\n 151: aload 16\n 153: checkcast #89 // class kotlin/collections/IntIterator\n 156: invokevirtual #92 // Method kotlin/collections/IntIterator.nextInt:()I\n 159: istore 17\n 161: aload 14\n 163: iload 17\n 165: istore 18\n 167: astore 19\n 169: iconst_0\n 170: istore 20\n 172: aload_0\n 173: iload 18\n 175: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 180: checkcast #18 // class java/util/List\n 183: iload 9\n 185: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 190: aload 19\n 192: swap\n 193: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 198: pop\n 199: goto 141\n 202: aload 14\n 204: checkcast #18 // class java/util/List\n 207: nop\n 208: nop\n 209: aload 21\n 211: swap\n 212: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 217: pop\n 218: goto 54\n 221: aload 5\n 223: checkcast #18 // class java/util/List\n 226: nop\n 227: areturn\n\n public static final java.util.List<java.lang.Integer> randomSequence(int, int);\n Code:\n 0: new #58 // class kotlin/ranges/IntRange\n 3: dup\n 4: iload_1\n 5: iload_0\n 6: invokespecial #65 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 9: checkcast #67 // class java/lang/Iterable\n 12: invokestatic #143 // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;\n 15: checkcast #78 // class java/util/Collection\n 18: invokestatic #147 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 21: astore_2\n 22: aload_2\n 23: astore_3\n 24: iconst_0\n 25: istore 4\n 27: aload_3\n 28: invokestatic #153 // Method java/util/Collections.shuffle:(Ljava/util/List;)V\n 31: aload_2\n 32: areturn\n\n public static java.util.List randomSequence$default(int, int, int, java.lang.Object);\n Code:\n 0: iload_2\n 1: iconst_1\n 2: iand\n 3: ifeq 9\n 6: bipush 10\n 8: istore_0\n 9: iload_2\n 10: iconst_2\n 11: iand\n 12: ifeq 17\n 15: iconst_0\n 16: istore_1\n 17: iload_0\n 18: iload_1\n 19: invokestatic #161 // Method randomSequence:(II)Ljava/util/List;\n 22: areturn\n\n public static final <T> java.util.List<T> pickRandom(java.util.List<? extends T>, int);\n Code:\n 0: aload_0\n 1: ldc #34 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokeinterface #95, 1 // InterfaceMethod java/util/List.size:()I\n 12: iconst_0\n 13: invokestatic #161 // Method randomSequence:(II)Ljava/util/List;\n 16: checkcast #67 // class java/lang/Iterable\n 19: iload_1\n 20: invokestatic #167 // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;\n 23: checkcast #67 // class java/lang/Iterable\n 26: astore_2\n 27: iconst_0\n 28: istore_3\n 29: aload_2\n 30: astore 4\n 32: new #69 // class java/util/ArrayList\n 35: dup\n 36: aload_2\n 37: bipush 10\n 39: invokestatic #73 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 42: invokespecial #76 // Method java/util/ArrayList.\"<init>\":(I)V\n 45: checkcast #78 // class java/util/Collection\n 48: astore 5\n 50: iconst_0\n 51: istore 6\n 53: aload 4\n 55: invokeinterface #82, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 60: astore 7\n 62: aload 7\n 64: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 69: ifeq 118\n 72: aload 7\n 74: invokeinterface #171, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 79: astore 8\n 81: aload 5\n 83: aload 8\n 85: checkcast #24 // class java/lang/Number\n 88: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 91: istore 9\n 93: astore 11\n 95: iconst_0\n 96: istore 10\n 98: aload_0\n 99: iload 9\n 101: invokeinterface #22, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 106: aload 11\n 108: swap\n 109: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 114: pop\n 115: goto 62\n 118: aload 5\n 120: checkcast #18 // class java/util/List\n 123: nop\n 124: areturn\n\n public static java.util.List pickRandom$default(java.util.List, int, int, java.lang.Object);\n Code:\n 0: iload_2\n 1: iconst_1\n 2: iand\n 3: ifeq 8\n 6: iconst_4\n 7: istore_1\n 8: aload_0\n 9: iload_1\n 10: invokestatic #179 // Method pickRandom:(Ljava/util/List;I)Ljava/util/List;\n 13: areturn\n}\n", "javap_err": "" } ]
rhavran__ProjectEuler__1115674/src/Utils.kt
import kotlin.math.sqrt /** * https://www.youtube.com/watch?v=V08g_lkKj6Q */ class EratosthenesSieve(n: Int) { val numbers: List<Boolean> init { val numbersArray = BooleanArray(n + 1) numbersArray.fill(true) var potentialPrime = 2 while (potentialPrime * potentialPrime <= n) { // If prime[p] is not changed, then it is a prime if (numbersArray[potentialPrime]) { // Update all multiples of p var nextPow = potentialPrime * potentialPrime while (nextPow <= n) { numbersArray[nextPow] = false nextPow += potentialPrime } } potentialPrime++ } numbers = numbersArray.toList() } fun isPrime(n: Int): Boolean { return numbers[n] } } object PrimeFactorization { private val incrementFunc: (t: Long, u: Long?) -> Long? = { _, old -> if (old == null) 1L else old + 1L } fun primeFactors(n: Long): Map<Long, Long> { val numberToPower = hashMapOf<Long, Long>() // Add the number of 2s that divide n. var number = n while (number % 2L == 0L) { numberToPower.compute(2L, incrementFunc) number /= 2L } // n must be odd at this point. So we can // skip one element (Note i = i +2) as per sieve of Eratosthenes. var i = 3L while (i <= sqrt(number.toDouble())) { // While i divides n, add i and divide n while (number % i == 0L) { numberToPower.compute(i, incrementFunc) number /= i } i += 2L } // This condition is to handle the case when // n is a prime number greater than 2 if (number > 2L) { numberToPower.compute(number, incrementFunc) } return numberToPower } } /** * σ0(N) * https://en.wikipedia.org/wiki/Divisor_function */ fun Long.dividers(): Long { var dividers = 1L val numberToPower = PrimeFactorization.primeFactors(this) for (entry in numberToPower) { dividers *= (entry.value + 1) } return dividers } fun Long.sequenceSumStartingFrom(a0: Long): Long { return sumFromTo(a0, this) } fun sumFromTo(a0: Long, aN: Long): Long { val n = aN - a0 + 1 return (n.toDouble() / 2.0 * (a0 + aN)).toLong() }
[ { "class_path": "rhavran__ProjectEuler__1115674/UtilsKt.class", "javap": "Compiled from \"Utils.kt\"\npublic final class UtilsKt {\n public static final long dividers(long);\n Code:\n 0: lconst_1\n 1: lstore_2\n 2: getstatic #12 // Field PrimeFactorization.INSTANCE:LPrimeFactorization;\n 5: lload_0\n 6: invokevirtual #16 // Method PrimeFactorization.primeFactors:(J)Ljava/util/Map;\n 9: astore 4\n 11: aload 4\n 13: invokeinterface #22, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 18: invokeinterface #28, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 23: astore 5\n 25: aload 5\n 27: invokeinterface #34, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 32: ifeq 68\n 35: aload 5\n 37: invokeinterface #38, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 42: checkcast #40 // class java/util/Map$Entry\n 45: astore 6\n 47: lload_2\n 48: aload 6\n 50: invokeinterface #43, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 55: checkcast #45 // class java/lang/Number\n 58: invokevirtual #49 // Method java/lang/Number.longValue:()J\n 61: lconst_1\n 62: ladd\n 63: lmul\n 64: lstore_2\n 65: goto 25\n 68: lload_2\n 69: lreturn\n\n public static final long sequenceSumStartingFrom(long, long);\n Code:\n 0: lload_2\n 1: lload_0\n 2: invokestatic #60 // Method sumFromTo:(JJ)J\n 5: lreturn\n\n public static final long sumFromTo(long, long);\n Code:\n 0: lload_2\n 1: lload_0\n 2: lsub\n 3: lconst_1\n 4: ladd\n 5: lstore 4\n 7: lload 4\n 9: l2d\n 10: ldc2_w #63 // double 2.0d\n 13: ddiv\n 14: lload_0\n 15: lload_2\n 16: ladd\n 17: l2d\n 18: dmul\n 19: d2l\n 20: lreturn\n}\n", "javap_err": "" } ]
rhavran__ProjectEuler__1115674/src/P14LongestCollatzSequence.kt
fun main(args: Array<String>) { println("Res: " + findSolution()) } /** The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1. Which starting number, under one million, produces the longest chain? NOTE: Once the chain starts the terms are allowed to go above one million. */ private fun findSolution(): Long { val startingPoint = 999_999L var maxChain = 0L var startingPointWithMaxChain = 0L for (x in startingPoint downTo 1L) { val collatzSequence = collatzSequence(x) if (collatzSequence > maxChain) { maxChain = collatzSequence startingPointWithMaxChain = x } } return startingPointWithMaxChain } fun collatzSequence(startingPoint: Long): Long { var result = 1L var number = startingPoint while (number != 1L) { number = nextCollatzNumber(number) result++ } return result } fun nextCollatzNumber(n: Long): Long { return if (n % 2 == 0L) n / 2 else (n * 3) + 1 }
[ { "class_path": "rhavran__ProjectEuler__1115674/P14LongestCollatzSequenceKt.class", "javap": "Compiled from \"P14LongestCollatzSequence.kt\"\npublic final class P14LongestCollatzSequenceKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #17 // class java/lang/StringBuilder\n 9: dup\n 10: invokespecial #21 // Method java/lang/StringBuilder.\"<init>\":()V\n 13: ldc #23 // String Res:\n 15: invokevirtual #27 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 18: invokestatic #31 // Method findSolution:()J\n 21: invokevirtual #34 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 24: invokevirtual #38 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 27: getstatic #44 // Field java/lang/System.out:Ljava/io/PrintStream;\n 30: swap\n 31: invokevirtual #50 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 34: return\n\n private static final long findSolution();\n Code:\n 0: ldc2_w #52 // long 999999l\n 3: lstore_0\n 4: lconst_0\n 5: lstore_2\n 6: lconst_0\n 7: lstore 4\n 9: lload_0\n 10: lstore 6\n 12: lconst_0\n 13: lload 6\n 15: lcmp\n 16: ifge 51\n 19: lload 6\n 21: invokestatic #57 // Method collatzSequence:(J)J\n 24: lstore 8\n 26: lload 8\n 28: lload_2\n 29: lcmp\n 30: ifle 40\n 33: lload 8\n 35: lstore_2\n 36: lload 6\n 38: lstore 4\n 40: lload 6\n 42: ldc2_w #58 // long -1l\n 45: ladd\n 46: lstore 6\n 48: goto 12\n 51: lload 4\n 53: lreturn\n\n public static final long collatzSequence(long);\n Code:\n 0: lconst_1\n 1: lstore_2\n 2: lload_0\n 3: lstore 4\n 5: lload 4\n 7: lconst_1\n 8: lcmp\n 9: ifeq 30\n 12: lload 4\n 14: invokestatic #67 // Method nextCollatzNumber:(J)J\n 17: lstore 4\n 19: lload_2\n 20: lstore 6\n 22: lload 6\n 24: lconst_1\n 25: ladd\n 26: lstore_2\n 27: goto 5\n 30: lload_2\n 31: lreturn\n\n public static final long nextCollatzNumber(long);\n Code:\n 0: lload_0\n 1: iconst_2\n 2: i2l\n 3: lrem\n 4: lconst_0\n 5: lcmp\n 6: ifne 16\n 9: lload_0\n 10: iconst_2\n 11: i2l\n 12: ldiv\n 13: goto 22\n 16: lload_0\n 17: iconst_3\n 18: i2l\n 19: lmul\n 20: lconst_1\n 21: ladd\n 22: lreturn\n}\n", "javap_err": "" } ]
rhavran__ProjectEuler__1115674/src/P12HighlyDivisibleTriangularNumber.kt
fun main(args: Array<String>) { println("Res: " + findSolution()) } /** The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... Let us list the factors of the first seven triangle numbers: 1: 1 3: 1,3 6: 1,2,3,6 10: 1,2,5,10 15: 1,3,5,15 21: 1,3,7,21 28: 1,2,4,7,14,28 We can see that 28 is the first triangle number to have over five divisors. What is the value of the first triangle number to have over five hundred divisors? Res:76576500 Solution: σ0(N) https://en.wikipedia.org/wiki/Prime_omega_function */ private fun findSolution(): Long { val min = 10000 // 28 has 5 val nThTriangleNumber = Long.MAX_VALUE for (nTh in min..nThTriangleNumber) { val triangleNumber = nTh.sequenceSumStartingFrom(1) if (triangleNumber % 2 != 0L && triangleNumber % 5 != 0L) { println(triangleNumber) continue } val numberOfDividers = triangleNumber.dividers() if (numberOfDividers >= 500L) { return triangleNumber } } return -1 }
[ { "class_path": "rhavran__ProjectEuler__1115674/P12HighlyDivisibleTriangularNumberKt.class", "javap": "Compiled from \"P12HighlyDivisibleTriangularNumber.kt\"\npublic final class P12HighlyDivisibleTriangularNumberKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #17 // class java/lang/StringBuilder\n 9: dup\n 10: invokespecial #21 // Method java/lang/StringBuilder.\"<init>\":()V\n 13: ldc #23 // String Res:\n 15: invokevirtual #27 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 18: invokestatic #31 // Method findSolution:()J\n 21: invokevirtual #34 // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;\n 24: invokevirtual #38 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 27: getstatic #44 // Field java/lang/System.out:Ljava/io/PrintStream;\n 30: swap\n 31: invokevirtual #50 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 34: return\n\n private static final long findSolution();\n Code:\n 0: sipush 10000\n 3: istore_0\n 4: ldc2_w #52 // long 9223372036854775807l\n 7: lstore_1\n 8: iload_0\n 9: i2l\n 10: lstore_3\n 11: lload_3\n 12: lload_1\n 13: lcmp\n 14: ifgt 87\n 17: lload_3\n 18: lconst_1\n 19: invokestatic #59 // Method UtilsKt.sequenceSumStartingFrom:(JJ)J\n 22: lstore 5\n 24: lload 5\n 26: iconst_2\n 27: i2l\n 28: lrem\n 29: lconst_0\n 30: lcmp\n 31: ifeq 55\n 34: lload 5\n 36: iconst_5\n 37: i2l\n 38: lrem\n 39: lconst_0\n 40: lcmp\n 41: ifeq 55\n 44: getstatic #44 // Field java/lang/System.out:Ljava/io/PrintStream;\n 47: lload 5\n 49: invokevirtual #62 // Method java/io/PrintStream.println:(J)V\n 52: goto 74\n 55: lload 5\n 57: invokestatic #66 // Method UtilsKt.dividers:(J)J\n 60: lstore 7\n 62: lload 7\n 64: ldc2_w #67 // long 500l\n 67: lcmp\n 68: iflt 74\n 71: lload 5\n 73: lreturn\n 74: lload_3\n 75: lload_1\n 76: lcmp\n 77: ifeq 87\n 80: lload_3\n 81: lconst_1\n 82: ladd\n 83: lstore_3\n 84: goto 17\n 87: ldc2_w #69 // long -1l\n 90: lreturn\n}\n", "javap_err": "" } ]
rhavran__ProjectEuler__1115674/src/P4LargersPalindromOf3Digits.kt
fun main(args: Array<String>) { println("Res: " + largestLargestPalindromeProduct()) } /** * A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. * Find the largest palindrome made from the product of two 3-digit numbers. */ private fun largestLargestPalindromeProduct(): Int { val largest = 999 val smallest = 100 // largest number * largest number could be the first largest palindrome result val palindrome = largest * largest for (x in palindrome downTo 1) { for (b in largest downTo smallest step 1) { val a = x / b; if (x % b == 0 && a <= largest && a >= smallest && isPalindrome(x.toString())) { return x } } } return 0 } fun isPalindrome(palindrome: String): Boolean { var isPalindrome = true for (ch in 0 until (palindrome.length / 2) step 1) { isPalindrome = isPalindrome && palindrome[ch] == palindrome[palindrome.length - 1 - ch] } return isPalindrome; }
[ { "class_path": "rhavran__ProjectEuler__1115674/P4LargersPalindromOf3DigitsKt.class", "javap": "Compiled from \"P4LargersPalindromOf3Digits.kt\"\npublic final class P4LargersPalindromOf3DigitsKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #17 // class java/lang/StringBuilder\n 9: dup\n 10: invokespecial #21 // Method java/lang/StringBuilder.\"<init>\":()V\n 13: ldc #23 // String Res:\n 15: invokevirtual #27 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 18: invokestatic #31 // Method largestLargestPalindromeProduct:()I\n 21: invokevirtual #34 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 24: invokevirtual #38 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 27: getstatic #44 // Field java/lang/System.out:Ljava/io/PrintStream;\n 30: swap\n 31: invokevirtual #50 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 34: return\n\n private static final int largestLargestPalindromeProduct();\n Code:\n 0: sipush 999\n 3: istore_0\n 4: bipush 100\n 6: istore_1\n 7: iload_0\n 8: iload_0\n 9: imul\n 10: istore_2\n 11: iload_2\n 12: istore_3\n 13: iconst_0\n 14: iload_3\n 15: if_icmpge 76\n 18: iload_0\n 19: istore 4\n 21: iload_3\n 22: iload 4\n 24: idiv\n 25: istore 5\n 27: iload_3\n 28: iload 4\n 30: irem\n 31: ifne 58\n 34: iload 5\n 36: iload_0\n 37: if_icmpgt 58\n 40: iload 5\n 42: iload_1\n 43: if_icmplt 58\n 46: iload_3\n 47: invokestatic #57 // Method java/lang/String.valueOf:(I)Ljava/lang/String;\n 50: invokestatic #61 // Method isPalindrome:(Ljava/lang/String;)Z\n 53: ifeq 58\n 56: iload_3\n 57: ireturn\n 58: iload 4\n 60: iload_1\n 61: if_icmpeq 70\n 64: iinc 4, -1\n 67: goto 21\n 70: iinc 3, -1\n 73: goto 13\n 76: iconst_0\n 77: ireturn\n\n public static final boolean isPalindrome(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #69 // String palindrome\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_1\n 7: istore_1\n 8: iconst_0\n 9: aload_0\n 10: invokevirtual #72 // Method java/lang/String.length:()I\n 13: iconst_2\n 14: idiv\n 15: invokestatic #78 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 18: checkcast #80 // class kotlin/ranges/IntProgression\n 21: iconst_1\n 22: invokestatic #84 // Method kotlin/ranges/RangesKt.step:(Lkotlin/ranges/IntProgression;I)Lkotlin/ranges/IntProgression;\n 25: astore_2\n 26: aload_2\n 27: invokevirtual #87 // Method kotlin/ranges/IntProgression.getFirst:()I\n 30: istore_3\n 31: aload_2\n 32: invokevirtual #90 // Method kotlin/ranges/IntProgression.getLast:()I\n 35: istore 4\n 37: aload_2\n 38: invokevirtual #93 // Method kotlin/ranges/IntProgression.getStep:()I\n 41: istore 5\n 43: iload 5\n 45: ifle 54\n 48: iload_3\n 49: iload 4\n 51: if_icmple 65\n 54: iload 5\n 56: ifge 109\n 59: iload 4\n 61: iload_3\n 62: if_icmpgt 109\n 65: iload_1\n 66: ifeq 93\n 69: aload_0\n 70: iload_3\n 71: invokevirtual #97 // Method java/lang/String.charAt:(I)C\n 74: aload_0\n 75: aload_0\n 76: invokevirtual #72 // Method java/lang/String.length:()I\n 79: iconst_1\n 80: isub\n 81: iload_3\n 82: isub\n 83: invokevirtual #97 // Method java/lang/String.charAt:(I)C\n 86: if_icmpne 93\n 89: iconst_1\n 90: goto 94\n 93: iconst_0\n 94: istore_1\n 95: iload_3\n 96: iload 4\n 98: if_icmpeq 109\n 101: iload_3\n 102: iload 5\n 104: iadd\n 105: istore_3\n 106: goto 65\n 109: iload_1\n 110: ireturn\n}\n", "javap_err": "" } ]
Mestru__Advent_of_Code_2017__2cc4211/src/main/kotlin/Day7.kt
import java.io.File import kotlin.math.abs data class Program(var weight: Int, var parent: String?, var children: List<String>?) val programs = HashMap<String, Program>() fun main(args: Array<String>) { // part 1 val lineRegex = "(\\w+) \\((\\d+)\\)( -> )?(.+)?".toRegex() var name: String var weight: Int var children: List<String> = ArrayList() File("input/day7.txt").forEachLine { line -> run { name = lineRegex.matchEntire(line)?.groups?.get(1)!!.value weight = lineRegex.matchEntire(line)?.groups?.get(2)!!.value.toInt() if (lineRegex.matchEntire(line)?.groups?.get(3)?.value != null) { children = lineRegex.matchEntire(line)?.groups?.get(4)?.value!!.split(", ") } children.forEach { child -> run { programs.getOrPut(child, { Program(-1, name, null) }).parent = name }} programs.getOrPut(name, { Program(weight, null, children) }).weight = weight programs.get(name)!!.children = children children = ArrayList() } } var parent = Program(0, null, null) programs.forEach { program -> run { if (program.value.parent == null) { println(program.key) parent = program.value } } } // part 2 balanceWeight(parent) } fun balanceWeight(program: Program): Int { var weight = program.weight var childWeight: Int val childrenWeight = ArrayList<Int>() if (program.children != null) { for (child in program.children!!) { childWeight = balanceWeight(programs.getOrDefault(child, Program(0, null, null))) childrenWeight.add(childWeight) weight += childWeight } } if (childrenWeight.size > 0) { val testedWeight = childrenWeight.get(0) var badWeight = -1 childrenWeight.forEach { childsWeight -> run { if (childsWeight != testedWeight) { badWeight = childsWeight } } } if (badWeight != -1 ) { println(abs(testedWeight - badWeight)) } } return weight }
[ { "class_path": "Mestru__Advent_of_Code_2017__2cc4211/Day7Kt.class", "javap": "Compiled from \"Day7.kt\"\npublic final class Day7Kt {\n private static final java.util.HashMap<java.lang.String, Program> programs;\n\n public static final java.util.HashMap<java.lang.String, Program> getPrograms();\n Code:\n 0: getstatic #12 // Field programs:Ljava/util/HashMap;\n 3: areturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #16 // String args\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #24 // class kotlin/text/Regex\n 9: dup\n 10: ldc #26 // String (\\\\w+) \\\\((\\\\d+)\\\\)( -> )?(.+)?\n 12: invokespecial #30 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 15: astore_1\n 16: new #32 // class kotlin/jvm/internal/Ref$ObjectRef\n 19: dup\n 20: invokespecial #35 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 23: astore_2\n 24: new #37 // class kotlin/jvm/internal/Ref$IntRef\n 27: dup\n 28: invokespecial #38 // Method kotlin/jvm/internal/Ref$IntRef.\"<init>\":()V\n 31: astore_3\n 32: new #32 // class kotlin/jvm/internal/Ref$ObjectRef\n 35: dup\n 36: invokespecial #35 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 39: astore 4\n 41: aload 4\n 43: new #40 // class java/util/ArrayList\n 46: dup\n 47: invokespecial #41 // Method java/util/ArrayList.\"<init>\":()V\n 50: putfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 53: new #47 // class java/io/File\n 56: dup\n 57: ldc #49 // String input/day7.txt\n 59: invokespecial #50 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 62: aconst_null\n 63: aload_2\n 64: aload_1\n 65: aload_3\n 66: aload 4\n 68: invokedynamic #70, 0 // InvokeDynamic #0:invoke:(Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/text/Regex;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/jvm/internal/Ref$ObjectRef;)Lkotlin/jvm/functions/Function1;\n 73: iconst_1\n 74: aconst_null\n 75: invokestatic #76 // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V\n 78: aconst_null\n 79: astore 5\n 81: new #78 // class Program\n 84: dup\n 85: iconst_0\n 86: aconst_null\n 87: aconst_null\n 88: invokespecial #81 // Method Program.\"<init>\":(ILjava/lang/String;Ljava/util/List;)V\n 91: astore 5\n 93: getstatic #12 // Field programs:Ljava/util/HashMap;\n 96: checkcast #83 // class java/util/Map\n 99: astore 6\n 101: iconst_0\n 102: istore 7\n 104: aload 6\n 106: invokeinterface #87, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 111: invokeinterface #93, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 116: astore 8\n 118: aload 8\n 120: invokeinterface #99, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 125: ifeq 196\n 128: aload 8\n 130: invokeinterface #103, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 135: checkcast #105 // class java/util/Map$Entry\n 138: astore 9\n 140: aload 9\n 142: astore 10\n 144: iconst_0\n 145: istore 11\n 147: iconst_0\n 148: istore 12\n 150: aload 10\n 152: invokeinterface #108, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 157: checkcast #78 // class Program\n 160: invokevirtual #112 // Method Program.getParent:()Ljava/lang/String;\n 163: ifnonnull 189\n 166: aload 10\n 168: invokeinterface #115, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 173: getstatic #121 // Field java/lang/System.out:Ljava/io/PrintStream;\n 176: swap\n 177: invokevirtual #127 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 180: aload 10\n 182: invokeinterface #108, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 187: astore 5\n 189: nop\n 190: nop\n 191: nop\n 192: nop\n 193: goto 118\n 196: nop\n 197: aload 5\n 199: checkcast #78 // class Program\n 202: invokestatic #131 // Method balanceWeight:(LProgram;)I\n 205: pop\n 206: return\n\n public static final int balanceWeight(Program);\n Code:\n 0: aload_0\n 1: ldc #151 // String program\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #155 // Method Program.getWeight:()I\n 10: istore_1\n 11: iconst_0\n 12: istore_2\n 13: new #40 // class java/util/ArrayList\n 16: dup\n 17: invokespecial #41 // Method java/util/ArrayList.\"<init>\":()V\n 20: astore_3\n 21: aload_0\n 22: invokevirtual #159 // Method Program.getChildren:()Ljava/util/List;\n 25: ifnull 112\n 28: aload_0\n 29: invokevirtual #159 // Method Program.getChildren:()Ljava/util/List;\n 32: dup\n 33: invokestatic #162 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 36: invokeinterface #165, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 41: astore 4\n 43: aload 4\n 45: invokeinterface #99, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 50: ifeq 112\n 53: aload 4\n 55: invokeinterface #103, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 60: checkcast #167 // class java/lang/String\n 63: astore 5\n 65: getstatic #12 // Field programs:Ljava/util/HashMap;\n 68: aload 5\n 70: new #78 // class Program\n 73: dup\n 74: iconst_0\n 75: aconst_null\n 76: aconst_null\n 77: invokespecial #81 // Method Program.\"<init>\":(ILjava/lang/String;Ljava/util/List;)V\n 80: invokevirtual #173 // Method java/util/HashMap.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 83: dup\n 84: ldc #175 // String getOrDefault(...)\n 86: invokestatic #178 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 89: checkcast #78 // class Program\n 92: invokestatic #131 // Method balanceWeight:(LProgram;)I\n 95: istore_2\n 96: aload_3\n 97: iload_2\n 98: invokestatic #184 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 101: invokevirtual #188 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 104: pop\n 105: iload_1\n 106: iload_2\n 107: iadd\n 108: istore_1\n 109: goto 43\n 112: aload_3\n 113: invokevirtual #191 // Method java/util/ArrayList.size:()I\n 116: ifle 240\n 119: aload_3\n 120: iconst_0\n 121: invokevirtual #195 // Method java/util/ArrayList.get:(I)Ljava/lang/Object;\n 124: dup\n 125: ldc #197 // String get(...)\n 127: invokestatic #178 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 130: checkcast #199 // class java/lang/Number\n 133: invokevirtual #202 // Method java/lang/Number.intValue:()I\n 136: istore 4\n 138: iconst_0\n 139: istore 5\n 141: iconst_m1\n 142: istore 5\n 144: aload_3\n 145: checkcast #204 // class java/lang/Iterable\n 148: astore 6\n 150: iconst_0\n 151: istore 7\n 153: aload 6\n 155: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 160: astore 8\n 162: aload 8\n 164: invokeinterface #99, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 169: ifeq 215\n 172: aload 8\n 174: invokeinterface #103, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 179: astore 9\n 181: aload 9\n 183: checkcast #199 // class java/lang/Number\n 186: invokevirtual #202 // Method java/lang/Number.intValue:()I\n 189: istore 10\n 191: iconst_0\n 192: istore 11\n 194: iconst_0\n 195: istore 12\n 197: iload 10\n 199: iload 4\n 201: if_icmpeq 208\n 204: iload 10\n 206: istore 5\n 208: nop\n 209: nop\n 210: nop\n 211: nop\n 212: goto 162\n 215: nop\n 216: iload 5\n 218: iconst_m1\n 219: if_icmpeq 240\n 222: iload 4\n 224: iload 5\n 226: isub\n 227: invokestatic #211 // Method java/lang/Math.abs:(I)I\n 230: istore 6\n 232: getstatic #121 // Field java/lang/System.out:Ljava/io/PrintStream;\n 235: iload 6\n 237: invokevirtual #214 // Method java/io/PrintStream.println:(I)V\n 240: iload_1\n 241: ireturn\n\n private static final kotlin.Unit main$lambda$5(kotlin.jvm.internal.Ref$ObjectRef, kotlin.text.Regex, kotlin.jvm.internal.Ref$IntRef, kotlin.jvm.internal.Ref$ObjectRef, java.lang.String);\n Code:\n 0: aload 4\n 2: ldc #228 // String line\n 4: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: iconst_0\n 8: istore 5\n 10: aload_0\n 11: aload_1\n 12: aload 4\n 14: checkcast #230 // class java/lang/CharSequence\n 17: invokevirtual #234 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;\n 20: dup\n 21: ifnull 42\n 24: invokeinterface #240, 1 // InterfaceMethod kotlin/text/MatchResult.getGroups:()Lkotlin/text/MatchGroupCollection;\n 29: dup\n 30: ifnull 42\n 33: iconst_1\n 34: invokeinterface #245, 2 // InterfaceMethod kotlin/text/MatchGroupCollection.get:(I)Lkotlin/text/MatchGroup;\n 39: goto 44\n 42: pop\n 43: aconst_null\n 44: dup\n 45: invokestatic #162 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 48: invokevirtual #249 // Method kotlin/text/MatchGroup.getValue:()Ljava/lang/String;\n 51: putfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 54: aload_2\n 55: aload_1\n 56: aload 4\n 58: checkcast #230 // class java/lang/CharSequence\n 61: invokevirtual #234 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;\n 64: dup\n 65: ifnull 86\n 68: invokeinterface #240, 1 // InterfaceMethod kotlin/text/MatchResult.getGroups:()Lkotlin/text/MatchGroupCollection;\n 73: dup\n 74: ifnull 86\n 77: iconst_2\n 78: invokeinterface #245, 2 // InterfaceMethod kotlin/text/MatchGroupCollection.get:(I)Lkotlin/text/MatchGroup;\n 83: goto 88\n 86: pop\n 87: aconst_null\n 88: dup\n 89: invokestatic #162 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 92: invokevirtual #249 // Method kotlin/text/MatchGroup.getValue:()Ljava/lang/String;\n 95: invokestatic #253 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 98: putfield #255 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 101: aload_1\n 102: aload 4\n 104: checkcast #230 // class java/lang/CharSequence\n 107: invokevirtual #234 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;\n 110: dup\n 111: ifnull 139\n 114: invokeinterface #240, 1 // InterfaceMethod kotlin/text/MatchResult.getGroups:()Lkotlin/text/MatchGroupCollection;\n 119: dup\n 120: ifnull 139\n 123: iconst_3\n 124: invokeinterface #245, 2 // InterfaceMethod kotlin/text/MatchGroupCollection.get:(I)Lkotlin/text/MatchGroup;\n 129: dup\n 130: ifnull 139\n 133: invokevirtual #249 // Method kotlin/text/MatchGroup.getValue:()Ljava/lang/String;\n 136: goto 141\n 139: pop\n 140: aconst_null\n 141: ifnull 218\n 144: aload_3\n 145: aload_1\n 146: aload 4\n 148: checkcast #230 // class java/lang/CharSequence\n 151: invokevirtual #234 // Method kotlin/text/Regex.matchEntire:(Ljava/lang/CharSequence;)Lkotlin/text/MatchResult;\n 154: dup\n 155: ifnull 183\n 158: invokeinterface #240, 1 // InterfaceMethod kotlin/text/MatchResult.getGroups:()Lkotlin/text/MatchGroupCollection;\n 163: dup\n 164: ifnull 183\n 167: iconst_4\n 168: invokeinterface #245, 2 // InterfaceMethod kotlin/text/MatchGroupCollection.get:(I)Lkotlin/text/MatchGroup;\n 173: dup\n 174: ifnull 183\n 177: invokevirtual #249 // Method kotlin/text/MatchGroup.getValue:()Ljava/lang/String;\n 180: goto 185\n 183: pop\n 184: aconst_null\n 185: dup\n 186: invokestatic #162 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 189: checkcast #230 // class java/lang/CharSequence\n 192: iconst_1\n 193: anewarray #167 // class java/lang/String\n 196: astore 6\n 198: aload 6\n 200: iconst_0\n 201: ldc_w #257 // String ,\n 204: aastore\n 205: aload 6\n 207: iconst_0\n 208: iconst_0\n 209: bipush 6\n 211: aconst_null\n 212: invokestatic #263 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 215: putfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 218: aload_3\n 219: getfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 222: checkcast #204 // class java/lang/Iterable\n 225: astore 6\n 227: iconst_0\n 228: istore 7\n 230: aload 6\n 232: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 237: astore 8\n 239: aload 8\n 241: invokeinterface #99, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 246: ifeq 359\n 249: aload 8\n 251: invokeinterface #103, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 256: astore 9\n 258: aload 9\n 260: checkcast #167 // class java/lang/String\n 263: astore 10\n 265: iconst_0\n 266: istore 11\n 268: iconst_0\n 269: istore 12\n 271: getstatic #12 // Field programs:Ljava/util/HashMap;\n 274: checkcast #83 // class java/util/Map\n 277: astore 13\n 279: iconst_0\n 280: istore 14\n 282: aload 13\n 284: aload 10\n 286: invokeinterface #265, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 291: astore 15\n 293: aload 15\n 295: ifnonnull 336\n 298: iconst_0\n 299: istore 16\n 301: new #78 // class Program\n 304: dup\n 305: iconst_m1\n 306: aload_0\n 307: getfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 310: checkcast #167 // class java/lang/String\n 313: aconst_null\n 314: invokespecial #81 // Method Program.\"<init>\":(ILjava/lang/String;Ljava/util/List;)V\n 317: astore 16\n 319: aload 13\n 321: aload 10\n 323: aload 16\n 325: invokeinterface #268, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 330: pop\n 331: aload 16\n 333: goto 338\n 336: aload 15\n 338: nop\n 339: checkcast #78 // class Program\n 342: aload_0\n 343: getfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 346: checkcast #167 // class java/lang/String\n 349: invokevirtual #271 // Method Program.setParent:(Ljava/lang/String;)V\n 352: nop\n 353: nop\n 354: nop\n 355: nop\n 356: goto 239\n 359: nop\n 360: getstatic #12 // Field programs:Ljava/util/HashMap;\n 363: checkcast #83 // class java/util/Map\n 366: astore 6\n 368: aload_0\n 369: getfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 372: astore 7\n 374: iconst_0\n 375: istore 8\n 377: aload 6\n 379: aload 7\n 381: invokeinterface #265, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 386: astore 9\n 388: aload 9\n 390: ifnonnull 434\n 393: iconst_0\n 394: istore 10\n 396: new #78 // class Program\n 399: dup\n 400: aload_2\n 401: getfield #255 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 404: aconst_null\n 405: aload_3\n 406: getfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 409: checkcast #164 // class java/util/List\n 412: invokespecial #81 // Method Program.\"<init>\":(ILjava/lang/String;Ljava/util/List;)V\n 415: astore 11\n 417: aload 6\n 419: aload 7\n 421: aload 11\n 423: invokeinterface #268, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 428: pop\n 429: aload 11\n 431: goto 436\n 434: aload 9\n 436: nop\n 437: checkcast #78 // class Program\n 440: aload_2\n 441: getfield #255 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 444: invokevirtual #274 // Method Program.setWeight:(I)V\n 447: getstatic #12 // Field programs:Ljava/util/HashMap;\n 450: aload_0\n 451: getfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 454: invokevirtual #275 // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 457: dup\n 458: invokestatic #162 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 461: checkcast #78 // class Program\n 464: aload_3\n 465: getfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 468: checkcast #164 // class java/util/List\n 471: invokevirtual #279 // Method Program.setChildren:(Ljava/util/List;)V\n 474: aload_3\n 475: new #40 // class java/util/ArrayList\n 478: dup\n 479: invokespecial #41 // Method java/util/ArrayList.\"<init>\":()V\n 482: putfield #45 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 485: nop\n 486: nop\n 487: getstatic #285 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 490: areturn\n\n static {};\n Code:\n 0: new #169 // class java/util/HashMap\n 3: dup\n 4: invokespecial #301 // Method java/util/HashMap.\"<init>\":()V\n 7: putstatic #12 // Field programs:Ljava/util/HashMap;\n 10: return\n}\n", "javap_err": "" } ]
Mestru__Advent_of_Code_2017__2cc4211/src/main/kotlin/Day4.kt
import java.io.File val letters = "abcdefghijklmnopqrstuvwxyz".toCharArray() fun main(args: Array<String>) { // part 1 var numberOfCorrectPassphrases = 0 File("input/day4.txt").forEachLine { line -> run { if (passphraseIsValid(line)) numberOfCorrectPassphrases++ } } println(numberOfCorrectPassphrases) // part 2 numberOfCorrectPassphrases = 0 File("input/day4.txt").forEachLine { line -> run { val words = line.split(Regex("[ \t]")) val o1 = HashMap<Char, Int>() val o2 = HashMap<Char, Int>() for (letter in letters) { o1.put(letter, 0) o2.put(letter, 0) } var isPassphraseCorrect = true for (i in 0 until words.size) { for (letter in letters) { o1.put(letter, 0) } words[i].toCharArray().forEach { c -> o1.put(c, o1.getValue(c) + 1) } for (j in 0 until words.size) { for (letter in letters) { o2.put(letter, 0) } words[j].toCharArray().forEach { c -> o2.put(c, o2.getValue(c) + 1) } if (i != j && mapsEqual(o1, o2)) isPassphraseCorrect = false } } if (isPassphraseCorrect) numberOfCorrectPassphrases++ } } println(numberOfCorrectPassphrases) } fun passphraseIsValid(line : String) : Boolean { val words = line.split(Regex("[ \t]")) for (i in 0 until words.size) { for (j in 0 until words.size) { if (i != j && words[i].equals(words[j])) return false } } return true } fun mapsEqual(o1: HashMap<Char, Int>, o2: HashMap<Char, Int>): Boolean { for (letter in letters) { if (o1.get(letter) != o2.get(letter)) return false } return true }
[ { "class_path": "Mestru__Advent_of_Code_2017__2cc4211/Day4Kt.class", "javap": "Compiled from \"Day4.kt\"\npublic final class Day4Kt {\n private static final char[] letters;\n\n public static final char[] getLetters();\n Code:\n 0: getstatic #11 // Field letters:[C\n 3: areturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #15 // String args\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #23 // class kotlin/jvm/internal/Ref$IntRef\n 9: dup\n 10: invokespecial #27 // Method kotlin/jvm/internal/Ref$IntRef.\"<init>\":()V\n 13: astore_1\n 14: new #29 // class java/io/File\n 17: dup\n 18: ldc #31 // String input/day4.txt\n 20: invokespecial #34 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 23: aconst_null\n 24: aload_1\n 25: invokedynamic #54, 0 // InvokeDynamic #0:invoke:(Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/jvm/functions/Function1;\n 30: iconst_1\n 31: aconst_null\n 32: invokestatic #60 // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V\n 35: aload_1\n 36: getfield #64 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 39: istore_2\n 40: getstatic #70 // Field java/lang/System.out:Ljava/io/PrintStream;\n 43: iload_2\n 44: invokevirtual #76 // Method java/io/PrintStream.println:(I)V\n 47: aload_1\n 48: iconst_0\n 49: putfield #64 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 52: new #29 // class java/io/File\n 55: dup\n 56: ldc #31 // String input/day4.txt\n 58: invokespecial #34 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 61: aconst_null\n 62: aload_1\n 63: invokedynamic #81, 0 // InvokeDynamic #1:invoke:(Lkotlin/jvm/internal/Ref$IntRef;)Lkotlin/jvm/functions/Function1;\n 68: iconst_1\n 69: aconst_null\n 70: invokestatic #60 // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V\n 73: aload_1\n 74: getfield #64 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 77: istore_2\n 78: getstatic #70 // Field java/lang/System.out:Ljava/io/PrintStream;\n 81: iload_2\n 82: invokevirtual #76 // Method java/io/PrintStream.println:(I)V\n 85: return\n\n public static final boolean passphraseIsValid(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #88 // String line\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #90 // class java/lang/CharSequence\n 10: astore_2\n 11: new #92 // class kotlin/text/Regex\n 14: dup\n 15: ldc #94 // String [ \\t]\n 17: invokespecial #95 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 20: astore_3\n 21: iconst_0\n 22: istore 4\n 24: aload_3\n 25: aload_2\n 26: iload 4\n 28: invokevirtual #99 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 31: astore_1\n 32: iconst_0\n 33: istore_2\n 34: aload_1\n 35: invokeinterface #105, 1 // InterfaceMethod java/util/List.size:()I\n 40: istore_3\n 41: iload_2\n 42: iload_3\n 43: if_icmpge 108\n 46: iconst_0\n 47: istore 4\n 49: aload_1\n 50: invokeinterface #105, 1 // InterfaceMethod java/util/List.size:()I\n 55: istore 5\n 57: iload 4\n 59: iload 5\n 61: if_icmpge 102\n 64: iload_2\n 65: iload 4\n 67: if_icmpeq 96\n 70: aload_1\n 71: iload_2\n 72: invokeinterface #109, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 77: checkcast #111 // class java/lang/String\n 80: aload_1\n 81: iload 4\n 83: invokeinterface #109, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 88: invokevirtual #115 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 91: ifeq 96\n 94: iconst_0\n 95: ireturn\n 96: iinc 4, 1\n 99: goto 57\n 102: iinc 2, 1\n 105: goto 41\n 108: iconst_1\n 109: ireturn\n\n public static final boolean mapsEqual(java.util.HashMap<java.lang.Character, java.lang.Integer>, java.util.HashMap<java.lang.Character, java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #125 // String o1\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #127 // String o2\n 9: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: getstatic #11 // Field letters:[C\n 15: astore_2\n 16: iconst_0\n 17: istore_3\n 18: aload_2\n 19: arraylength\n 20: istore 4\n 22: iload_3\n 23: iload 4\n 25: if_icmpge 65\n 28: aload_2\n 29: iload_3\n 30: caload\n 31: istore 5\n 33: aload_0\n 34: iload 5\n 36: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 39: invokevirtual #137 // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 42: aload_1\n 43: iload 5\n 45: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 48: invokevirtual #137 // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 51: invokestatic #141 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 54: ifne 59\n 57: iconst_0\n 58: ireturn\n 59: iinc 3, 1\n 62: goto 22\n 65: iconst_1\n 66: ireturn\n\n private static final kotlin.Unit main$lambda$1(kotlin.jvm.internal.Ref$IntRef, java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #88 // String line\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: aload_1\n 9: invokestatic #147 // Method passphraseIsValid:(Ljava/lang/String;)Z\n 12: ifeq 27\n 15: aload_0\n 16: getfield #64 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 19: istore_3\n 20: aload_0\n 21: iload_3\n 22: iconst_1\n 23: iadd\n 24: putfield #64 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 27: nop\n 28: nop\n 29: getstatic #153 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 32: areturn\n\n private static final kotlin.Unit main$lambda$5(kotlin.jvm.internal.Ref$IntRef, java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #88 // String line\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: aload_1\n 9: checkcast #90 // class java/lang/CharSequence\n 12: astore_3\n 13: new #92 // class kotlin/text/Regex\n 16: dup\n 17: ldc #94 // String [ \\t]\n 19: invokespecial #95 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 22: astore 4\n 24: iconst_0\n 25: istore 5\n 27: aload 4\n 29: aload_3\n 30: iload 5\n 32: invokevirtual #99 // Method kotlin/text/Regex.split:(Ljava/lang/CharSequence;I)Ljava/util/List;\n 35: astore 6\n 37: new #135 // class java/util/HashMap\n 40: dup\n 41: invokespecial #156 // Method java/util/HashMap.\"<init>\":()V\n 44: astore_3\n 45: new #135 // class java/util/HashMap\n 48: dup\n 49: invokespecial #156 // Method java/util/HashMap.\"<init>\":()V\n 52: astore 4\n 54: getstatic #11 // Field letters:[C\n 57: astore 5\n 59: iconst_0\n 60: istore 7\n 62: aload 5\n 64: arraylength\n 65: istore 8\n 67: iload 7\n 69: iload 8\n 71: if_icmpge 116\n 74: aload 5\n 76: iload 7\n 78: caload\n 79: istore 9\n 81: aload_3\n 82: iload 9\n 84: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 87: iconst_0\n 88: invokestatic #161 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 91: invokevirtual #165 // Method java/util/HashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 94: pop\n 95: aload 4\n 97: iload 9\n 99: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 102: iconst_0\n 103: invokestatic #161 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 106: invokevirtual #165 // Method java/util/HashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 109: pop\n 110: iinc 7, 1\n 113: goto 67\n 116: iconst_1\n 117: istore 5\n 119: iconst_0\n 120: istore 7\n 122: aload 6\n 124: invokeinterface #105, 1 // InterfaceMethod java/util/List.size:()I\n 129: istore 8\n 131: iload 7\n 133: iload 8\n 135: if_icmpge 479\n 138: getstatic #11 // Field letters:[C\n 141: astore 9\n 143: iconst_0\n 144: istore 10\n 146: aload 9\n 148: arraylength\n 149: istore 11\n 151: iload 10\n 153: iload 11\n 155: if_icmpge 185\n 158: aload 9\n 160: iload 10\n 162: caload\n 163: istore 12\n 165: aload_3\n 166: iload 12\n 168: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 171: iconst_0\n 172: invokestatic #161 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 175: invokevirtual #165 // Method java/util/HashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 178: pop\n 179: iinc 10, 1\n 182: goto 151\n 185: aload 6\n 187: iload 7\n 189: invokeinterface #109, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 194: checkcast #111 // class java/lang/String\n 197: invokevirtual #168 // Method java/lang/String.toCharArray:()[C\n 200: dup\n 201: ldc #170 // String toCharArray(...)\n 203: invokestatic #173 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 206: astore 9\n 208: nop\n 209: iconst_0\n 210: istore 10\n 212: iconst_0\n 213: istore 11\n 215: aload 9\n 217: arraylength\n 218: istore 12\n 220: iload 11\n 222: iload 12\n 224: if_icmpge 281\n 227: aload 9\n 229: iload 11\n 231: caload\n 232: istore 13\n 234: iload 13\n 236: istore 14\n 238: iconst_0\n 239: istore 15\n 241: aload_3\n 242: iload 14\n 244: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 247: aload_3\n 248: checkcast #175 // class java/util/Map\n 251: iload 14\n 253: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 256: invokestatic #181 // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;\n 259: checkcast #183 // class java/lang/Number\n 262: invokevirtual #186 // Method java/lang/Number.intValue:()I\n 265: iconst_1\n 266: iadd\n 267: invokestatic #161 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 270: invokevirtual #165 // Method java/util/HashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 273: pop\n 274: nop\n 275: iinc 11, 1\n 278: goto 220\n 281: nop\n 282: iconst_0\n 283: istore 9\n 285: aload 6\n 287: invokeinterface #105, 1 // InterfaceMethod java/util/List.size:()I\n 292: istore 10\n 294: iload 9\n 296: iload 10\n 298: if_icmpge 473\n 301: getstatic #11 // Field letters:[C\n 304: astore 11\n 306: iconst_0\n 307: istore 12\n 309: aload 11\n 311: arraylength\n 312: istore 13\n 314: iload 12\n 316: iload 13\n 318: if_icmpge 349\n 321: aload 11\n 323: iload 12\n 325: caload\n 326: istore 14\n 328: aload 4\n 330: iload 14\n 332: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 335: iconst_0\n 336: invokestatic #161 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 339: invokevirtual #165 // Method java/util/HashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 342: pop\n 343: iinc 12, 1\n 346: goto 314\n 349: aload 6\n 351: iload 9\n 353: invokeinterface #109, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 358: checkcast #111 // class java/lang/String\n 361: invokevirtual #168 // Method java/lang/String.toCharArray:()[C\n 364: dup\n 365: ldc #170 // String toCharArray(...)\n 367: invokestatic #173 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 370: astore 11\n 372: nop\n 373: iconst_0\n 374: istore 12\n 376: iconst_0\n 377: istore 13\n 379: aload 11\n 381: arraylength\n 382: istore 14\n 384: iload 13\n 386: iload 14\n 388: if_icmpge 447\n 391: aload 11\n 393: iload 13\n 395: caload\n 396: istore 15\n 398: iload 15\n 400: istore 16\n 402: iconst_0\n 403: istore 17\n 405: aload 4\n 407: iload 16\n 409: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 412: aload 4\n 414: checkcast #175 // class java/util/Map\n 417: iload 16\n 419: invokestatic #133 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 422: invokestatic #181 // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;\n 425: checkcast #183 // class java/lang/Number\n 428: invokevirtual #186 // Method java/lang/Number.intValue:()I\n 431: iconst_1\n 432: iadd\n 433: invokestatic #161 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 436: invokevirtual #165 // Method java/util/HashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 439: pop\n 440: nop\n 441: iinc 13, 1\n 444: goto 384\n 447: nop\n 448: iload 7\n 450: iload 9\n 452: if_icmpeq 467\n 455: aload_3\n 456: aload 4\n 458: invokestatic #188 // Method mapsEqual:(Ljava/util/HashMap;Ljava/util/HashMap;)Z\n 461: ifeq 467\n 464: iconst_0\n 465: istore 5\n 467: iinc 9, 1\n 470: goto 294\n 473: iinc 7, 1\n 476: goto 131\n 479: iload 5\n 481: ifeq 498\n 484: aload_0\n 485: getfield #64 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 488: istore 7\n 490: aload_0\n 491: iload 7\n 493: iconst_1\n 494: iadd\n 495: putfield #64 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 498: nop\n 499: nop\n 500: getstatic #153 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 503: areturn\n\n static {};\n Code:\n 0: ldc #200 // String abcdefghijklmnopqrstuvwxyz\n 2: invokevirtual #168 // Method java/lang/String.toCharArray:()[C\n 5: dup\n 6: ldc #170 // String toCharArray(...)\n 8: invokestatic #173 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 11: putstatic #11 // Field letters:[C\n 14: return\n}\n", "javap_err": "" } ]
JoelEager__Kotlin-Collision-Detector__2c05f92/src/sat.kt
import kotlin.math.pow class Vector(var x: Double, var y: Double) /** * @param poly1, poly2 The two polygons described as arrays of points as Vectors * Note: The points list must go in sequence around the polygon * @param maxDist The maximum distance between any two points of any two polygons that can be touching * If this null then the optimization check that uses it will be skipped */ fun hasCollided(poly1: Array<Vector>, poly2: Array<Vector>, maxDist: Double?=null): Boolean { // Do an optimization check using the maxDist if (maxDist != null) { if ((poly1[1].x - poly2[0].x).pow(2) + (poly1[1].y - poly2[0].y).pow(2) <= maxDist.pow(2)) { // Collision is possible so run SAT on the polys return runSAT(poly1, poly2) } else { return false } } else { // No maxDist so run SAT on the polys return runSAT(poly1, poly2) } } fun runSAT(poly1: Array<Vector>, poly2: Array<Vector>): Boolean { // Implements the actual SAT algorithm val edges = polyToEdges(poly1) + polyToEdges(poly2) val axes = Array(edges.size, { index -> orthogonal(edges[index])}) for (axis in axes) { if (!overlap(project(poly1, axis), project(poly2, axis))) { // The polys don't overlap on this axis so they can't be touching return false } } // The polys overlap on all axes so they must be touching return true } /** * Returns a vector going from point1 to point2 */ fun edgeVector(point1: Vector, point2: Vector) = Vector(point2.x - point1.x, point2.y - point1.y) /** * Returns an array of the edges of the poly as vectors */ fun polyToEdges(poly: Array<Vector>) = Array(poly.size, { index -> edgeVector(poly[index], poly[(index + 1) % poly.size]) }) /** * Returns a new vector which is orthogonal to the given vector */ fun orthogonal(vector: Vector) = Vector(vector.y, -vector.x) /** * Returns the dot (or scalar) product of the two vectors */ fun dotProduct(vector1: Vector, vector2: Vector) = vector1.x * vector2.x + vector1.y * vector2.y /** * Returns a vector showing how much of the poly lies along the axis */ fun project(poly: Array<Vector>, axis: Vector): Vector { val dots = Array(poly.size, { index -> dotProduct(poly[index], axis) }) return Vector(dots.min()!!, dots.max()!!) } /** * Returns a boolean indicating if the two projections overlap */ fun overlap(projection1: Vector, projection2: Vector) = projection1.x <= projection2.y && projection2.x <= projection1.y
[ { "class_path": "JoelEager__Kotlin-Collision-Detector__2c05f92/SatKt.class", "javap": "Compiled from \"sat.kt\"\npublic final class SatKt {\n public static final boolean hasCollided(Vector[], Vector[], java.lang.Double);\n Code:\n 0: aload_0\n 1: ldc #10 // String poly1\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #18 // String poly2\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_2\n 13: ifnull 74\n 16: aload_0\n 17: iconst_1\n 18: aaload\n 19: invokevirtual #24 // Method Vector.getX:()D\n 22: aload_1\n 23: iconst_0\n 24: aaload\n 25: invokevirtual #24 // Method Vector.getX:()D\n 28: dsub\n 29: iconst_2\n 30: i2d\n 31: invokestatic #30 // Method java/lang/Math.pow:(DD)D\n 34: aload_0\n 35: iconst_1\n 36: aaload\n 37: invokevirtual #33 // Method Vector.getY:()D\n 40: aload_1\n 41: iconst_0\n 42: aaload\n 43: invokevirtual #33 // Method Vector.getY:()D\n 46: dsub\n 47: iconst_2\n 48: i2d\n 49: invokestatic #30 // Method java/lang/Math.pow:(DD)D\n 52: dadd\n 53: aload_2\n 54: invokevirtual #38 // Method java/lang/Double.doubleValue:()D\n 57: iconst_2\n 58: i2d\n 59: invokestatic #30 // Method java/lang/Math.pow:(DD)D\n 62: dcmpg\n 63: ifgt 72\n 66: aload_0\n 67: aload_1\n 68: invokestatic #42 // Method runSAT:([LVector;[LVector;)Z\n 71: ireturn\n 72: iconst_0\n 73: ireturn\n 74: aload_0\n 75: aload_1\n 76: invokestatic #42 // Method runSAT:([LVector;[LVector;)Z\n 79: ireturn\n\n public static boolean hasCollided$default(Vector[], Vector[], java.lang.Double, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_4\n 2: iand\n 3: ifeq 8\n 6: aconst_null\n 7: astore_2\n 8: aload_0\n 9: aload_1\n 10: aload_2\n 11: invokestatic #49 // Method hasCollided:([LVector;[LVector;Ljava/lang/Double;)Z\n 14: ireturn\n\n public static final boolean runSAT(Vector[], Vector[]);\n Code:\n 0: aload_0\n 1: ldc #10 // String poly1\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #18 // String poly2\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: invokestatic #53 // Method polyToEdges:([LVector;)[LVector;\n 16: aload_1\n 17: invokestatic #53 // Method polyToEdges:([LVector;)[LVector;\n 20: invokestatic #59 // Method kotlin/collections/ArraysKt.plus:([Ljava/lang/Object;[Ljava/lang/Object;)[Ljava/lang/Object;\n 23: checkcast #60 // class \"[LVector;\"\n 26: astore_2\n 27: iconst_0\n 28: istore 4\n 30: aload_2\n 31: arraylength\n 32: istore 5\n 34: iload 5\n 36: anewarray #20 // class Vector\n 39: astore 6\n 41: iload 4\n 43: iload 5\n 45: if_icmpge 70\n 48: iload 4\n 50: istore 7\n 52: aload 6\n 54: iload 7\n 56: aload_2\n 57: iload 7\n 59: aaload\n 60: invokestatic #64 // Method orthogonal:(LVector;)LVector;\n 63: aastore\n 64: iinc 4, 1\n 67: goto 41\n 70: aload 6\n 72: astore_3\n 73: iconst_0\n 74: istore 4\n 76: aload_3\n 77: arraylength\n 78: istore 5\n 80: iload 4\n 82: iload 5\n 84: if_icmpge 119\n 87: aload_3\n 88: iload 4\n 90: aaload\n 91: astore 6\n 93: aload_0\n 94: aload 6\n 96: invokestatic #68 // Method project:([LVector;LVector;)LVector;\n 99: aload_1\n 100: aload 6\n 102: invokestatic #68 // Method project:([LVector;LVector;)LVector;\n 105: invokestatic #72 // Method overlap:(LVector;LVector;)Z\n 108: ifne 113\n 111: iconst_0\n 112: ireturn\n 113: iinc 4, 1\n 116: goto 80\n 119: iconst_1\n 120: ireturn\n\n public static final Vector edgeVector(Vector, Vector);\n Code:\n 0: aload_0\n 1: ldc #80 // String point1\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #82 // String point2\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: new #20 // class Vector\n 15: dup\n 16: aload_1\n 17: invokevirtual #24 // Method Vector.getX:()D\n 20: aload_0\n 21: invokevirtual #24 // Method Vector.getX:()D\n 24: dsub\n 25: aload_1\n 26: invokevirtual #33 // Method Vector.getY:()D\n 29: aload_0\n 30: invokevirtual #33 // Method Vector.getY:()D\n 33: dsub\n 34: invokespecial #86 // Method Vector.\"<init>\":(DD)V\n 37: areturn\n\n public static final Vector[] polyToEdges(Vector[]);\n Code:\n 0: aload_0\n 1: ldc #88 // String poly\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: aload_0\n 9: arraylength\n 10: istore_2\n 11: iload_2\n 12: anewarray #20 // class Vector\n 15: astore_3\n 16: iload_1\n 17: iload_2\n 18: if_icmpge 50\n 21: iload_1\n 22: istore 4\n 24: aload_3\n 25: iload 4\n 27: aload_0\n 28: iload 4\n 30: aaload\n 31: aload_0\n 32: iload 4\n 34: iconst_1\n 35: iadd\n 36: aload_0\n 37: arraylength\n 38: irem\n 39: aaload\n 40: invokestatic #90 // Method edgeVector:(LVector;LVector;)LVector;\n 43: aastore\n 44: iinc 1, 1\n 47: goto 16\n 50: aload_3\n 51: areturn\n\n public static final Vector orthogonal(Vector);\n Code:\n 0: aload_0\n 1: ldc #92 // String vector\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #20 // class Vector\n 9: dup\n 10: aload_0\n 11: invokevirtual #33 // Method Vector.getY:()D\n 14: aload_0\n 15: invokevirtual #24 // Method Vector.getX:()D\n 18: dneg\n 19: invokespecial #86 // Method Vector.\"<init>\":(DD)V\n 22: areturn\n\n public static final double dotProduct(Vector, Vector);\n Code:\n 0: aload_0\n 1: ldc #96 // String vector1\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #98 // String vector2\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: invokevirtual #24 // Method Vector.getX:()D\n 16: aload_1\n 17: invokevirtual #24 // Method Vector.getX:()D\n 20: dmul\n 21: aload_0\n 22: invokevirtual #33 // Method Vector.getY:()D\n 25: aload_1\n 26: invokevirtual #33 // Method Vector.getY:()D\n 29: dmul\n 30: dadd\n 31: dreturn\n\n public static final Vector project(Vector[], Vector);\n Code:\n 0: aload_0\n 1: ldc #88 // String poly\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #99 // String axis\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: iconst_0\n 13: istore_3\n 14: aload_0\n 15: arraylength\n 16: istore 4\n 18: iload 4\n 20: anewarray #35 // class java/lang/Double\n 23: astore 5\n 25: iload_3\n 26: iload 4\n 28: if_icmpge 56\n 31: iload_3\n 32: istore 6\n 34: aload 5\n 36: iload 6\n 38: aload_0\n 39: iload 6\n 41: aaload\n 42: aload_1\n 43: invokestatic #101 // Method dotProduct:(LVector;LVector;)D\n 46: invokestatic #105 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 49: aastore\n 50: iinc 3, 1\n 53: goto 25\n 56: aload 5\n 58: astore_2\n 59: new #20 // class Vector\n 62: dup\n 63: aload_2\n 64: invokestatic #109 // Method kotlin/collections/ArraysKt.minOrThrow:([Ljava/lang/Double;)D\n 67: aload_2\n 68: invokestatic #112 // Method kotlin/collections/ArraysKt.maxOrThrow:([Ljava/lang/Double;)D\n 71: invokespecial #86 // Method Vector.\"<init>\":(DD)V\n 74: areturn\n\n public static final boolean overlap(Vector, Vector);\n Code:\n 0: aload_0\n 1: ldc #117 // String projection1\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #119 // String projection2\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: invokevirtual #24 // Method Vector.getX:()D\n 16: aload_1\n 17: invokevirtual #33 // Method Vector.getY:()D\n 20: dcmpg\n 21: ifgt 40\n 24: aload_1\n 25: invokevirtual #24 // Method Vector.getX:()D\n 28: aload_0\n 29: invokevirtual #33 // Method Vector.getY:()D\n 32: dcmpg\n 33: ifgt 40\n 36: iconst_1\n 37: goto 41\n 40: iconst_0\n 41: ireturn\n}\n", "javap_err": "" } ]
darwineee__adventOfCode2023__c301358/src/main/kotlin/Day1.kt
import kotlin.io.path.Path import kotlin.io.path.forEachLine fun day1_part1(path: String) { var result = 0 Path(path).forEachLine { line -> val numLine = line.filter { it.isDigit() } val num = when (numLine.length) { 1 -> numLine + numLine 2 -> numLine else -> numLine.removeRange(1, numLine.lastIndex) }.toIntOrNull() if (num != null) result += num } println(result) } fun day1_part2(path: String) { var result = 0 val map = mapOf( "one" to "1", "two" to "2", "three" to "3", "four" to "4", "five" to "5", "six" to "6", "seven" to "7", "eight" to "8", "nine" to "9", ) val substrings = map.flatMap { listOf(it.key, it.value) } Path(path).forEachLine { line -> val numLine = findAllOverlappingMatches(line, substrings).joinToString("") { map[it] ?: it } val num = when (numLine.length) { 1 -> numLine + numLine 2 -> numLine else -> numLine.removeRange(1, numLine.lastIndex) }.toIntOrNull() if (num != null) result += num } println(result) } fun findAllOverlappingMatches(input: String, substrings: List<String>): List<String> { val matches = mutableListOf<String>() for (i in input.indices) { for (j in i + 1..input.length) { val substring = input.substring(i, j) if (substrings.contains(substring)) { matches.add(substring) } } } return matches }
[ { "class_path": "darwineee__adventOfCode2023__c301358/Day1Kt.class", "javap": "Compiled from \"Day1.kt\"\npublic final class Day1Kt {\n public static final void day1_part1(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #11 // String path\n 3: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: aload_0\n 9: iconst_0\n 10: anewarray #19 // class java/lang/String\n 13: invokestatic #25 // Method java/nio/file/Paths.get:(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;\n 16: dup\n 17: ldc #27 // String get(...)\n 19: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 22: astore_2\n 23: getstatic #36 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;\n 26: aload_2\n 27: swap\n 28: invokestatic #42 // Method java/nio/file/Files.newBufferedReader:(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)Ljava/io/BufferedReader;\n 31: dup\n 32: ldc #44 // String newBufferedReader(...)\n 34: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 37: checkcast #46 // class java/io/Reader\n 40: astore_3\n 41: aload_3\n 42: checkcast #48 // class java/io/BufferedReader\n 45: checkcast #50 // class java/io/Closeable\n 48: astore 4\n 50: aconst_null\n 51: astore 5\n 53: nop\n 54: aload 4\n 56: checkcast #48 // class java/io/BufferedReader\n 59: astore 6\n 61: aload 6\n 63: invokestatic #56 // Method kotlin/io/TextStreamsKt.lineSequence:(Ljava/io/BufferedReader;)Lkotlin/sequences/Sequence;\n 66: astore 7\n 68: aload 7\n 70: astore 8\n 72: aload 8\n 74: invokeinterface #62, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 79: astore 9\n 81: aload 9\n 83: invokeinterface #68, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 88: ifeq 318\n 91: aload 9\n 93: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 98: checkcast #19 // class java/lang/String\n 101: astore 10\n 103: iconst_0\n 104: istore 11\n 106: aload 10\n 108: astore 12\n 110: iconst_0\n 111: istore 13\n 113: aload 12\n 115: checkcast #74 // class java/lang/CharSequence\n 118: astore 14\n 120: new #76 // class java/lang/StringBuilder\n 123: dup\n 124: invokespecial #80 // Method java/lang/StringBuilder.\"<init>\":()V\n 127: checkcast #82 // class java/lang/Appendable\n 130: astore 15\n 132: iconst_0\n 133: istore 16\n 135: iconst_0\n 136: istore 17\n 138: aload 14\n 140: invokeinterface #86, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 145: istore 18\n 147: iload 17\n 149: iload 18\n 151: if_icmpge 197\n 154: aload 14\n 156: iload 17\n 158: invokeinterface #90, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 163: istore 19\n 165: iload 19\n 167: istore 20\n 169: iconst_0\n 170: istore 21\n 172: iload 20\n 174: invokestatic #96 // Method java/lang/Character.isDigit:(C)Z\n 177: nop\n 178: ifeq 191\n 181: aload 15\n 183: iload 19\n 185: invokeinterface #100, 2 // InterfaceMethod java/lang/Appendable.append:(C)Ljava/lang/Appendable;\n 190: pop\n 191: iinc 17, 1\n 194: goto 147\n 197: aload 15\n 199: checkcast #76 // class java/lang/StringBuilder\n 202: invokevirtual #104 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 205: astore 22\n 207: aload 22\n 209: invokevirtual #105 // Method java/lang/String.length:()I\n 212: tableswitch { // 1 to 2\n 1: 236\n 2: 259\n default: 264\n }\n 236: new #76 // class java/lang/StringBuilder\n 239: dup\n 240: invokespecial #80 // Method java/lang/StringBuilder.\"<init>\":()V\n 243: aload 22\n 245: invokevirtual #108 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 248: aload 22\n 250: invokevirtual #108 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 253: invokevirtual #104 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 256: goto 296\n 259: aload 22\n 261: goto 296\n 264: aload 22\n 266: astore 14\n 268: iconst_1\n 269: istore 15\n 271: aload 22\n 273: checkcast #74 // class java/lang/CharSequence\n 276: invokestatic #114 // Method kotlin/text/StringsKt.getLastIndex:(Ljava/lang/CharSequence;)I\n 279: istore 16\n 281: aload 14\n 283: checkcast #74 // class java/lang/CharSequence\n 286: iload 15\n 288: iload 16\n 290: invokestatic #118 // Method kotlin/text/StringsKt.removeRange:(Ljava/lang/CharSequence;II)Ljava/lang/CharSequence;\n 293: invokevirtual #119 // Method java/lang/Object.toString:()Ljava/lang/String;\n 296: invokestatic #123 // Method kotlin/text/StringsKt.toIntOrNull:(Ljava/lang/String;)Ljava/lang/Integer;\n 299: astore 12\n 301: aload 12\n 303: ifnull 314\n 306: iload_1\n 307: aload 12\n 309: invokevirtual #128 // Method java/lang/Integer.intValue:()I\n 312: iadd\n 313: istore_1\n 314: nop\n 315: goto 81\n 318: aload 4\n 320: aload 5\n 322: invokestatic #134 // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V\n 325: goto 349\n 328: astore 23\n 330: aload 23\n 332: astore 5\n 334: aload 23\n 336: athrow\n 337: astore 23\n 339: aload 4\n 341: aload 5\n 343: invokestatic #134 // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V\n 346: aload 23\n 348: athrow\n 349: iload_1\n 350: istore_2\n 351: getstatic #140 // Field java/lang/System.out:Ljava/io/PrintStream;\n 354: iload_2\n 355: invokevirtual #146 // Method java/io/PrintStream.println:(I)V\n 358: return\n Exception table:\n from to target type\n 53 318 328 Class java/lang/Throwable\n 53 318 337 any\n 328 337 337 any\n 337 339 337 any\n\n public static final void day1_part2(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #11 // String path\n 3: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: bipush 9\n 10: anewarray #171 // class kotlin/Pair\n 13: astore_3\n 14: aload_3\n 15: iconst_0\n 16: ldc #173 // String one\n 18: ldc #175 // String 1\n 20: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 23: aastore\n 24: aload_3\n 25: iconst_1\n 26: ldc #183 // String two\n 28: ldc #185 // String 2\n 30: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 33: aastore\n 34: aload_3\n 35: iconst_2\n 36: ldc #187 // String three\n 38: ldc #189 // String 3\n 40: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 43: aastore\n 44: aload_3\n 45: iconst_3\n 46: ldc #191 // String four\n 48: ldc #193 // String 4\n 50: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 53: aastore\n 54: aload_3\n 55: iconst_4\n 56: ldc #195 // String five\n 58: ldc #197 // String 5\n 60: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 63: aastore\n 64: aload_3\n 65: iconst_5\n 66: ldc #199 // String six\n 68: ldc #201 // String 6\n 70: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 73: aastore\n 74: aload_3\n 75: bipush 6\n 77: ldc #203 // String seven\n 79: ldc #205 // String 7\n 81: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 84: aastore\n 85: aload_3\n 86: bipush 7\n 88: ldc #207 // String eight\n 90: ldc #209 // String 8\n 92: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 95: aastore\n 96: aload_3\n 97: bipush 8\n 99: ldc #211 // String nine\n 101: ldc #213 // String 9\n 103: invokestatic #181 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 106: aastore\n 107: aload_3\n 108: invokestatic #219 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 111: astore_2\n 112: aload_2\n 113: astore 4\n 115: iconst_0\n 116: istore 5\n 118: aload 4\n 120: astore 6\n 122: new #221 // class java/util/ArrayList\n 125: dup\n 126: invokespecial #222 // Method java/util/ArrayList.\"<init>\":()V\n 129: checkcast #224 // class java/util/Collection\n 132: astore 7\n 134: iconst_0\n 135: istore 8\n 137: aload 6\n 139: invokeinterface #230, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 144: invokeinterface #233, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 149: astore 9\n 151: aload 9\n 153: invokeinterface #68, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 158: ifeq 229\n 161: aload 9\n 163: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 168: checkcast #235 // class java/util/Map$Entry\n 171: astore 10\n 173: aload 10\n 175: astore 11\n 177: iconst_0\n 178: istore 12\n 180: iconst_2\n 181: anewarray #19 // class java/lang/String\n 184: astore 13\n 186: aload 13\n 188: iconst_0\n 189: aload 11\n 191: invokeinterface #238, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 196: aastore\n 197: aload 13\n 199: iconst_1\n 200: aload 11\n 202: invokeinterface #241, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 207: aastore\n 208: aload 13\n 210: invokestatic #247 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 213: checkcast #249 // class java/lang/Iterable\n 216: astore 11\n 218: aload 7\n 220: aload 11\n 222: invokestatic #253 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 225: pop\n 226: goto 151\n 229: aload 7\n 231: checkcast #255 // class java/util/List\n 234: nop\n 235: astore_3\n 236: aload_0\n 237: iconst_0\n 238: anewarray #19 // class java/lang/String\n 241: invokestatic #25 // Method java/nio/file/Paths.get:(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;\n 244: dup\n 245: ldc #27 // String get(...)\n 247: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 250: astore 4\n 252: getstatic #36 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;\n 255: aload 4\n 257: swap\n 258: invokestatic #42 // Method java/nio/file/Files.newBufferedReader:(Ljava/nio/file/Path;Ljava/nio/charset/Charset;)Ljava/io/BufferedReader;\n 261: dup\n 262: ldc #44 // String newBufferedReader(...)\n 264: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 267: checkcast #46 // class java/io/Reader\n 270: astore 6\n 272: aload 6\n 274: checkcast #48 // class java/io/BufferedReader\n 277: checkcast #50 // class java/io/Closeable\n 280: astore 7\n 282: aconst_null\n 283: astore 8\n 285: nop\n 286: aload 7\n 288: checkcast #48 // class java/io/BufferedReader\n 291: astore 9\n 293: aload 9\n 295: invokestatic #56 // Method kotlin/io/TextStreamsKt.lineSequence:(Ljava/io/BufferedReader;)Lkotlin/sequences/Sequence;\n 298: astore 10\n 300: aload 10\n 302: astore 11\n 304: aload 11\n 306: invokeinterface #62, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 311: astore 12\n 313: aload 12\n 315: invokeinterface #68, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 320: ifeq 482\n 323: aload 12\n 325: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 330: checkcast #19 // class java/lang/String\n 333: astore 13\n 335: iconst_0\n 336: istore 14\n 338: aload 13\n 340: aload_3\n 341: invokestatic #259 // Method findAllOverlappingMatches:(Ljava/lang/String;Ljava/util/List;)Ljava/util/List;\n 344: checkcast #249 // class java/lang/Iterable\n 347: ldc_w #261 // String\n 350: checkcast #74 // class java/lang/CharSequence\n 353: aconst_null\n 354: aconst_null\n 355: iconst_0\n 356: aconst_null\n 357: aload_2\n 358: invokedynamic #281, 0 // InvokeDynamic #0:invoke:(Ljava/util/Map;)Lkotlin/jvm/functions/Function1;\n 363: bipush 30\n 365: aconst_null\n 366: invokestatic #285 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 369: astore 15\n 371: aload 15\n 373: invokevirtual #105 // Method java/lang/String.length:()I\n 376: tableswitch { // 1 to 2\n 1: 400\n 2: 423\n default: 428\n }\n 400: new #76 // class java/lang/StringBuilder\n 403: dup\n 404: invokespecial #80 // Method java/lang/StringBuilder.\"<init>\":()V\n 407: aload 15\n 409: invokevirtual #108 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 412: aload 15\n 414: invokevirtual #108 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 417: invokevirtual #104 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 420: goto 460\n 423: aload 15\n 425: goto 460\n 428: aload 15\n 430: astore 16\n 432: iconst_1\n 433: istore 17\n 435: aload 15\n 437: checkcast #74 // class java/lang/CharSequence\n 440: invokestatic #114 // Method kotlin/text/StringsKt.getLastIndex:(Ljava/lang/CharSequence;)I\n 443: istore 18\n 445: aload 16\n 447: checkcast #74 // class java/lang/CharSequence\n 450: iload 17\n 452: iload 18\n 454: invokestatic #118 // Method kotlin/text/StringsKt.removeRange:(Ljava/lang/CharSequence;II)Ljava/lang/CharSequence;\n 457: invokevirtual #119 // Method java/lang/Object.toString:()Ljava/lang/String;\n 460: invokestatic #123 // Method kotlin/text/StringsKt.toIntOrNull:(Ljava/lang/String;)Ljava/lang/Integer;\n 463: astore 19\n 465: aload 19\n 467: ifnull 478\n 470: iload_1\n 471: aload 19\n 473: invokevirtual #128 // Method java/lang/Integer.intValue:()I\n 476: iadd\n 477: istore_1\n 478: nop\n 479: goto 313\n 482: aload 7\n 484: aload 8\n 486: invokestatic #134 // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V\n 489: goto 513\n 492: astore 20\n 494: aload 20\n 496: astore 8\n 498: aload 20\n 500: athrow\n 501: astore 20\n 503: aload 7\n 505: aload 8\n 507: invokestatic #134 // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V\n 510: aload 20\n 512: athrow\n 513: iload_1\n 514: istore 4\n 516: getstatic #140 // Field java/lang/System.out:Ljava/io/PrintStream;\n 519: iload 4\n 521: invokevirtual #146 // Method java/io/PrintStream.println:(I)V\n 524: return\n Exception table:\n from to target type\n 285 482 492 Class java/lang/Throwable\n 285 482 501 any\n 492 501 501 any\n 501 503 501 any\n\n public static final java.util.List<java.lang.String> findAllOverlappingMatches(java.lang.String, java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: ldc_w #304 // String input\n 4: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_1\n 8: ldc_w #305 // String substrings\n 11: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 14: new #221 // class java/util/ArrayList\n 17: dup\n 18: invokespecial #222 // Method java/util/ArrayList.\"<init>\":()V\n 21: checkcast #255 // class java/util/List\n 24: astore_2\n 25: iconst_0\n 26: istore_3\n 27: aload_0\n 28: checkcast #74 // class java/lang/CharSequence\n 31: invokeinterface #86, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 36: istore 4\n 38: iload_3\n 39: iload 4\n 41: if_icmpge 117\n 44: iload_3\n 45: iconst_1\n 46: iadd\n 47: istore 5\n 49: aload_0\n 50: invokevirtual #105 // Method java/lang/String.length:()I\n 53: istore 6\n 55: iload 5\n 57: iload 6\n 59: if_icmpgt 111\n 62: aload_0\n 63: iload_3\n 64: iload 5\n 66: invokevirtual #309 // Method java/lang/String.substring:(II)Ljava/lang/String;\n 69: dup\n 70: ldc_w #311 // String substring(...)\n 73: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 76: astore 7\n 78: aload_1\n 79: aload 7\n 81: invokeinterface #315, 2 // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z\n 86: ifeq 98\n 89: aload_2\n 90: aload 7\n 92: invokeinterface #318, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 97: pop\n 98: iload 5\n 100: iload 6\n 102: if_icmpeq 111\n 105: iinc 5, 1\n 108: goto 62\n 111: iinc 3, 1\n 114: goto 38\n 117: aload_2\n 118: areturn\n\n private static final java.lang.CharSequence day1_part2$lambda$4$lambda$3(java.util.Map, java.lang.String);\n Code:\n 0: aload_1\n 1: ldc_w #322 // String it\n 4: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_0\n 8: aload_1\n 9: invokeinterface #324, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 14: checkcast #19 // class java/lang/String\n 17: dup\n 18: ifnull 27\n 21: checkcast #74 // class java/lang/CharSequence\n 24: goto 32\n 27: pop\n 28: aload_1\n 29: checkcast #74 // class java/lang/CharSequence\n 32: areturn\n}\n", "javap_err": "" } ]
leonhardbrenner__kitchensink__a7b9701/src/jvmMain/kotlin/Atom.kt
import java.util.* val Pair<Int, Int>.a: Int get() = first val Pair<Int, Int>.b: Int get() = second fun <T, R> Sequence<T>.reductions(initial: R, operation: (acc: R, T) -> R) : Sequence<R> = sequence { var last = initial forEach { last = operation(last, it) yield(last) } } class Atom(val data: IntArray) { override fun toString() = Arrays.toString(this.data) operator fun get(index: Atom) = Atom(data.sliceArray(index.data.toList())) operator fun set(index: Atom, value: Atom) { (index.data zip value.data).map { pair: Pair<Int, Int> -> val (index, value) = pair this.data[index] = value } } operator fun plus(b: Int) = Atom(data.map { it + b }.toIntArray()) operator fun plus(other: Atom) = Atom((data zip other.data).map { it.a + it.b }.toIntArray()) operator fun minus(b: Int) = Atom(data.map { it - b }.toIntArray()) operator fun minus(other: Atom) = Atom((data zip other.data).map { it.a - it.b }.toIntArray()) operator fun times(b: Int) = Atom(data.map { it * b }.toIntArray()) operator fun times(other: Atom) = Atom((data zip other.data).map { it.a * it.b }.toIntArray()) operator fun div(b: Int) = Atom(data.map { it / b }.toIntArray()) operator fun div(other: Atom) = Atom((data zip other.data).map { it.a / it.b }.toIntArray()) operator fun rem(b: Int) = Atom(data.map { it % b }.toIntArray()) operator fun rem(other: Atom) = Atom((data zip other.data).map { it.a % it.b }.toIntArray()) //Todo - implement this like rl.range operator fun rangeTo(b: Int): Atom = TODO("Not specified yet") //Atom(data.map { it % b }.toIntArray()) operator fun rangeTo(other: Atom): Atom = TODO("Not specified yet") //Atom((data zip other.data).map { it.a % it.b }.toIntArray()) fun cumsum(): Atom { var last = 0 return Atom(data.map { last += it last }.toIntArray()) } fun repeat(count: Int): Atom { return Atom(this.data.flatMap { value -> IntRange(1, count).map { value } }.toIntArray()) } fun repeat(counts: IntArray): Atom { return Atom(this.data.zip(counts).flatMap { pair -> val (value, count) = pair IntRange(1, count).map { value } }.toIntArray()) } fun repeat(counts: Atom): Atom { return this.repeat(counts.data) } } fun main(args: Array<String>) { val x = Atom(arrayOf(1, 2, 3, 4).toIntArray()) val y = Atom(arrayOf(1, 3).toIntArray()) println("x = $x") println("y = $y") println("x[y] = ${x[y]}") println("x + 1 = ${x + 1}") println("x + x = ${x + x}") println("x - 1 = ${x - 1}") println("x - x = ${x - x}") println("x * 1 = ${x * 1}") println("x * x = ${x * x}") println("x / 2 = ${x / 2}") println("x / (x * 2) = ${x / (x * 2)}") println("x % 2 = ${x % 2}") println("x % (x * 2) = ${x % Atom(arrayOf(2, 2, 2, 2).toIntArray())}") x[y] = y + 2; println("x[y] = y + 2; x = ${x}") try { x[y]..2 } catch (ex: NotImplementedError) { println("TODO - Think of a useful way of using ..") } try { x[y]..y } catch (ex: NotImplementedError) { println("TODO - Think of a useful way of using ..") } println(x) println(x.cumsum()) //SequenceOf println(sequenceOf(0, 1, 2, 3, 4).reductions(0) { last, it -> last + it }.toList()) //Cumsum println(sequenceOf(0, 1, 2, 3, 4).reduce { last, it -> last + it }) //Sum println(x.repeat(3)) println(x.repeat(x)) }
[ { "class_path": "leonhardbrenner__kitchensink__a7b9701/AtomKt.class", "javap": "Compiled from \"Atom.kt\"\npublic final class AtomKt {\n public static final int getA(kotlin.Pair<java.lang.Integer, java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #10 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #22 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 10: checkcast #24 // class java/lang/Number\n 13: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 16: ireturn\n\n public static final int getB(kotlin.Pair<java.lang.Integer, java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #10 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #34 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 10: checkcast #24 // class java/lang/Number\n 13: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 16: ireturn\n\n public static final <T, R> kotlin.sequences.Sequence<R> reductions(kotlin.sequences.Sequence<? extends T>, R, kotlin.jvm.functions.Function2<? super R, ? super T, ? extends R>);\n Code:\n 0: aload_0\n 1: ldc #10 // String <this>\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_2\n 7: ldc #40 // String operation\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: new #42 // class AtomKt$reductions$1\n 15: dup\n 16: aload_1\n 17: aload_0\n 18: aload_2\n 19: aconst_null\n 20: invokespecial #46 // Method AtomKt$reductions$1.\"<init>\":(Ljava/lang/Object;Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)V\n 23: checkcast #48 // class kotlin/jvm/functions/Function2\n 26: invokestatic #54 // Method kotlin/sequences/SequencesKt.sequence:(Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;\n 29: areturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #65 // String args\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #67 // class Atom\n 9: dup\n 10: iconst_4\n 11: anewarray #69 // class java/lang/Integer\n 14: astore_2\n 15: aload_2\n 16: iconst_0\n 17: iconst_1\n 18: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 21: aastore\n 22: aload_2\n 23: iconst_1\n 24: iconst_2\n 25: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 28: aastore\n 29: aload_2\n 30: iconst_2\n 31: iconst_3\n 32: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 35: aastore\n 36: aload_2\n 37: iconst_3\n 38: iconst_4\n 39: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 42: aastore\n 43: aload_2\n 44: invokestatic #79 // Method kotlin/collections/ArraysKt.toIntArray:([Ljava/lang/Integer;)[I\n 47: invokespecial #82 // Method Atom.\"<init>\":([I)V\n 50: astore_1\n 51: new #67 // class Atom\n 54: dup\n 55: iconst_2\n 56: anewarray #69 // class java/lang/Integer\n 59: astore_3\n 60: aload_3\n 61: iconst_0\n 62: iconst_1\n 63: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 66: aastore\n 67: aload_3\n 68: iconst_1\n 69: iconst_3\n 70: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 73: aastore\n 74: aload_3\n 75: invokestatic #79 // Method kotlin/collections/ArraysKt.toIntArray:([Ljava/lang/Integer;)[I\n 78: invokespecial #82 // Method Atom.\"<init>\":([I)V\n 81: astore_2\n 82: new #84 // class java/lang/StringBuilder\n 85: dup\n 86: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 89: ldc #89 // String x =\n 91: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 94: aload_1\n 95: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 98: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 101: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 104: swap\n 105: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 108: new #84 // class java/lang/StringBuilder\n 111: dup\n 112: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 115: ldc #114 // String y =\n 117: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 120: aload_2\n 121: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 124: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 127: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 130: swap\n 131: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 134: new #84 // class java/lang/StringBuilder\n 137: dup\n 138: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 141: ldc #116 // String x[y] =\n 143: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 146: aload_1\n 147: aload_2\n 148: invokevirtual #120 // Method Atom.get:(LAtom;)LAtom;\n 151: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 154: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 157: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 160: swap\n 161: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 164: new #84 // class java/lang/StringBuilder\n 167: dup\n 168: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 171: ldc #122 // String x + 1 =\n 173: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 176: aload_1\n 177: iconst_1\n 178: invokevirtual #126 // Method Atom.plus:(I)LAtom;\n 181: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 184: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 187: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 190: swap\n 191: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 194: new #84 // class java/lang/StringBuilder\n 197: dup\n 198: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 201: ldc #128 // String x + x =\n 203: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 206: aload_1\n 207: aload_1\n 208: invokevirtual #130 // Method Atom.plus:(LAtom;)LAtom;\n 211: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 214: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 217: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 220: swap\n 221: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 224: new #84 // class java/lang/StringBuilder\n 227: dup\n 228: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 231: ldc #132 // String x - 1 =\n 233: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 236: aload_1\n 237: iconst_1\n 238: invokevirtual #135 // Method Atom.minus:(I)LAtom;\n 241: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 244: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 247: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 250: swap\n 251: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 254: new #84 // class java/lang/StringBuilder\n 257: dup\n 258: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 261: ldc #137 // String x - x =\n 263: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 266: aload_1\n 267: aload_1\n 268: invokevirtual #139 // Method Atom.minus:(LAtom;)LAtom;\n 271: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 274: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 277: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 280: swap\n 281: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 284: new #84 // class java/lang/StringBuilder\n 287: dup\n 288: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 291: ldc #141 // String x * 1 =\n 293: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 296: aload_1\n 297: iconst_1\n 298: invokevirtual #144 // Method Atom.times:(I)LAtom;\n 301: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 304: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 307: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 310: swap\n 311: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 314: new #84 // class java/lang/StringBuilder\n 317: dup\n 318: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 321: ldc #146 // String x * x =\n 323: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 326: aload_1\n 327: aload_1\n 328: invokevirtual #148 // Method Atom.times:(LAtom;)LAtom;\n 331: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 334: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 337: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 340: swap\n 341: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 344: new #84 // class java/lang/StringBuilder\n 347: dup\n 348: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 351: ldc #150 // String x / 2 =\n 353: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 356: aload_1\n 357: iconst_2\n 358: invokevirtual #153 // Method Atom.div:(I)LAtom;\n 361: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 364: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 367: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 370: swap\n 371: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 374: new #84 // class java/lang/StringBuilder\n 377: dup\n 378: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 381: ldc #155 // String x / (x * 2) =\n 383: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 386: aload_1\n 387: aload_1\n 388: iconst_2\n 389: invokevirtual #144 // Method Atom.times:(I)LAtom;\n 392: invokevirtual #157 // Method Atom.div:(LAtom;)LAtom;\n 395: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 398: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 401: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 404: swap\n 405: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 408: new #84 // class java/lang/StringBuilder\n 411: dup\n 412: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 415: ldc #159 // String x % 2 =\n 417: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 420: aload_1\n 421: iconst_2\n 422: invokevirtual #162 // Method Atom.rem:(I)LAtom;\n 425: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 428: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 431: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 434: swap\n 435: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 438: new #84 // class java/lang/StringBuilder\n 441: dup\n 442: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 445: ldc #164 // String x % (x * 2) =\n 447: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 450: aload_1\n 451: new #67 // class Atom\n 454: dup\n 455: iconst_4\n 456: anewarray #69 // class java/lang/Integer\n 459: astore_3\n 460: aload_3\n 461: iconst_0\n 462: iconst_2\n 463: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 466: aastore\n 467: aload_3\n 468: iconst_1\n 469: iconst_2\n 470: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 473: aastore\n 474: aload_3\n 475: iconst_2\n 476: iconst_2\n 477: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 480: aastore\n 481: aload_3\n 482: iconst_3\n 483: iconst_2\n 484: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 487: aastore\n 488: aload_3\n 489: invokestatic #79 // Method kotlin/collections/ArraysKt.toIntArray:([Ljava/lang/Integer;)[I\n 492: invokespecial #82 // Method Atom.\"<init>\":([I)V\n 495: invokevirtual #166 // Method Atom.rem:(LAtom;)LAtom;\n 498: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 501: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 504: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 507: swap\n 508: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 511: aload_1\n 512: aload_2\n 513: aload_2\n 514: iconst_2\n 515: invokevirtual #126 // Method Atom.plus:(I)LAtom;\n 518: invokevirtual #170 // Method Atom.set:(LAtom;LAtom;)V\n 521: new #84 // class java/lang/StringBuilder\n 524: dup\n 525: invokespecial #87 // Method java/lang/StringBuilder.\"<init>\":()V\n 528: ldc #172 // String x[y] = y + 2; x =\n 530: invokevirtual #93 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 533: aload_1\n 534: invokevirtual #96 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 537: invokevirtual #100 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 540: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 543: swap\n 544: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 547: nop\n 548: aload_1\n 549: aload_2\n 550: invokevirtual #120 // Method Atom.get:(LAtom;)LAtom;\n 553: iconst_2\n 554: invokevirtual #175 // Method Atom.rangeTo:(I)LAtom;\n 557: pop\n 558: goto 572\n 561: astore 4\n 563: ldc #177 // String TODO - Think of a useful way of using ..\n 565: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 568: swap\n 569: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 572: nop\n 573: aload_1\n 574: aload_2\n 575: invokevirtual #120 // Method Atom.get:(LAtom;)LAtom;\n 578: aload_2\n 579: invokevirtual #179 // Method Atom.rangeTo:(LAtom;)LAtom;\n 582: pop\n 583: goto 597\n 586: astore 4\n 588: ldc #177 // String TODO - Think of a useful way of using ..\n 590: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 593: swap\n 594: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 597: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 600: aload_1\n 601: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 604: aload_1\n 605: invokevirtual #183 // Method Atom.cumsum:()LAtom;\n 608: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 611: swap\n 612: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 615: iconst_5\n 616: anewarray #69 // class java/lang/Integer\n 619: astore_3\n 620: aload_3\n 621: iconst_0\n 622: iconst_0\n 623: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 626: aastore\n 627: aload_3\n 628: iconst_1\n 629: iconst_1\n 630: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 633: aastore\n 634: aload_3\n 635: iconst_2\n 636: iconst_2\n 637: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 640: aastore\n 641: aload_3\n 642: iconst_3\n 643: iconst_3\n 644: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 647: aastore\n 648: aload_3\n 649: iconst_4\n 650: iconst_4\n 651: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 654: aastore\n 655: aload_3\n 656: invokestatic #187 // Method kotlin/sequences/SequencesKt.sequenceOf:([Ljava/lang/Object;)Lkotlin/sequences/Sequence;\n 659: iconst_0\n 660: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 663: invokedynamic #207, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;\n 668: invokestatic #209 // Method reductions:(Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;\n 671: invokestatic #213 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 674: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 677: swap\n 678: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 681: iconst_5\n 682: anewarray #69 // class java/lang/Integer\n 685: astore_3\n 686: aload_3\n 687: iconst_0\n 688: iconst_0\n 689: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 692: aastore\n 693: aload_3\n 694: iconst_1\n 695: iconst_1\n 696: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 699: aastore\n 700: aload_3\n 701: iconst_2\n 702: iconst_2\n 703: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 706: aastore\n 707: aload_3\n 708: iconst_3\n 709: iconst_3\n 710: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 713: aastore\n 714: aload_3\n 715: iconst_4\n 716: iconst_4\n 717: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 720: aastore\n 721: aload_3\n 722: invokestatic #187 // Method kotlin/sequences/SequencesKt.sequenceOf:([Ljava/lang/Object;)Lkotlin/sequences/Sequence;\n 725: astore_3\n 726: iconst_0\n 727: istore 4\n 729: aload_3\n 730: invokeinterface #219, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 735: astore 5\n 737: aload 5\n 739: invokeinterface #225, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 744: ifne 757\n 747: new #227 // class java/lang/UnsupportedOperationException\n 750: dup\n 751: ldc #229 // String Empty sequence can\\'t be reduced.\n 753: invokespecial #232 // Method java/lang/UnsupportedOperationException.\"<init>\":(Ljava/lang/String;)V\n 756: athrow\n 757: aload 5\n 759: invokeinterface #235, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 764: astore 6\n 766: aload 5\n 768: invokeinterface #225, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 773: ifeq 817\n 776: aload 6\n 778: aload 5\n 780: invokeinterface #235, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 785: checkcast #24 // class java/lang/Number\n 788: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 791: istore 7\n 793: checkcast #24 // class java/lang/Number\n 796: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 799: istore 8\n 801: iconst_0\n 802: istore 9\n 804: iload 8\n 806: iload 7\n 808: iadd\n 809: invokestatic #73 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 812: astore 6\n 814: goto 766\n 817: aload 6\n 819: checkcast #24 // class java/lang/Number\n 822: invokevirtual #28 // Method java/lang/Number.intValue:()I\n 825: istore_3\n 826: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 829: iload_3\n 830: invokevirtual #238 // Method java/io/PrintStream.println:(I)V\n 833: aload_1\n 834: iconst_3\n 835: invokevirtual #241 // Method Atom.repeat:(I)LAtom;\n 838: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 841: swap\n 842: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 845: aload_1\n 846: aload_1\n 847: invokevirtual #243 // Method Atom.repeat:(LAtom;)LAtom;\n 850: getstatic #106 // Field java/lang/System.out:Ljava/io/PrintStream;\n 853: swap\n 854: invokevirtual #112 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 857: return\n Exception table:\n from to target type\n 547 558 561 Class kotlin/NotImplementedError\n 572 583 586 Class kotlin/NotImplementedError\n\n private static final int main$lambda$0(int, int);\n Code:\n 0: iload_0\n 1: iload_1\n 2: iadd\n 3: ireturn\n}\n", "javap_err": "" }, { "class_path": "leonhardbrenner__kitchensink__a7b9701/AtomKt$reductions$1.class", "javap": "Compiled from \"Atom.kt\"\nfinal class AtomKt$reductions$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super R>, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {\n java.lang.Object L$1;\n\n java.lang.Object L$2;\n\n java.lang.Object L$3;\n\n int label;\n\n private java.lang.Object L$0;\n\n final R $initial;\n\n final kotlin.sequences.Sequence<T> $this_reductions;\n\n final kotlin.jvm.functions.Function2<R, T, R> $operation;\n\n AtomKt$reductions$1(R, kotlin.sequences.Sequence<? extends T>, kotlin.jvm.functions.Function2<? super R, ? super T, ? extends R>, kotlin.coroutines.Continuation<? super AtomKt$reductions$1>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #14 // Field $initial:Ljava/lang/Object;\n 5: aload_0\n 6: aload_2\n 7: putfield #18 // Field $this_reductions:Lkotlin/sequences/Sequence;\n 10: aload_0\n 11: aload_3\n 12: putfield #22 // Field $operation:Lkotlin/jvm/functions/Function2;\n 15: aload_0\n 16: iconst_2\n 17: aload 4\n 19: invokespecial #25 // Method kotlin/coroutines/jvm/internal/RestrictedSuspendLambda.\"<init>\":(ILkotlin/coroutines/Continuation;)V\n 22: return\n\n public final java.lang.Object invokeSuspend(java.lang.Object);\n Code:\n 0: invokestatic #55 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;\n 3: astore 11\n 5: aload_0\n 6: getfield #59 // Field label:I\n 9: tableswitch { // 0 to 1\n 0: 32\n 1: 172\n default: 226\n }\n 32: aload_1\n 33: invokestatic #65 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 36: aload_0\n 37: getfield #67 // Field L$0:Ljava/lang/Object;\n 40: checkcast #69 // class kotlin/sequences/SequenceScope\n 43: astore_2\n 44: new #71 // class kotlin/jvm/internal/Ref$ObjectRef\n 47: dup\n 48: invokespecial #74 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 51: astore_3\n 52: aload_3\n 53: aload_0\n 54: getfield #14 // Field $initial:Ljava/lang/Object;\n 57: putfield #77 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 60: aload_0\n 61: getfield #18 // Field $this_reductions:Lkotlin/sequences/Sequence;\n 64: astore 4\n 66: aload_0\n 67: getfield #22 // Field $operation:Lkotlin/jvm/functions/Function2;\n 70: astore 5\n 72: iconst_0\n 73: istore 6\n 75: aload 4\n 77: invokeinterface #83, 1 // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;\n 82: astore 7\n 84: aload 7\n 86: invokeinterface #89, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 91: ifeq 221\n 94: aload 7\n 96: invokeinterface #92, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 101: astore 8\n 103: aload 8\n 105: astore 9\n 107: iconst_0\n 108: istore 10\n 110: aload_3\n 111: aload 5\n 113: aload_3\n 114: getfield #77 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 117: aload 9\n 119: invokeinterface #96, 3 // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 124: putfield #77 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 127: aload_2\n 128: aload_3\n 129: getfield #77 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 132: aload_0\n 133: aload_0\n 134: aload_2\n 135: putfield #67 // Field L$0:Ljava/lang/Object;\n 138: aload_0\n 139: aload_3\n 140: putfield #98 // Field L$1:Ljava/lang/Object;\n 143: aload_0\n 144: aload 5\n 146: putfield #100 // Field L$2:Ljava/lang/Object;\n 149: aload_0\n 150: aload 7\n 152: putfield #102 // Field L$3:Ljava/lang/Object;\n 155: aload_0\n 156: iconst_1\n 157: putfield #59 // Field label:I\n 160: invokevirtual #106 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 163: dup\n 164: aload 11\n 166: if_acmpne 217\n 169: aload 11\n 171: areturn\n 172: iconst_0\n 173: istore 6\n 175: iconst_0\n 176: istore 10\n 178: aload_0\n 179: getfield #102 // Field L$3:Ljava/lang/Object;\n 182: checkcast #85 // class java/util/Iterator\n 185: astore 7\n 187: aload_0\n 188: getfield #100 // Field L$2:Ljava/lang/Object;\n 191: checkcast #7 // class kotlin/jvm/functions/Function2\n 194: astore 5\n 196: aload_0\n 197: getfield #98 // Field L$1:Ljava/lang/Object;\n 200: checkcast #71 // class kotlin/jvm/internal/Ref$ObjectRef\n 203: astore_3\n 204: aload_0\n 205: getfield #67 // Field L$0:Ljava/lang/Object;\n 208: checkcast #69 // class kotlin/sequences/SequenceScope\n 211: astore_2\n 212: aload_1\n 213: invokestatic #65 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V\n 216: aload_1\n 217: pop\n 218: goto 84\n 221: nop\n 222: getstatic #112 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 225: areturn\n 226: new #114 // class java/lang/IllegalStateException\n 229: dup\n 230: ldc #116 // String call to \\'resume\\' before \\'invoke\\' with coroutine\n 232: invokespecial #119 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 235: athrow\n\n public final kotlin.coroutines.Continuation<kotlin.Unit> create(java.lang.Object, kotlin.coroutines.Continuation<?>);\n Code:\n 0: new #2 // class AtomKt$reductions$1\n 3: dup\n 4: aload_0\n 5: getfield #14 // Field $initial:Ljava/lang/Object;\n 8: aload_0\n 9: getfield #18 // Field $this_reductions:Lkotlin/sequences/Sequence;\n 12: aload_0\n 13: getfield #22 // Field $operation:Lkotlin/jvm/functions/Function2;\n 16: aload_2\n 17: invokespecial #134 // Method \"<init>\":(Ljava/lang/Object;Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)V\n 20: astore_3\n 21: aload_3\n 22: aload_1\n 23: putfield #67 // Field L$0:Ljava/lang/Object;\n 26: aload_3\n 27: checkcast #136 // class kotlin/coroutines/Continuation\n 30: areturn\n\n public final java.lang.Object invoke(kotlin.sequences.SequenceScope<? super R>, kotlin.coroutines.Continuation<? super kotlin.Unit>);\n Code:\n 0: aload_0\n 1: aload_1\n 2: aload_2\n 3: invokevirtual #141 // Method create:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;\n 6: checkcast #2 // class AtomKt$reductions$1\n 9: getstatic #112 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 12: invokevirtual #143 // Method invokeSuspend:(Ljava/lang/Object;)Ljava/lang/Object;\n 15: areturn\n\n public java.lang.Object invoke(java.lang.Object, java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: checkcast #69 // class kotlin/sequences/SequenceScope\n 5: aload_2\n 6: checkcast #136 // class kotlin/coroutines/Continuation\n 9: invokevirtual #147 // Method invoke:(Lkotlin/sequences/SequenceScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;\n 12: areturn\n}\n", "javap_err": "" }, { "class_path": "leonhardbrenner__kitchensink__a7b9701/Atom.class", "javap": "Compiled from \"Atom.kt\"\npublic final class Atom {\n private final int[] data;\n\n public Atom(int[]);\n Code:\n 0: aload_1\n 1: ldc #9 // String data\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokespecial #18 // Method java/lang/Object.\"<init>\":()V\n 10: aload_0\n 11: aload_1\n 12: putfield #21 // Field data:[I\n 15: return\n\n public final int[] getData();\n Code:\n 0: aload_0\n 1: getfield #21 // Field data:[I\n 4: areturn\n\n public java.lang.String toString();\n Code:\n 0: aload_0\n 1: getfield #21 // Field data:[I\n 4: invokestatic #32 // Method java/util/Arrays.toString:([I)Ljava/lang/String;\n 7: areturn\n\n public final Atom get(Atom);\n Code:\n 0: aload_1\n 1: ldc #36 // String index\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #2 // class Atom\n 9: dup\n 10: aload_0\n 11: getfield #21 // Field data:[I\n 14: aload_1\n 15: getfield #21 // Field data:[I\n 18: invokestatic #42 // Method kotlin/collections/ArraysKt.toList:([I)Ljava/util/List;\n 21: checkcast #44 // class java/util/Collection\n 24: invokestatic #48 // Method kotlin/collections/ArraysKt.sliceArray:([ILjava/util/Collection;)[I\n 27: invokespecial #50 // Method \"<init>\":([I)V\n 30: areturn\n\n public final void set(Atom, Atom);\n Code:\n 0: aload_1\n 1: ldc #36 // String index\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_2\n 7: ldc #54 // String value\n 9: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_1\n 13: getfield #21 // Field data:[I\n 16: aload_2\n 17: getfield #21 // Field data:[I\n 20: invokestatic #58 // Method kotlin/collections/ArraysKt.zip:([I[I)Ljava/util/List;\n 23: checkcast #60 // class java/lang/Iterable\n 26: astore_3\n 27: iconst_0\n 28: istore 4\n 30: aload_3\n 31: astore 5\n 33: new #62 // class java/util/ArrayList\n 36: dup\n 37: aload_3\n 38: bipush 10\n 40: invokestatic #68 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 43: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 46: checkcast #44 // class java/util/Collection\n 49: astore 6\n 51: iconst_0\n 52: istore 7\n 54: aload 5\n 56: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 61: astore 8\n 63: aload 8\n 65: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 70: ifeq 146\n 73: aload 8\n 75: invokeinterface #85, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 80: astore 9\n 82: aload 6\n 84: aload 9\n 86: checkcast #87 // class kotlin/Pair\n 89: astore 10\n 91: astore 14\n 93: iconst_0\n 94: istore 11\n 96: aload 10\n 98: invokevirtual #90 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 101: checkcast #92 // class java/lang/Number\n 104: invokevirtual #96 // Method java/lang/Number.intValue:()I\n 107: istore 12\n 109: aload 10\n 111: invokevirtual #99 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 114: checkcast #92 // class java/lang/Number\n 117: invokevirtual #96 // Method java/lang/Number.intValue:()I\n 120: istore 13\n 122: aload_0\n 123: getfield #21 // Field data:[I\n 126: iload 12\n 128: iload 13\n 130: iastore\n 131: nop\n 132: aload 14\n 134: getstatic #105 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 137: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 142: pop\n 143: goto 63\n 146: aload 6\n 148: checkcast #111 // class java/util/List\n 151: nop\n 152: pop\n 153: return\n\n public final Atom plus(int);\n Code:\n 0: aload_0\n 1: getfield #21 // Field data:[I\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #62 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: arraylength\n 16: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 19: checkcast #44 // class java/util/Collection\n 22: astore 5\n 24: iconst_0\n 25: istore 6\n 27: iconst_0\n 28: istore 7\n 30: aload 4\n 32: arraylength\n 33: istore 8\n 35: iload 7\n 37: iload 8\n 39: if_icmpge 82\n 42: aload 4\n 44: iload 7\n 46: iaload\n 47: istore 9\n 49: aload 5\n 51: iload 9\n 53: istore 10\n 55: astore 12\n 57: iconst_0\n 58: istore 11\n 60: iload 10\n 62: iload_1\n 63: iadd\n 64: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 67: aload 12\n 69: swap\n 70: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 75: pop\n 76: iinc 7, 1\n 79: goto 35\n 82: aload 5\n 84: checkcast #111 // class java/util/List\n 87: nop\n 88: checkcast #44 // class java/util/Collection\n 91: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 94: astore 13\n 96: new #2 // class Atom\n 99: dup\n 100: aload 13\n 102: invokespecial #50 // Method \"<init>\":([I)V\n 105: areturn\n\n public final Atom plus(Atom);\n Code:\n 0: aload_1\n 1: ldc #142 // String other\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #21 // Field data:[I\n 10: aload_1\n 11: getfield #21 // Field data:[I\n 14: invokestatic #58 // Method kotlin/collections/ArraysKt.zip:([I[I)Ljava/util/List;\n 17: checkcast #60 // class java/lang/Iterable\n 20: astore_2\n 21: iconst_0\n 22: istore_3\n 23: aload_2\n 24: astore 4\n 26: new #62 // class java/util/ArrayList\n 29: dup\n 30: aload_2\n 31: bipush 10\n 33: invokestatic #68 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 36: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 39: checkcast #44 // class java/util/Collection\n 42: astore 5\n 44: iconst_0\n 45: istore 6\n 47: aload 4\n 49: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 54: astore 7\n 56: aload 7\n 58: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 63: ifeq 115\n 66: aload 7\n 68: invokeinterface #85, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 73: astore 8\n 75: aload 5\n 77: aload 8\n 79: checkcast #87 // class kotlin/Pair\n 82: astore 9\n 84: astore 11\n 86: iconst_0\n 87: istore 10\n 89: aload 9\n 91: invokestatic #148 // Method AtomKt.getA:(Lkotlin/Pair;)I\n 94: aload 9\n 96: invokestatic #151 // Method AtomKt.getB:(Lkotlin/Pair;)I\n 99: iadd\n 100: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 103: aload 11\n 105: swap\n 106: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 111: pop\n 112: goto 56\n 115: aload 5\n 117: checkcast #111 // class java/util/List\n 120: nop\n 121: checkcast #44 // class java/util/Collection\n 124: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 127: astore 12\n 129: new #2 // class Atom\n 132: dup\n 133: aload 12\n 135: invokespecial #50 // Method \"<init>\":([I)V\n 138: areturn\n\n public final Atom minus(int);\n Code:\n 0: aload_0\n 1: getfield #21 // Field data:[I\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #62 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: arraylength\n 16: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 19: checkcast #44 // class java/util/Collection\n 22: astore 5\n 24: iconst_0\n 25: istore 6\n 27: iconst_0\n 28: istore 7\n 30: aload 4\n 32: arraylength\n 33: istore 8\n 35: iload 7\n 37: iload 8\n 39: if_icmpge 82\n 42: aload 4\n 44: iload 7\n 46: iaload\n 47: istore 9\n 49: aload 5\n 51: iload 9\n 53: istore 10\n 55: astore 12\n 57: iconst_0\n 58: istore 11\n 60: iload 10\n 62: iload_1\n 63: isub\n 64: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 67: aload 12\n 69: swap\n 70: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 75: pop\n 76: iinc 7, 1\n 79: goto 35\n 82: aload 5\n 84: checkcast #111 // class java/util/List\n 87: nop\n 88: checkcast #44 // class java/util/Collection\n 91: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 94: astore 13\n 96: new #2 // class Atom\n 99: dup\n 100: aload 13\n 102: invokespecial #50 // Method \"<init>\":([I)V\n 105: areturn\n\n public final Atom minus(Atom);\n Code:\n 0: aload_1\n 1: ldc #142 // String other\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #21 // Field data:[I\n 10: aload_1\n 11: getfield #21 // Field data:[I\n 14: invokestatic #58 // Method kotlin/collections/ArraysKt.zip:([I[I)Ljava/util/List;\n 17: checkcast #60 // class java/lang/Iterable\n 20: astore_2\n 21: iconst_0\n 22: istore_3\n 23: aload_2\n 24: astore 4\n 26: new #62 // class java/util/ArrayList\n 29: dup\n 30: aload_2\n 31: bipush 10\n 33: invokestatic #68 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 36: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 39: checkcast #44 // class java/util/Collection\n 42: astore 5\n 44: iconst_0\n 45: istore 6\n 47: aload 4\n 49: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 54: astore 7\n 56: aload 7\n 58: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 63: ifeq 115\n 66: aload 7\n 68: invokeinterface #85, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 73: astore 8\n 75: aload 5\n 77: aload 8\n 79: checkcast #87 // class kotlin/Pair\n 82: astore 9\n 84: astore 11\n 86: iconst_0\n 87: istore 10\n 89: aload 9\n 91: invokestatic #148 // Method AtomKt.getA:(Lkotlin/Pair;)I\n 94: aload 9\n 96: invokestatic #151 // Method AtomKt.getB:(Lkotlin/Pair;)I\n 99: isub\n 100: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 103: aload 11\n 105: swap\n 106: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 111: pop\n 112: goto 56\n 115: aload 5\n 117: checkcast #111 // class java/util/List\n 120: nop\n 121: checkcast #44 // class java/util/Collection\n 124: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 127: astore 12\n 129: new #2 // class Atom\n 132: dup\n 133: aload 12\n 135: invokespecial #50 // Method \"<init>\":([I)V\n 138: areturn\n\n public final Atom times(int);\n Code:\n 0: aload_0\n 1: getfield #21 // Field data:[I\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #62 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: arraylength\n 16: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 19: checkcast #44 // class java/util/Collection\n 22: astore 5\n 24: iconst_0\n 25: istore 6\n 27: iconst_0\n 28: istore 7\n 30: aload 4\n 32: arraylength\n 33: istore 8\n 35: iload 7\n 37: iload 8\n 39: if_icmpge 82\n 42: aload 4\n 44: iload 7\n 46: iaload\n 47: istore 9\n 49: aload 5\n 51: iload 9\n 53: istore 10\n 55: astore 12\n 57: iconst_0\n 58: istore 11\n 60: iload 10\n 62: iload_1\n 63: imul\n 64: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 67: aload 12\n 69: swap\n 70: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 75: pop\n 76: iinc 7, 1\n 79: goto 35\n 82: aload 5\n 84: checkcast #111 // class java/util/List\n 87: nop\n 88: checkcast #44 // class java/util/Collection\n 91: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 94: astore 13\n 96: new #2 // class Atom\n 99: dup\n 100: aload 13\n 102: invokespecial #50 // Method \"<init>\":([I)V\n 105: areturn\n\n public final Atom times(Atom);\n Code:\n 0: aload_1\n 1: ldc #142 // String other\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #21 // Field data:[I\n 10: aload_1\n 11: getfield #21 // Field data:[I\n 14: invokestatic #58 // Method kotlin/collections/ArraysKt.zip:([I[I)Ljava/util/List;\n 17: checkcast #60 // class java/lang/Iterable\n 20: astore_2\n 21: iconst_0\n 22: istore_3\n 23: aload_2\n 24: astore 4\n 26: new #62 // class java/util/ArrayList\n 29: dup\n 30: aload_2\n 31: bipush 10\n 33: invokestatic #68 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 36: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 39: checkcast #44 // class java/util/Collection\n 42: astore 5\n 44: iconst_0\n 45: istore 6\n 47: aload 4\n 49: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 54: astore 7\n 56: aload 7\n 58: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 63: ifeq 115\n 66: aload 7\n 68: invokeinterface #85, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 73: astore 8\n 75: aload 5\n 77: aload 8\n 79: checkcast #87 // class kotlin/Pair\n 82: astore 9\n 84: astore 11\n 86: iconst_0\n 87: istore 10\n 89: aload 9\n 91: invokestatic #148 // Method AtomKt.getA:(Lkotlin/Pair;)I\n 94: aload 9\n 96: invokestatic #151 // Method AtomKt.getB:(Lkotlin/Pair;)I\n 99: imul\n 100: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 103: aload 11\n 105: swap\n 106: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 111: pop\n 112: goto 56\n 115: aload 5\n 117: checkcast #111 // class java/util/List\n 120: nop\n 121: checkcast #44 // class java/util/Collection\n 124: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 127: astore 12\n 129: new #2 // class Atom\n 132: dup\n 133: aload 12\n 135: invokespecial #50 // Method \"<init>\":([I)V\n 138: areturn\n\n public final Atom div(int);\n Code:\n 0: aload_0\n 1: getfield #21 // Field data:[I\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #62 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: arraylength\n 16: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 19: checkcast #44 // class java/util/Collection\n 22: astore 5\n 24: iconst_0\n 25: istore 6\n 27: iconst_0\n 28: istore 7\n 30: aload 4\n 32: arraylength\n 33: istore 8\n 35: iload 7\n 37: iload 8\n 39: if_icmpge 82\n 42: aload 4\n 44: iload 7\n 46: iaload\n 47: istore 9\n 49: aload 5\n 51: iload 9\n 53: istore 10\n 55: astore 12\n 57: iconst_0\n 58: istore 11\n 60: iload 10\n 62: iload_1\n 63: idiv\n 64: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 67: aload 12\n 69: swap\n 70: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 75: pop\n 76: iinc 7, 1\n 79: goto 35\n 82: aload 5\n 84: checkcast #111 // class java/util/List\n 87: nop\n 88: checkcast #44 // class java/util/Collection\n 91: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 94: astore 13\n 96: new #2 // class Atom\n 99: dup\n 100: aload 13\n 102: invokespecial #50 // Method \"<init>\":([I)V\n 105: areturn\n\n public final Atom div(Atom);\n Code:\n 0: aload_1\n 1: ldc #142 // String other\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #21 // Field data:[I\n 10: aload_1\n 11: getfield #21 // Field data:[I\n 14: invokestatic #58 // Method kotlin/collections/ArraysKt.zip:([I[I)Ljava/util/List;\n 17: checkcast #60 // class java/lang/Iterable\n 20: astore_2\n 21: iconst_0\n 22: istore_3\n 23: aload_2\n 24: astore 4\n 26: new #62 // class java/util/ArrayList\n 29: dup\n 30: aload_2\n 31: bipush 10\n 33: invokestatic #68 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 36: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 39: checkcast #44 // class java/util/Collection\n 42: astore 5\n 44: iconst_0\n 45: istore 6\n 47: aload 4\n 49: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 54: astore 7\n 56: aload 7\n 58: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 63: ifeq 115\n 66: aload 7\n 68: invokeinterface #85, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 73: astore 8\n 75: aload 5\n 77: aload 8\n 79: checkcast #87 // class kotlin/Pair\n 82: astore 9\n 84: astore 11\n 86: iconst_0\n 87: istore 10\n 89: aload 9\n 91: invokestatic #148 // Method AtomKt.getA:(Lkotlin/Pair;)I\n 94: aload 9\n 96: invokestatic #151 // Method AtomKt.getB:(Lkotlin/Pair;)I\n 99: idiv\n 100: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 103: aload 11\n 105: swap\n 106: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 111: pop\n 112: goto 56\n 115: aload 5\n 117: checkcast #111 // class java/util/List\n 120: nop\n 121: checkcast #44 // class java/util/Collection\n 124: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 127: astore 12\n 129: new #2 // class Atom\n 132: dup\n 133: aload 12\n 135: invokespecial #50 // Method \"<init>\":([I)V\n 138: areturn\n\n public final Atom rem(int);\n Code:\n 0: aload_0\n 1: getfield #21 // Field data:[I\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #62 // class java/util/ArrayList\n 13: dup\n 14: aload_2\n 15: arraylength\n 16: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 19: checkcast #44 // class java/util/Collection\n 22: astore 5\n 24: iconst_0\n 25: istore 6\n 27: iconst_0\n 28: istore 7\n 30: aload 4\n 32: arraylength\n 33: istore 8\n 35: iload 7\n 37: iload 8\n 39: if_icmpge 82\n 42: aload 4\n 44: iload 7\n 46: iaload\n 47: istore 9\n 49: aload 5\n 51: iload 9\n 53: istore 10\n 55: astore 12\n 57: iconst_0\n 58: istore 11\n 60: iload 10\n 62: iload_1\n 63: irem\n 64: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 67: aload 12\n 69: swap\n 70: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 75: pop\n 76: iinc 7, 1\n 79: goto 35\n 82: aload 5\n 84: checkcast #111 // class java/util/List\n 87: nop\n 88: checkcast #44 // class java/util/Collection\n 91: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 94: astore 13\n 96: new #2 // class Atom\n 99: dup\n 100: aload 13\n 102: invokespecial #50 // Method \"<init>\":([I)V\n 105: areturn\n\n public final Atom rem(Atom);\n Code:\n 0: aload_1\n 1: ldc #142 // String other\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #21 // Field data:[I\n 10: aload_1\n 11: getfield #21 // Field data:[I\n 14: invokestatic #58 // Method kotlin/collections/ArraysKt.zip:([I[I)Ljava/util/List;\n 17: checkcast #60 // class java/lang/Iterable\n 20: astore_2\n 21: iconst_0\n 22: istore_3\n 23: aload_2\n 24: astore 4\n 26: new #62 // class java/util/ArrayList\n 29: dup\n 30: aload_2\n 31: bipush 10\n 33: invokestatic #68 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 36: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 39: checkcast #44 // class java/util/Collection\n 42: astore 5\n 44: iconst_0\n 45: istore 6\n 47: aload 4\n 49: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 54: astore 7\n 56: aload 7\n 58: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 63: ifeq 115\n 66: aload 7\n 68: invokeinterface #85, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 73: astore 8\n 75: aload 5\n 77: aload 8\n 79: checkcast #87 // class kotlin/Pair\n 82: astore 9\n 84: astore 11\n 86: iconst_0\n 87: istore 10\n 89: aload 9\n 91: invokestatic #148 // Method AtomKt.getA:(Lkotlin/Pair;)I\n 94: aload 9\n 96: invokestatic #151 // Method AtomKt.getB:(Lkotlin/Pair;)I\n 99: irem\n 100: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 103: aload 11\n 105: swap\n 106: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 111: pop\n 112: goto 56\n 115: aload 5\n 117: checkcast #111 // class java/util/List\n 120: nop\n 121: checkcast #44 // class java/util/Collection\n 124: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 127: astore 12\n 129: new #2 // class Atom\n 132: dup\n 133: aload 12\n 135: invokespecial #50 // Method \"<init>\":([I)V\n 138: areturn\n\n public final Atom rangeTo(int);\n Code:\n 0: ldc #167 // String Not specified yet\n 2: astore_2\n 3: new #169 // class kotlin/NotImplementedError\n 6: dup\n 7: new #171 // class java/lang/StringBuilder\n 10: dup\n 11: invokespecial #172 // Method java/lang/StringBuilder.\"<init>\":()V\n 14: ldc #174 // String An operation is not implemented:\n 16: invokevirtual #178 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 19: aload_2\n 20: invokevirtual #178 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 23: invokevirtual #180 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 26: invokespecial #183 // Method kotlin/NotImplementedError.\"<init>\":(Ljava/lang/String;)V\n 29: athrow\n\n public final Atom rangeTo(Atom);\n Code:\n 0: aload_1\n 1: ldc #142 // String other\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #167 // String Not specified yet\n 8: astore_2\n 9: new #169 // class kotlin/NotImplementedError\n 12: dup\n 13: new #171 // class java/lang/StringBuilder\n 16: dup\n 17: invokespecial #172 // Method java/lang/StringBuilder.\"<init>\":()V\n 20: ldc #174 // String An operation is not implemented:\n 22: invokevirtual #178 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 25: aload_2\n 26: invokevirtual #178 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 29: invokevirtual #180 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 32: invokespecial #183 // Method kotlin/NotImplementedError.\"<init>\":(Ljava/lang/String;)V\n 35: athrow\n\n public final Atom cumsum();\n Code:\n 0: iconst_0\n 1: istore_1\n 2: aload_0\n 3: getfield #21 // Field data:[I\n 6: astore_2\n 7: iconst_0\n 8: istore_3\n 9: aload_2\n 10: astore 4\n 12: new #62 // class java/util/ArrayList\n 15: dup\n 16: aload_2\n 17: arraylength\n 18: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 21: checkcast #44 // class java/util/Collection\n 24: astore 5\n 26: iconst_0\n 27: istore 6\n 29: iconst_0\n 30: istore 7\n 32: aload 4\n 34: arraylength\n 35: istore 8\n 37: iload 7\n 39: iload 8\n 41: if_icmpge 86\n 44: aload 4\n 46: iload 7\n 48: iaload\n 49: istore 9\n 51: aload 5\n 53: iload 9\n 55: istore 10\n 57: astore 12\n 59: iconst_0\n 60: istore 11\n 62: iload_1\n 63: iload 10\n 65: iadd\n 66: istore_1\n 67: iload_1\n 68: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 71: aload 12\n 73: swap\n 74: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 79: pop\n 80: iinc 7, 1\n 83: goto 37\n 86: aload 5\n 88: checkcast #111 // class java/util/List\n 91: nop\n 92: checkcast #44 // class java/util/Collection\n 95: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 98: astore 13\n 100: new #2 // class Atom\n 103: dup\n 104: aload 13\n 106: invokespecial #50 // Method \"<init>\":([I)V\n 109: areturn\n\n public final Atom repeat(int);\n Code:\n 0: aload_0\n 1: getfield #21 // Field data:[I\n 4: astore_2\n 5: iconst_0\n 6: istore_3\n 7: aload_2\n 8: astore 4\n 10: new #62 // class java/util/ArrayList\n 13: dup\n 14: invokespecial #189 // Method java/util/ArrayList.\"<init>\":()V\n 17: checkcast #44 // class java/util/Collection\n 20: astore 5\n 22: iconst_0\n 23: istore 6\n 25: iconst_0\n 26: istore 7\n 28: aload 4\n 30: arraylength\n 31: istore 8\n 33: iload 7\n 35: iload 8\n 37: if_icmpge 180\n 40: aload 4\n 42: iload 7\n 44: iaload\n 45: istore 9\n 47: iload 9\n 49: istore 10\n 51: iconst_0\n 52: istore 11\n 54: new #191 // class kotlin/ranges/IntRange\n 57: dup\n 58: iconst_1\n 59: iload_1\n 60: invokespecial #194 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 63: checkcast #60 // class java/lang/Iterable\n 66: astore 12\n 68: iconst_0\n 69: istore 13\n 71: aload 12\n 73: astore 14\n 75: new #62 // class java/util/ArrayList\n 78: dup\n 79: aload 12\n 81: bipush 10\n 83: invokestatic #68 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 86: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 89: checkcast #44 // class java/util/Collection\n 92: astore 15\n 94: iconst_0\n 95: istore 16\n 97: aload 14\n 99: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 104: astore 17\n 106: aload 17\n 108: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 113: ifeq 154\n 116: aload 17\n 118: checkcast #196 // class kotlin/collections/IntIterator\n 121: invokevirtual #199 // Method kotlin/collections/IntIterator.nextInt:()I\n 124: istore 18\n 126: aload 15\n 128: iload 18\n 130: istore 19\n 132: astore 20\n 134: iconst_0\n 135: istore 21\n 137: iload 10\n 139: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 142: aload 20\n 144: swap\n 145: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 150: pop\n 151: goto 106\n 154: aload 15\n 156: checkcast #111 // class java/util/List\n 159: nop\n 160: checkcast #60 // class java/lang/Iterable\n 163: nop\n 164: astore 10\n 166: aload 5\n 168: aload 10\n 170: invokestatic #203 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 173: pop\n 174: iinc 7, 1\n 177: goto 33\n 180: aload 5\n 182: checkcast #111 // class java/util/List\n 185: nop\n 186: checkcast #44 // class java/util/Collection\n 189: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 192: astore 22\n 194: new #2 // class Atom\n 197: dup\n 198: aload 22\n 200: invokespecial #50 // Method \"<init>\":([I)V\n 203: areturn\n\n public final Atom repeat(int[]);\n Code:\n 0: aload_1\n 1: ldc #215 // String counts\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: getfield #21 // Field data:[I\n 10: aload_1\n 11: invokestatic #58 // Method kotlin/collections/ArraysKt.zip:([I[I)Ljava/util/List;\n 14: checkcast #60 // class java/lang/Iterable\n 17: astore_2\n 18: iconst_0\n 19: istore_3\n 20: aload_2\n 21: astore 4\n 23: new #62 // class java/util/ArrayList\n 26: dup\n 27: invokespecial #189 // Method java/util/ArrayList.\"<init>\":()V\n 30: checkcast #44 // class java/util/Collection\n 33: astore 5\n 35: iconst_0\n 36: istore 6\n 38: aload 4\n 40: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 45: astore 7\n 47: aload 7\n 49: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 54: ifeq 226\n 57: aload 7\n 59: invokeinterface #85, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 64: astore 8\n 66: aload 8\n 68: checkcast #87 // class kotlin/Pair\n 71: astore 9\n 73: iconst_0\n 74: istore 10\n 76: aload 9\n 78: invokevirtual #90 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 81: checkcast #92 // class java/lang/Number\n 84: invokevirtual #96 // Method java/lang/Number.intValue:()I\n 87: istore 11\n 89: aload 9\n 91: invokevirtual #99 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 94: checkcast #92 // class java/lang/Number\n 97: invokevirtual #96 // Method java/lang/Number.intValue:()I\n 100: istore 12\n 102: new #191 // class kotlin/ranges/IntRange\n 105: dup\n 106: iconst_1\n 107: iload 12\n 109: invokespecial #194 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 112: checkcast #60 // class java/lang/Iterable\n 115: astore 13\n 117: iconst_0\n 118: istore 14\n 120: aload 13\n 122: astore 15\n 124: new #62 // class java/util/ArrayList\n 127: dup\n 128: aload 13\n 130: bipush 10\n 132: invokestatic #68 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 135: invokespecial #71 // Method java/util/ArrayList.\"<init>\":(I)V\n 138: checkcast #44 // class java/util/Collection\n 141: astore 16\n 143: iconst_0\n 144: istore 17\n 146: aload 15\n 148: invokeinterface #75, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 153: astore 18\n 155: aload 18\n 157: invokeinterface #81, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 162: ifeq 203\n 165: aload 18\n 167: checkcast #196 // class kotlin/collections/IntIterator\n 170: invokevirtual #199 // Method kotlin/collections/IntIterator.nextInt:()I\n 173: istore 19\n 175: aload 16\n 177: iload 19\n 179: istore 20\n 181: astore 21\n 183: iconst_0\n 184: istore 22\n 186: iload 11\n 188: invokestatic #132 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 191: aload 21\n 193: swap\n 194: invokeinterface #109, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 199: pop\n 200: goto 155\n 203: aload 16\n 205: checkcast #111 // class java/util/List\n 208: nop\n 209: checkcast #60 // class java/lang/Iterable\n 212: nop\n 213: astore 9\n 215: aload 5\n 217: aload 9\n 219: invokestatic #203 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 222: pop\n 223: goto 47\n 226: aload 5\n 228: checkcast #111 // class java/util/List\n 231: nop\n 232: checkcast #44 // class java/util/Collection\n 235: invokestatic #136 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I\n 238: astore 23\n 240: new #2 // class Atom\n 243: dup\n 244: aload 23\n 246: invokespecial #50 // Method \"<init>\":([I)V\n 249: areturn\n\n public final Atom repeat(Atom);\n Code:\n 0: aload_1\n 1: ldc #215 // String counts\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: getfield #21 // Field data:[I\n 11: invokevirtual #219 // Method repeat:([I)LAtom;\n 14: areturn\n}\n", "javap_err": "" } ]
NicLeenknegt__kenze_exercise__11081ce/src/main/kotlin/Main.kt
import java.io.File data class Matrix( val matrix:Array<ArrayList<String>>, var row:Int = 0, var column:Int = 0 ) fun main(args: Array<String>) { var words:Array<String> = splitStringByDelimiter(readFile("./input.txt"), "\n") printStringArray(words) var maxWordLength = words.map{ it:String -> it.length }.max() ?: 0 var maxWord = words.maxBy{ it:String -> it.length } println(maxWordLength) println(maxWord) var wordMatrix: Array<ArrayList<String>> = Array<ArrayList<String>>(maxWordLength) { arrayListOf() } //Counting sort for (word in words) { wordMatrix[word.length-1].add(word) } for (array in wordMatrix) { println("ARRAY") for (word in array) { println(word) } } var wordMatrixClass:Matrix = Matrix(wordMatrix) } fun readFile(filename:String):String = File(filename).inputStream().readBytes().toString(Charsets.UTF_8) fun splitStringByDelimiter(input:String, delimiter:String):Array<String> = input.split(delimiter).map { it -> it.trim()}.dropLast(1).toTypedArray() fun printStringArray(stringArray:Array<String>) { for (string in stringArray) { println(string) } } fun isSolutionValid(wordLength:Int, solutionLength:Int, solutionWord:String, referenceWord:String):Boolean = ((wordLength + solutionLength) <= referenceWord.length ) && referenceWord.startsWith(solutionWord) fun isSolutionComplete(referenceWord:String, solutionWord:String):Boolean = referenceWord == solutionWord fun buildMatchingWordArrayRec(wordMatrix:Matrix, solutionArrayList:ArrayList<String>, solutionLength:Int, solutionCalculation:String, solutionWord:String, referenceWord:String) { if (!isSolutionValid(wordMatrix.row, solutionLength, solutionWord, referenceWord)) { return } if (isSolutionComplete(referenceWord, solutionWord)) { println(solutionWord) solutionArrayList.add(solutionWord) } while (wordMatrix.row < wordMatrix.matrix.size) { while(wordMatrix.column < wordMatrix.matrix[wordMatrix.row].size) { //Add current word to word solution solutionWord.plus(wordMatrix.matrix[wordMatrix.row][wordMatrix.column]) //solutionLength is now equal to the original length + matrixRow buildMatchingWordArrayRec(wordMatrix, solutionArrayList, solutionLength + wordMatrix.row, solutionCalculation, solutionWord, referenceWord) wordMatrix.column + 1 } wordMatrix.row + 1 wordMatrix.column = 0 } }
[ { "class_path": "NicLeenknegt__kenze_exercise__11081ce/MainKt.class", "javap": "Compiled from \"Main.kt\"\npublic final class MainKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #17 // String ./input.txt\n 8: invokestatic #21 // Method readFile:(Ljava/lang/String;)Ljava/lang/String;\n 11: ldc #23 // String \\n\n 13: invokestatic #27 // Method splitStringByDelimiter:(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;\n 16: astore_1\n 17: aload_1\n 18: invokestatic #30 // Method printStringArray:([Ljava/lang/String;)V\n 21: aload_1\n 22: astore 4\n 24: iconst_0\n 25: istore 5\n 27: aload 4\n 29: astore 6\n 31: new #32 // class java/util/ArrayList\n 34: dup\n 35: aload 4\n 37: arraylength\n 38: invokespecial #36 // Method java/util/ArrayList.\"<init>\":(I)V\n 41: checkcast #38 // class java/util/Collection\n 44: astore 7\n 46: iconst_0\n 47: istore 8\n 49: iconst_0\n 50: istore 9\n 52: aload 6\n 54: arraylength\n 55: istore 10\n 57: iload 9\n 59: iload 10\n 61: if_icmpge 105\n 64: aload 6\n 66: iload 9\n 68: aaload\n 69: astore 11\n 71: aload 7\n 73: aload 11\n 75: astore 12\n 77: astore 14\n 79: iconst_0\n 80: istore 13\n 82: aload 12\n 84: invokevirtual #44 // Method java/lang/String.length:()I\n 87: invokestatic #50 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 90: aload 14\n 92: swap\n 93: invokeinterface #54, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 98: pop\n 99: iinc 9, 1\n 102: goto 57\n 105: aload 7\n 107: checkcast #56 // class java/util/List\n 110: nop\n 111: checkcast #58 // class java/lang/Iterable\n 114: invokestatic #64 // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 117: checkcast #66 // class java/lang/Number\n 120: invokevirtual #69 // Method java/lang/Number.intValue:()I\n 123: istore_2\n 124: aload_1\n 125: astore 4\n 127: iconst_0\n 128: istore 5\n 130: aload 4\n 132: arraylength\n 133: ifne 140\n 136: iconst_1\n 137: goto 141\n 140: iconst_0\n 141: ifeq 152\n 144: new #71 // class java/util/NoSuchElementException\n 147: dup\n 148: invokespecial #74 // Method java/util/NoSuchElementException.\"<init>\":()V\n 151: athrow\n 152: aload 4\n 154: iconst_0\n 155: aaload\n 156: astore 6\n 158: aload 4\n 160: invokestatic #80 // Method kotlin/collections/ArraysKt.getLastIndex:([Ljava/lang/Object;)I\n 163: istore 7\n 165: iload 7\n 167: ifne 175\n 170: aload 6\n 172: goto 250\n 175: aload 6\n 177: astore 8\n 179: iconst_0\n 180: istore 9\n 182: aload 8\n 184: invokevirtual #44 // Method java/lang/String.length:()I\n 187: istore 8\n 189: iconst_1\n 190: istore 9\n 192: iload 9\n 194: iload 7\n 196: if_icmpgt 248\n 199: aload 4\n 201: iload 9\n 203: aaload\n 204: astore 10\n 206: aload 10\n 208: astore 11\n 210: iconst_0\n 211: istore 12\n 213: aload 11\n 215: invokevirtual #44 // Method java/lang/String.length:()I\n 218: istore 11\n 220: iload 8\n 222: iload 11\n 224: if_icmpge 235\n 227: aload 10\n 229: astore 6\n 231: iload 11\n 233: istore 8\n 235: iload 9\n 237: iload 7\n 239: if_icmpeq 248\n 242: iinc 9, 1\n 245: goto 199\n 248: aload 6\n 250: astore_3\n 251: getstatic #86 // Field java/lang/System.out:Ljava/io/PrintStream;\n 254: iload_2\n 255: invokevirtual #91 // Method java/io/PrintStream.println:(I)V\n 258: getstatic #86 // Field java/lang/System.out:Ljava/io/PrintStream;\n 261: aload_3\n 262: invokevirtual #94 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 265: iconst_0\n 266: istore 5\n 268: iload_2\n 269: istore 6\n 271: iload 6\n 273: anewarray #32 // class java/util/ArrayList\n 276: astore 7\n 278: iload 5\n 280: iload 6\n 282: if_icmpge 307\n 285: iload 5\n 287: istore 8\n 289: aload 7\n 291: iload 8\n 293: new #32 // class java/util/ArrayList\n 296: dup\n 297: invokespecial #95 // Method java/util/ArrayList.\"<init>\":()V\n 300: aastore\n 301: iinc 5, 1\n 304: goto 278\n 307: aload 7\n 309: astore 4\n 311: aload_1\n 312: astore 5\n 314: iconst_0\n 315: istore 6\n 317: aload 5\n 319: arraylength\n 320: istore 7\n 322: iload 6\n 324: iload 7\n 326: if_icmpge 358\n 329: aload 5\n 331: iload 6\n 333: aaload\n 334: astore 8\n 336: aload 4\n 338: aload 8\n 340: invokevirtual #44 // Method java/lang/String.length:()I\n 343: iconst_1\n 344: isub\n 345: aaload\n 346: aload 8\n 348: invokevirtual #96 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 351: pop\n 352: iinc 6, 1\n 355: goto 322\n 358: aload 4\n 360: astore 5\n 362: iconst_0\n 363: istore 6\n 365: aload 5\n 367: arraylength\n 368: istore 7\n 370: iload 6\n 372: iload 7\n 374: if_icmpge 451\n 377: aload 5\n 379: iload 6\n 381: aaload\n 382: astore 8\n 384: ldc #98 // String ARRAY\n 386: getstatic #86 // Field java/lang/System.out:Ljava/io/PrintStream;\n 389: swap\n 390: invokevirtual #94 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 393: aload 8\n 395: invokevirtual #102 // Method java/util/ArrayList.iterator:()Ljava/util/Iterator;\n 398: dup\n 399: ldc #104 // String iterator(...)\n 401: invokestatic #107 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 404: astore 9\n 406: aload 9\n 408: invokeinterface #113, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 413: ifeq 445\n 416: aload 9\n 418: invokeinterface #117, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 423: dup\n 424: ldc #119 // String next(...)\n 426: invokestatic #107 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 429: checkcast #40 // class java/lang/String\n 432: astore 10\n 434: getstatic #86 // Field java/lang/System.out:Ljava/io/PrintStream;\n 437: aload 10\n 439: invokevirtual #94 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 442: goto 406\n 445: iinc 6, 1\n 448: goto 370\n 451: new #121 // class Matrix\n 454: dup\n 455: aload 4\n 457: iconst_0\n 458: iconst_0\n 459: bipush 6\n 461: aconst_null\n 462: invokespecial #124 // Method Matrix.\"<init>\":([Ljava/util/ArrayList;IIILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 465: astore 5\n 467: return\n\n public static final java.lang.String readFile(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #161 // String filename\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #40 // class java/lang/String\n 9: dup\n 10: new #163 // class java/io/FileInputStream\n 13: dup\n 14: new #165 // class java/io/File\n 17: dup\n 18: aload_0\n 19: invokespecial #168 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 22: invokespecial #171 // Method java/io/FileInputStream.\"<init>\":(Ljava/io/File;)V\n 25: checkcast #173 // class java/io/InputStream\n 28: invokestatic #179 // Method kotlin/io/ByteStreamsKt.readBytes:(Ljava/io/InputStream;)[B\n 31: getstatic #185 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;\n 34: invokespecial #188 // Method java/lang/String.\"<init>\":([BLjava/nio/charset/Charset;)V\n 37: areturn\n\n public static final java.lang.String[] splitStringByDelimiter(java.lang.String, java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #190 // String input\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #192 // String delimiter\n 9: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: checkcast #194 // class java/lang/CharSequence\n 16: iconst_1\n 17: anewarray #40 // class java/lang/String\n 20: astore_2\n 21: aload_2\n 22: iconst_0\n 23: aload_1\n 24: aastore\n 25: aload_2\n 26: iconst_0\n 27: iconst_0\n 28: bipush 6\n 30: aconst_null\n 31: invokestatic #200 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 34: checkcast #58 // class java/lang/Iterable\n 37: astore_2\n 38: iconst_0\n 39: istore_3\n 40: aload_2\n 41: astore 4\n 43: new #32 // class java/util/ArrayList\n 46: dup\n 47: aload_2\n 48: bipush 10\n 50: invokestatic #204 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 53: invokespecial #36 // Method java/util/ArrayList.\"<init>\":(I)V\n 56: checkcast #38 // class java/util/Collection\n 59: astore 5\n 61: iconst_0\n 62: istore 6\n 64: aload 4\n 66: invokeinterface #205, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 71: astore 7\n 73: aload 7\n 75: invokeinterface #113, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 80: ifeq 130\n 83: aload 7\n 85: invokeinterface #117, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 90: astore 8\n 92: aload 5\n 94: aload 8\n 96: checkcast #40 // class java/lang/String\n 99: astore 9\n 101: astore 11\n 103: iconst_0\n 104: istore 10\n 106: aload 9\n 108: checkcast #194 // class java/lang/CharSequence\n 111: invokestatic #209 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 114: invokevirtual #213 // Method java/lang/Object.toString:()Ljava/lang/String;\n 117: nop\n 118: aload 11\n 120: swap\n 121: invokeinterface #54, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 126: pop\n 127: goto 73\n 130: aload 5\n 132: checkcast #56 // class java/util/List\n 135: nop\n 136: iconst_1\n 137: invokestatic #217 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;\n 140: checkcast #38 // class java/util/Collection\n 143: astore_2\n 144: iconst_0\n 145: istore_3\n 146: aload_2\n 147: astore 4\n 149: aload 4\n 151: iconst_0\n 152: anewarray #40 // class java/lang/String\n 155: invokeinterface #221, 2 // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;\n 160: checkcast #158 // class \"[Ljava/lang/String;\"\n 163: areturn\n\n public static final void printStringArray(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #228 // String stringArray\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: aload_0\n 9: arraylength\n 10: istore_2\n 11: iload_1\n 12: iload_2\n 13: if_icmpge 33\n 16: aload_0\n 17: iload_1\n 18: aaload\n 19: astore_3\n 20: getstatic #86 // Field java/lang/System.out:Ljava/io/PrintStream;\n 23: aload_3\n 24: invokevirtual #94 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 27: iinc 1, 1\n 30: goto 11\n 33: return\n\n public static final boolean isSolutionValid(int, int, java.lang.String, java.lang.String);\n Code:\n 0: aload_2\n 1: ldc #233 // String solutionWord\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_3\n 7: ldc #235 // String referenceWord\n 9: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: iload_0\n 13: iload_1\n 14: iadd\n 15: aload_3\n 16: invokevirtual #44 // Method java/lang/String.length:()I\n 19: if_icmpgt 37\n 22: aload_3\n 23: aload_2\n 24: iconst_0\n 25: iconst_2\n 26: aconst_null\n 27: invokestatic #239 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 30: ifeq 37\n 33: iconst_1\n 34: goto 38\n 37: iconst_0\n 38: ireturn\n\n public static final boolean isSolutionComplete(java.lang.String, java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #235 // String referenceWord\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #233 // String solutionWord\n 9: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: aload_1\n 14: invokestatic #247 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 17: ireturn\n\n public static final void buildMatchingWordArrayRec(Matrix, java.util.ArrayList<java.lang.String>, int, java.lang.String, java.lang.String, java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #251 // String wordMatrix\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #253 // String solutionArrayList\n 9: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_3\n 13: ldc #255 // String solutionCalculation\n 15: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 18: aload 4\n 20: ldc #233 // String solutionWord\n 22: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 25: aload 5\n 27: ldc #235 // String referenceWord\n 29: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 32: aload_0\n 33: invokevirtual #258 // Method Matrix.getRow:()I\n 36: iload_2\n 37: aload 4\n 39: aload 5\n 41: invokestatic #260 // Method isSolutionValid:(IILjava/lang/String;Ljava/lang/String;)Z\n 44: ifne 48\n 47: return\n 48: aload 5\n 50: aload 4\n 52: invokestatic #262 // Method isSolutionComplete:(Ljava/lang/String;Ljava/lang/String;)Z\n 55: ifeq 73\n 58: getstatic #86 // Field java/lang/System.out:Ljava/io/PrintStream;\n 61: aload 4\n 63: invokevirtual #94 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 66: aload_1\n 67: aload 4\n 69: invokevirtual #96 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 72: pop\n 73: aload_0\n 74: invokevirtual #258 // Method Matrix.getRow:()I\n 77: aload_0\n 78: invokevirtual #266 // Method Matrix.getMatrix:()[Ljava/util/ArrayList;\n 81: arraylength\n 82: if_icmpge 183\n 85: aload_0\n 86: invokevirtual #269 // Method Matrix.getColumn:()I\n 89: aload_0\n 90: invokevirtual #266 // Method Matrix.getMatrix:()[Ljava/util/ArrayList;\n 93: aload_0\n 94: invokevirtual #258 // Method Matrix.getRow:()I\n 97: aaload\n 98: invokevirtual #272 // Method java/util/ArrayList.size:()I\n 101: if_icmpge 168\n 104: new #274 // class java/lang/StringBuilder\n 107: dup\n 108: invokespecial #275 // Method java/lang/StringBuilder.\"<init>\":()V\n 111: aload 4\n 113: invokevirtual #279 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 116: aload_0\n 117: invokevirtual #266 // Method Matrix.getMatrix:()[Ljava/util/ArrayList;\n 120: aload_0\n 121: invokevirtual #258 // Method Matrix.getRow:()I\n 124: aaload\n 125: aload_0\n 126: invokevirtual #269 // Method Matrix.getColumn:()I\n 129: invokevirtual #283 // Method java/util/ArrayList.get:(I)Ljava/lang/Object;\n 132: checkcast #40 // class java/lang/String\n 135: invokevirtual #279 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 138: invokevirtual #284 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 141: pop\n 142: aload_0\n 143: aload_1\n 144: iload_2\n 145: aload_0\n 146: invokevirtual #258 // Method Matrix.getRow:()I\n 149: iadd\n 150: aload_3\n 151: aload 4\n 153: aload 5\n 155: invokestatic #286 // Method buildMatchingWordArrayRec:(LMatrix;Ljava/util/ArrayList;ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V\n 158: aload_0\n 159: invokevirtual #269 // Method Matrix.getColumn:()I\n 162: iconst_1\n 163: iadd\n 164: pop\n 165: goto 85\n 168: aload_0\n 169: invokevirtual #258 // Method Matrix.getRow:()I\n 172: iconst_1\n 173: iadd\n 174: pop\n 175: aload_0\n 176: iconst_0\n 177: invokevirtual #289 // Method Matrix.setColumn:(I)V\n 180: goto 73\n 183: return\n}\n", "javap_err": "" } ]
gardnerdickson__advent-of-code-2015__4a23ab3/src/day_2.kt
import java.io.File import kotlin.streams.toList fun main(args: Array<String>) { val input = "res/day_2_input.txt" val answer1 = Day2.part1(input) println("Part 1: $answer1") val answer2 = Day2.part2(input) println("Part 2: $answer2") } object Day2 { fun part1(input: String): Int { val reader = File(input).bufferedReader() val amounts = reader.lines() .map { parsePresent(it) } .map { it.surfaceArea() + it.slack() } .toList() return amounts.sum() } fun part2(input: String): Int { val reader = File(input).bufferedReader() val amounts = reader.lines() .map { parsePresent(it) } .map { it.ribbon() + it.bow() } .toList() return amounts.sum() } private fun parsePresent(dimensions: String): Present { val components = dimensions.split("x") return Present(components[0].toInt(), components[1].toInt(), components[2].toInt()) } } data class Present(val width: Int, val height: Int, val length: Int) { fun surfaceArea(): Int { return 2 * length * width + 2 * width * height + 2 * height * length } fun slack(): Int { val sorted = listOf(width, height, length).sorted() return sorted[0] * sorted[1] } fun ribbon(): Int { val sorted = listOf(width, height, length).sorted() return sorted[0] * 2 + sorted[1] * 2 } fun bow(): Int { return width * height * length } }
[ { "class_path": "gardnerdickson__advent-of-code-2015__4a23ab3/Day_2Kt.class", "javap": "Compiled from \"day_2.kt\"\npublic final class Day_2Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #17 // String res/day_2_input.txt\n 8: astore_1\n 9: getstatic #23 // Field Day2.INSTANCE:LDay2;\n 12: aload_1\n 13: invokevirtual #27 // Method Day2.part1:(Ljava/lang/String;)I\n 16: istore_2\n 17: new #29 // class java/lang/StringBuilder\n 20: dup\n 21: invokespecial #33 // Method java/lang/StringBuilder.\"<init>\":()V\n 24: ldc #35 // String Part 1:\n 26: invokevirtual #39 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 29: iload_2\n 30: invokevirtual #42 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 33: invokevirtual #46 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 36: getstatic #52 // Field java/lang/System.out:Ljava/io/PrintStream;\n 39: swap\n 40: invokevirtual #58 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 43: getstatic #23 // Field Day2.INSTANCE:LDay2;\n 46: aload_1\n 47: invokevirtual #61 // Method Day2.part2:(Ljava/lang/String;)I\n 50: istore_3\n 51: new #29 // class java/lang/StringBuilder\n 54: dup\n 55: invokespecial #33 // Method java/lang/StringBuilder.\"<init>\":()V\n 58: ldc #63 // String Part 2:\n 60: invokevirtual #39 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 63: iload_3\n 64: invokevirtual #42 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 67: invokevirtual #46 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 70: getstatic #52 // Field java/lang/System.out:Ljava/io/PrintStream;\n 73: swap\n 74: invokevirtual #58 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 77: return\n}\n", "javap_err": "" } ]
gardnerdickson__advent-of-code-2015__4a23ab3/src/day_3.kt
import java.io.File fun main(args: Array<String>) { val input = "res/day_3_input.txt" val answer1 = Day3.part1(input) println("Part 1: $answer1") val answer2 = Day3.part2(input) println("Part 2: $answer2") } object Day3 { private enum class Turn { SANTA, ROBO_SANTA; fun nextTurn(): Turn { return when (this) { Turn.SANTA -> Turn.ROBO_SANTA else -> Turn.SANTA } } } fun part1(input: String): Int { val directions = File(input).readText().toCharArray() var currentPosition = Position(0, 0) val positions = mutableSetOf<Position>() positions.add(currentPosition) for (direction in directions) { val nextPosition = currentPosition.move(direction) positions.add(nextPosition) currentPosition = nextPosition } return positions.size } fun part2(input: String): Int { val directions = File(input).readText().toCharArray() var currentSantaPosition = Position(0, 0) var currentRoboSantaPosition = Position(0, 0) val positions = mutableSetOf<Position>() positions.add(currentSantaPosition) var turn = Turn.SANTA for (direction in directions) { when (turn) { Turn.SANTA -> { val nextPosition = currentSantaPosition.move(direction) positions.add(nextPosition) currentSantaPosition = nextPosition } Turn.ROBO_SANTA -> { val nextPosition = currentRoboSantaPosition.move(direction) positions.add(nextPosition) currentRoboSantaPosition = nextPosition } } turn = turn.nextTurn() } return positions.size } } data class Position(val x: Int, val y: Int) { fun move(direction: Char): Position { return when (direction) { '^' -> Position(this.x, this.y + 1) '>' -> Position(this.x + 1, this.y) 'v' -> Position(this.x, this.y - 1) '<' -> Position(this.x - 1, this.y) else -> throw IllegalArgumentException("Input contained invalid character: $direction") } } }
[ { "class_path": "gardnerdickson__advent-of-code-2015__4a23ab3/Day_3Kt.class", "javap": "Compiled from \"day_3.kt\"\npublic final class Day_3Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #17 // String res/day_3_input.txt\n 8: astore_1\n 9: getstatic #23 // Field Day3.INSTANCE:LDay3;\n 12: aload_1\n 13: invokevirtual #27 // Method Day3.part1:(Ljava/lang/String;)I\n 16: istore_2\n 17: new #29 // class java/lang/StringBuilder\n 20: dup\n 21: invokespecial #33 // Method java/lang/StringBuilder.\"<init>\":()V\n 24: ldc #35 // String Part 1:\n 26: invokevirtual #39 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 29: iload_2\n 30: invokevirtual #42 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 33: invokevirtual #46 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 36: getstatic #52 // Field java/lang/System.out:Ljava/io/PrintStream;\n 39: swap\n 40: invokevirtual #58 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 43: getstatic #23 // Field Day3.INSTANCE:LDay3;\n 46: aload_1\n 47: invokevirtual #61 // Method Day3.part2:(Ljava/lang/String;)I\n 50: istore_3\n 51: new #29 // class java/lang/StringBuilder\n 54: dup\n 55: invokespecial #33 // Method java/lang/StringBuilder.\"<init>\":()V\n 58: ldc #63 // String Part 2:\n 60: invokevirtual #39 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 63: iload_3\n 64: invokevirtual #42 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 67: invokevirtual #46 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 70: getstatic #52 // Field java/lang/System.out:Ljava/io/PrintStream;\n 73: swap\n 74: invokevirtual #58 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 77: return\n}\n", "javap_err": "" } ]
gardnerdickson__advent-of-code-2015__4a23ab3/src/day_10.kt
import java.lang.StringBuilder fun main(args: Array<String>) { val input = "1113222113" val answer1 = Day10.part1(input) println("Part 1: $answer1") val answer2 = Day10.part2(input) println("Part 2: $answer2") } object Day10 { private fun lookAndSay(sequence: String): String { val digits = sequence.toCharArray().map { Character.getNumericValue(it) } val stringBuilder = StringBuilder() var lastDigit = -1 var currentDigit: Int var quantity = 0 for (i in 0 until digits.size) { currentDigit = digits[i] if (i == digits.size - 1) { if (currentDigit != lastDigit) { stringBuilder.append("$quantity$lastDigit") stringBuilder.append("1$currentDigit") } else { stringBuilder.append("${(quantity + 1)}$lastDigit") } } else if (currentDigit != lastDigit && lastDigit != -1) { stringBuilder.append("$quantity$lastDigit") quantity = 1 } else { quantity++ } lastDigit = currentDigit } return stringBuilder.toString() } fun part1(sequence: String): Int { var nextSequence = sequence repeat(40) { nextSequence = lookAndSay(nextSequence) } return nextSequence.length } fun part2(sequence: String): Int { var nextSequence = sequence repeat(50) { nextSequence = lookAndSay(nextSequence) } return nextSequence.length } }
[ { "class_path": "gardnerdickson__advent-of-code-2015__4a23ab3/Day_10Kt.class", "javap": "Compiled from \"day_10.kt\"\npublic final class Day_10Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #17 // String 1113222113\n 8: astore_1\n 9: getstatic #23 // Field Day10.INSTANCE:LDay10;\n 12: aload_1\n 13: invokevirtual #27 // Method Day10.part1:(Ljava/lang/String;)I\n 16: istore_2\n 17: new #29 // class java/lang/StringBuilder\n 20: dup\n 21: invokespecial #33 // Method java/lang/StringBuilder.\"<init>\":()V\n 24: ldc #35 // String Part 1:\n 26: invokevirtual #39 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 29: iload_2\n 30: invokevirtual #42 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 33: invokevirtual #46 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 36: getstatic #52 // Field java/lang/System.out:Ljava/io/PrintStream;\n 39: swap\n 40: invokevirtual #58 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 43: getstatic #23 // Field Day10.INSTANCE:LDay10;\n 46: aload_1\n 47: invokevirtual #61 // Method Day10.part2:(Ljava/lang/String;)I\n 50: istore_3\n 51: new #29 // class java/lang/StringBuilder\n 54: dup\n 55: invokespecial #33 // Method java/lang/StringBuilder.\"<init>\":()V\n 58: ldc #63 // String Part 2:\n 60: invokevirtual #39 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 63: iload_3\n 64: invokevirtual #42 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 67: invokevirtual #46 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 70: getstatic #52 // Field java/lang/System.out:Ljava/io/PrintStream;\n 73: swap\n 74: invokevirtual #58 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 77: return\n}\n", "javap_err": "" } ]
gardnerdickson__advent-of-code-2015__4a23ab3/src/day_7.kt
import java.io.File import java.util.regex.Matcher fun main(args: Array<String>) { val filename = "res/day_7_input.txt" val answer1 = Day7.part1(File(filename)) println("Part 1: $answer1") val answer2 = Day7.part2(File(filename), answer1) println("Part 2: $answer2") } object Day7 { fun part1(file: File): Int { val wires = mutableMapOf<String, Gate>() file.useLines { lines -> lines.map { Gate.parse(it) }.forEach { wires[it.target] = it } } return wires["a"]!!.evaluate(wires) } fun part2(file: File, a: Int): Int { val wires = mutableMapOf<String, Gate>() file.useLines { lines -> lines.map { Gate.parse(it) }.forEach { wires[it.target] = it } } wires["b"]!!.wireValue = a return wires["a"]!!.evaluate(wires) } } sealed class Gate(val target: String) { companion object { private val andRegex = Regex("(?<left>[\\w\\d]+) AND (?<right>[\\w\\d]+) -> (?<target>\\w+)").toPattern() private val orRegex = Regex("(?<left>[\\w\\d]+) OR (?<right>[\\w\\d]+) -> (?<target>\\w+)").toPattern() private val lshiftRegex = Regex("(?<left>[\\w\\d]+) LSHIFT (?<right>[\\d]+) -> (?<target>\\w+)").toPattern() private val rshiftRegex = Regex("(?<left>[\\w\\d]+) RSHIFT (?<right>[\\d]+) -> (?<target>\\w+)").toPattern() private val notRegex = Regex("NOT (?<source>[\\w]+) -> (?<target>\\w+)").toPattern() private val signalRegex = Regex("(?<source>[\\w\\d]+) -> (?<target>\\w+)").toPattern() operator fun Matcher.get(name: String): String { return this.group(name) } fun parse(instruction: String): Gate { var matcher = andRegex.matcher(instruction) if (matcher.matches()) { return AndGate(matcher["left"], matcher["right"], matcher["target"]) } matcher = orRegex.matcher(instruction) if (matcher.matches()) { return OrGate(matcher["left"], matcher["right"], matcher["target"]) } matcher = lshiftRegex.matcher(instruction) if (matcher.matches()) { return LshiftGate(matcher["left"], matcher["right"].toInt(), matcher["target"]) } matcher = rshiftRegex.matcher(instruction) if (matcher.matches()) { return RshiftGate(matcher["left"], matcher["right"].toInt(), matcher["target"]) } matcher = notRegex.matcher(instruction) if (matcher.matches()) { return NotGate(matcher["source"], matcher["target"]) } matcher = signalRegex.matcher(instruction) if (matcher.matches()) { return SignalGate(matcher["source"], matcher["target"]) } throw IllegalArgumentException("Instruction '$instruction' could not be parsed") } } var wireValue: Int? = null abstract fun evaluate(wires: Map<String, Gate>): Int } class AndGate(private val left: String, private val right: String, target: String) : Gate(target) { override fun evaluate(wires: Map<String, Gate>): Int { if (wireValue == null) { wireValue = (left.toIntOrNull() ?: wires[left]!!.evaluate(wires)) and (right.toIntOrNull() ?: wires[right]!!.evaluate(wires)) } return wireValue!!.toInt() } } class OrGate(private val left: String, private val right: String, target: String) : Gate(target) { override fun evaluate(wires: Map<String, Gate>): Int { if (wireValue == null) { wireValue = (left.toIntOrNull() ?: wires[left]!!.evaluate(wires)) or (right.toIntOrNull() ?: wires[right]!!.evaluate(wires)) } return wireValue!!.toInt() } } class LshiftGate(private val left: String, private val right: Int, target: String) : Gate(target) { override fun evaluate(wires: Map<String, Gate>): Int { if (wireValue == null) { wireValue = (left.toIntOrNull() ?: wires[left]!!.evaluate(wires)) shl right } return wireValue!!.toInt() } } class RshiftGate(private val left: String, private val right: Int, target: String) : Gate(target) { override fun evaluate(wires: Map<String, Gate>): Int { if (wireValue == null) { wireValue = (left.toIntOrNull() ?: wires[left]!!.evaluate(wires)) shr right } return wireValue!!.toInt(); } } class NotGate(private val source: String, target: String) : Gate(target) { override fun evaluate(wires: Map<String, Gate>): Int { if (wireValue == null) { wireValue = (source.toIntOrNull() ?: wires[source]!!.evaluate(wires)).inv() } return wireValue!!.toInt() } } class SignalGate(private val source: String, target: String) : Gate(target) { override fun evaluate(wires: Map<String, Gate>): Int { if (wireValue == null) { wireValue = source.toIntOrNull() ?: wires[source]!!.evaluate(wires) } return wireValue!!.toInt() } }
[ { "class_path": "gardnerdickson__advent-of-code-2015__4a23ab3/Day_7Kt.class", "javap": "Compiled from \"day_7.kt\"\npublic final class Day_7Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #17 // String res/day_7_input.txt\n 8: astore_1\n 9: getstatic #23 // Field Day7.INSTANCE:LDay7;\n 12: new #25 // class java/io/File\n 15: dup\n 16: aload_1\n 17: invokespecial #29 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 20: invokevirtual #33 // Method Day7.part1:(Ljava/io/File;)I\n 23: istore_2\n 24: new #35 // class java/lang/StringBuilder\n 27: dup\n 28: invokespecial #38 // Method java/lang/StringBuilder.\"<init>\":()V\n 31: ldc #40 // String Part 1:\n 33: invokevirtual #44 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 36: iload_2\n 37: invokevirtual #47 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 40: invokevirtual #51 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 43: getstatic #57 // Field java/lang/System.out:Ljava/io/PrintStream;\n 46: swap\n 47: invokevirtual #63 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 50: getstatic #23 // Field Day7.INSTANCE:LDay7;\n 53: new #25 // class java/io/File\n 56: dup\n 57: aload_1\n 58: invokespecial #29 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 61: iload_2\n 62: invokevirtual #67 // Method Day7.part2:(Ljava/io/File;I)I\n 65: istore_3\n 66: new #35 // class java/lang/StringBuilder\n 69: dup\n 70: invokespecial #38 // Method java/lang/StringBuilder.\"<init>\":()V\n 73: ldc #69 // String Part 2:\n 75: invokevirtual #44 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 78: iload_3\n 79: invokevirtual #47 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 82: invokevirtual #51 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 85: getstatic #57 // Field java/lang/System.out:Ljava/io/PrintStream;\n 88: swap\n 89: invokevirtual #63 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 92: return\n}\n", "javap_err": "" } ]
darian-catalin-cucer__maximum-matching__db6b2b8/kt.kt
import java.util.* fun maxMatching(n: Int, graph: Array<MutableList<Int>>): Int { val matching = IntArray(n) { -1 } val seen = BooleanArray(n) fun dfs(i: Int): Boolean { seen[i].also { seen[i] = true } graph[i].forEach { j -> if (matching[j] == -1 || (!seen[matching[j]] && dfs(matching[j]))) { matching[j] = i return true } } return false } var matches = 0 (0 until n).forEach { i -> if (dfs(i)) { matches++ } seen.fill(false) } return matches } // The code above implements the Hopcroft-Karp algorithm for finding the maximum matching in a bipartite graph. The algorithm starts by initializing the matching array to -1, which represents the fact that no node has been matched yet. The function dfs(i) attempts to find an augmenting path starting from node i, and updates the matching array if it succeeds. The maxMatching function loops over all nodes in one side of the bipartite graph, calling dfs on each node and incrementing the matches counter if a match is found. This process continues until no more augmenting paths can be found. The final value of matches is the size of the maximum matching in the bipartite graph.
[ { "class_path": "darian-catalin-cucer__maximum-matching__db6b2b8/KtKt.class", "javap": "Compiled from \"kt.kt\"\npublic final class KtKt {\n public static final int maxMatching(int, java.util.List<java.lang.Integer>[]);\n Code:\n 0: aload_1\n 1: ldc #10 // String graph\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_3\n 8: iload_0\n 9: newarray int\n 11: astore 4\n 13: iload_3\n 14: iload_0\n 15: if_icmpge 33\n 18: iload_3\n 19: istore 5\n 21: aload 4\n 23: iload 5\n 25: iconst_m1\n 26: iastore\n 27: iinc 3, 1\n 30: goto 13\n 33: aload 4\n 35: astore_2\n 36: iload_0\n 37: newarray boolean\n 39: astore_3\n 40: iconst_0\n 41: istore 4\n 43: iconst_0\n 44: iload_0\n 45: invokestatic #22 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 48: checkcast #24 // class java/lang/Iterable\n 51: astore 5\n 53: iconst_0\n 54: istore 6\n 56: aload 5\n 58: invokeinterface #28, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 63: astore 7\n 65: aload 7\n 67: invokeinterface #34, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 72: ifeq 124\n 75: aload 7\n 77: checkcast #36 // class kotlin/collections/IntIterator\n 80: invokevirtual #40 // Method kotlin/collections/IntIterator.nextInt:()I\n 83: istore 8\n 85: iload 8\n 87: istore 9\n 89: iconst_0\n 90: istore 10\n 92: aload_3\n 93: aload_1\n 94: aload_2\n 95: iload 9\n 97: invokestatic #44 // Method maxMatching$dfs:([Z[Ljava/util/List;[II)Z\n 100: ifeq 109\n 103: iload 4\n 105: iconst_1\n 106: iadd\n 107: istore 4\n 109: aload_3\n 110: iconst_0\n 111: iconst_0\n 112: iconst_0\n 113: bipush 6\n 115: aconst_null\n 116: invokestatic #50 // Method kotlin/collections/ArraysKt.fill$default:([ZZIIILjava/lang/Object;)V\n 119: nop\n 120: nop\n 121: goto 65\n 124: nop\n 125: iload 4\n 127: ireturn\n\n private static final boolean maxMatching$dfs(boolean[], java.util.List<java.lang.Integer>[], int[], int);\n Code:\n 0: aload_0\n 1: iload_3\n 2: baload\n 3: istore 4\n 5: iload 4\n 7: istore 5\n 9: iconst_0\n 10: istore 6\n 12: aload_0\n 13: iload_3\n 14: iconst_1\n 15: bastore\n 16: nop\n 17: aload_1\n 18: iload_3\n 19: aaload\n 20: checkcast #24 // class java/lang/Iterable\n 23: astore 4\n 25: iconst_0\n 26: istore 5\n 28: aload 4\n 30: invokeinterface #28, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 35: astore 6\n 37: aload 6\n 39: invokeinterface #34, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 44: ifeq 111\n 47: aload 6\n 49: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 54: astore 7\n 56: aload 7\n 58: checkcast #74 // class java/lang/Number\n 61: invokevirtual #77 // Method java/lang/Number.intValue:()I\n 64: istore 8\n 66: iconst_0\n 67: istore 9\n 69: aload_2\n 70: iload 8\n 72: iaload\n 73: iconst_m1\n 74: if_icmpeq 99\n 77: aload_0\n 78: aload_2\n 79: iload 8\n 81: iaload\n 82: baload\n 83: ifne 106\n 86: aload_0\n 87: aload_1\n 88: aload_2\n 89: aload_2\n 90: iload 8\n 92: iaload\n 93: invokestatic #44 // Method maxMatching$dfs:([Z[Ljava/util/List;[II)Z\n 96: ifeq 106\n 99: aload_2\n 100: iload 8\n 102: iload_3\n 103: iastore\n 104: iconst_1\n 105: ireturn\n 106: nop\n 107: nop\n 108: goto 37\n 111: nop\n 112: iconst_0\n 113: ireturn\n}\n", "javap_err": "" } ]
luluvia__advent-of-code-22__29ddde3/src/main/kotlin/Day03.kt
class Day03 { fun part1(input: List<String>): Int { var priorityScore = 0 for (line in input) { val matchingChar = getMatchingChar(line) priorityScore += getPriorityScore(matchingChar) } return priorityScore } fun part2(input: List<String>): Int { var priorityScore = 0 for (lines in input.chunked(3)) { priorityScore += getPriorityScore(getMatchingCharThreeLines(lines)) } return priorityScore } // Get char that matches across three lines private fun getMatchingCharThreeLines(lines: List<String>): Char { for (char in lines[0]) { if (lines[1].contains(char) && lines[2].contains(char)) { return char } } throw IllegalArgumentException("Lines do not contain matching char") } private fun getMatchingChar(line: String): Char { val firstRucksackRange = IntRange(0, line.length/2 - 1) val secondRucksackRange = IntRange(line.length/2, line.length - 1) for (char in line.substring(firstRucksackRange)) { if (char in line.substring(secondRucksackRange)) { return char } } throw IllegalArgumentException("Line does not contain matching character") } private fun getPriorityScore(matchingChar: Char): Int { return if (matchingChar.isLowerCase()) { matchingChar.code - 96 } else { matchingChar.code - 38 } } }
[ { "class_path": "luluvia__advent-of-code-22__29ddde3/Day03.class", "javap": "Compiled from \"Day03.kt\"\npublic final class Day03 {\n public Day03();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #16 // String input\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: aload_1\n 9: invokeinterface #28, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 14: astore_3\n 15: aload_3\n 16: invokeinterface #34, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 21: ifeq 55\n 24: aload_3\n 25: invokeinterface #38, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 30: checkcast #40 // class java/lang/String\n 33: astore 4\n 35: aload_0\n 36: aload 4\n 38: invokespecial #44 // Method getMatchingChar:(Ljava/lang/String;)C\n 41: istore 5\n 43: iload_2\n 44: aload_0\n 45: iload 5\n 47: invokespecial #48 // Method getPriorityScore:(C)I\n 50: iadd\n 51: istore_2\n 52: goto 15\n 55: iload_2\n 56: ireturn\n\n public final int part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #16 // String input\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: aload_1\n 9: checkcast #58 // class java/lang/Iterable\n 12: iconst_3\n 13: invokestatic #64 // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;\n 16: invokeinterface #28, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 21: astore_3\n 22: aload_3\n 23: invokeinterface #34, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 28: ifeq 58\n 31: aload_3\n 32: invokeinterface #38, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 37: checkcast #24 // class java/util/List\n 40: astore 4\n 42: iload_2\n 43: aload_0\n 44: aload_0\n 45: aload 4\n 47: invokespecial #68 // Method getMatchingCharThreeLines:(Ljava/util/List;)C\n 50: invokespecial #48 // Method getPriorityScore:(C)I\n 53: iadd\n 54: istore_2\n 55: goto 22\n 58: iload_2\n 59: ireturn\n\n private final char getMatchingCharThreeLines(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: iconst_0\n 2: invokeinterface #74, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 7: checkcast #40 // class java/lang/String\n 10: astore_2\n 11: iconst_0\n 12: istore_3\n 13: aload_2\n 14: invokevirtual #78 // Method java/lang/String.length:()I\n 17: istore 4\n 19: iload_3\n 20: iload 4\n 22: if_icmpge 83\n 25: aload_2\n 26: iload_3\n 27: invokevirtual #82 // Method java/lang/String.charAt:(I)C\n 30: istore 5\n 32: aload_1\n 33: iconst_1\n 34: invokeinterface #74, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 39: checkcast #84 // class java/lang/CharSequence\n 42: iload 5\n 44: iconst_0\n 45: iconst_2\n 46: aconst_null\n 47: invokestatic #90 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z\n 50: ifeq 77\n 53: aload_1\n 54: iconst_2\n 55: invokeinterface #74, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 60: checkcast #84 // class java/lang/CharSequence\n 63: iload 5\n 65: iconst_0\n 66: iconst_2\n 67: aconst_null\n 68: invokestatic #90 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z\n 71: ifeq 77\n 74: iload 5\n 76: ireturn\n 77: iinc 3, 1\n 80: goto 19\n 83: new #92 // class java/lang/IllegalArgumentException\n 86: dup\n 87: ldc #94 // String Lines do not contain matching char\n 89: invokespecial #97 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 92: athrow\n\n private final char getMatchingChar(java.lang.String);\n Code:\n 0: new #100 // class kotlin/ranges/IntRange\n 3: dup\n 4: iconst_0\n 5: aload_1\n 6: invokevirtual #78 // Method java/lang/String.length:()I\n 9: iconst_2\n 10: idiv\n 11: iconst_1\n 12: isub\n 13: invokespecial #103 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 16: astore_2\n 17: new #100 // class kotlin/ranges/IntRange\n 20: dup\n 21: aload_1\n 22: invokevirtual #78 // Method java/lang/String.length:()I\n 25: iconst_2\n 26: idiv\n 27: aload_1\n 28: invokevirtual #78 // Method java/lang/String.length:()I\n 31: iconst_1\n 32: isub\n 33: invokespecial #103 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 36: astore_3\n 37: aload_1\n 38: aload_2\n 39: invokestatic #107 // Method kotlin/text/StringsKt.substring:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;\n 42: astore 4\n 44: iconst_0\n 45: istore 5\n 47: aload 4\n 49: invokevirtual #78 // Method java/lang/String.length:()I\n 52: istore 6\n 54: iload 5\n 56: iload 6\n 58: if_icmpge 98\n 61: aload 4\n 63: iload 5\n 65: invokevirtual #82 // Method java/lang/String.charAt:(I)C\n 68: istore 7\n 70: aload_1\n 71: aload_3\n 72: invokestatic #107 // Method kotlin/text/StringsKt.substring:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;\n 75: checkcast #84 // class java/lang/CharSequence\n 78: iload 7\n 80: iconst_0\n 81: iconst_2\n 82: aconst_null\n 83: invokestatic #90 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z\n 86: ifeq 92\n 89: iload 7\n 91: ireturn\n 92: iinc 5, 1\n 95: goto 54\n 98: new #92 // class java/lang/IllegalArgumentException\n 101: dup\n 102: ldc #109 // String Line does not contain matching character\n 104: invokespecial #97 // Method java/lang/IllegalArgumentException.\"<init>\":(Ljava/lang/String;)V\n 107: athrow\n\n private final int getPriorityScore(char);\n Code:\n 0: iload_1\n 1: invokestatic #118 // Method java/lang/Character.isLowerCase:(C)Z\n 4: ifeq 14\n 7: iload_1\n 8: bipush 96\n 10: isub\n 11: goto 18\n 14: iload_1\n 15: bipush 38\n 17: isub\n 18: ireturn\n}\n", "javap_err": "" } ]
luluvia__advent-of-code-22__29ddde3/src/main/kotlin/Day02.kt
class Day02 { private val scores1 = mapOf( 'X' to mapOf('A' to 4, 'B' to 1, 'C' to 7), 'Y' to mapOf('A' to 8, 'B' to 5, 'C' to 2), 'Z' to mapOf('A' to 3, 'B' to 9, 'C' to 6) ) private val scores2 = mapOf( 'X' to mapOf('A' to 3, 'B' to 1, 'C' to 2), 'Y' to mapOf('A' to 4, 'B' to 5, 'C' to 6), 'Z' to mapOf('A' to 8, 'B' to 9, 'C' to 7) ) fun part1(input: List<String>): Int { var score = 0 for (line in input) { val opChoice = line[0] val myChoice = line[2] score += scores1[myChoice]!![opChoice]!! } return score } fun part2(input: List<String>): Int { var score = 0 for (line in input) { val opChoice = line[0] val myOutcome = line[2] score += scores2[myOutcome]!![opChoice]!! } return score } }
[ { "class_path": "luluvia__advent-of-code-22__29ddde3/Day02.class", "javap": "Compiled from \"Day02.kt\"\npublic final class Day02 {\n private final java.util.Map<java.lang.Character, java.util.Map<java.lang.Character, java.lang.Integer>> scores1;\n\n private final java.util.Map<java.lang.Character, java.util.Map<java.lang.Character, java.lang.Integer>> scores2;\n\n public Day02();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: iconst_3\n 6: anewarray #10 // class kotlin/Pair\n 9: astore_1\n 10: aload_1\n 11: iconst_0\n 12: bipush 88\n 14: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 17: iconst_3\n 18: anewarray #10 // class kotlin/Pair\n 21: astore_2\n 22: aload_2\n 23: iconst_0\n 24: bipush 65\n 26: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 29: iconst_4\n 30: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 33: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 36: aastore\n 37: aload_2\n 38: iconst_1\n 39: bipush 66\n 41: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 44: iconst_1\n 45: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 48: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 51: aastore\n 52: aload_2\n 53: iconst_2\n 54: bipush 67\n 56: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 59: bipush 7\n 61: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 64: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 67: aastore\n 68: aload_2\n 69: invokestatic #33 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 72: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 75: aastore\n 76: aload_1\n 77: iconst_1\n 78: bipush 89\n 80: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 83: iconst_3\n 84: anewarray #10 // class kotlin/Pair\n 87: astore_2\n 88: aload_2\n 89: iconst_0\n 90: bipush 65\n 92: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 95: bipush 8\n 97: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 100: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 103: aastore\n 104: aload_2\n 105: iconst_1\n 106: bipush 66\n 108: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 111: iconst_5\n 112: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 115: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 118: aastore\n 119: aload_2\n 120: iconst_2\n 121: bipush 67\n 123: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 126: iconst_2\n 127: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 130: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 133: aastore\n 134: aload_2\n 135: invokestatic #33 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 138: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 141: aastore\n 142: aload_1\n 143: iconst_2\n 144: bipush 90\n 146: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 149: iconst_3\n 150: anewarray #10 // class kotlin/Pair\n 153: astore_2\n 154: aload_2\n 155: iconst_0\n 156: bipush 65\n 158: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 161: iconst_3\n 162: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 165: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 168: aastore\n 169: aload_2\n 170: iconst_1\n 171: bipush 66\n 173: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 176: bipush 9\n 178: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 181: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 184: aastore\n 185: aload_2\n 186: iconst_2\n 187: bipush 67\n 189: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 192: bipush 6\n 194: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 197: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 200: aastore\n 201: aload_2\n 202: invokestatic #33 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 205: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 208: aastore\n 209: aload_1\n 210: invokestatic #33 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 213: putfield #37 // Field scores1:Ljava/util/Map;\n 216: aload_0\n 217: iconst_3\n 218: anewarray #10 // class kotlin/Pair\n 221: astore_1\n 222: aload_1\n 223: iconst_0\n 224: bipush 88\n 226: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 229: iconst_3\n 230: anewarray #10 // class kotlin/Pair\n 233: astore_2\n 234: aload_2\n 235: iconst_0\n 236: bipush 65\n 238: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 241: iconst_3\n 242: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 245: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 248: aastore\n 249: aload_2\n 250: iconst_1\n 251: bipush 66\n 253: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 256: iconst_1\n 257: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 260: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 263: aastore\n 264: aload_2\n 265: iconst_2\n 266: bipush 67\n 268: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 271: iconst_2\n 272: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 275: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 278: aastore\n 279: aload_2\n 280: invokestatic #33 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 283: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 286: aastore\n 287: aload_1\n 288: iconst_1\n 289: bipush 89\n 291: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 294: iconst_3\n 295: anewarray #10 // class kotlin/Pair\n 298: astore_2\n 299: aload_2\n 300: iconst_0\n 301: bipush 65\n 303: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 306: iconst_4\n 307: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 310: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 313: aastore\n 314: aload_2\n 315: iconst_1\n 316: bipush 66\n 318: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 321: iconst_5\n 322: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 325: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 328: aastore\n 329: aload_2\n 330: iconst_2\n 331: bipush 67\n 333: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 336: bipush 6\n 338: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 341: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 344: aastore\n 345: aload_2\n 346: invokestatic #33 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 349: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 352: aastore\n 353: aload_1\n 354: iconst_2\n 355: bipush 90\n 357: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 360: iconst_3\n 361: anewarray #10 // class kotlin/Pair\n 364: astore_2\n 365: aload_2\n 366: iconst_0\n 367: bipush 65\n 369: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 372: bipush 8\n 374: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 377: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 380: aastore\n 381: aload_2\n 382: iconst_1\n 383: bipush 66\n 385: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 388: bipush 9\n 390: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 393: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 396: aastore\n 397: aload_2\n 398: iconst_2\n 399: bipush 67\n 401: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 404: bipush 7\n 406: invokestatic #21 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 409: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 412: aastore\n 413: aload_2\n 414: invokestatic #33 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 417: invokestatic #27 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 420: aastore\n 421: aload_1\n 422: invokestatic #33 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 425: putfield #40 // Field scores2:Ljava/util/Map;\n 428: return\n\n public final int part1(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #48 // String input\n 3: invokestatic #54 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: aload_1\n 9: invokeinterface #60, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 14: astore_3\n 15: aload_3\n 16: invokeinterface #66, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 21: ifeq 98\n 24: aload_3\n 25: invokeinterface #70, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 30: checkcast #72 // class java/lang/String\n 33: astore 4\n 35: aload 4\n 37: iconst_0\n 38: invokevirtual #76 // Method java/lang/String.charAt:(I)C\n 41: istore 5\n 43: aload 4\n 45: iconst_2\n 46: invokevirtual #76 // Method java/lang/String.charAt:(I)C\n 49: istore 6\n 51: iload_2\n 52: aload_0\n 53: getfield #37 // Field scores1:Ljava/util/Map;\n 56: iload 6\n 58: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 61: invokeinterface #82, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 66: dup\n 67: invokestatic #86 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 70: checkcast #78 // class java/util/Map\n 73: iload 5\n 75: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 78: invokeinterface #82, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 83: dup\n 84: invokestatic #86 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 87: checkcast #88 // class java/lang/Number\n 90: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 93: iadd\n 94: istore_2\n 95: goto 15\n 98: iload_2\n 99: ireturn\n\n public final int part2(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #48 // String input\n 3: invokestatic #54 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_2\n 8: aload_1\n 9: invokeinterface #60, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 14: astore_3\n 15: aload_3\n 16: invokeinterface #66, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 21: ifeq 98\n 24: aload_3\n 25: invokeinterface #70, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 30: checkcast #72 // class java/lang/String\n 33: astore 4\n 35: aload 4\n 37: iconst_0\n 38: invokevirtual #76 // Method java/lang/String.charAt:(I)C\n 41: istore 5\n 43: aload 4\n 45: iconst_2\n 46: invokevirtual #76 // Method java/lang/String.charAt:(I)C\n 49: istore 6\n 51: iload_2\n 52: aload_0\n 53: getfield #40 // Field scores2:Ljava/util/Map;\n 56: iload 6\n 58: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 61: invokeinterface #82, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 66: dup\n 67: invokestatic #86 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 70: checkcast #78 // class java/util/Map\n 73: iload 5\n 75: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 78: invokeinterface #82, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 83: dup\n 84: invokestatic #86 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 87: checkcast #88 // class java/lang/Number\n 90: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 93: iadd\n 94: istore_2\n 95: goto 15\n 98: iload_2\n 99: ireturn\n}\n", "javap_err": "" } ]
xfl03__DiscreteCourseWork__281042e/Matrix/Matrix.kt
/** * 邻接矩阵 * 1 2 0 0 * 0 0 1 0 * 1 0 0 1 * 0 0 1 0 */ val matrix = arrayOf( "1200", "0010", "1001", "0010" ) /** * 矩阵乘法 */ fun multiply(a: Array<IntArray>, b: Array<IntArray>): Array<IntArray> { val arr = Array(a.size) { IntArray(b[0].size) } for (i in a.indices) { for (j in 0 until b[0].size) { for (k in 0 until a[0].size) { arr[i][j] += a[i][k] * b[k][j] } } } return arr } /** * 输出矩阵 */ fun printMatrix(a: Array<IntArray>, mode: Int = 0) { val n = a.size for (i in 0 until n) { for (j in 0 until n) { print(if (mode == 0) "${a[i][j]} " else "${if (a[i][j] != 0) 1 else 0} ") } println() } } /** * 矩阵内元素和 */ fun sumMatrix(a: Array<IntArray>): Int { val n = a.size var t = 0 for (i in 0 until n) { for (j in 0 until n) { t += a[i][j] } } return t } /** * 矩阵加法 */ fun add(a: Array<IntArray>, b: Array<IntArray>): Array<IntArray> { val n = a.size val arr = Array(n) { IntArray(n) } for (i in 0 until n) { for (j in 0 until n) { arr[i][j] = a[i][j] + b[i][j] } } return arr } /** * 主函数 */ fun main(args: Array<String>) { val n = matrix.size //创建二维数组存储矩阵 val arr = Array(n) { IntArray(n) } //初始化矩阵,将文本形式的矩阵转换成数组形式 (0 until n).forEach { i -> var t = matrix[i].toInt() (0 until n).forEach { arr[i][n - 1 - it] = t % 10 t /= 10 } } //输出邻接矩阵 println("邻接矩阵") printMatrix(arr) println() //计算并存储矩阵的n次方 val arr2 = multiply(arr, arr) val arr3 = multiply(arr, arr2) val arr4 = multiply(arr, arr3) println("邻接矩阵4次方") printMatrix(arr4) println("长度为4的通路") println(sumMatrix(arr4)) println() //合并矩阵 val arrs = add(arr, add(arr2, arr3)) println("可达矩阵") printMatrix(arrs, 1) }
[ { "class_path": "xfl03__DiscreteCourseWork__281042e/MatrixKt.class", "javap": "Compiled from \"Matrix.kt\"\npublic final class MatrixKt {\n private static final java.lang.String[] matrix;\n\n public static final java.lang.String[] getMatrix();\n Code:\n 0: getstatic #11 // Field matrix:[Ljava/lang/String;\n 3: areturn\n\n public static final int[][] multiply(int[][], int[][]);\n Code:\n 0: aload_0\n 1: ldc #15 // String a\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #23 // String b\n 9: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: iconst_0\n 13: istore_3\n 14: aload_0\n 15: checkcast #25 // class \"[Ljava/lang/Object;\"\n 18: arraylength\n 19: istore 4\n 21: iload 4\n 23: anewarray #27 // class \"[I\"\n 26: astore 5\n 28: iload_3\n 29: iload 4\n 31: if_icmpge 54\n 34: iload_3\n 35: istore 6\n 37: aload 5\n 39: iload 6\n 41: aload_1\n 42: iconst_0\n 43: aaload\n 44: arraylength\n 45: newarray int\n 47: aastore\n 48: iinc 3, 1\n 51: goto 28\n 54: aload 5\n 56: astore_2\n 57: iconst_0\n 58: istore_3\n 59: aload_0\n 60: checkcast #25 // class \"[Ljava/lang/Object;\"\n 63: arraylength\n 64: istore 4\n 66: iload_3\n 67: iload 4\n 69: if_icmpge 156\n 72: iconst_0\n 73: istore 5\n 75: aload_1\n 76: iconst_0\n 77: aaload\n 78: arraylength\n 79: istore 6\n 81: iload 5\n 83: iload 6\n 85: if_icmpge 150\n 88: iconst_0\n 89: istore 7\n 91: aload_0\n 92: iconst_0\n 93: aaload\n 94: arraylength\n 95: istore 8\n 97: iload 7\n 99: iload 8\n 101: if_icmpge 144\n 104: aload_2\n 105: iload_3\n 106: aaload\n 107: astore 9\n 109: iload 5\n 111: istore 10\n 113: aload 9\n 115: iload 10\n 117: aload 9\n 119: iload 10\n 121: iaload\n 122: aload_0\n 123: iload_3\n 124: aaload\n 125: iload 7\n 127: iaload\n 128: aload_1\n 129: iload 7\n 131: aaload\n 132: iload 5\n 134: iaload\n 135: imul\n 136: iadd\n 137: iastore\n 138: iinc 7, 1\n 141: goto 97\n 144: iinc 5, 1\n 147: goto 81\n 150: iinc 3, 1\n 153: goto 66\n 156: aload_2\n 157: areturn\n\n public static final void printMatrix(int[][], int);\n Code:\n 0: aload_0\n 1: ldc #15 // String a\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #25 // class \"[Ljava/lang/Object;\"\n 10: arraylength\n 11: istore_2\n 12: iconst_0\n 13: istore_3\n 14: iload_3\n 15: iload_2\n 16: if_icmpge 116\n 19: iconst_0\n 20: istore 4\n 22: iload 4\n 24: iload_2\n 25: if_icmpge 104\n 28: iload_1\n 29: ifne 59\n 32: new #38 // class java/lang/StringBuilder\n 35: dup\n 36: invokespecial #42 // Method java/lang/StringBuilder.\"<init>\":()V\n 39: aload_0\n 40: iload_3\n 41: aaload\n 42: iload 4\n 44: iaload\n 45: invokevirtual #46 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 48: bipush 32\n 50: invokevirtual #49 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 53: invokevirtual #53 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 56: goto 91\n 59: new #38 // class java/lang/StringBuilder\n 62: dup\n 63: invokespecial #42 // Method java/lang/StringBuilder.\"<init>\":()V\n 66: aload_0\n 67: iload_3\n 68: aaload\n 69: iload 4\n 71: iaload\n 72: ifeq 79\n 75: iconst_1\n 76: goto 80\n 79: iconst_0\n 80: invokevirtual #46 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 83: bipush 32\n 85: invokevirtual #49 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 88: invokevirtual #53 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 91: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 94: swap\n 95: invokevirtual #65 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V\n 98: iinc 4, 1\n 101: goto 22\n 104: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 107: invokevirtual #68 // Method java/io/PrintStream.println:()V\n 110: iinc 3, 1\n 113: goto 14\n 116: return\n\n public static void printMatrix$default(int[][], int, int, java.lang.Object);\n Code:\n 0: iload_2\n 1: iconst_2\n 2: iand\n 3: ifeq 8\n 6: iconst_0\n 7: istore_1\n 8: aload_0\n 9: iload_1\n 10: invokestatic #76 // Method printMatrix:([[II)V\n 13: return\n\n public static final int sumMatrix(int[][]);\n Code:\n 0: aload_0\n 1: ldc #15 // String a\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #25 // class \"[Ljava/lang/Object;\"\n 10: arraylength\n 11: istore_1\n 12: iconst_0\n 13: istore_2\n 14: iconst_0\n 15: istore_3\n 16: iload_3\n 17: iload_1\n 18: if_icmpge 51\n 21: iconst_0\n 22: istore 4\n 24: iload 4\n 26: iload_1\n 27: if_icmpge 45\n 30: iload_2\n 31: aload_0\n 32: iload_3\n 33: aaload\n 34: iload 4\n 36: iaload\n 37: iadd\n 38: istore_2\n 39: iinc 4, 1\n 42: goto 24\n 45: iinc 3, 1\n 48: goto 16\n 51: iload_2\n 52: ireturn\n\n public static final int[][] add(int[][], int[][]);\n Code:\n 0: aload_0\n 1: ldc #15 // String a\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #23 // String b\n 9: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: checkcast #25 // class \"[Ljava/lang/Object;\"\n 16: arraylength\n 17: istore_2\n 18: iconst_0\n 19: istore 4\n 21: iload_2\n 22: anewarray #27 // class \"[I\"\n 25: astore 5\n 27: iload 4\n 29: iload_2\n 30: if_icmpge 51\n 33: iload 4\n 35: istore 6\n 37: aload 5\n 39: iload 6\n 41: iload_2\n 42: newarray int\n 44: aastore\n 45: iinc 4, 1\n 48: goto 27\n 51: aload 5\n 53: astore_3\n 54: iconst_0\n 55: istore 4\n 57: iload 4\n 59: iload_2\n 60: if_icmpge 106\n 63: iconst_0\n 64: istore 5\n 66: iload 5\n 68: iload_2\n 69: if_icmpge 100\n 72: aload_3\n 73: iload 4\n 75: aaload\n 76: iload 5\n 78: aload_0\n 79: iload 4\n 81: aaload\n 82: iload 5\n 84: iaload\n 85: aload_1\n 86: iload 4\n 88: aaload\n 89: iload 5\n 91: iaload\n 92: iadd\n 93: iastore\n 94: iinc 5, 1\n 97: goto 66\n 100: iinc 4, 1\n 103: goto 57\n 106: aload_3\n 107: areturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #84 // String args\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: getstatic #11 // Field matrix:[Ljava/lang/String;\n 9: arraylength\n 10: istore_1\n 11: iconst_0\n 12: istore_3\n 13: iload_1\n 14: anewarray #27 // class \"[I\"\n 17: astore 4\n 19: iload_3\n 20: iload_1\n 21: if_icmpge 41\n 24: iload_3\n 25: istore 5\n 27: aload 4\n 29: iload 5\n 31: iload_1\n 32: newarray int\n 34: aastore\n 35: iinc 3, 1\n 38: goto 19\n 41: aload 4\n 43: astore_2\n 44: iconst_0\n 45: iload_1\n 46: invokestatic #90 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 49: checkcast #92 // class java/lang/Iterable\n 52: astore_3\n 53: iconst_0\n 54: istore 4\n 56: aload_3\n 57: invokeinterface #96, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 62: astore 5\n 64: aload 5\n 66: invokeinterface #102, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 71: ifeq 188\n 74: aload 5\n 76: checkcast #104 // class kotlin/collections/IntIterator\n 79: invokevirtual #108 // Method kotlin/collections/IntIterator.nextInt:()I\n 82: istore 6\n 84: iload 6\n 86: istore 7\n 88: iconst_0\n 89: istore 8\n 91: iconst_0\n 92: istore 9\n 94: getstatic #11 // Field matrix:[Ljava/lang/String;\n 97: iload 7\n 99: aaload\n 100: invokestatic #114 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 103: istore 9\n 105: iconst_0\n 106: iload_1\n 107: invokestatic #90 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 110: checkcast #92 // class java/lang/Iterable\n 113: astore 10\n 115: iconst_0\n 116: istore 11\n 118: aload 10\n 120: invokeinterface #96, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 125: astore 12\n 127: aload 12\n 129: invokeinterface #102, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 134: ifeq 182\n 137: aload 12\n 139: checkcast #104 // class kotlin/collections/IntIterator\n 142: invokevirtual #108 // Method kotlin/collections/IntIterator.nextInt:()I\n 145: istore 13\n 147: iload 13\n 149: istore 14\n 151: iconst_0\n 152: istore 15\n 154: aload_2\n 155: iload 7\n 157: aaload\n 158: iload_1\n 159: iconst_1\n 160: isub\n 161: iload 14\n 163: isub\n 164: iload 9\n 166: bipush 10\n 168: irem\n 169: iastore\n 170: iload 9\n 172: bipush 10\n 174: idiv\n 175: istore 9\n 177: nop\n 178: nop\n 179: goto 127\n 182: nop\n 183: nop\n 184: nop\n 185: goto 64\n 188: nop\n 189: ldc #116 // String 邻接矩阵\n 191: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 194: swap\n 195: invokevirtual #118 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 198: aload_2\n 199: iconst_0\n 200: iconst_2\n 201: aconst_null\n 202: invokestatic #120 // Method printMatrix$default:([[IIILjava/lang/Object;)V\n 205: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 208: invokevirtual #68 // Method java/io/PrintStream.println:()V\n 211: aload_2\n 212: aload_2\n 213: invokestatic #122 // Method multiply:([[I[[I)[[I\n 216: astore_3\n 217: aload_2\n 218: aload_3\n 219: invokestatic #122 // Method multiply:([[I[[I)[[I\n 222: astore 4\n 224: aload_2\n 225: aload 4\n 227: invokestatic #122 // Method multiply:([[I[[I)[[I\n 230: astore 5\n 232: ldc #124 // String 邻接矩阵4次方\n 234: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 237: swap\n 238: invokevirtual #118 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 241: aload 5\n 243: iconst_0\n 244: iconst_2\n 245: aconst_null\n 246: invokestatic #120 // Method printMatrix$default:([[IIILjava/lang/Object;)V\n 249: ldc #126 // String 长度为4的通路\n 251: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 254: swap\n 255: invokevirtual #118 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 258: aload 5\n 260: invokestatic #128 // Method sumMatrix:([[I)I\n 263: istore 6\n 265: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 268: iload 6\n 270: invokevirtual #131 // Method java/io/PrintStream.println:(I)V\n 273: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 276: invokevirtual #68 // Method java/io/PrintStream.println:()V\n 279: aload_2\n 280: aload_3\n 281: aload 4\n 283: invokestatic #133 // Method add:([[I[[I)[[I\n 286: invokestatic #133 // Method add:([[I[[I)[[I\n 289: astore 6\n 291: ldc #135 // String 可达矩阵\n 293: getstatic #59 // Field java/lang/System.out:Ljava/io/PrintStream;\n 296: swap\n 297: invokevirtual #118 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 300: aload 6\n 302: iconst_1\n 303: invokestatic #76 // Method printMatrix:([[II)V\n 306: return\n\n static {};\n Code:\n 0: iconst_4\n 1: anewarray #72 // class java/lang/String\n 4: astore_0\n 5: aload_0\n 6: iconst_0\n 7: ldc #150 // String 1200\n 9: aastore\n 10: aload_0\n 11: iconst_1\n 12: ldc #152 // String 0010\n 14: aastore\n 15: aload_0\n 16: iconst_2\n 17: ldc #154 // String 1001\n 19: aastore\n 20: aload_0\n 21: iconst_3\n 22: ldc #152 // String 0010\n 24: aastore\n 25: aload_0\n 26: putstatic #11 // Field matrix:[Ljava/lang/String;\n 29: return\n}\n", "javap_err": "" } ]
mehran-naghizadeh__radix-sort__8b8bb34/radix_sort.kt
fun main() = unitTest() fun radixSort(list: List<Int>): List<Int> { val count = maxDigits(list) var sorted = stringify(list) for(i in 1..count) { sorted = bucketize(sorted, count - i).flatten() } return sorted.map { it.toInt() } } fun bucketize(list: List<String>, position: Int): List<List<String>> { return (0..9).map { list.filter { str -> str[position].toString() == it.toString() } } } fun stringify(list: List<Int>): List<String> { val length = maxDigits(list) return list.map { val prefix = "0".repeat(length - it.toString().length) "$prefix$it" } } fun maxDigits(list: List<Int>) = list.maxOrNull()?.toString()?.length ?: 0 fun unitTest() { val testCases = listOf( listOf( listOf(170, 45, 75, 90, 2, 802, 2, 66), listOf(2, 2, 45, 66, 75, 90, 170, 802) ), listOf( listOf(8902, 67832, 12, 1000, 4002), listOf(12, 1000, 4002, 8902, 67832) ) ) testCases.forEach { val originalArray = it[0] val expectedResult = it[1] val result = radixSort(originalArray) if (result == expectedResult) { println("Worked well for") } else { println("Failed on") } println(originalArray) println(result) println("--------") } }
[ { "class_path": "mehran-naghizadeh__radix-sort__8b8bb34/Radix_sortKt.class", "javap": "Compiled from \"radix_sort.kt\"\npublic final class Radix_sortKt {\n public static final void main();\n Code:\n 0: invokestatic #9 // Method unitTest:()V\n 3: return\n\n public static final java.util.List<java.lang.Integer> radixSort(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #15 // String list\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokestatic #25 // Method maxDigits:(Ljava/util/List;)I\n 10: istore_1\n 11: aload_0\n 12: invokestatic #28 // Method stringify:(Ljava/util/List;)Ljava/util/List;\n 15: astore_2\n 16: iconst_1\n 17: istore_3\n 18: iload_3\n 19: iload_1\n 20: if_icmpgt 48\n 23: aload_2\n 24: iload_1\n 25: iload_3\n 26: isub\n 27: invokestatic #32 // Method bucketize:(Ljava/util/List;I)Ljava/util/List;\n 30: checkcast #34 // class java/lang/Iterable\n 33: invokestatic #40 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 36: astore_2\n 37: iload_3\n 38: iload_1\n 39: if_icmpeq 48\n 42: iinc 3, 1\n 45: goto 23\n 48: aload_2\n 49: checkcast #34 // class java/lang/Iterable\n 52: astore_3\n 53: iconst_0\n 54: istore 4\n 56: aload_3\n 57: astore 5\n 59: new #42 // class java/util/ArrayList\n 62: dup\n 63: aload_3\n 64: bipush 10\n 66: invokestatic #46 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 69: invokespecial #50 // Method java/util/ArrayList.\"<init>\":(I)V\n 72: checkcast #52 // class java/util/Collection\n 75: astore 6\n 77: iconst_0\n 78: istore 7\n 80: aload 5\n 82: invokeinterface #56, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 87: astore 8\n 89: aload 8\n 91: invokeinterface #62, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 96: ifeq 143\n 99: aload 8\n 101: invokeinterface #66, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 106: astore 9\n 108: aload 6\n 110: aload 9\n 112: checkcast #68 // class java/lang/String\n 115: astore 10\n 117: astore 12\n 119: iconst_0\n 120: istore 11\n 122: aload 10\n 124: invokestatic #74 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 127: nop\n 128: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 131: aload 12\n 133: swap\n 134: invokeinterface #82, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 139: pop\n 140: goto 89\n 143: aload 6\n 145: checkcast #84 // class java/util/List\n 148: nop\n 149: areturn\n\n public static final java.util.List<java.util.List<java.lang.String>> bucketize(java.util.List<java.lang.String>, int);\n Code:\n 0: aload_0\n 1: ldc #15 // String list\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #104 // class kotlin/ranges/IntRange\n 9: dup\n 10: iconst_0\n 11: bipush 9\n 13: invokespecial #107 // Method kotlin/ranges/IntRange.\"<init>\":(II)V\n 16: checkcast #34 // class java/lang/Iterable\n 19: astore_2\n 20: iconst_0\n 21: istore_3\n 22: aload_2\n 23: astore 4\n 25: new #42 // class java/util/ArrayList\n 28: dup\n 29: aload_2\n 30: bipush 10\n 32: invokestatic #46 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 35: invokespecial #50 // Method java/util/ArrayList.\"<init>\":(I)V\n 38: checkcast #52 // class java/util/Collection\n 41: astore 5\n 43: iconst_0\n 44: istore 6\n 46: aload 4\n 48: invokeinterface #56, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 53: astore 7\n 55: aload 7\n 57: invokeinterface #62, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 62: ifeq 204\n 65: aload 7\n 67: checkcast #109 // class kotlin/collections/IntIterator\n 70: invokevirtual #113 // Method kotlin/collections/IntIterator.nextInt:()I\n 73: istore 8\n 75: aload 5\n 77: iload 8\n 79: istore 9\n 81: astore 20\n 83: iconst_0\n 84: istore 10\n 86: aload_0\n 87: checkcast #34 // class java/lang/Iterable\n 90: astore 11\n 92: iconst_0\n 93: istore 12\n 95: aload 11\n 97: astore 13\n 99: new #42 // class java/util/ArrayList\n 102: dup\n 103: invokespecial #115 // Method java/util/ArrayList.\"<init>\":()V\n 106: checkcast #52 // class java/util/Collection\n 109: astore 14\n 111: iconst_0\n 112: istore 15\n 114: aload 13\n 116: invokeinterface #56, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 121: astore 16\n 123: aload 16\n 125: invokeinterface #62, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 130: ifeq 185\n 133: aload 16\n 135: invokeinterface #66, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 140: astore 17\n 142: aload 17\n 144: checkcast #68 // class java/lang/String\n 147: astore 18\n 149: iconst_0\n 150: istore 19\n 152: aload 18\n 154: iload_1\n 155: invokevirtual #119 // Method java/lang/String.charAt:(I)C\n 158: invokestatic #122 // Method java/lang/String.valueOf:(C)Ljava/lang/String;\n 161: iload 9\n 163: invokestatic #125 // Method java/lang/String.valueOf:(I)Ljava/lang/String;\n 166: invokestatic #129 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 169: ifeq 123\n 172: aload 14\n 174: aload 17\n 176: invokeinterface #82, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 181: pop\n 182: goto 123\n 185: aload 14\n 187: checkcast #84 // class java/util/List\n 190: nop\n 191: nop\n 192: aload 20\n 194: swap\n 195: invokeinterface #82, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 200: pop\n 201: goto 55\n 204: aload 5\n 206: checkcast #84 // class java/util/List\n 209: nop\n 210: areturn\n\n public static final java.util.List<java.lang.String> stringify(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #15 // String list\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokestatic #25 // Method maxDigits:(Ljava/util/List;)I\n 10: istore_1\n 11: aload_0\n 12: checkcast #34 // class java/lang/Iterable\n 15: astore_2\n 16: iconst_0\n 17: istore_3\n 18: aload_2\n 19: astore 4\n 21: new #42 // class java/util/ArrayList\n 24: dup\n 25: aload_2\n 26: bipush 10\n 28: invokestatic #46 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 31: invokespecial #50 // Method java/util/ArrayList.\"<init>\":(I)V\n 34: checkcast #52 // class java/util/Collection\n 37: astore 5\n 39: iconst_0\n 40: istore 6\n 42: aload 4\n 44: invokeinterface #56, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 49: astore 7\n 51: aload 7\n 53: invokeinterface #62, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 58: ifeq 139\n 61: aload 7\n 63: invokeinterface #66, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 68: astore 8\n 70: aload 5\n 72: aload 8\n 74: checkcast #141 // class java/lang/Number\n 77: invokevirtual #144 // Method java/lang/Number.intValue:()I\n 80: istore 9\n 82: astore 12\n 84: iconst_0\n 85: istore 10\n 87: ldc #146 // String 0\n 89: checkcast #148 // class java/lang/CharSequence\n 92: iload_1\n 93: iload 9\n 95: invokestatic #125 // Method java/lang/String.valueOf:(I)Ljava/lang/String;\n 98: invokevirtual #151 // Method java/lang/String.length:()I\n 101: isub\n 102: invokestatic #157 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;\n 105: astore 11\n 107: new #159 // class java/lang/StringBuilder\n 110: dup\n 111: invokespecial #160 // Method java/lang/StringBuilder.\"<init>\":()V\n 114: aload 11\n 116: invokevirtual #164 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 119: iload 9\n 121: invokevirtual #167 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 124: invokevirtual #171 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 127: aload 12\n 129: swap\n 130: invokeinterface #82, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 135: pop\n 136: goto 51\n 139: aload 5\n 141: checkcast #84 // class java/util/List\n 144: nop\n 145: areturn\n\n public static final int maxDigits(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #15 // String list\n 3: invokestatic #21 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #34 // class java/lang/Iterable\n 10: invokestatic #178 // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 13: checkcast #70 // class java/lang/Integer\n 16: dup\n 17: ifnull 33\n 20: invokevirtual #179 // Method java/lang/Integer.toString:()Ljava/lang/String;\n 23: dup\n 24: ifnull 33\n 27: invokevirtual #151 // Method java/lang/String.length:()I\n 30: goto 35\n 33: pop\n 34: iconst_0\n 35: ireturn\n\n public static final void unitTest();\n Code:\n 0: iconst_2\n 1: anewarray #84 // class java/util/List\n 4: astore_1\n 5: aload_1\n 6: iconst_0\n 7: iconst_2\n 8: anewarray #84 // class java/util/List\n 11: astore_2\n 12: aload_2\n 13: iconst_0\n 14: bipush 8\n 16: anewarray #70 // class java/lang/Integer\n 19: astore_3\n 20: aload_3\n 21: iconst_0\n 22: sipush 170\n 25: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 28: aastore\n 29: aload_3\n 30: iconst_1\n 31: bipush 45\n 33: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 36: aastore\n 37: aload_3\n 38: iconst_2\n 39: bipush 75\n 41: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 44: aastore\n 45: aload_3\n 46: iconst_3\n 47: bipush 90\n 49: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 52: aastore\n 53: aload_3\n 54: iconst_4\n 55: iconst_2\n 56: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 59: aastore\n 60: aload_3\n 61: iconst_5\n 62: sipush 802\n 65: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 68: aastore\n 69: aload_3\n 70: bipush 6\n 72: iconst_2\n 73: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 76: aastore\n 77: aload_3\n 78: bipush 7\n 80: bipush 66\n 82: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 85: aastore\n 86: aload_3\n 87: invokestatic #183 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 90: aastore\n 91: aload_2\n 92: iconst_1\n 93: bipush 8\n 95: anewarray #70 // class java/lang/Integer\n 98: astore_3\n 99: aload_3\n 100: iconst_0\n 101: iconst_2\n 102: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 105: aastore\n 106: aload_3\n 107: iconst_1\n 108: iconst_2\n 109: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 112: aastore\n 113: aload_3\n 114: iconst_2\n 115: bipush 45\n 117: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 120: aastore\n 121: aload_3\n 122: iconst_3\n 123: bipush 66\n 125: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 128: aastore\n 129: aload_3\n 130: iconst_4\n 131: bipush 75\n 133: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 136: aastore\n 137: aload_3\n 138: iconst_5\n 139: bipush 90\n 141: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 144: aastore\n 145: aload_3\n 146: bipush 6\n 148: sipush 170\n 151: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 154: aastore\n 155: aload_3\n 156: bipush 7\n 158: sipush 802\n 161: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 164: aastore\n 165: aload_3\n 166: invokestatic #183 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 169: aastore\n 170: aload_2\n 171: invokestatic #183 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 174: aastore\n 175: aload_1\n 176: iconst_1\n 177: iconst_2\n 178: anewarray #84 // class java/util/List\n 181: astore_2\n 182: aload_2\n 183: iconst_0\n 184: iconst_5\n 185: anewarray #70 // class java/lang/Integer\n 188: astore_3\n 189: aload_3\n 190: iconst_0\n 191: sipush 8902\n 194: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 197: aastore\n 198: aload_3\n 199: iconst_1\n 200: ldc #184 // int 67832\n 202: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 205: aastore\n 206: aload_3\n 207: iconst_2\n 208: bipush 12\n 210: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 213: aastore\n 214: aload_3\n 215: iconst_3\n 216: sipush 1000\n 219: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 222: aastore\n 223: aload_3\n 224: iconst_4\n 225: sipush 4002\n 228: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 231: aastore\n 232: aload_3\n 233: invokestatic #183 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 236: aastore\n 237: aload_2\n 238: iconst_1\n 239: iconst_5\n 240: anewarray #70 // class java/lang/Integer\n 243: astore_3\n 244: aload_3\n 245: iconst_0\n 246: bipush 12\n 248: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 251: aastore\n 252: aload_3\n 253: iconst_1\n 254: sipush 1000\n 257: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 260: aastore\n 261: aload_3\n 262: iconst_2\n 263: sipush 4002\n 266: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 269: aastore\n 270: aload_3\n 271: iconst_3\n 272: sipush 8902\n 275: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 278: aastore\n 279: aload_3\n 280: iconst_4\n 281: ldc #184 // int 67832\n 283: invokestatic #78 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 286: aastore\n 287: aload_3\n 288: invokestatic #183 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 291: aastore\n 292: aload_2\n 293: invokestatic #183 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 296: aastore\n 297: aload_1\n 298: invokestatic #183 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 301: astore_0\n 302: aload_0\n 303: checkcast #34 // class java/lang/Iterable\n 306: astore_1\n 307: iconst_0\n 308: istore_2\n 309: aload_1\n 310: invokeinterface #56, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 315: astore_3\n 316: aload_3\n 317: invokeinterface #62, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 322: ifeq 437\n 325: aload_3\n 326: invokeinterface #66, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 331: astore 4\n 333: aload 4\n 335: checkcast #84 // class java/util/List\n 338: astore 5\n 340: iconst_0\n 341: istore 6\n 343: aload 5\n 345: iconst_0\n 346: invokeinterface #188, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 351: checkcast #84 // class java/util/List\n 354: astore 7\n 356: aload 5\n 358: iconst_1\n 359: invokeinterface #188, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 364: checkcast #84 // class java/util/List\n 367: astore 8\n 369: aload 7\n 371: invokestatic #190 // Method radixSort:(Ljava/util/List;)Ljava/util/List;\n 374: astore 9\n 376: aload 9\n 378: aload 8\n 380: invokestatic #129 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 383: ifeq 398\n 386: ldc #192 // String Worked well for\n 388: getstatic #198 // Field java/lang/System.out:Ljava/io/PrintStream;\n 391: swap\n 392: invokevirtual #204 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 395: goto 407\n 398: ldc #206 // String Failed on\n 400: getstatic #198 // Field java/lang/System.out:Ljava/io/PrintStream;\n 403: swap\n 404: invokevirtual #204 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 407: getstatic #198 // Field java/lang/System.out:Ljava/io/PrintStream;\n 410: aload 7\n 412: invokevirtual #204 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 415: getstatic #198 // Field java/lang/System.out:Ljava/io/PrintStream;\n 418: aload 9\n 420: invokevirtual #204 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 423: ldc #208 // String --------\n 425: getstatic #198 // Field java/lang/System.out:Ljava/io/PrintStream;\n 428: swap\n 429: invokevirtual #204 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 432: nop\n 433: nop\n 434: goto 316\n 437: nop\n 438: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #219 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
fpeterek__Advent-Of-Code__d5bdf89/Day3/spiral_memory.kt
import kotlin.math.abs import kotlin.math.ceil import kotlin.math.sqrt fun findNearestSquareRoot(num: Int): Int { val nearestRoot = ceil(sqrt(num.toDouble())).toInt() return if (nearestRoot % 2 == 0) { nearestRoot + 1 } else { nearestRoot } } fun main(args: Array<String>) { val input = 325489 val nearestRoot = findNearestSquareRoot(input) val rightBottom = nearestRoot * nearestRoot val leftBottom = rightBottom - nearestRoot + 1 val leftTop = leftBottom - nearestRoot + 1 val rightTop = leftTop - nearestRoot + 1 val rightLowest = rightTop - nearestRoot + 2 val horizontalPos = when (input) { in leftTop..leftBottom -> leftTop in rightLowest..rightTop -> rightBottom else -> input } val horizontal = if (horizontalPos >= leftBottom) { val midVal = leftBottom + (nearestRoot / 2.0).toInt() abs(horizontalPos - midVal) } else { val midVal = rightTop + (nearestRoot / 2.0).toInt() abs(horizontalPos - midVal) } val verticalPosition = when (input) { in leftBottom..rightBottom -> leftBottom in leftTop..rightTop -> leftTop else -> input } val vertical = if (verticalPosition < leftTop) { val midVal = rightTop - (nearestRoot / 2.0).toInt() abs(verticalPosition - midVal) } else { val midVal = leftTop + (nearestRoot / 2.0).toInt() abs(verticalPosition - midVal) } println(horizontal + vertical) }
[ { "class_path": "fpeterek__Advent-Of-Code__d5bdf89/Spiral_memoryKt.class", "javap": "Compiled from \"spiral_memory.kt\"\npublic final class Spiral_memoryKt {\n public static final int findNearestSquareRoot(int);\n Code:\n 0: iload_0\n 1: i2d\n 2: invokestatic #12 // Method java/lang/Math.sqrt:(D)D\n 5: invokestatic #15 // Method java/lang/Math.ceil:(D)D\n 8: d2i\n 9: istore_1\n 10: iload_1\n 11: iconst_2\n 12: irem\n 13: ifne 22\n 16: iload_1\n 17: iconst_1\n 18: iadd\n 19: goto 23\n 22: iload_1\n 23: ireturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #23 // String args\n 3: invokestatic #29 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #30 // int 325489\n 8: istore_1\n 9: iload_1\n 10: invokestatic #32 // Method findNearestSquareRoot:(I)I\n 13: istore_2\n 14: iload_2\n 15: iload_2\n 16: imul\n 17: istore_3\n 18: iload_3\n 19: iload_2\n 20: isub\n 21: iconst_1\n 22: iadd\n 23: istore 4\n 25: iload 4\n 27: iload_2\n 28: isub\n 29: iconst_1\n 30: iadd\n 31: istore 5\n 33: iload 5\n 35: iload_2\n 36: isub\n 37: iconst_1\n 38: iadd\n 39: istore 6\n 41: iload 6\n 43: iload_2\n 44: isub\n 45: iconst_2\n 46: iadd\n 47: istore 7\n 49: iload_1\n 50: istore 9\n 52: iload 5\n 54: iload 9\n 56: if_icmpgt 74\n 59: iload 9\n 61: iload 4\n 63: if_icmpgt 70\n 66: iconst_1\n 67: goto 75\n 70: iconst_0\n 71: goto 75\n 74: iconst_0\n 75: ifeq 83\n 78: iload 5\n 80: goto 114\n 83: iload 7\n 85: iload 9\n 87: if_icmpgt 105\n 90: iload 9\n 92: iload 6\n 94: if_icmpgt 101\n 97: iconst_1\n 98: goto 106\n 101: iconst_0\n 102: goto 106\n 105: iconst_0\n 106: ifeq 113\n 109: iload_3\n 110: goto 114\n 113: iload_1\n 114: istore 8\n 116: iload 8\n 118: iload 4\n 120: if_icmplt 146\n 123: iload 4\n 125: iload_2\n 126: i2d\n 127: ldc2_w #33 // double 2.0d\n 130: ddiv\n 131: d2i\n 132: iadd\n 133: istore 10\n 135: iload 8\n 137: iload 10\n 139: isub\n 140: invokestatic #37 // Method java/lang/Math.abs:(I)I\n 143: goto 166\n 146: iload 6\n 148: iload_2\n 149: i2d\n 150: ldc2_w #33 // double 2.0d\n 153: ddiv\n 154: d2i\n 155: iadd\n 156: istore 10\n 158: iload 8\n 160: iload 10\n 162: isub\n 163: invokestatic #37 // Method java/lang/Math.abs:(I)I\n 166: istore 9\n 168: iload_1\n 169: istore 11\n 171: iload 4\n 173: iload 11\n 175: if_icmpgt 192\n 178: iload 11\n 180: iload_3\n 181: if_icmpgt 188\n 184: iconst_1\n 185: goto 193\n 188: iconst_0\n 189: goto 193\n 192: iconst_0\n 193: ifeq 201\n 196: iload 4\n 198: goto 233\n 201: iload 5\n 203: iload 11\n 205: if_icmpgt 223\n 208: iload 11\n 210: iload 6\n 212: if_icmpgt 219\n 215: iconst_1\n 216: goto 224\n 219: iconst_0\n 220: goto 224\n 223: iconst_0\n 224: ifeq 232\n 227: iload 5\n 229: goto 233\n 232: iload_1\n 233: istore 10\n 235: iload 10\n 237: iload 5\n 239: if_icmpge 265\n 242: iload 6\n 244: iload_2\n 245: i2d\n 246: ldc2_w #33 // double 2.0d\n 249: ddiv\n 250: d2i\n 251: isub\n 252: istore 12\n 254: iload 10\n 256: iload 12\n 258: isub\n 259: invokestatic #37 // Method java/lang/Math.abs:(I)I\n 262: goto 285\n 265: iload 5\n 267: iload_2\n 268: i2d\n 269: ldc2_w #33 // double 2.0d\n 272: ddiv\n 273: d2i\n 274: iadd\n 275: istore 12\n 277: iload 10\n 279: iload 12\n 281: isub\n 282: invokestatic #37 // Method java/lang/Math.abs:(I)I\n 285: istore 11\n 287: iload 9\n 289: iload 11\n 291: iadd\n 292: istore 12\n 294: getstatic #43 // Field java/lang/System.out:Ljava/io/PrintStream;\n 297: iload 12\n 299: invokevirtual #49 // Method java/io/PrintStream.println:(I)V\n 302: return\n}\n", "javap_err": "" } ]
fpeterek__Advent-Of-Code__d5bdf89/Day6/memory_banks.kt
// Solves both first and second problem fun redistribute(banks: MutableList<Int>) { val max = banks.max()!! var index = banks.indexOf(max) var blocksToAlloc = max banks[index] = 0 while (blocksToAlloc > 0) { ++index if (index >= banks.size) { index = 0 } ++banks[index] --blocksToAlloc } } fun main(args: Array<String>) { val input = "5 1 10 0 1 7 13 14 3 12 8 10 7 12 0 6" val banks = input.split(" ").map { it.toInt() }.toMutableList() val occuredCombinations = mutableListOf<String>() var combination: String while (true) { redistribute(banks) combination = banks.fold("") { acc: String, i: Int -> "$acc$i " } if (occuredCombinations.find {it == combination} != null) { break } occuredCombinations.add(combination) } val loopSize = (occuredCombinations.size) - occuredCombinations.indexOf(combination) println("Number of combinations: ${occuredCombinations.size + 1}") println("Loop size: $loopSize") }
[ { "class_path": "fpeterek__Advent-Of-Code__d5bdf89/Memory_banksKt.class", "javap": "Compiled from \"memory_banks.kt\"\npublic final class Memory_banksKt {\n public static final void redistribute(java.util.List<java.lang.Integer>);\n Code:\n 0: aload_0\n 1: ldc #10 // String banks\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #18 // class java/lang/Iterable\n 10: invokestatic #24 // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 13: dup\n 14: invokestatic #28 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 17: checkcast #30 // class java/lang/Number\n 20: invokevirtual #34 // Method java/lang/Number.intValue:()I\n 23: istore_1\n 24: aload_0\n 25: iload_1\n 26: invokestatic #40 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 29: invokeinterface #46, 2 // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I\n 34: istore_2\n 35: iload_1\n 36: istore_3\n 37: aload_0\n 38: iload_2\n 39: iconst_0\n 40: invokestatic #40 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 43: invokeinterface #50, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 48: pop\n 49: iload_3\n 50: ifle 114\n 53: iinc 2, 1\n 56: iload_2\n 57: aload_0\n 58: invokeinterface #53, 1 // InterfaceMethod java/util/List.size:()I\n 63: if_icmplt 68\n 66: iconst_0\n 67: istore_2\n 68: iload_2\n 69: istore 4\n 71: aload_0\n 72: iload 4\n 74: aload_0\n 75: iload 4\n 77: invokeinterface #57, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 82: checkcast #30 // class java/lang/Number\n 85: invokevirtual #34 // Method java/lang/Number.intValue:()I\n 88: iconst_1\n 89: iadd\n 90: invokestatic #40 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 93: invokeinterface #50, 3 // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;\n 98: pop\n 99: aload_0\n 100: iload 4\n 102: invokeinterface #57, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 107: pop\n 108: iinc 3, -1\n 111: goto 49\n 114: return\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #66 // String args\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #68 // String 5 1 10 0 1 7 13 14 3 12 8 10 7 12 0 6\n 8: astore_1\n 9: aload_1\n 10: checkcast #70 // class java/lang/CharSequence\n 13: iconst_1\n 14: anewarray #72 // class java/lang/String\n 17: astore_3\n 18: aload_3\n 19: iconst_0\n 20: ldc #74 // String\n 22: aastore\n 23: aload_3\n 24: iconst_0\n 25: iconst_0\n 26: bipush 6\n 28: aconst_null\n 29: invokestatic #80 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 32: checkcast #18 // class java/lang/Iterable\n 35: astore_3\n 36: iconst_0\n 37: istore 4\n 39: aload_3\n 40: astore 5\n 42: new #82 // class java/util/ArrayList\n 45: dup\n 46: aload_3\n 47: bipush 10\n 49: invokestatic #86 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 52: invokespecial #90 // Method java/util/ArrayList.\"<init>\":(I)V\n 55: checkcast #92 // class java/util/Collection\n 58: astore 6\n 60: iconst_0\n 61: istore 7\n 63: aload 5\n 65: invokeinterface #96, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 70: astore 8\n 72: aload 8\n 74: invokeinterface #102, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 79: ifeq 126\n 82: aload 8\n 84: invokeinterface #106, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 89: astore 9\n 91: aload 6\n 93: aload 9\n 95: checkcast #72 // class java/lang/String\n 98: astore 10\n 100: astore 14\n 102: iconst_0\n 103: istore 11\n 105: aload 10\n 107: invokestatic #110 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 110: nop\n 111: invokestatic #40 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 114: aload 14\n 116: swap\n 117: invokeinterface #114, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 122: pop\n 123: goto 72\n 126: aload 6\n 128: checkcast #42 // class java/util/List\n 131: nop\n 132: checkcast #92 // class java/util/Collection\n 135: invokestatic #118 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;\n 138: astore_2\n 139: new #82 // class java/util/ArrayList\n 142: dup\n 143: invokespecial #121 // Method java/util/ArrayList.\"<init>\":()V\n 146: checkcast #42 // class java/util/List\n 149: astore_3\n 150: aconst_null\n 151: astore 4\n 153: nop\n 154: aload_2\n 155: invokestatic #123 // Method redistribute:(Ljava/util/List;)V\n 158: aload_2\n 159: checkcast #18 // class java/lang/Iterable\n 162: astore 5\n 164: ldc #125 // String\n 166: astore 6\n 168: iconst_0\n 169: istore 7\n 171: aload 6\n 173: astore 8\n 175: aload 5\n 177: invokeinterface #96, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 182: astore 9\n 184: aload 9\n 186: invokeinterface #102, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 191: ifeq 250\n 194: aload 9\n 196: invokeinterface #106, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 201: astore 10\n 203: aload 8\n 205: aload 10\n 207: checkcast #30 // class java/lang/Number\n 210: invokevirtual #34 // Method java/lang/Number.intValue:()I\n 213: istore 11\n 215: astore 12\n 217: iconst_0\n 218: istore 13\n 220: new #127 // class java/lang/StringBuilder\n 223: dup\n 224: invokespecial #128 // Method java/lang/StringBuilder.\"<init>\":()V\n 227: aload 12\n 229: invokevirtual #132 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 232: iload 11\n 234: invokevirtual #135 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 237: bipush 32\n 239: invokevirtual #138 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 242: invokevirtual #142 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 245: astore 8\n 247: goto 184\n 250: aload 8\n 252: astore 4\n 254: aload_3\n 255: checkcast #18 // class java/lang/Iterable\n 258: astore 6\n 260: aload 6\n 262: invokeinterface #96, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 267: astore 7\n 269: aload 7\n 271: invokeinterface #102, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 276: ifeq 313\n 279: aload 7\n 281: invokeinterface #106, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 286: astore 8\n 288: aload 8\n 290: checkcast #72 // class java/lang/String\n 293: astore 9\n 295: iconst_0\n 296: istore 10\n 298: aload 9\n 300: aload 4\n 302: invokestatic #146 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 305: ifeq 269\n 308: aload 8\n 310: goto 314\n 313: aconst_null\n 314: ifnull 320\n 317: goto 332\n 320: aload_3\n 321: aload 4\n 323: invokeinterface #147, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 328: pop\n 329: goto 153\n 332: aload_3\n 333: invokeinterface #53, 1 // InterfaceMethod java/util/List.size:()I\n 338: aload_3\n 339: aload 4\n 341: invokeinterface #46, 2 // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I\n 346: isub\n 347: istore 5\n 349: new #127 // class java/lang/StringBuilder\n 352: dup\n 353: invokespecial #128 // Method java/lang/StringBuilder.\"<init>\":()V\n 356: ldc #149 // String Number of combinations:\n 358: invokevirtual #132 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 361: aload_3\n 362: invokeinterface #53, 1 // InterfaceMethod java/util/List.size:()I\n 367: iconst_1\n 368: iadd\n 369: invokevirtual #135 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 372: invokevirtual #142 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 375: getstatic #155 // Field java/lang/System.out:Ljava/io/PrintStream;\n 378: swap\n 379: invokevirtual #160 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 382: new #127 // class java/lang/StringBuilder\n 385: dup\n 386: invokespecial #128 // Method java/lang/StringBuilder.\"<init>\":()V\n 389: ldc #162 // String Loop size:\n 391: invokevirtual #132 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 394: iload 5\n 396: invokevirtual #135 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 399: invokevirtual #142 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 402: getstatic #155 // Field java/lang/System.out:Ljava/io/PrintStream;\n 405: swap\n 406: invokevirtual #160 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 409: return\n}\n", "javap_err": "" } ]
rfermontero__LalL-a-rLar__ca693f2/src/Parser.kt
fun parseGrammar(grammar: List<Pair<String, String>>) = getFirsts(grammar) fun getFirsts(grammar: List<Pair<String, String>>): Map<String, List<String>> = grammar.groupBy { it.first } .mapValues { it.value.map { it.second } } .mapValues { it.value.map { getFirsts(grammar.groupBy { it.first }.mapValues { it.value.map { it.second } }, it) }.flatten() } fun getFollows(grammar: List<Pair<String, String>>, firsts: Map<String, List<String>>) { } private fun getFirsts(mapByRules: Map<String, List<String>>, it: String): Collection<String> { return when { !mapByRules.containsKey(it.substringBefore(" ")) -> setOf(it.substringBefore(" ")) else -> mapByRules .filterKeys { key -> key == it } .values .flatten() .map { when { !mapByRules.containsKey(it.substringBefore(" ")) -> listOf(it) else -> getFirsts(mapByRules, it) } }.flatten() } }
[ { "class_path": "rfermontero__LalL-a-rLar__ca693f2/ParserKt.class", "javap": "Compiled from \"Parser.kt\"\npublic final class ParserKt {\n public static final java.util.Map<java.lang.String, java.util.List<java.lang.String>> parseGrammar(java.util.List<kotlin.Pair<java.lang.String, java.lang.String>>);\n Code:\n 0: aload_0\n 1: ldc #10 // String grammar\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokestatic #19 // Method getFirsts:(Ljava/util/List;)Ljava/util/Map;\n 10: areturn\n\n public static final java.util.Map<java.lang.String, java.util.List<java.lang.String>> getFirsts(java.util.List<kotlin.Pair<java.lang.String, java.lang.String>>);\n Code:\n 0: aload_0\n 1: ldc #10 // String grammar\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #22 // class java/lang/Iterable\n 10: astore_1\n 11: iconst_0\n 12: istore_2\n 13: aload_1\n 14: astore_3\n 15: new #24 // class java/util/LinkedHashMap\n 18: dup\n 19: invokespecial #28 // Method java/util/LinkedHashMap.\"<init>\":()V\n 22: checkcast #30 // class java/util/Map\n 25: astore 4\n 27: iconst_0\n 28: istore 5\n 30: aload_3\n 31: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 36: astore 6\n 38: aload 6\n 40: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 45: ifeq 153\n 48: aload 6\n 50: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 55: astore 7\n 57: aload 7\n 59: checkcast #46 // class kotlin/Pair\n 62: astore 8\n 64: iconst_0\n 65: istore 9\n 67: aload 8\n 69: invokevirtual #49 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 72: checkcast #51 // class java/lang/String\n 75: astore 10\n 77: aload 4\n 79: astore 11\n 81: iconst_0\n 82: istore 12\n 84: aload 11\n 86: aload 10\n 88: invokeinterface #55, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 93: astore 13\n 95: aload 13\n 97: ifnonnull 132\n 100: iconst_0\n 101: istore 14\n 103: new #57 // class java/util/ArrayList\n 106: dup\n 107: invokespecial #58 // Method java/util/ArrayList.\"<init>\":()V\n 110: checkcast #60 // class java/util/List\n 113: astore 14\n 115: aload 11\n 117: aload 10\n 119: aload 14\n 121: invokeinterface #64, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 126: pop\n 127: aload 14\n 129: goto 134\n 132: aload 13\n 134: nop\n 135: checkcast #60 // class java/util/List\n 138: astore 8\n 140: aload 8\n 142: aload 7\n 144: invokeinterface #68, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 149: pop\n 150: goto 38\n 153: aload 4\n 155: nop\n 156: astore_1\n 157: nop\n 158: iconst_0\n 159: istore_2\n 160: aload_1\n 161: astore_3\n 162: new #24 // class java/util/LinkedHashMap\n 165: dup\n 166: aload_1\n 167: invokeinterface #72, 1 // InterfaceMethod java/util/Map.size:()I\n 172: invokestatic #78 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 175: invokespecial #81 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 178: checkcast #30 // class java/util/Map\n 181: astore 4\n 183: iconst_0\n 184: istore 5\n 186: aload_3\n 187: invokeinterface #85, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 192: checkcast #22 // class java/lang/Iterable\n 195: astore 6\n 197: iconst_0\n 198: istore 7\n 200: aload 6\n 202: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 207: astore 8\n 209: aload 8\n 211: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 216: ifeq 393\n 219: aload 8\n 221: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 226: astore 9\n 228: aload 4\n 230: aload 9\n 232: checkcast #87 // class java/util/Map$Entry\n 235: astore 10\n 237: astore 11\n 239: iconst_0\n 240: istore 12\n 242: aload 10\n 244: invokeinterface #90, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 249: aload 11\n 251: swap\n 252: aload 9\n 254: checkcast #87 // class java/util/Map$Entry\n 257: astore 13\n 259: astore 53\n 261: astore 52\n 263: iconst_0\n 264: istore 14\n 266: aload 13\n 268: invokeinterface #93, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 273: checkcast #22 // class java/lang/Iterable\n 276: astore 15\n 278: iconst_0\n 279: istore 16\n 281: aload 15\n 283: astore 17\n 285: new #57 // class java/util/ArrayList\n 288: dup\n 289: aload 15\n 291: bipush 10\n 293: invokestatic #99 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 296: invokespecial #100 // Method java/util/ArrayList.\"<init>\":(I)V\n 299: checkcast #102 // class java/util/Collection\n 302: astore 18\n 304: iconst_0\n 305: istore 19\n 307: aload 17\n 309: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 314: astore 20\n 316: aload 20\n 318: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 323: ifeq 369\n 326: aload 20\n 328: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 333: astore 21\n 335: aload 18\n 337: aload 21\n 339: checkcast #46 // class kotlin/Pair\n 342: astore 22\n 344: astore 23\n 346: iconst_0\n 347: istore 24\n 349: aload 22\n 351: invokevirtual #105 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 354: checkcast #51 // class java/lang/String\n 357: aload 23\n 359: swap\n 360: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 365: pop\n 366: goto 316\n 369: aload 18\n 371: checkcast #60 // class java/util/List\n 374: nop\n 375: nop\n 376: astore 54\n 378: aload 52\n 380: aload 53\n 382: aload 54\n 384: invokeinterface #64, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 389: pop\n 390: goto 209\n 393: aload 4\n 395: nop\n 396: nop\n 397: astore_1\n 398: nop\n 399: iconst_0\n 400: istore_2\n 401: aload_1\n 402: astore_3\n 403: new #24 // class java/util/LinkedHashMap\n 406: dup\n 407: aload_1\n 408: invokeinterface #72, 1 // InterfaceMethod java/util/Map.size:()I\n 413: invokestatic #78 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 416: invokespecial #81 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 419: checkcast #30 // class java/util/Map\n 422: astore 4\n 424: iconst_0\n 425: istore 5\n 427: aload_3\n 428: invokeinterface #85, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 433: checkcast #22 // class java/lang/Iterable\n 436: astore 6\n 438: iconst_0\n 439: istore 7\n 441: aload 6\n 443: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 448: astore 8\n 450: aload 8\n 452: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 457: ifeq 1038\n 460: aload 8\n 462: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 467: astore 9\n 469: aload 4\n 471: aload 9\n 473: checkcast #87 // class java/util/Map$Entry\n 476: astore 10\n 478: astore 11\n 480: iconst_0\n 481: istore 12\n 483: aload 10\n 485: invokeinterface #90, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 490: aload 11\n 492: swap\n 493: aload 9\n 495: checkcast #87 // class java/util/Map$Entry\n 498: astore 13\n 500: astore 53\n 502: astore 52\n 504: iconst_0\n 505: istore 14\n 507: aload 13\n 509: invokeinterface #93, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 514: checkcast #22 // class java/lang/Iterable\n 517: astore 15\n 519: iconst_0\n 520: istore 16\n 522: aload 15\n 524: astore 17\n 526: new #57 // class java/util/ArrayList\n 529: dup\n 530: aload 15\n 532: bipush 10\n 534: invokestatic #99 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 537: invokespecial #100 // Method java/util/ArrayList.\"<init>\":(I)V\n 540: checkcast #102 // class java/util/Collection\n 543: astore 18\n 545: iconst_0\n 546: istore 19\n 548: aload 17\n 550: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 555: astore 20\n 557: aload 20\n 559: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 564: ifeq 1009\n 567: aload 20\n 569: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 574: astore 21\n 576: aload 18\n 578: aload 21\n 580: checkcast #51 // class java/lang/String\n 583: astore 22\n 585: astore 23\n 587: iconst_0\n 588: istore 24\n 590: aload_0\n 591: checkcast #22 // class java/lang/Iterable\n 594: astore 25\n 596: iconst_0\n 597: istore 26\n 599: aload 25\n 601: astore 27\n 603: new #24 // class java/util/LinkedHashMap\n 606: dup\n 607: invokespecial #28 // Method java/util/LinkedHashMap.\"<init>\":()V\n 610: checkcast #30 // class java/util/Map\n 613: astore 28\n 615: iconst_0\n 616: istore 29\n 618: aload 27\n 620: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 625: astore 30\n 627: aload 30\n 629: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 634: ifeq 742\n 637: aload 30\n 639: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 644: astore 31\n 646: aload 31\n 648: checkcast #46 // class kotlin/Pair\n 651: astore 32\n 653: iconst_0\n 654: istore 33\n 656: aload 32\n 658: invokevirtual #49 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 661: checkcast #51 // class java/lang/String\n 664: astore 34\n 666: aload 28\n 668: astore 35\n 670: iconst_0\n 671: istore 36\n 673: aload 35\n 675: aload 34\n 677: invokeinterface #55, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 682: astore 37\n 684: aload 37\n 686: ifnonnull 721\n 689: iconst_0\n 690: istore 38\n 692: new #57 // class java/util/ArrayList\n 695: dup\n 696: invokespecial #58 // Method java/util/ArrayList.\"<init>\":()V\n 699: checkcast #60 // class java/util/List\n 702: astore 38\n 704: aload 35\n 706: aload 34\n 708: aload 38\n 710: invokeinterface #64, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 715: pop\n 716: aload 38\n 718: goto 723\n 721: aload 37\n 723: nop\n 724: checkcast #60 // class java/util/List\n 727: astore 32\n 729: aload 32\n 731: aload 31\n 733: invokeinterface #68, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 738: pop\n 739: goto 627\n 742: aload 28\n 744: nop\n 745: astore 25\n 747: nop\n 748: iconst_0\n 749: istore 26\n 751: aload 25\n 753: astore 27\n 755: new #24 // class java/util/LinkedHashMap\n 758: dup\n 759: aload 25\n 761: invokeinterface #72, 1 // InterfaceMethod java/util/Map.size:()I\n 766: invokestatic #78 // Method kotlin/collections/MapsKt.mapCapacity:(I)I\n 769: invokespecial #81 // Method java/util/LinkedHashMap.\"<init>\":(I)V\n 772: checkcast #30 // class java/util/Map\n 775: astore 28\n 777: iconst_0\n 778: istore 29\n 780: aload 27\n 782: invokeinterface #85, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 787: checkcast #22 // class java/lang/Iterable\n 790: astore 30\n 792: iconst_0\n 793: istore 31\n 795: aload 30\n 797: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 802: astore 32\n 804: aload 32\n 806: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 811: ifeq 988\n 814: aload 32\n 816: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 821: astore 33\n 823: aload 28\n 825: aload 33\n 827: checkcast #87 // class java/util/Map$Entry\n 830: astore 34\n 832: astore 35\n 834: iconst_0\n 835: istore 36\n 837: aload 34\n 839: invokeinterface #90, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 844: aload 35\n 846: swap\n 847: aload 33\n 849: checkcast #87 // class java/util/Map$Entry\n 852: astore 37\n 854: astore 39\n 856: astore 40\n 858: iconst_0\n 859: istore 38\n 861: aload 37\n 863: invokeinterface #93, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 868: checkcast #22 // class java/lang/Iterable\n 871: astore 41\n 873: iconst_0\n 874: istore 42\n 876: aload 41\n 878: astore 43\n 880: new #57 // class java/util/ArrayList\n 883: dup\n 884: aload 41\n 886: bipush 10\n 888: invokestatic #99 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 891: invokespecial #100 // Method java/util/ArrayList.\"<init>\":(I)V\n 894: checkcast #102 // class java/util/Collection\n 897: astore 44\n 899: iconst_0\n 900: istore 45\n 902: aload 43\n 904: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 909: astore 46\n 911: aload 46\n 913: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 918: ifeq 964\n 921: aload 46\n 923: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 928: astore 47\n 930: aload 44\n 932: aload 47\n 934: checkcast #46 // class kotlin/Pair\n 937: astore 48\n 939: astore 49\n 941: iconst_0\n 942: istore 50\n 944: aload 48\n 946: invokevirtual #105 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 949: checkcast #51 // class java/lang/String\n 952: aload 49\n 954: swap\n 955: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 960: pop\n 961: goto 911\n 964: aload 44\n 966: checkcast #60 // class java/util/List\n 969: nop\n 970: nop\n 971: astore 51\n 973: aload 40\n 975: aload 39\n 977: aload 51\n 979: invokeinterface #64, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 984: pop\n 985: goto 804\n 988: aload 28\n 990: nop\n 991: nop\n 992: aload 22\n 994: invokestatic #109 // Method getFirsts:(Ljava/util/Map;Ljava/lang/String;)Ljava/util/Collection;\n 997: aload 23\n 999: swap\n 1000: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 1005: pop\n 1006: goto 557\n 1009: aload 18\n 1011: checkcast #60 // class java/util/List\n 1014: nop\n 1015: checkcast #22 // class java/lang/Iterable\n 1018: invokestatic #113 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 1021: astore 54\n 1023: aload 52\n 1025: aload 53\n 1027: aload 54\n 1029: invokeinterface #64, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 1034: pop\n 1035: goto 450\n 1038: aload 4\n 1040: nop\n 1041: nop\n 1042: areturn\n\n public static final void getFollows(java.util.List<kotlin.Pair<java.lang.String, java.lang.String>>, java.util.Map<java.lang.String, ? extends java.util.List<java.lang.String>>);\n Code:\n 0: aload_0\n 1: ldc #10 // String grammar\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #162 // String firsts\n 9: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: return\n\n private static final java.util.Collection<java.lang.String> getFirsts(java.util.Map<java.lang.String, ? extends java.util.List<java.lang.String>>, java.lang.String);\n Code:\n 0: nop\n 1: aload_0\n 2: aload_1\n 3: ldc #165 // String\n 5: aconst_null\n 6: iconst_2\n 7: aconst_null\n 8: invokestatic #171 // Method kotlin/text/StringsKt.substringBefore$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;\n 11: invokeinterface #174, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 16: ifne 37\n 19: aload_1\n 20: ldc #165 // String\n 22: aconst_null\n 23: iconst_2\n 24: aconst_null\n 25: invokestatic #171 // Method kotlin/text/StringsKt.substringBefore$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;\n 28: invokestatic #180 // Method kotlin/collections/SetsKt.setOf:(Ljava/lang/Object;)Ljava/util/Set;\n 31: checkcast #102 // class java/util/Collection\n 34: goto 287\n 37: aload_0\n 38: astore_2\n 39: nop\n 40: iconst_0\n 41: istore_3\n 42: new #24 // class java/util/LinkedHashMap\n 45: dup\n 46: invokespecial #28 // Method java/util/LinkedHashMap.\"<init>\":()V\n 49: astore 4\n 51: aload_2\n 52: invokeinterface #85, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 57: invokeinterface #183, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 62: astore 5\n 64: aload 5\n 66: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 71: ifeq 133\n 74: aload 5\n 76: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 81: checkcast #87 // class java/util/Map$Entry\n 84: astore 6\n 86: aload 6\n 88: invokeinterface #90, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 93: checkcast #51 // class java/lang/String\n 96: astore 7\n 98: iconst_0\n 99: istore 8\n 101: aload 7\n 103: aload_1\n 104: invokestatic #187 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 107: ifeq 64\n 110: aload 4\n 112: aload 6\n 114: invokeinterface #90, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 119: aload 6\n 121: invokeinterface #93, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 126: invokevirtual #188 // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 129: pop\n 130: goto 64\n 133: aload 4\n 135: checkcast #30 // class java/util/Map\n 138: invokeinterface #192, 1 // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;\n 143: checkcast #22 // class java/lang/Iterable\n 146: invokestatic #113 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 149: checkcast #22 // class java/lang/Iterable\n 152: astore_2\n 153: nop\n 154: iconst_0\n 155: istore_3\n 156: aload_2\n 157: astore 4\n 159: new #57 // class java/util/ArrayList\n 162: dup\n 163: aload_2\n 164: bipush 10\n 166: invokestatic #99 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 169: invokespecial #100 // Method java/util/ArrayList.\"<init>\":(I)V\n 172: checkcast #102 // class java/util/Collection\n 175: astore 5\n 177: iconst_0\n 178: istore 6\n 180: aload 4\n 182: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 187: astore 7\n 189: aload 7\n 191: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 196: ifeq 272\n 199: aload 7\n 201: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 206: astore 8\n 208: aload 5\n 210: aload 8\n 212: checkcast #51 // class java/lang/String\n 215: astore 9\n 217: astore 11\n 219: iconst_0\n 220: istore 10\n 222: nop\n 223: aload_0\n 224: aload 9\n 226: ldc #165 // String\n 228: aconst_null\n 229: iconst_2\n 230: aconst_null\n 231: invokestatic #171 // Method kotlin/text/StringsKt.substringBefore$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;\n 234: invokeinterface #174, 2 // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z\n 239: ifne 253\n 242: aload 9\n 244: invokestatic #196 // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;\n 247: checkcast #102 // class java/util/Collection\n 250: goto 259\n 253: aload_0\n 254: aload 9\n 256: invokestatic #109 // Method getFirsts:(Ljava/util/Map;Ljava/lang/String;)Ljava/util/Collection;\n 259: nop\n 260: aload 11\n 262: swap\n 263: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 268: pop\n 269: goto 189\n 272: aload 5\n 274: checkcast #60 // class java/util/List\n 277: nop\n 278: checkcast #22 // class java/lang/Iterable\n 281: invokestatic #113 // Method kotlin/collections/CollectionsKt.flatten:(Ljava/lang/Iterable;)Ljava/util/List;\n 284: checkcast #102 // class java/util/Collection\n 287: areturn\n}\n", "javap_err": "" } ]
KonstantinLukaschenko__genetic-algorithm-kotlin__e282854/src/GeneticAlgorithm.kt
import java.lang.Math.random /** * Implementation of a basic genetic algorithm, that is capable to generate solutions for optimization and search * problems relying on bio-inspired operations such as crossover, mutation and selection. * * @param T the type of an individual. * @property population a collection of individuals to start optimization. * @property score a function which scores the fitness of an individual. Higher fitness is better. * @property cross a function which implements the crossover of two individuals resulting in a child. * @property mutate a function which mutates a given individual. * @property select a function which implements a selection strategy of an individual from the population. */ class GeneticAlgorithm<T>( var population: Collection<T>, val score: (individual: T) -> Double, val cross: (parents: Pair<T, T>) -> T, val mutate: (individual: T) -> T, val select: (scoredPopulation: Collection<Pair<Double, T>>) -> T) { /** * Returns the best individual after the given number of optimization epochs. * * @param epochs number of optimization epochs. * @property mutationProbability a value between 0 and 1, which defines the mutation probability of each child. */ fun run(epochs: Int = 1000, mutationProbability: Double = 0.1): T { var scoredPopulation = population.map { Pair(score(it), it) }.sortedByDescending { it.first } for (i in 0..epochs) scoredPopulation = scoredPopulation .map { Pair(select(scoredPopulation), select(scoredPopulation)) } .map { cross(it) } .map { if (random() <= mutationProbability) mutate(it) else it } .map { Pair(score(it), it) } .sortedByDescending { it.first } return scoredPopulation.first().second } }
[ { "class_path": "KonstantinLukaschenko__genetic-algorithm-kotlin__e282854/GeneticAlgorithm$run$$inlined$sortedByDescending$2.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class GeneticAlgorithm$run$$inlined$sortedByDescending$2<T> implements java.util.Comparator {\n public GeneticAlgorithm$run$$inlined$sortedByDescending$2();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_2\n 1: checkcast #23 // class kotlin/Pair\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 12: checkcast #29 // class java/lang/Double\n 15: checkcast #31 // class java/lang/Comparable\n 18: aload_1\n 19: checkcast #23 // class kotlin/Pair\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 32: checkcast #29 // class java/lang/Double\n 35: aload 5\n 37: swap\n 38: checkcast #31 // class java/lang/Comparable\n 41: invokestatic #37 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" }, { "class_path": "KonstantinLukaschenko__genetic-algorithm-kotlin__e282854/GeneticAlgorithm$run$$inlined$sortedByDescending$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class GeneticAlgorithm$run$$inlined$sortedByDescending$1<T> implements java.util.Comparator {\n public GeneticAlgorithm$run$$inlined$sortedByDescending$1();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_2\n 1: checkcast #23 // class kotlin/Pair\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 12: checkcast #29 // class java/lang/Double\n 15: checkcast #31 // class java/lang/Comparable\n 18: aload_1\n 19: checkcast #23 // class kotlin/Pair\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 32: checkcast #29 // class java/lang/Double\n 35: aload 5\n 37: swap\n 38: checkcast #31 // class java/lang/Comparable\n 41: invokestatic #37 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" }, { "class_path": "KonstantinLukaschenko__genetic-algorithm-kotlin__e282854/GeneticAlgorithm.class", "javap": "Compiled from \"GeneticAlgorithm.kt\"\npublic final class GeneticAlgorithm<T> {\n private java.util.Collection<? extends T> population;\n\n private final kotlin.jvm.functions.Function1<T, java.lang.Double> score;\n\n private final kotlin.jvm.functions.Function1<kotlin.Pair<? extends T, ? extends T>, T> cross;\n\n private final kotlin.jvm.functions.Function1<T, T> mutate;\n\n private final kotlin.jvm.functions.Function1<java.util.Collection<? extends kotlin.Pair<java.lang.Double, ? extends T>>, T> select;\n\n public GeneticAlgorithm(java.util.Collection<? extends T>, kotlin.jvm.functions.Function1<? super T, java.lang.Double>, kotlin.jvm.functions.Function1<? super kotlin.Pair<? extends T, ? extends T>, ? extends T>, kotlin.jvm.functions.Function1<? super T, ? extends T>, kotlin.jvm.functions.Function1<? super java.util.Collection<? extends kotlin.Pair<java.lang.Double, ? extends T>>, ? extends T>);\n Code:\n 0: aload_1\n 1: ldc #11 // String population\n 3: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_2\n 7: ldc #19 // String score\n 9: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_3\n 13: ldc #21 // String cross\n 15: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 18: aload 4\n 20: ldc #23 // String mutate\n 22: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 25: aload 5\n 27: ldc #25 // String select\n 29: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 32: aload_0\n 33: invokespecial #28 // Method java/lang/Object.\"<init>\":()V\n 36: aload_0\n 37: aload_1\n 38: putfield #31 // Field population:Ljava/util/Collection;\n 41: aload_0\n 42: aload_2\n 43: putfield #34 // Field score:Lkotlin/jvm/functions/Function1;\n 46: aload_0\n 47: aload_3\n 48: putfield #36 // Field cross:Lkotlin/jvm/functions/Function1;\n 51: aload_0\n 52: aload 4\n 54: putfield #38 // Field mutate:Lkotlin/jvm/functions/Function1;\n 57: aload_0\n 58: aload 5\n 60: putfield #40 // Field select:Lkotlin/jvm/functions/Function1;\n 63: return\n\n public final java.util.Collection<T> getPopulation();\n Code:\n 0: aload_0\n 1: getfield #31 // Field population:Ljava/util/Collection;\n 4: areturn\n\n public final void setPopulation(java.util.Collection<? extends T>);\n Code:\n 0: aload_1\n 1: ldc #50 // String <set-?>\n 3: invokestatic #17 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: putfield #31 // Field population:Ljava/util/Collection;\n 11: return\n\n public final kotlin.jvm.functions.Function1<T, java.lang.Double> getScore();\n Code:\n 0: aload_0\n 1: getfield #34 // Field score:Lkotlin/jvm/functions/Function1;\n 4: areturn\n\n public final kotlin.jvm.functions.Function1<kotlin.Pair<? extends T, ? extends T>, T> getCross();\n Code:\n 0: aload_0\n 1: getfield #36 // Field cross:Lkotlin/jvm/functions/Function1;\n 4: areturn\n\n public final kotlin.jvm.functions.Function1<T, T> getMutate();\n Code:\n 0: aload_0\n 1: getfield #38 // Field mutate:Lkotlin/jvm/functions/Function1;\n 4: areturn\n\n public final kotlin.jvm.functions.Function1<java.util.Collection<? extends kotlin.Pair<java.lang.Double, ? extends T>>, T> getSelect();\n Code:\n 0: aload_0\n 1: getfield #40 // Field select:Lkotlin/jvm/functions/Function1;\n 4: areturn\n\n public final T run(int, double);\n Code:\n 0: aconst_null\n 1: astore 4\n 3: aload_0\n 4: getfield #31 // Field population:Ljava/util/Collection;\n 7: checkcast #64 // class java/lang/Iterable\n 10: astore 5\n 12: iconst_0\n 13: istore 6\n 15: aload 5\n 17: astore 7\n 19: new #66 // class java/util/ArrayList\n 22: dup\n 23: aload 5\n 25: bipush 10\n 27: invokestatic #72 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 30: invokespecial #75 // Method java/util/ArrayList.\"<init>\":(I)V\n 33: checkcast #77 // class java/util/Collection\n 36: astore 8\n 38: iconst_0\n 39: istore 9\n 41: aload 7\n 43: invokeinterface #81, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 48: astore 10\n 50: aload 10\n 52: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 57: ifeq 112\n 60: aload 10\n 62: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 67: astore 11\n 69: aload 8\n 71: aload 11\n 73: astore 12\n 75: astore 15\n 77: iconst_0\n 78: istore 13\n 80: new #93 // class kotlin/Pair\n 83: dup\n 84: aload_0\n 85: getfield #34 // Field score:Lkotlin/jvm/functions/Function1;\n 88: aload 12\n 90: invokeinterface #99, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 95: aload 12\n 97: invokespecial #102 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 100: aload 15\n 102: swap\n 103: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 108: pop\n 109: goto 50\n 112: aload 8\n 114: checkcast #108 // class java/util/List\n 117: nop\n 118: checkcast #64 // class java/lang/Iterable\n 121: astore 5\n 123: nop\n 124: iconst_0\n 125: istore 6\n 127: aload 5\n 129: new #110 // class GeneticAlgorithm$run$$inlined$sortedByDescending$1\n 132: dup\n 133: invokespecial #111 // Method GeneticAlgorithm$run$$inlined$sortedByDescending$1.\"<init>\":()V\n 136: checkcast #113 // class java/util/Comparator\n 139: invokestatic #117 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 142: astore 4\n 144: iconst_0\n 145: istore 5\n 147: iload 5\n 149: iload_1\n 150: if_icmpgt 651\n 153: aload 4\n 155: checkcast #64 // class java/lang/Iterable\n 158: astore 6\n 160: nop\n 161: iconst_0\n 162: istore 7\n 164: aload 6\n 166: astore 8\n 168: new #66 // class java/util/ArrayList\n 171: dup\n 172: aload 6\n 174: bipush 10\n 176: invokestatic #72 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 179: invokespecial #75 // Method java/util/ArrayList.\"<init>\":(I)V\n 182: checkcast #77 // class java/util/Collection\n 185: astore 9\n 187: iconst_0\n 188: istore 10\n 190: aload 8\n 192: invokeinterface #81, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 197: astore 11\n 199: aload 11\n 201: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 206: ifeq 273\n 209: aload 11\n 211: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 216: astore 12\n 218: aload 9\n 220: aload 12\n 222: checkcast #93 // class kotlin/Pair\n 225: astore 13\n 227: astore 15\n 229: iconst_0\n 230: istore 14\n 232: new #93 // class kotlin/Pair\n 235: dup\n 236: aload_0\n 237: getfield #40 // Field select:Lkotlin/jvm/functions/Function1;\n 240: aload 4\n 242: invokeinterface #99, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 247: aload_0\n 248: getfield #40 // Field select:Lkotlin/jvm/functions/Function1;\n 251: aload 4\n 253: invokeinterface #99, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 258: invokespecial #102 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 261: aload 15\n 263: swap\n 264: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 269: pop\n 270: goto 199\n 273: aload 9\n 275: checkcast #108 // class java/util/List\n 278: nop\n 279: checkcast #64 // class java/lang/Iterable\n 282: astore 6\n 284: nop\n 285: iconst_0\n 286: istore 7\n 288: aload 6\n 290: astore 8\n 292: new #66 // class java/util/ArrayList\n 295: dup\n 296: aload 6\n 298: bipush 10\n 300: invokestatic #72 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 303: invokespecial #75 // Method java/util/ArrayList.\"<init>\":(I)V\n 306: checkcast #77 // class java/util/Collection\n 309: astore 9\n 311: iconst_0\n 312: istore 10\n 314: aload 8\n 316: invokeinterface #81, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 321: astore 11\n 323: aload 11\n 325: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 330: ifeq 379\n 333: aload 11\n 335: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 340: astore 12\n 342: aload 9\n 344: aload 12\n 346: checkcast #93 // class kotlin/Pair\n 349: astore 13\n 351: astore 15\n 353: iconst_0\n 354: istore 14\n 356: aload_0\n 357: getfield #36 // Field cross:Lkotlin/jvm/functions/Function1;\n 360: aload 13\n 362: invokeinterface #99, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 367: aload 15\n 369: swap\n 370: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 375: pop\n 376: goto 323\n 379: aload 9\n 381: checkcast #108 // class java/util/List\n 384: nop\n 385: checkcast #64 // class java/lang/Iterable\n 388: astore 6\n 390: nop\n 391: iconst_0\n 392: istore 7\n 394: aload 6\n 396: astore 8\n 398: new #66 // class java/util/ArrayList\n 401: dup\n 402: aload 6\n 404: bipush 10\n 406: invokestatic #72 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 409: invokespecial #75 // Method java/util/ArrayList.\"<init>\":(I)V\n 412: checkcast #77 // class java/util/Collection\n 415: astore 9\n 417: iconst_0\n 418: istore 10\n 420: aload 8\n 422: invokeinterface #81, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 427: astore 11\n 429: aload 11\n 431: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 436: ifeq 495\n 439: aload 11\n 441: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 446: astore 12\n 448: aload 9\n 450: aload 12\n 452: astore 13\n 454: astore 15\n 456: iconst_0\n 457: istore 14\n 459: invokestatic #123 // Method java/lang/Math.random:()D\n 462: dload_2\n 463: dcmpg\n 464: ifgt 481\n 467: aload_0\n 468: getfield #38 // Field mutate:Lkotlin/jvm/functions/Function1;\n 471: aload 13\n 473: invokeinterface #99, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 478: goto 483\n 481: aload 13\n 483: aload 15\n 485: swap\n 486: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 491: pop\n 492: goto 429\n 495: aload 9\n 497: checkcast #108 // class java/util/List\n 500: nop\n 501: checkcast #64 // class java/lang/Iterable\n 504: astore 6\n 506: nop\n 507: iconst_0\n 508: istore 7\n 510: aload 6\n 512: astore 8\n 514: new #66 // class java/util/ArrayList\n 517: dup\n 518: aload 6\n 520: bipush 10\n 522: invokestatic #72 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 525: invokespecial #75 // Method java/util/ArrayList.\"<init>\":(I)V\n 528: checkcast #77 // class java/util/Collection\n 531: astore 9\n 533: iconst_0\n 534: istore 10\n 536: aload 8\n 538: invokeinterface #81, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 543: astore 11\n 545: aload 11\n 547: invokeinterface #87, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 552: ifeq 607\n 555: aload 11\n 557: invokeinterface #91, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 562: astore 12\n 564: aload 9\n 566: aload 12\n 568: astore 13\n 570: astore 15\n 572: iconst_0\n 573: istore 14\n 575: new #93 // class kotlin/Pair\n 578: dup\n 579: aload_0\n 580: getfield #34 // Field score:Lkotlin/jvm/functions/Function1;\n 583: aload 13\n 585: invokeinterface #99, 2 // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;\n 590: aload 13\n 592: invokespecial #102 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 595: aload 15\n 597: swap\n 598: invokeinterface #106, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 603: pop\n 604: goto 545\n 607: aload 9\n 609: checkcast #108 // class java/util/List\n 612: nop\n 613: checkcast #64 // class java/lang/Iterable\n 616: astore 6\n 618: nop\n 619: iconst_0\n 620: istore 7\n 622: aload 6\n 624: new #125 // class GeneticAlgorithm$run$$inlined$sortedByDescending$2\n 627: dup\n 628: invokespecial #126 // Method GeneticAlgorithm$run$$inlined$sortedByDescending$2.\"<init>\":()V\n 631: checkcast #113 // class java/util/Comparator\n 634: invokestatic #117 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;\n 637: astore 4\n 639: iload 5\n 641: iload_1\n 642: if_icmpeq 651\n 645: iinc 5, 1\n 648: goto 153\n 651: aload 4\n 653: invokestatic #130 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 656: checkcast #93 // class kotlin/Pair\n 659: invokevirtual #133 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 662: areturn\n\n public static java.lang.Object run$default(GeneticAlgorithm, int, double, int, java.lang.Object);\n Code:\n 0: iload 4\n 2: iconst_1\n 3: iand\n 4: ifeq 11\n 7: sipush 1000\n 10: istore_1\n 11: iload 4\n 13: iconst_2\n 14: iand\n 15: ifeq 22\n 18: ldc2_w #159 // double 0.1d\n 21: dstore_2\n 22: aload_0\n 23: iload_1\n 24: dload_2\n 25: invokevirtual #162 // Method run:(ID)Ljava/lang/Object;\n 28: areturn\n}\n", "javap_err": "" } ]
thalees__kotlin-code-challenges__3b499d2/9_nine/FallingBlocks.kt
import java.util.* private class Block(val l: Int, val r: Int) : Comparable<Block> { fun cover(c: Block) = l <= c.l && r >= c.r override fun compareTo(other: Block): Int = l.compareTo(other.l) } fun main() { val (n, d) = readLine()!!.split(" ").map { it.toInt() } val bh = arrayOfNulls<TreeSet<Block>>(n + 1) // blocks by height // Segment tree val tt = BooleanArray(4 * d) // terminal(leaf) node in segment tree val th = IntArray(4 * d) // max height in this segment tt[0] = true // Segment tree functions fun findMax(b: Block, i: Int, tl: Int, tr: Int): Int { if (tt[i] || b.l <= tl && b.r >= tr) return th[i] val tm = (tl + tr) / 2 return maxOf( if (b.l <= tm) findMax(b, 2 * i + 1, tl, tm) else 0, if (b.r > tm) findMax(b, 2 * i + 2, tm + 1, tr) else 0 ) } fun setLeaf(i: Int, h: Int) { tt[i] = true th[i] = h } fun place(b: Block, h: Int, i: Int, tl: Int, tr: Int) { if (b.l <= tl && b.r >= tr) return setLeaf(i, h) val tm = (tl + tr) / 2 val j1 = 2 * i + 1 val j2 = 2 * i + 2 if (tt[i]) { // split node tt[i] = false setLeaf(j1, th[i]) setLeaf(j2, th[i]) } if (b.l <= tm) place(b, h, j1, tl, tm) if (b.r > tm) place(b, h, j2, tm + 1, tr) th[i] = maxOf(th[j1], th[j2]) } // Simulate each incoming block & print answer var bc = 0 repeat(n) { val b = readLine()!!.split(" ").map { it.toInt() }.let{ (l, r) -> Block(l, r) } var maxH = findMax(b, 0, 1, d) while (true) { val bs = bh[maxH] ?: break var floor = bs.floor(b) if (floor != null && floor.r < b.l) floor = bs.higher(floor) if (floor == null) floor = bs.first() check(floor.l <= b.r) val list = bs.tailSet(floor).takeWhile { it.l <= b.r } if (!b.cover(list.first()) || !b.cover(list.last())) break for (c in list) bs -= c // don't use bs.removeAll(list) bc -= list.size maxH-- } val h = maxH + 1 place(b, h, 0, 1, d) val bs = bh[h] ?: run { TreeSet<Block>().also { bh[h] = it } } bs += b println(++bc) } }
[ { "class_path": "thalees__kotlin-code-challenges__3b499d2/FallingBlocksKt.class", "javap": "Compiled from \"FallingBlocks.kt\"\npublic final class FallingBlocksKt {\n public static final void main();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 3: dup\n 4: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 7: checkcast #20 // class java/lang/CharSequence\n 10: iconst_1\n 11: anewarray #22 // class java/lang/String\n 14: astore_1\n 15: aload_1\n 16: iconst_0\n 17: ldc #24 // String\n 19: aastore\n 20: aload_1\n 21: iconst_0\n 22: iconst_0\n 23: bipush 6\n 25: aconst_null\n 26: invokestatic #30 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 29: checkcast #32 // class java/lang/Iterable\n 32: astore_1\n 33: iconst_0\n 34: istore_2\n 35: aload_1\n 36: astore_3\n 37: new #34 // class java/util/ArrayList\n 40: dup\n 41: aload_1\n 42: bipush 10\n 44: invokestatic #40 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 47: invokespecial #44 // Method java/util/ArrayList.\"<init>\":(I)V\n 50: checkcast #46 // class java/util/Collection\n 53: astore 4\n 55: iconst_0\n 56: istore 5\n 58: aload_3\n 59: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 64: astore 6\n 66: aload 6\n 68: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 73: ifeq 120\n 76: aload 6\n 78: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 83: astore 7\n 85: aload 4\n 87: aload 7\n 89: checkcast #22 // class java/lang/String\n 92: astore 8\n 94: astore 23\n 96: iconst_0\n 97: istore 9\n 99: aload 8\n 101: invokestatic #66 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 104: nop\n 105: invokestatic #70 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 108: aload 23\n 110: swap\n 111: invokeinterface #74, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 116: pop\n 117: goto 66\n 120: aload 4\n 122: checkcast #76 // class java/util/List\n 125: nop\n 126: astore_0\n 127: aload_0\n 128: iconst_0\n 129: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 134: checkcast #82 // class java/lang/Number\n 137: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 140: istore_1\n 141: aload_0\n 142: iconst_1\n 143: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 148: checkcast #82 // class java/lang/Number\n 151: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 154: istore_2\n 155: iload_1\n 156: iconst_1\n 157: iadd\n 158: anewarray #88 // class java/util/TreeSet\n 161: astore_3\n 162: iconst_4\n 163: iload_2\n 164: imul\n 165: newarray boolean\n 167: astore 4\n 169: iconst_4\n 170: iload_2\n 171: imul\n 172: newarray int\n 174: astore 5\n 176: aload 4\n 178: iconst_0\n 179: iconst_1\n 180: bastore\n 181: iconst_0\n 182: istore 6\n 184: iconst_0\n 185: istore 7\n 187: iload 7\n 189: iload_1\n 190: if_icmpge 823\n 193: iload 7\n 195: istore 8\n 197: iconst_0\n 198: istore 9\n 200: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 203: dup\n 204: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 207: checkcast #20 // class java/lang/CharSequence\n 210: iconst_1\n 211: anewarray #22 // class java/lang/String\n 214: astore 10\n 216: aload 10\n 218: iconst_0\n 219: ldc #24 // String\n 221: aastore\n 222: aload 10\n 224: iconst_0\n 225: iconst_0\n 226: bipush 6\n 228: aconst_null\n 229: invokestatic #30 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 232: checkcast #32 // class java/lang/Iterable\n 235: astore 10\n 237: iconst_0\n 238: istore 11\n 240: aload 10\n 242: astore 12\n 244: new #34 // class java/util/ArrayList\n 247: dup\n 248: aload 10\n 250: bipush 10\n 252: invokestatic #40 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 255: invokespecial #44 // Method java/util/ArrayList.\"<init>\":(I)V\n 258: checkcast #46 // class java/util/Collection\n 261: astore 13\n 263: iconst_0\n 264: istore 14\n 266: aload 12\n 268: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 273: astore 15\n 275: aload 15\n 277: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 282: ifeq 329\n 285: aload 15\n 287: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 292: astore 16\n 294: aload 13\n 296: aload 16\n 298: checkcast #22 // class java/lang/String\n 301: astore 17\n 303: astore 18\n 305: iconst_0\n 306: istore 19\n 308: aload 17\n 310: invokestatic #66 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 313: nop\n 314: invokestatic #70 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 317: aload 18\n 319: swap\n 320: invokeinterface #74, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 325: pop\n 326: goto 275\n 329: aload 13\n 331: checkcast #76 // class java/util/List\n 334: nop\n 335: astore 11\n 337: iconst_0\n 338: istore 12\n 340: aload 11\n 342: iconst_0\n 343: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 348: checkcast #82 // class java/lang/Number\n 351: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 354: istore 13\n 356: aload 11\n 358: iconst_1\n 359: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 364: checkcast #82 // class java/lang/Number\n 367: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 370: istore 14\n 372: new #90 // class Block\n 375: dup\n 376: iload 13\n 378: iload 14\n 380: invokespecial #93 // Method Block.\"<init>\":(II)V\n 383: nop\n 384: astore 20\n 386: aload 4\n 388: aload 5\n 390: aload 20\n 392: iconst_0\n 393: iconst_1\n 394: iload_2\n 395: invokestatic #97 // Method main$findMax:([Z[ILBlock;III)I\n 398: istore 10\n 400: nop\n 401: aload_3\n 402: iload 10\n 404: aaload\n 405: dup\n 406: ifnonnull 413\n 409: pop\n 410: goto 725\n 413: astore 11\n 415: aload 11\n 417: aload 20\n 419: invokevirtual #101 // Method java/util/TreeSet.floor:(Ljava/lang/Object;)Ljava/lang/Object;\n 422: checkcast #90 // class Block\n 425: astore 12\n 427: aload 12\n 429: ifnull 457\n 432: aload 12\n 434: invokevirtual #104 // Method Block.getR:()I\n 437: aload 20\n 439: invokevirtual #107 // Method Block.getL:()I\n 442: if_icmpge 457\n 445: aload 11\n 447: aload 12\n 449: invokevirtual #110 // Method java/util/TreeSet.higher:(Ljava/lang/Object;)Ljava/lang/Object;\n 452: checkcast #90 // class Block\n 455: astore 12\n 457: aload 12\n 459: ifnonnull 472\n 462: aload 11\n 464: invokevirtual #113 // Method java/util/TreeSet.first:()Ljava/lang/Object;\n 467: checkcast #90 // class Block\n 470: astore 12\n 472: aload 12\n 474: invokevirtual #107 // Method Block.getL:()I\n 477: aload 20\n 479: invokevirtual #104 // Method Block.getR:()I\n 482: if_icmpgt 489\n 485: iconst_1\n 486: goto 490\n 489: iconst_0\n 490: ifne 503\n 493: new #115 // class java/lang/IllegalStateException\n 496: dup\n 497: ldc #117 // String Check failed.\n 499: invokespecial #120 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 502: athrow\n 503: aload 11\n 505: aload 12\n 507: invokevirtual #124 // Method java/util/TreeSet.tailSet:(Ljava/lang/Object;)Ljava/util/SortedSet;\n 510: dup\n 511: ldc #126 // String tailSet(...)\n 513: invokestatic #130 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 516: checkcast #32 // class java/lang/Iterable\n 519: astore 14\n 521: iconst_0\n 522: istore 15\n 524: new #34 // class java/util/ArrayList\n 527: dup\n 528: invokespecial #132 // Method java/util/ArrayList.\"<init>\":()V\n 531: astore 16\n 533: aload 14\n 535: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 540: astore 17\n 542: aload 17\n 544: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 549: ifeq 606\n 552: aload 17\n 554: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 559: astore 19\n 561: aload 19\n 563: checkcast #90 // class Block\n 566: astore 21\n 568: iconst_0\n 569: istore 22\n 571: aload 21\n 573: invokevirtual #107 // Method Block.getL:()I\n 576: aload 20\n 578: invokevirtual #104 // Method Block.getR:()I\n 581: if_icmpgt 588\n 584: iconst_1\n 585: goto 589\n 588: iconst_0\n 589: ifne 595\n 592: goto 606\n 595: aload 16\n 597: aload 19\n 599: invokevirtual #133 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z\n 602: pop\n 603: goto 542\n 606: aload 16\n 608: checkcast #76 // class java/util/List\n 611: astore 13\n 613: aload 20\n 615: aload 13\n 617: invokestatic #136 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 620: dup\n 621: ldc #138 // String first(...)\n 623: invokestatic #130 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 626: checkcast #90 // class Block\n 629: invokevirtual #142 // Method Block.cover:(LBlock;)Z\n 632: ifeq 725\n 635: aload 20\n 637: aload 13\n 639: invokestatic #145 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 642: dup\n 643: ldc #147 // String last(...)\n 645: invokestatic #130 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 648: checkcast #90 // class Block\n 651: invokevirtual #142 // Method Block.cover:(LBlock;)Z\n 654: ifne 660\n 657: goto 725\n 660: aload 13\n 662: invokeinterface #148, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 667: astore 14\n 669: aload 14\n 671: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 676: ifeq 707\n 679: aload 14\n 681: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 686: checkcast #90 // class Block\n 689: astore 15\n 691: aload 11\n 693: checkcast #46 // class java/util/Collection\n 696: aload 15\n 698: invokeinterface #151, 2 // InterfaceMethod java/util/Collection.remove:(Ljava/lang/Object;)Z\n 703: pop\n 704: goto 669\n 707: iload 6\n 709: aload 13\n 711: invokeinterface #154, 1 // InterfaceMethod java/util/List.size:()I\n 716: isub\n 717: istore 6\n 719: iinc 10, -1\n 722: goto 400\n 725: iload 10\n 727: iconst_1\n 728: iadd\n 729: istore 11\n 731: aload 4\n 733: aload 5\n 735: aload 20\n 737: iload 11\n 739: iconst_0\n 740: iconst_1\n 741: iload_2\n 742: invokestatic #158 // Method main$place:([Z[ILBlock;IIII)V\n 745: aload_3\n 746: iload 11\n 748: aaload\n 749: dup\n 750: ifnonnull 783\n 753: pop\n 754: iconst_0\n 755: istore 14\n 757: new #88 // class java/util/TreeSet\n 760: dup\n 761: invokespecial #159 // Method java/util/TreeSet.\"<init>\":()V\n 764: astore 15\n 766: aload 15\n 768: astore 16\n 770: iconst_0\n 771: istore 17\n 773: aload_3\n 774: iload 11\n 776: aload 16\n 778: aastore\n 779: aload 15\n 781: nop\n 782: nop\n 783: astore 12\n 785: aload 12\n 787: checkcast #46 // class java/util/Collection\n 790: aload 20\n 792: invokeinterface #74, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 797: pop\n 798: iload 6\n 800: iconst_1\n 801: iadd\n 802: istore 6\n 804: iload 6\n 806: istore 13\n 808: getstatic #165 // Field java/lang/System.out:Ljava/io/PrintStream;\n 811: iload 13\n 813: invokevirtual #170 // Method java/io/PrintStream.println:(I)V\n 816: nop\n 817: iinc 7, 1\n 820: goto 187\n 823: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #220 // Method main:()V\n 3: return\n\n private static final int main$findMax(boolean[], int[], Block, int, int, int);\n Code:\n 0: aload_0\n 1: iload_3\n 2: baload\n 3: ifne 24\n 6: aload_2\n 7: invokevirtual #107 // Method Block.getL:()I\n 10: iload 4\n 12: if_icmpgt 28\n 15: aload_2\n 16: invokevirtual #104 // Method Block.getR:()I\n 19: iload 5\n 21: if_icmplt 28\n 24: aload_1\n 25: iload_3\n 26: iaload\n 27: ireturn\n 28: iload 4\n 30: iload 5\n 32: iadd\n 33: iconst_2\n 34: idiv\n 35: istore 6\n 37: nop\n 38: aload_2\n 39: invokevirtual #107 // Method Block.getL:()I\n 42: iload 6\n 44: if_icmpgt 65\n 47: aload_0\n 48: aload_1\n 49: aload_2\n 50: iconst_2\n 51: iload_3\n 52: imul\n 53: iconst_1\n 54: iadd\n 55: iload 4\n 57: iload 6\n 59: invokestatic #97 // Method main$findMax:([Z[ILBlock;III)I\n 62: goto 66\n 65: iconst_0\n 66: aload_2\n 67: invokevirtual #104 // Method Block.getR:()I\n 70: iload 6\n 72: if_icmple 95\n 75: aload_0\n 76: aload_1\n 77: aload_2\n 78: iconst_2\n 79: iload_3\n 80: imul\n 81: iconst_2\n 82: iadd\n 83: iload 6\n 85: iconst_1\n 86: iadd\n 87: iload 5\n 89: invokestatic #97 // Method main$findMax:([Z[ILBlock;III)I\n 92: goto 96\n 95: iconst_0\n 96: invokestatic #228 // Method java/lang/Math.max:(II)I\n 99: ireturn\n\n private static final void main$setLeaf(boolean[], int[], int, int);\n Code:\n 0: aload_0\n 1: iload_2\n 2: iconst_1\n 3: bastore\n 4: aload_1\n 5: iload_2\n 6: iload_3\n 7: iastore\n 8: return\n\n private static final void main$place(boolean[], int[], Block, int, int, int, int);\n Code:\n 0: aload_2\n 1: invokevirtual #107 // Method Block.getL:()I\n 4: iload 5\n 6: if_icmpgt 27\n 9: aload_2\n 10: invokevirtual #104 // Method Block.getR:()I\n 13: iload 6\n 15: if_icmplt 27\n 18: aload_0\n 19: aload_1\n 20: iload 4\n 22: iload_3\n 23: invokestatic #236 // Method main$setLeaf:([Z[III)V\n 26: return\n 27: iload 5\n 29: iload 6\n 31: iadd\n 32: iconst_2\n 33: idiv\n 34: istore 7\n 36: iconst_2\n 37: iload 4\n 39: imul\n 40: iconst_1\n 41: iadd\n 42: istore 8\n 44: iconst_2\n 45: iload 4\n 47: imul\n 48: iconst_2\n 49: iadd\n 50: istore 9\n 52: aload_0\n 53: iload 4\n 55: baload\n 56: ifeq 86\n 59: aload_0\n 60: iload 4\n 62: iconst_0\n 63: bastore\n 64: aload_0\n 65: aload_1\n 66: iload 8\n 68: aload_1\n 69: iload 4\n 71: iaload\n 72: invokestatic #236 // Method main$setLeaf:([Z[III)V\n 75: aload_0\n 76: aload_1\n 77: iload 9\n 79: aload_1\n 80: iload 4\n 82: iaload\n 83: invokestatic #236 // Method main$setLeaf:([Z[III)V\n 86: aload_2\n 87: invokevirtual #107 // Method Block.getL:()I\n 90: iload 7\n 92: if_icmpgt 108\n 95: aload_0\n 96: aload_1\n 97: aload_2\n 98: iload_3\n 99: iload 8\n 101: iload 5\n 103: iload 7\n 105: invokestatic #158 // Method main$place:([Z[ILBlock;IIII)V\n 108: aload_2\n 109: invokevirtual #104 // Method Block.getR:()I\n 112: iload 7\n 114: if_icmple 132\n 117: aload_0\n 118: aload_1\n 119: aload_2\n 120: iload_3\n 121: iload 9\n 123: iload 7\n 125: iconst_1\n 126: iadd\n 127: iload 6\n 129: invokestatic #158 // Method main$place:([Z[ILBlock;IIII)V\n 132: aload_1\n 133: iload 4\n 135: aload_1\n 136: iload 8\n 138: iaload\n 139: aload_1\n 140: iload 9\n 142: iaload\n 143: invokestatic #228 // Method java/lang/Math.max:(II)I\n 146: iastore\n 147: return\n}\n", "javap_err": "" } ]
thalees__kotlin-code-challenges__3b499d2/8_eight/PaintString.kt
fun main() { class Ans(val a: String, val m: String) repeat(readLine()!!.toInt()) { val s = readLine()!! val n = s.length val dp = Array(n) { i -> arrayOfNulls<Ans>(i + 1) } dp[0][0] = Ans(s.substring(0, 1), "R") var best = Ans(s, "") fun updateBest(p: Ans) { if (p.a <= best.a) best = p } fun updateDP(i: Int, j: Int, p: Ans) { val cur = dp[i][j] if (cur == null || p.a < cur.a) dp[i][j] = p } for (i in 1 until n) { for (j in 0 until i) { val p = dp[i - 1][j] ?: continue updateDP(i, j, Ans(p.a + s[i], p.m + "R")) if (j >= i - j) continue if (s[i] == p.a[j]) updateDP(i, j + 1, Ans(p.a, p.m + "B")) if (s[i] < p.a[j]) updateBest(Ans(p.a, p.m + "B".repeat(n - i))) } } for (p in dp[n - 1]) if (p != null) updateBest(p) println(best.m) } }
[ { "class_path": "thalees__kotlin-code-challenges__3b499d2/PaintStringKt$main$Ans.class", "javap": "Compiled from \"PaintString.kt\"\npublic final class PaintStringKt$main$Ans {\n private final java.lang.String a;\n\n private final java.lang.String m;\n\n public PaintStringKt$main$Ans(java.lang.String, java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #8 // String a\n 3: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_2\n 7: ldc #16 // String m\n 9: invokestatic #14 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_0\n 13: invokespecial #19 // Method java/lang/Object.\"<init>\":()V\n 16: aload_0\n 17: aload_1\n 18: putfield #22 // Field a:Ljava/lang/String;\n 21: aload_0\n 22: aload_2\n 23: putfield #24 // Field m:Ljava/lang/String;\n 26: return\n\n public final java.lang.String getA();\n Code:\n 0: aload_0\n 1: getfield #22 // Field a:Ljava/lang/String;\n 4: areturn\n\n public final java.lang.String getM();\n Code:\n 0: aload_0\n 1: getfield #24 // Field m:Ljava/lang/String;\n 4: areturn\n}\n", "javap_err": "" }, { "class_path": "thalees__kotlin-code-challenges__3b499d2/PaintStringKt.class", "javap": "Compiled from \"PaintString.kt\"\npublic final class PaintStringKt {\n public static final void main();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 3: dup\n 4: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 7: invokestatic #24 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 10: istore_0\n 11: iconst_0\n 12: istore_1\n 13: iload_1\n 14: iload_0\n 15: if_icmpge 477\n 18: iload_1\n 19: istore_2\n 20: iconst_0\n 21: istore_3\n 22: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 25: dup\n 26: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 29: astore 4\n 31: aload 4\n 33: invokevirtual #30 // Method java/lang/String.length:()I\n 36: istore 5\n 38: iconst_0\n 39: istore 6\n 41: iload 5\n 43: anewarray #32 // class \"[LPaintStringKt$main$Ans;\"\n 46: astore 7\n 48: iload 6\n 50: iload 5\n 52: if_icmpge 77\n 55: iload 6\n 57: istore 8\n 59: aload 7\n 61: iload 8\n 63: iload 8\n 65: iconst_1\n 66: iadd\n 67: anewarray #34 // class PaintStringKt$main$Ans\n 70: aastore\n 71: iinc 6, 1\n 74: goto 48\n 77: aload 7\n 79: astore 9\n 81: aload 9\n 83: iconst_0\n 84: aaload\n 85: iconst_0\n 86: new #34 // class PaintStringKt$main$Ans\n 89: dup\n 90: aload 4\n 92: iconst_0\n 93: iconst_1\n 94: invokevirtual #38 // Method java/lang/String.substring:(II)Ljava/lang/String;\n 97: dup\n 98: ldc #40 // String substring(...)\n 100: invokestatic #44 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 103: ldc #46 // String R\n 105: invokespecial #50 // Method PaintStringKt$main$Ans.\"<init>\":(Ljava/lang/String;Ljava/lang/String;)V\n 108: aastore\n 109: new #52 // class kotlin/jvm/internal/Ref$ObjectRef\n 112: dup\n 113: invokespecial #54 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 116: astore 6\n 118: aload 6\n 120: new #34 // class PaintStringKt$main$Ans\n 123: dup\n 124: aload 4\n 126: ldc #56 // String\n 128: invokespecial #50 // Method PaintStringKt$main$Ans.\"<init>\":(Ljava/lang/String;Ljava/lang/String;)V\n 131: putfield #60 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 134: iconst_1\n 135: istore 7\n 137: iload 7\n 139: iload 5\n 141: if_icmpge 403\n 144: iconst_0\n 145: istore 8\n 147: iload 8\n 149: iload 7\n 151: if_icmpge 397\n 154: aload 9\n 156: iload 7\n 158: iconst_1\n 159: isub\n 160: aaload\n 161: iload 8\n 163: aaload\n 164: dup\n 165: ifnonnull 172\n 168: pop\n 169: goto 391\n 172: astore 10\n 174: aload 9\n 176: iload 7\n 178: iload 8\n 180: new #34 // class PaintStringKt$main$Ans\n 183: dup\n 184: new #62 // class java/lang/StringBuilder\n 187: dup\n 188: invokespecial #63 // Method java/lang/StringBuilder.\"<init>\":()V\n 191: aload 10\n 193: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 196: invokevirtual #70 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 199: aload 4\n 201: iload 7\n 203: invokevirtual #74 // Method java/lang/String.charAt:(I)C\n 206: invokevirtual #77 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 209: invokevirtual #80 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 212: new #62 // class java/lang/StringBuilder\n 215: dup\n 216: invokespecial #63 // Method java/lang/StringBuilder.\"<init>\":()V\n 219: aload 10\n 221: invokevirtual #83 // Method PaintStringKt$main$Ans.getM:()Ljava/lang/String;\n 224: invokevirtual #70 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 227: bipush 82\n 229: invokevirtual #77 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 232: invokevirtual #80 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 235: invokespecial #50 // Method PaintStringKt$main$Ans.\"<init>\":(Ljava/lang/String;Ljava/lang/String;)V\n 238: invokestatic #87 // Method main$lambda$0$updateDP:([[LPaintStringKt$main$Ans;IILPaintStringKt$main$Ans;)V\n 241: iload 8\n 243: iload 7\n 245: iload 8\n 247: isub\n 248: if_icmpge 391\n 251: aload 4\n 253: iload 7\n 255: invokevirtual #74 // Method java/lang/String.charAt:(I)C\n 258: aload 10\n 260: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 263: iload 8\n 265: invokevirtual #74 // Method java/lang/String.charAt:(I)C\n 268: if_icmpne 317\n 271: aload 9\n 273: iload 7\n 275: iload 8\n 277: iconst_1\n 278: iadd\n 279: new #34 // class PaintStringKt$main$Ans\n 282: dup\n 283: aload 10\n 285: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 288: new #62 // class java/lang/StringBuilder\n 291: dup\n 292: invokespecial #63 // Method java/lang/StringBuilder.\"<init>\":()V\n 295: aload 10\n 297: invokevirtual #83 // Method PaintStringKt$main$Ans.getM:()Ljava/lang/String;\n 300: invokevirtual #70 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 303: bipush 66\n 305: invokevirtual #77 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 308: invokevirtual #80 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 311: invokespecial #50 // Method PaintStringKt$main$Ans.\"<init>\":(Ljava/lang/String;Ljava/lang/String;)V\n 314: invokestatic #87 // Method main$lambda$0$updateDP:([[LPaintStringKt$main$Ans;IILPaintStringKt$main$Ans;)V\n 317: aload 4\n 319: iload 7\n 321: invokevirtual #74 // Method java/lang/String.charAt:(I)C\n 324: aload 10\n 326: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 329: iload 8\n 331: invokevirtual #74 // Method java/lang/String.charAt:(I)C\n 334: invokestatic #91 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I\n 337: ifge 391\n 340: aload 6\n 342: new #34 // class PaintStringKt$main$Ans\n 345: dup\n 346: aload 10\n 348: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 351: new #62 // class java/lang/StringBuilder\n 354: dup\n 355: invokespecial #63 // Method java/lang/StringBuilder.\"<init>\":()V\n 358: aload 10\n 360: invokevirtual #83 // Method PaintStringKt$main$Ans.getM:()Ljava/lang/String;\n 363: invokevirtual #70 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 366: ldc #93 // String B\n 368: checkcast #95 // class java/lang/CharSequence\n 371: iload 5\n 373: iload 7\n 375: isub\n 376: invokestatic #101 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;\n 379: invokevirtual #70 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 382: invokevirtual #80 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 385: invokespecial #50 // Method PaintStringKt$main$Ans.\"<init>\":(Ljava/lang/String;Ljava/lang/String;)V\n 388: invokestatic #105 // Method main$lambda$0$updateBest:(Lkotlin/jvm/internal/Ref$ObjectRef;LPaintStringKt$main$Ans;)V\n 391: iinc 8, 1\n 394: goto 147\n 397: iinc 7, 1\n 400: goto 137\n 403: aload 9\n 405: iload 5\n 407: iconst_1\n 408: isub\n 409: aaload\n 410: astore 7\n 412: iconst_0\n 413: istore 8\n 415: aload 7\n 417: arraylength\n 418: istore 10\n 420: iload 8\n 422: iload 10\n 424: if_icmpge 452\n 427: aload 7\n 429: iload 8\n 431: aaload\n 432: astore 11\n 434: aload 11\n 436: ifnull 446\n 439: aload 6\n 441: aload 11\n 443: invokestatic #105 // Method main$lambda$0$updateBest:(Lkotlin/jvm/internal/Ref$ObjectRef;LPaintStringKt$main$Ans;)V\n 446: iinc 8, 1\n 449: goto 420\n 452: aload 6\n 454: getfield #60 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 457: checkcast #34 // class PaintStringKt$main$Ans\n 460: invokevirtual #83 // Method PaintStringKt$main$Ans.getM:()Ljava/lang/String;\n 463: getstatic #111 // Field java/lang/System.out:Ljava/io/PrintStream;\n 466: swap\n 467: invokevirtual #116 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 470: nop\n 471: iinc 1, 1\n 474: goto 13\n 477: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #134 // Method main:()V\n 3: return\n\n private static final void main$lambda$0$updateBest(kotlin.jvm.internal.Ref$ObjectRef<PaintStringKt$main$Ans>, PaintStringKt$main$Ans);\n Code:\n 0: aload_1\n 1: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 4: aload_0\n 5: getfield #60 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 8: checkcast #34 // class PaintStringKt$main$Ans\n 11: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 14: invokevirtual #140 // Method java/lang/String.compareTo:(Ljava/lang/String;)I\n 17: ifgt 25\n 20: aload_0\n 21: aload_1\n 22: putfield #60 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 25: return\n\n private static final void main$lambda$0$updateDP(PaintStringKt$main$Ans[][], int, int, PaintStringKt$main$Ans);\n Code:\n 0: aload_0\n 1: iload_1\n 2: aaload\n 3: iload_2\n 4: aaload\n 5: astore 4\n 7: aload 4\n 9: ifnull 27\n 12: aload_3\n 13: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 16: aload 4\n 18: invokevirtual #66 // Method PaintStringKt$main$Ans.getA:()Ljava/lang/String;\n 21: invokevirtual #140 // Method java/lang/String.compareTo:(Ljava/lang/String;)I\n 24: ifge 33\n 27: aload_0\n 28: iload_1\n 29: aaload\n 30: iload_2\n 31: aload_3\n 32: aastore\n 33: return\n}\n", "javap_err": "" } ]
thalees__kotlin-code-challenges__3b499d2/6_six/MovieFan.kt
import java.util.* fun main() { repeat(readLine()!!.toInt()) { // readLine() // skip empty line solveCase() } } private data class Mv(val i: Int, val a: Int, val b: Int, var t: Int = 0) : Comparable<Mv> { override fun compareTo(other: Mv): Int = if (b != other.b) b.compareTo(other.b) else i.compareTo(other.i) } private fun solveCase() { val (n, m) = readLine()!!.split(" ").map { it.toInt() } val d = Array(n) { i -> readLine()!!.split(" ").map { it.toInt() }.let { (a, b) -> Mv(i, a, b) } } d.sortBy { it.a } var t = 0 val w = TreeSet<Mv>() fun advance(to: Int) { while (t < to && !w.isEmpty()) { repeat(minOf(w.size, m)) { val v = w.first() v.t = t w -= v } t++ } t = to } for (v in d) { advance(v.a) w += v } advance(Int.MAX_VALUE) d.sortBy { it.i } println(maxOf(0, d.map { it.t - it.b }.max()!!)) println(d.joinToString(" ") { it.t.toString() }) }
[ { "class_path": "thalees__kotlin-code-challenges__3b499d2/MovieFanKt$solveCase$$inlined$sortBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class MovieFanKt$solveCase$$inlined$sortBy$1<T> implements java.util.Comparator {\n public MovieFanKt$solveCase$$inlined$sortBy$1();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_1\n 1: checkcast #23 // class Mv\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method Mv.getA:()I\n 12: invokestatic #33 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 15: checkcast #35 // class java/lang/Comparable\n 18: aload_2\n 19: checkcast #23 // class Mv\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method Mv.getA:()I\n 32: invokestatic #33 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 35: aload 5\n 37: swap\n 38: checkcast #35 // class java/lang/Comparable\n 41: invokestatic #41 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" }, { "class_path": "thalees__kotlin-code-challenges__3b499d2/MovieFanKt.class", "javap": "Compiled from \"MovieFan.kt\"\npublic final class MovieFanKt {\n public static final void main();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 3: dup\n 4: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 7: invokestatic #24 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 10: istore_0\n 11: iconst_0\n 12: istore_1\n 13: iload_1\n 14: iload_0\n 15: if_icmpge 32\n 18: iload_1\n 19: istore_2\n 20: iconst_0\n 21: istore_3\n 22: invokestatic #27 // Method solveCase:()V\n 25: nop\n 26: iinc 1, 1\n 29: goto 13\n 32: return\n\n private static final void solveCase();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 3: dup\n 4: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 7: checkcast #32 // class java/lang/CharSequence\n 10: iconst_1\n 11: anewarray #34 // class java/lang/String\n 14: astore_1\n 15: aload_1\n 16: iconst_0\n 17: ldc #36 // String\n 19: aastore\n 20: aload_1\n 21: iconst_0\n 22: iconst_0\n 23: bipush 6\n 25: aconst_null\n 26: invokestatic #42 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 29: checkcast #44 // class java/lang/Iterable\n 32: astore_1\n 33: iconst_0\n 34: istore_2\n 35: aload_1\n 36: astore_3\n 37: new #46 // class java/util/ArrayList\n 40: dup\n 41: aload_1\n 42: bipush 10\n 44: invokestatic #52 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 47: invokespecial #56 // Method java/util/ArrayList.\"<init>\":(I)V\n 50: checkcast #58 // class java/util/Collection\n 53: astore 4\n 55: iconst_0\n 56: istore 5\n 58: aload_3\n 59: invokeinterface #62, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 64: astore 6\n 66: aload 6\n 68: invokeinterface #68, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 73: ifeq 120\n 76: aload 6\n 78: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 83: astore 7\n 85: aload 4\n 87: aload 7\n 89: checkcast #34 // class java/lang/String\n 92: astore 8\n 94: astore 17\n 96: iconst_0\n 97: istore 9\n 99: aload 8\n 101: invokestatic #24 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 104: nop\n 105: invokestatic #76 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 108: aload 17\n 110: swap\n 111: invokeinterface #80, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 116: pop\n 117: goto 66\n 120: aload 4\n 122: checkcast #82 // class java/util/List\n 125: nop\n 126: astore_0\n 127: aload_0\n 128: iconst_0\n 129: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 134: checkcast #88 // class java/lang/Number\n 137: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 140: istore_1\n 141: aload_0\n 142: iconst_1\n 143: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 148: checkcast #88 // class java/lang/Number\n 151: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 154: istore_2\n 155: iconst_0\n 156: istore 4\n 158: iload_1\n 159: anewarray #94 // class Mv\n 162: astore 5\n 164: iload 4\n 166: iload_1\n 167: if_icmpge 398\n 170: iload 4\n 172: istore 6\n 174: aload 5\n 176: iload 6\n 178: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 181: dup\n 182: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 185: checkcast #32 // class java/lang/CharSequence\n 188: iconst_1\n 189: anewarray #34 // class java/lang/String\n 192: astore 7\n 194: aload 7\n 196: iconst_0\n 197: ldc #36 // String\n 199: aastore\n 200: aload 7\n 202: iconst_0\n 203: iconst_0\n 204: bipush 6\n 206: aconst_null\n 207: invokestatic #42 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 210: checkcast #44 // class java/lang/Iterable\n 213: astore 7\n 215: istore 18\n 217: astore 17\n 219: iconst_0\n 220: istore 8\n 222: aload 7\n 224: astore 9\n 226: new #46 // class java/util/ArrayList\n 229: dup\n 230: aload 7\n 232: bipush 10\n 234: invokestatic #52 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 237: invokespecial #56 // Method java/util/ArrayList.\"<init>\":(I)V\n 240: checkcast #58 // class java/util/Collection\n 243: astore 10\n 245: iconst_0\n 246: istore 11\n 248: aload 9\n 250: invokeinterface #62, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 255: astore 12\n 257: aload 12\n 259: invokeinterface #68, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 264: ifeq 311\n 267: aload 12\n 269: invokeinterface #72, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 274: astore 13\n 276: aload 10\n 278: aload 13\n 280: checkcast #34 // class java/lang/String\n 283: astore 14\n 285: astore 19\n 287: iconst_0\n 288: istore 15\n 290: aload 14\n 292: invokestatic #24 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 295: nop\n 296: invokestatic #76 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 299: aload 19\n 301: swap\n 302: invokeinterface #80, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 307: pop\n 308: goto 257\n 311: aload 10\n 313: checkcast #82 // class java/util/List\n 316: nop\n 317: astore 19\n 319: aload 17\n 321: iload 18\n 323: aload 19\n 325: astore 8\n 327: istore 18\n 329: astore 17\n 331: iconst_0\n 332: istore 9\n 334: aload 8\n 336: iconst_0\n 337: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 342: checkcast #88 // class java/lang/Number\n 345: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 348: istore 10\n 350: aload 8\n 352: iconst_1\n 353: invokeinterface #86, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 358: checkcast #88 // class java/lang/Number\n 361: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 364: istore 11\n 366: new #94 // class Mv\n 369: dup\n 370: iload 6\n 372: iload 10\n 374: iload 11\n 376: iconst_0\n 377: bipush 8\n 379: aconst_null\n 380: invokespecial #97 // Method Mv.\"<init>\":(IIIIILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 383: astore 19\n 385: aload 17\n 387: iload 18\n 389: aload 19\n 391: aastore\n 392: iinc 4, 1\n 395: goto 164\n 398: aload 5\n 400: astore_3\n 401: aload_3\n 402: astore 4\n 404: iconst_0\n 405: istore 5\n 407: aload 4\n 409: arraylength\n 410: iconst_1\n 411: if_icmple 429\n 414: aload 4\n 416: new #99 // class MovieFanKt$solveCase$$inlined$sortBy$1\n 419: dup\n 420: invokespecial #101 // Method MovieFanKt$solveCase$$inlined$sortBy$1.\"<init>\":()V\n 423: checkcast #103 // class java/util/Comparator\n 426: invokestatic #109 // Method kotlin/collections/ArraysKt.sortWith:([Ljava/lang/Object;Ljava/util/Comparator;)V\n 429: nop\n 430: new #111 // class kotlin/jvm/internal/Ref$IntRef\n 433: dup\n 434: invokespecial #112 // Method kotlin/jvm/internal/Ref$IntRef.\"<init>\":()V\n 437: astore 4\n 439: new #114 // class java/util/TreeSet\n 442: dup\n 443: invokespecial #115 // Method java/util/TreeSet.\"<init>\":()V\n 446: astore 5\n 448: iconst_0\n 449: istore 6\n 451: aload_3\n 452: arraylength\n 453: istore 7\n 455: iload 6\n 457: iload 7\n 459: if_icmpge 500\n 462: aload_3\n 463: iload 6\n 465: aaload\n 466: astore 8\n 468: aload 4\n 470: aload 5\n 472: iload_2\n 473: aload 8\n 475: invokevirtual #118 // Method Mv.getA:()I\n 478: invokestatic #122 // Method solveCase$advance:(Lkotlin/jvm/internal/Ref$IntRef;Ljava/util/TreeSet;II)V\n 481: aload 5\n 483: checkcast #58 // class java/util/Collection\n 486: aload 8\n 488: invokeinterface #80, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 493: pop\n 494: iinc 6, 1\n 497: goto 455\n 500: aload 4\n 502: aload 5\n 504: iload_2\n 505: ldc #123 // int 2147483647\n 507: invokestatic #122 // Method solveCase$advance:(Lkotlin/jvm/internal/Ref$IntRef;Ljava/util/TreeSet;II)V\n 510: aload_3\n 511: astore 6\n 513: iconst_0\n 514: istore 7\n 516: aload 6\n 518: arraylength\n 519: iconst_1\n 520: if_icmple 538\n 523: aload 6\n 525: new #125 // class MovieFanKt$solveCase$$inlined$sortBy$2\n 528: dup\n 529: invokespecial #126 // Method MovieFanKt$solveCase$$inlined$sortBy$2.\"<init>\":()V\n 532: checkcast #103 // class java/util/Comparator\n 535: invokestatic #109 // Method kotlin/collections/ArraysKt.sortWith:([Ljava/lang/Object;Ljava/util/Comparator;)V\n 538: nop\n 539: iconst_0\n 540: istore 6\n 542: aload_3\n 543: astore 7\n 545: iconst_0\n 546: istore 8\n 548: aload 7\n 550: astore 9\n 552: new #46 // class java/util/ArrayList\n 555: dup\n 556: aload 7\n 558: arraylength\n 559: invokespecial #56 // Method java/util/ArrayList.\"<init>\":(I)V\n 562: checkcast #58 // class java/util/Collection\n 565: astore 10\n 567: iconst_0\n 568: istore 11\n 570: iconst_0\n 571: istore 12\n 573: aload 9\n 575: arraylength\n 576: istore 13\n 578: iload 12\n 580: iload 13\n 582: if_icmpge 632\n 585: aload 9\n 587: iload 12\n 589: aaload\n 590: astore 14\n 592: aload 10\n 594: aload 14\n 596: astore 15\n 598: astore 17\n 600: iconst_0\n 601: istore 16\n 603: aload 15\n 605: invokevirtual #129 // Method Mv.getT:()I\n 608: aload 15\n 610: invokevirtual #132 // Method Mv.getB:()I\n 613: isub\n 614: invokestatic #76 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 617: aload 17\n 619: swap\n 620: invokeinterface #80, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 625: pop\n 626: iinc 12, 1\n 629: goto 578\n 632: aload 10\n 634: checkcast #82 // class java/util/List\n 637: nop\n 638: checkcast #44 // class java/lang/Iterable\n 641: invokestatic #136 // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;\n 644: dup\n 645: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 648: checkcast #88 // class java/lang/Number\n 651: invokevirtual #92 // Method java/lang/Number.intValue:()I\n 654: istore 7\n 656: iload 6\n 658: iload 7\n 660: invokestatic #142 // Method java/lang/Math.max:(II)I\n 663: istore 6\n 665: getstatic #148 // Field java/lang/System.out:Ljava/io/PrintStream;\n 668: iload 6\n 670: invokevirtual #153 // Method java/io/PrintStream.println:(I)V\n 673: aload_3\n 674: ldc #36 // String\n 676: checkcast #32 // class java/lang/CharSequence\n 679: aconst_null\n 680: aconst_null\n 681: iconst_0\n 682: aconst_null\n 683: invokedynamic #172, 0 // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;\n 688: bipush 30\n 690: aconst_null\n 691: invokestatic #176 // Method kotlin/collections/ArraysKt.joinToString$default:([Ljava/lang/Object;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 694: getstatic #148 // Field java/lang/System.out:Ljava/io/PrintStream;\n 697: swap\n 698: invokevirtual #178 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 701: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #211 // Method main:()V\n 3: return\n\n private static final void solveCase$advance(kotlin.jvm.internal.Ref$IntRef, java.util.TreeSet<Mv>, int, int);\n Code:\n 0: aload_0\n 1: getfield #217 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 4: iload_3\n 5: if_icmpge 96\n 8: aload_1\n 9: invokevirtual #220 // Method java/util/TreeSet.isEmpty:()Z\n 12: ifne 96\n 15: aload_1\n 16: invokevirtual #223 // Method java/util/TreeSet.size:()I\n 19: iload_2\n 20: invokestatic #226 // Method java/lang/Math.min:(II)I\n 23: istore 4\n 25: iconst_0\n 26: istore 5\n 28: iload 5\n 30: iload 4\n 32: if_icmpge 79\n 35: iload 5\n 37: istore 6\n 39: iconst_0\n 40: istore 7\n 42: aload_1\n 43: invokevirtual #229 // Method java/util/TreeSet.first:()Ljava/lang/Object;\n 46: checkcast #94 // class Mv\n 49: astore 8\n 51: aload 8\n 53: aload_0\n 54: getfield #217 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 57: invokevirtual #232 // Method Mv.setT:(I)V\n 60: aload_1\n 61: checkcast #58 // class java/util/Collection\n 64: aload 8\n 66: invokeinterface #235, 2 // InterfaceMethod java/util/Collection.remove:(Ljava/lang/Object;)Z\n 71: pop\n 72: nop\n 73: iinc 5, 1\n 76: goto 28\n 79: aload_0\n 80: getfield #217 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 83: istore 4\n 85: aload_0\n 86: iload 4\n 88: iconst_1\n 89: iadd\n 90: putfield #217 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 93: goto 0\n 96: aload_0\n 97: iload_3\n 98: putfield #217 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 101: return\n\n private static final java.lang.CharSequence solveCase$lambda$8(Mv);\n Code:\n 0: aload_0\n 1: ldc #238 // String it\n 3: invokestatic #242 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokevirtual #129 // Method Mv.getT:()I\n 10: invokestatic #245 // Method java/lang/String.valueOf:(I)Ljava/lang/String;\n 13: checkcast #32 // class java/lang/CharSequence\n 16: areturn\n}\n", "javap_err": "" }, { "class_path": "thalees__kotlin-code-challenges__3b499d2/MovieFanKt$solveCase$$inlined$sortBy$2.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class MovieFanKt$solveCase$$inlined$sortBy$2<T> implements java.util.Comparator {\n public MovieFanKt$solveCase$$inlined$sortBy$2();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_1\n 1: checkcast #23 // class Mv\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method Mv.getI:()I\n 12: invokestatic #33 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 15: checkcast #35 // class java/lang/Comparable\n 18: aload_2\n 19: checkcast #23 // class Mv\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method Mv.getI:()I\n 32: invokestatic #33 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 35: aload 5\n 37: swap\n 38: checkcast #35 // class java/lang/Comparable\n 41: invokestatic #41 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" } ]
thalees__kotlin-code-challenges__3b499d2/7_seven/MNumbers.kt
fun main() { val (m, k) = readLine()!!.split(" ").map { it.toInt() } val f = factor(m) ?: run { println(-1) return } val dp = HashMap<Long,Long>() val dig = IntArray(100_000) fun count(nd: Int, p: Long = -1): Long { val e = f[0] + (f[1] shl 5) + (f[2] shl 10) + (f[3] shl 15) + (nd.toLong() shl 20) if (nd == 0) return if (e == 0L) 1 else 0 if (p == -1L) dp[e]?.let { return it } var cnt = 0L for (d in 1..9) { dig[nd - 1] = d val df = factors[d] for (i in 0..3) f[i] -= df[i] if (f.all { it >= 0 }) { val nc = count(nd - 1) if (p >= 0 && cnt + nc > p) return count(nd - 1, p - cnt) cnt += nc } for (i in 0..3) f[i] += df[i] } dp[e] = cnt return cnt } var num = 1L var nd = 1 while (count(nd) <= k - num) num += count(nd++) check(count(nd, k - num) == 1L) println(dig.take(nd).reversed().joinToString("")) } private val pr = listOf(2, 3, 5, 7) private val factors = Array(10) { factor(it)!! } private fun factor(m: Int): IntArray? { val f = IntArray(4) if (m <= 1) return f var rem = m for ((i, p) in pr.withIndex()) { while (rem % p == 0) { rem /= p f[i]++ } } return f.takeIf { rem == 1 } }
[ { "class_path": "thalees__kotlin-code-challenges__3b499d2/MNumbersKt.class", "javap": "Compiled from \"MNumbers.kt\"\npublic final class MNumbersKt {\n private static final java.util.List<java.lang.Integer> pr;\n\n private static final int[][] factors;\n\n public static final void main();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 3: dup\n 4: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 7: checkcast #20 // class java/lang/CharSequence\n 10: iconst_1\n 11: anewarray #22 // class java/lang/String\n 14: astore_1\n 15: aload_1\n 16: iconst_0\n 17: ldc #24 // String\n 19: aastore\n 20: aload_1\n 21: iconst_0\n 22: iconst_0\n 23: bipush 6\n 25: aconst_null\n 26: invokestatic #30 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 29: checkcast #32 // class java/lang/Iterable\n 32: astore_1\n 33: iconst_0\n 34: istore_2\n 35: aload_1\n 36: astore_3\n 37: new #34 // class java/util/ArrayList\n 40: dup\n 41: aload_1\n 42: bipush 10\n 44: invokestatic #40 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 47: invokespecial #44 // Method java/util/ArrayList.\"<init>\":(I)V\n 50: checkcast #46 // class java/util/Collection\n 53: astore 4\n 55: iconst_0\n 56: istore 5\n 58: aload_3\n 59: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 64: astore 6\n 66: aload 6\n 68: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 73: ifeq 120\n 76: aload 6\n 78: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 83: astore 7\n 85: aload 4\n 87: aload 7\n 89: checkcast #22 // class java/lang/String\n 92: astore 8\n 94: astore 10\n 96: iconst_0\n 97: istore 9\n 99: aload 8\n 101: invokestatic #66 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 104: nop\n 105: invokestatic #70 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 108: aload 10\n 110: swap\n 111: invokeinterface #74, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 116: pop\n 117: goto 66\n 120: aload 4\n 122: checkcast #76 // class java/util/List\n 125: nop\n 126: astore_0\n 127: aload_0\n 128: iconst_0\n 129: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 134: checkcast #82 // class java/lang/Number\n 137: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 140: istore_1\n 141: aload_0\n 142: iconst_1\n 143: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 148: checkcast #82 // class java/lang/Number\n 151: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 154: istore_2\n 155: iload_1\n 156: invokestatic #90 // Method factor:(I)[I\n 159: dup\n 160: ifnonnull 179\n 163: pop\n 164: iconst_0\n 165: istore 5\n 167: iconst_m1\n 168: istore 6\n 170: getstatic #96 // Field java/lang/System.out:Ljava/io/PrintStream;\n 173: iload 6\n 175: invokevirtual #101 // Method java/io/PrintStream.println:(I)V\n 178: return\n 179: astore_3\n 180: new #103 // class java/util/HashMap\n 183: dup\n 184: invokespecial #105 // Method java/util/HashMap.\"<init>\":()V\n 187: astore 4\n 189: ldc #106 // int 100000\n 191: newarray int\n 193: astore 5\n 195: lconst_1\n 196: lstore 6\n 198: iconst_1\n 199: istore 8\n 201: aload_3\n 202: aload 4\n 204: aload 5\n 206: iload 8\n 208: lconst_0\n 209: bipush 16\n 211: aconst_null\n 212: invokestatic #110 // Method main$count$default:([ILjava/util/HashMap;[IIJILjava/lang/Object;)J\n 215: iload_2\n 216: i2l\n 217: lload 6\n 219: lsub\n 220: lcmp\n 221: ifgt 249\n 224: lload 6\n 226: aload_3\n 227: aload 4\n 229: aload 5\n 231: iload 8\n 233: iinc 8, 1\n 236: lconst_0\n 237: bipush 16\n 239: aconst_null\n 240: invokestatic #110 // Method main$count$default:([ILjava/util/HashMap;[IIJILjava/lang/Object;)J\n 243: ladd\n 244: lstore 6\n 246: goto 201\n 249: aload_3\n 250: aload 4\n 252: aload 5\n 254: iload 8\n 256: iload_2\n 257: i2l\n 258: lload 6\n 260: lsub\n 261: invokestatic #114 // Method main$count:([ILjava/util/HashMap;[IIJ)J\n 264: lconst_1\n 265: lcmp\n 266: ifne 273\n 269: iconst_1\n 270: goto 274\n 273: iconst_0\n 274: ifne 287\n 277: new #116 // class java/lang/IllegalStateException\n 280: dup\n 281: ldc #118 // String Check failed.\n 283: invokespecial #121 // Method java/lang/IllegalStateException.\"<init>\":(Ljava/lang/String;)V\n 286: athrow\n 287: aload 5\n 289: iload 8\n 291: invokestatic #127 // Method kotlin/collections/ArraysKt.take:([II)Ljava/util/List;\n 294: checkcast #32 // class java/lang/Iterable\n 297: invokestatic #131 // Method kotlin/collections/CollectionsKt.reversed:(Ljava/lang/Iterable;)Ljava/util/List;\n 300: checkcast #32 // class java/lang/Iterable\n 303: ldc #133 // String\n 305: checkcast #20 // class java/lang/CharSequence\n 308: aconst_null\n 309: aconst_null\n 310: iconst_0\n 311: aconst_null\n 312: aconst_null\n 313: bipush 62\n 315: aconst_null\n 316: invokestatic #137 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 319: getstatic #96 // Field java/lang/System.out:Ljava/io/PrintStream;\n 322: swap\n 323: invokevirtual #139 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 326: return\n\n private static final int[] factor(int);\n Code:\n 0: iconst_4\n 1: newarray int\n 3: astore_1\n 4: iload_0\n 5: iconst_1\n 6: if_icmpgt 11\n 9: aload_1\n 10: areturn\n 11: iconst_0\n 12: istore_2\n 13: iload_0\n 14: istore_2\n 15: getstatic #168 // Field pr:Ljava/util/List;\n 18: checkcast #32 // class java/lang/Iterable\n 21: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 26: astore_3\n 27: iconst_0\n 28: istore 4\n 30: aload_3\n 31: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 36: ifeq 92\n 39: iload 4\n 41: istore 5\n 43: iload 4\n 45: iconst_1\n 46: iadd\n 47: istore 4\n 49: aload_3\n 50: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 55: checkcast #82 // class java/lang/Number\n 58: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 61: istore 6\n 63: iload_2\n 64: iload 6\n 66: irem\n 67: ifne 30\n 70: iload_2\n 71: iload 6\n 73: idiv\n 74: istore_2\n 75: aload_1\n 76: iload 5\n 78: iaload\n 79: istore 7\n 81: aload_1\n 82: iload 5\n 84: iload 7\n 86: iconst_1\n 87: iadd\n 88: iastore\n 89: goto 63\n 92: aload_1\n 93: astore_3\n 94: aload_3\n 95: astore 4\n 97: iconst_0\n 98: istore 5\n 100: iload_2\n 101: iconst_1\n 102: if_icmpne 109\n 105: iconst_1\n 106: goto 110\n 109: iconst_0\n 110: ifeq 117\n 113: aload_3\n 114: goto 118\n 117: aconst_null\n 118: areturn\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #175 // Method main:()V\n 3: return\n\n private static final long main$count(int[], java.util.HashMap<java.lang.Long, java.lang.Long>, int[], int, long);\n Code:\n 0: aload_0\n 1: iconst_0\n 2: iaload\n 3: aload_0\n 4: iconst_1\n 5: iaload\n 6: iconst_5\n 7: ishl\n 8: iadd\n 9: aload_0\n 10: iconst_2\n 11: iaload\n 12: bipush 10\n 14: ishl\n 15: iadd\n 16: aload_0\n 17: iconst_3\n 18: iaload\n 19: bipush 15\n 21: ishl\n 22: iadd\n 23: i2l\n 24: iload_3\n 25: i2l\n 26: bipush 20\n 28: lshl\n 29: ladd\n 30: lstore 6\n 32: iload_3\n 33: ifne 49\n 36: lload 6\n 38: lconst_0\n 39: lcmp\n 40: ifne 47\n 43: lconst_1\n 44: goto 48\n 47: lconst_0\n 48: lreturn\n 49: lload 4\n 51: ldc2_w #179 // long -1l\n 54: lcmp\n 55: ifne 93\n 58: aload_1\n 59: lload 6\n 61: invokestatic #185 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 64: invokevirtual #188 // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 67: checkcast #182 // class java/lang/Long\n 70: astore 8\n 72: aload 8\n 74: ifnull 93\n 77: aload 8\n 79: checkcast #82 // class java/lang/Number\n 82: invokevirtual #192 // Method java/lang/Number.longValue:()J\n 85: lstore 10\n 87: iconst_0\n 88: istore 12\n 90: lload 10\n 92: lreturn\n 93: lconst_0\n 94: lstore 8\n 96: iconst_1\n 97: istore 10\n 99: iload 10\n 101: bipush 10\n 103: if_icmpge 310\n 106: aload_2\n 107: iload_3\n 108: iconst_1\n 109: isub\n 110: iload 10\n 112: iastore\n 113: getstatic #196 // Field factors:[[I\n 116: iload 10\n 118: aaload\n 119: astore 11\n 121: iconst_0\n 122: istore 12\n 124: iload 12\n 126: iconst_4\n 127: if_icmpge 154\n 130: iload 12\n 132: istore 13\n 134: aload_0\n 135: iload 13\n 137: aload_0\n 138: iload 13\n 140: iaload\n 141: aload 11\n 143: iload 12\n 145: iaload\n 146: isub\n 147: iastore\n 148: iinc 12, 1\n 151: goto 124\n 154: aload_0\n 155: astore 12\n 157: iconst_0\n 158: istore 13\n 160: iconst_0\n 161: istore 14\n 163: aload 12\n 165: arraylength\n 166: istore 15\n 168: iload 14\n 170: iload 15\n 172: if_icmpge 212\n 175: aload 12\n 177: iload 14\n 179: iaload\n 180: istore 16\n 182: iload 16\n 184: istore 17\n 186: iconst_0\n 187: istore 18\n 189: iload 17\n 191: iflt 198\n 194: iconst_1\n 195: goto 199\n 198: iconst_0\n 199: ifne 206\n 202: iconst_0\n 203: goto 213\n 206: iinc 14, 1\n 209: goto 168\n 212: iconst_1\n 213: ifeq 271\n 216: aload_0\n 217: aload_1\n 218: aload_2\n 219: iload_3\n 220: iconst_1\n 221: isub\n 222: lconst_0\n 223: bipush 16\n 225: aconst_null\n 226: invokestatic #110 // Method main$count$default:([ILjava/util/HashMap;[IIJILjava/lang/Object;)J\n 229: lstore 12\n 231: lload 4\n 233: lconst_0\n 234: lcmp\n 235: iflt 264\n 238: lload 8\n 240: lload 12\n 242: ladd\n 243: lload 4\n 245: lcmp\n 246: ifle 264\n 249: aload_0\n 250: aload_1\n 251: aload_2\n 252: iload_3\n 253: iconst_1\n 254: isub\n 255: lload 4\n 257: lload 8\n 259: lsub\n 260: invokestatic #114 // Method main$count:([ILjava/util/HashMap;[IIJ)J\n 263: lreturn\n 264: lload 8\n 266: lload 12\n 268: ladd\n 269: lstore 8\n 271: iconst_0\n 272: istore 12\n 274: iload 12\n 276: iconst_4\n 277: if_icmpge 304\n 280: iload 12\n 282: istore 13\n 284: aload_0\n 285: iload 13\n 287: aload_0\n 288: iload 13\n 290: iaload\n 291: aload 11\n 293: iload 12\n 295: iaload\n 296: iadd\n 297: iastore\n 298: iinc 12, 1\n 301: goto 274\n 304: iinc 10, 1\n 307: goto 99\n 310: lload 6\n 312: invokestatic #185 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 315: astore 11\n 317: lload 8\n 319: invokestatic #185 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 322: astore 12\n 324: aload_1\n 325: checkcast #198 // class java/util/Map\n 328: aload 11\n 330: aload 12\n 332: invokeinterface #202, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 337: pop\n 338: lload 8\n 340: lreturn\n\n static long main$count$default(int[], java.util.HashMap, int[], int, long, int, java.lang.Object);\n Code:\n 0: iload 6\n 2: bipush 16\n 4: iand\n 5: ifeq 13\n 8: ldc2_w #179 // long -1l\n 11: lstore 4\n 13: aload_0\n 14: aload_1\n 15: aload_2\n 16: iload_3\n 17: lload 4\n 19: invokestatic #114 // Method main$count:([ILjava/util/HashMap;[IIJ)J\n 22: lreturn\n\n static {};\n Code:\n 0: iconst_4\n 1: anewarray #62 // class java/lang/Integer\n 4: astore_0\n 5: aload_0\n 6: iconst_0\n 7: iconst_2\n 8: invokestatic #70 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 11: aastore\n 12: aload_0\n 13: iconst_1\n 14: iconst_3\n 15: invokestatic #70 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 18: aastore\n 19: aload_0\n 20: iconst_2\n 21: iconst_5\n 22: invokestatic #70 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 25: aastore\n 26: aload_0\n 27: iconst_3\n 28: bipush 7\n 30: invokestatic #70 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 33: aastore\n 34: aload_0\n 35: invokestatic #217 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 38: putstatic #168 // Field pr:Ljava/util/List;\n 41: iconst_0\n 42: istore_0\n 43: bipush 10\n 45: anewarray #164 // class \"[I\"\n 48: astore_1\n 49: iload_0\n 50: bipush 10\n 52: if_icmpge 74\n 55: iload_0\n 56: istore_2\n 57: aload_1\n 58: iload_2\n 59: iload_2\n 60: invokestatic #90 // Method factor:(I)[I\n 63: dup\n 64: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 67: aastore\n 68: iinc 0, 1\n 71: goto 49\n 74: aload_1\n 75: putstatic #196 // Field factors:[[I\n 78: return\n}\n", "javap_err": "" } ]
philipphofmann__coding-problems__db0889c/src/LongestUniqueSubSequence.kt
/** * Returns the longest subsequence with unique character. */ fun longestUniqueSubSequence(value: String): String { var longestUniqueSubSequence = "" value.forEachIndexed { index, _ -> val uniqueSubsequence = uniqueSubSequence(value.subSequence(index, value.length)) if (longestUniqueSubSequence.length < uniqueSubsequence.length) { longestUniqueSubSequence = uniqueSubsequence } } return longestUniqueSubSequence } private fun uniqueSubSequence(sequence: CharSequence): String { var uniqueSubSequence = "" sequence.forEach { char -> if (!uniqueSubSequence.contains(char)) { uniqueSubSequence += char } else { return uniqueSubSequence } } return uniqueSubSequence }
[ { "class_path": "philipphofmann__coding-problems__db0889c/LongestUniqueSubSequenceKt.class", "javap": "Compiled from \"LongestUniqueSubSequence.kt\"\npublic final class LongestUniqueSubSequenceKt {\n public static final java.lang.String longestUniqueSubSequence(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #9 // String value\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aconst_null\n 7: astore_1\n 8: ldc #17 // String\n 10: astore_1\n 11: aload_0\n 12: checkcast #19 // class java/lang/CharSequence\n 15: astore_2\n 16: iconst_0\n 17: istore_3\n 18: iconst_0\n 19: istore 4\n 21: iconst_0\n 22: istore 5\n 24: iload 5\n 26: aload_2\n 27: invokeinterface #23, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 32: if_icmpge 93\n 35: aload_2\n 36: iload 5\n 38: invokeinterface #27, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 43: istore 6\n 45: iload 4\n 47: iinc 4, 1\n 50: istore 7\n 52: iconst_0\n 53: istore 8\n 55: aload_0\n 56: iload 7\n 58: aload_0\n 59: invokevirtual #30 // Method java/lang/String.length:()I\n 62: invokevirtual #34 // Method java/lang/String.subSequence:(II)Ljava/lang/CharSequence;\n 65: invokestatic #38 // Method uniqueSubSequence:(Ljava/lang/CharSequence;)Ljava/lang/String;\n 68: astore 9\n 70: aload_1\n 71: invokevirtual #30 // Method java/lang/String.length:()I\n 74: aload 9\n 76: invokevirtual #30 // Method java/lang/String.length:()I\n 79: if_icmpge 85\n 82: aload 9\n 84: astore_1\n 85: nop\n 86: nop\n 87: iinc 5, 1\n 90: goto 24\n 93: nop\n 94: aload_1\n 95: areturn\n\n private static final java.lang.String uniqueSubSequence(java.lang.CharSequence);\n Code:\n 0: aconst_null\n 1: astore_1\n 2: ldc #17 // String\n 4: astore_1\n 5: aload_0\n 6: astore_2\n 7: iconst_0\n 8: istore_3\n 9: iconst_0\n 10: istore 4\n 12: iload 4\n 14: aload_2\n 15: invokeinterface #23, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 20: if_icmpge 88\n 23: aload_2\n 24: iload 4\n 26: invokeinterface #27, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 31: istore 5\n 33: iload 5\n 35: istore 6\n 37: iconst_0\n 38: istore 7\n 40: aload_1\n 41: checkcast #19 // class java/lang/CharSequence\n 44: iload 6\n 46: iconst_0\n 47: iconst_2\n 48: aconst_null\n 49: invokestatic #56 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z\n 52: ifne 78\n 55: new #58 // class java/lang/StringBuilder\n 58: dup\n 59: invokespecial #62 // Method java/lang/StringBuilder.\"<init>\":()V\n 62: aload_1\n 63: invokevirtual #66 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 66: iload 6\n 68: invokevirtual #69 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 71: invokevirtual #73 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 74: astore_1\n 75: goto 80\n 78: aload_1\n 79: areturn\n 80: nop\n 81: nop\n 82: iinc 4, 1\n 85: goto 12\n 88: nop\n 89: aload_1\n 90: areturn\n}\n", "javap_err": "" } ]
philipphofmann__coding-problems__db0889c/src/Atoi.kt
/** * Parses the string as an [Int] number and returns the result. * See https://leetcode.com/problems/string-to-integer-atoi/ * * @throws NumberFormatException if the string is not a valid representation of a number. */ fun atoi(string: String): Int { val noWhitespaces = string.trim { it.isWhitespace() } if (!isDigit(noWhitespaces[0])) { return 0 } val digitsAndNegativeSign = noWhitespaces.trim { char -> !isDigit(char) || char == '+' } val isNegative = digitsAndNegativeSign[0] == '-' val digits = if (isNegative) { digitsAndNegativeSign.removeRange(0, 1) } else { digitsAndNegativeSign } var result = 0 var exponent = 1.0 var overflow = false for (i in digits.length - 1 downTo 0) { val digitValue = (charToInt(digits[i]) * exponent).toInt() val r = result + digitValue // HD 2-12 Overflow if both arguments have the opposite sign of r if (result xor r and (digitValue xor r) < 0) { overflow = true break } result = r exponent *= 10 } result = if (isNegative) -result else result return if (overflow) { if (result < 0) { Int.MIN_VALUE } else { Int.MAX_VALUE } } else { result } } private fun isDigit(char: Char) = charToInt(char) >= 0 || char == '-' || char == '+' private fun charToInt(char: Char): Int { return when (char) { '0' -> 0 '1' -> 1 '2' -> 2 '3' -> 3 '4' -> 4 '5' -> 5 '6' -> 6 '7' -> 7 '8' -> 8 '9' -> 9 else -> Int.MIN_VALUE } }
[ { "class_path": "philipphofmann__coding-problems__db0889c/AtoiKt.class", "javap": "Compiled from \"Atoi.kt\"\npublic final class AtoiKt {\n public static final int atoi(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #9 // String string\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: astore_2\n 8: iconst_0\n 9: istore_3\n 10: aload_2\n 11: checkcast #17 // class java/lang/CharSequence\n 14: astore 4\n 16: iconst_0\n 17: istore 5\n 19: iconst_0\n 20: istore 6\n 22: aload 4\n 24: invokeinterface #21, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 29: iconst_1\n 30: isub\n 31: istore 7\n 33: iconst_0\n 34: istore 8\n 36: iload 6\n 38: iload 7\n 40: if_icmpgt 114\n 43: iload 8\n 45: ifne 53\n 48: iload 6\n 50: goto 55\n 53: iload 7\n 55: istore 9\n 57: aload 4\n 59: iload 9\n 61: invokeinterface #25, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 66: istore 10\n 68: iconst_0\n 69: istore 11\n 71: iload 10\n 73: invokestatic #31 // Method kotlin/text/CharsKt.isWhitespace:(C)Z\n 76: istore 10\n 78: iload 8\n 80: ifne 100\n 83: iload 10\n 85: ifne 94\n 88: iconst_1\n 89: istore 8\n 91: goto 36\n 94: iinc 6, 1\n 97: goto 36\n 100: iload 10\n 102: ifne 108\n 105: goto 114\n 108: iinc 7, -1\n 111: goto 36\n 114: aload 4\n 116: iload 6\n 118: iload 7\n 120: iconst_1\n 121: iadd\n 122: invokeinterface #35, 3 // InterfaceMethod java/lang/CharSequence.subSequence:(II)Ljava/lang/CharSequence;\n 127: invokevirtual #39 // Method java/lang/Object.toString:()Ljava/lang/String;\n 130: astore_1\n 131: aload_1\n 132: iconst_0\n 133: invokevirtual #42 // Method java/lang/String.charAt:(I)C\n 136: invokestatic #45 // Method isDigit:(C)Z\n 139: ifne 144\n 142: iconst_0\n 143: ireturn\n 144: aload_1\n 145: astore_3\n 146: iconst_0\n 147: istore 4\n 149: aload_3\n 150: checkcast #17 // class java/lang/CharSequence\n 153: astore 5\n 155: iconst_0\n 156: istore 6\n 158: iconst_0\n 159: istore 7\n 161: aload 5\n 163: invokeinterface #21, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 168: iconst_1\n 169: isub\n 170: istore 8\n 172: iconst_0\n 173: istore 9\n 175: iload 7\n 177: iload 8\n 179: if_icmpgt 268\n 182: iload 9\n 184: ifne 192\n 187: iload 7\n 189: goto 194\n 192: iload 8\n 194: istore 10\n 196: aload 5\n 198: iload 10\n 200: invokeinterface #25, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 205: istore 11\n 207: iconst_0\n 208: istore 12\n 210: iload 11\n 212: invokestatic #45 // Method isDigit:(C)Z\n 215: ifeq 225\n 218: iload 11\n 220: bipush 43\n 222: if_icmpne 229\n 225: iconst_1\n 226: goto 230\n 229: iconst_0\n 230: istore 11\n 232: iload 9\n 234: ifne 254\n 237: iload 11\n 239: ifne 248\n 242: iconst_1\n 243: istore 9\n 245: goto 175\n 248: iinc 7, 1\n 251: goto 175\n 254: iload 11\n 256: ifne 262\n 259: goto 268\n 262: iinc 8, -1\n 265: goto 175\n 268: aload 5\n 270: iload 7\n 272: iload 8\n 274: iconst_1\n 275: iadd\n 276: invokeinterface #35, 3 // InterfaceMethod java/lang/CharSequence.subSequence:(II)Ljava/lang/CharSequence;\n 281: invokevirtual #39 // Method java/lang/Object.toString:()Ljava/lang/String;\n 284: astore_2\n 285: aload_2\n 286: iconst_0\n 287: invokevirtual #42 // Method java/lang/String.charAt:(I)C\n 290: bipush 45\n 292: if_icmpne 299\n 295: iconst_1\n 296: goto 300\n 299: iconst_0\n 300: istore_3\n 301: iload_3\n 302: ifeq 332\n 305: aload_2\n 306: astore 5\n 308: iconst_0\n 309: istore 6\n 311: iconst_1\n 312: istore 7\n 314: aload 5\n 316: checkcast #17 // class java/lang/CharSequence\n 319: iload 6\n 321: iload 7\n 323: invokestatic #51 // Method kotlin/text/StringsKt.removeRange:(Ljava/lang/CharSequence;II)Ljava/lang/CharSequence;\n 326: invokevirtual #39 // Method java/lang/Object.toString:()Ljava/lang/String;\n 329: goto 333\n 332: aload_2\n 333: astore 4\n 335: iconst_0\n 336: istore 5\n 338: dconst_1\n 339: dstore 6\n 341: iconst_0\n 342: istore 8\n 344: aload 4\n 346: invokevirtual #52 // Method java/lang/String.length:()I\n 349: iconst_1\n 350: isub\n 351: istore 9\n 353: iconst_m1\n 354: iload 9\n 356: if_icmpge 421\n 359: aload 4\n 361: iload 9\n 363: invokevirtual #42 // Method java/lang/String.charAt:(I)C\n 366: invokestatic #56 // Method charToInt:(C)I\n 369: i2d\n 370: dload 6\n 372: dmul\n 373: d2i\n 374: istore 10\n 376: iload 5\n 378: iload 10\n 380: iadd\n 381: istore 11\n 383: iload 5\n 385: iload 11\n 387: ixor\n 388: iload 10\n 390: iload 11\n 392: ixor\n 393: iand\n 394: ifge 403\n 397: iconst_1\n 398: istore 8\n 400: goto 421\n 403: iload 11\n 405: istore 5\n 407: dload 6\n 409: bipush 10\n 411: i2d\n 412: dmul\n 413: dstore 6\n 415: iinc 9, -1\n 418: goto 353\n 421: iload_3\n 422: ifeq 431\n 425: iload 5\n 427: ineg\n 428: goto 433\n 431: iload 5\n 433: istore 5\n 435: iload 8\n 437: ifeq 455\n 440: iload 5\n 442: ifge 450\n 445: ldc #57 // int -2147483648\n 447: goto 457\n 450: ldc #58 // int 2147483647\n 452: goto 457\n 455: iload 5\n 457: ireturn\n\n private static final boolean isDigit(char);\n Code:\n 0: iload_0\n 1: invokestatic #56 // Method charToInt:(C)I\n 4: ifge 19\n 7: iload_0\n 8: bipush 45\n 10: if_icmpeq 19\n 13: iload_0\n 14: bipush 43\n 16: if_icmpne 23\n 19: iconst_1\n 20: goto 24\n 23: iconst_0\n 24: ireturn\n\n private static final int charToInt(char);\n Code:\n 0: iload_0\n 1: tableswitch { // 48 to 57\n 48: 56\n 49: 60\n 50: 64\n 51: 68\n 52: 72\n 53: 76\n 54: 80\n 55: 85\n 56: 90\n 57: 95\n default: 100\n }\n 56: iconst_0\n 57: goto 102\n 60: iconst_1\n 61: goto 102\n 64: iconst_2\n 65: goto 102\n 68: iconst_3\n 69: goto 102\n 72: iconst_4\n 73: goto 102\n 76: iconst_5\n 77: goto 102\n 80: bipush 6\n 82: goto 102\n 85: bipush 7\n 87: goto 102\n 90: bipush 8\n 92: goto 102\n 95: bipush 9\n 97: goto 102\n 100: ldc #57 // int -2147483648\n 102: ireturn\n}\n", "javap_err": "" } ]
guilhermealbm__ManualFlashSettingsCalculator__74f049d/src/main/kotlin/CalculateAperture.kt
import java.lang.NumberFormatException import kotlin.math.abs val distances = listOf(1.2, 1.8, 2.5, 3.5, 5.0, 7.0) val apertures = listOf(1.2, 1.4, 2, 2.8, 4, 5.6, 8, 11, 16, 22, 32, 45) fun calculateAperture(iso_: String?, distance_: String?) : String { val iso = convertIso(iso_) val distance = convertDistance(distance_) distance?.let { val distanceIndex = distances.reversed().indexOf(it) val isoIndex = iso.index return "Set your aperture to ${apertures[distanceIndex + isoIndex]}" } ?: run { return "Unable to convert distance." } } fun convertDistance(distance_: String?) : Double? = try { distance_?.toDouble()?.let { distances.closestValue(it) } ?: run { null } } catch (exception: NumberFormatException) { null } private fun List<Double>.closestValue(value: Double) = minByOrNull { abs(value - it) } fun convertIso(iso: String?) : ISO = when(iso?.trim()) { "25" -> ISO.I25 "50" -> ISO.I50 "100" -> ISO.I100 "200" -> ISO.I200 "400" -> ISO.I400 "800" -> ISO.I800 "1000" -> ISO.I1000 else -> ISO.I100 } enum class ISO(val index: Int) { I25(0), I50(1), I100(2), I200(3), I400(4), I800(5), I1000(6) }
[ { "class_path": "guilhermealbm__ManualFlashSettingsCalculator__74f049d/CalculateApertureKt.class", "javap": "Compiled from \"CalculateAperture.kt\"\npublic final class CalculateApertureKt {\n private static final java.util.List<java.lang.Double> distances;\n\n private static final java.util.List<java.lang.Object> apertures;\n\n public static final java.util.List<java.lang.Double> getDistances();\n Code:\n 0: getstatic #12 // Field distances:Ljava/util/List;\n 3: areturn\n\n public static final java.util.List<java.lang.Object> getApertures();\n Code:\n 0: getstatic #17 // Field apertures:Ljava/util/List;\n 3: areturn\n\n public static final java.lang.String calculateAperture(java.lang.String, java.lang.String);\n Code:\n 0: aload_0\n 1: invokestatic #24 // Method convertIso:(Ljava/lang/String;)LISO;\n 4: astore_2\n 5: aload_1\n 6: invokestatic #28 // Method convertDistance:(Ljava/lang/String;)Ljava/lang/Double;\n 9: astore_3\n 10: aload_3\n 11: dup\n 12: ifnull 85\n 15: checkcast #30 // class java/lang/Number\n 18: invokevirtual #34 // Method java/lang/Number.doubleValue:()D\n 21: dstore 5\n 23: iconst_0\n 24: istore 7\n 26: getstatic #12 // Field distances:Ljava/util/List;\n 29: checkcast #36 // class java/lang/Iterable\n 32: invokestatic #42 // Method kotlin/collections/CollectionsKt.reversed:(Ljava/lang/Iterable;)Ljava/util/List;\n 35: dload 5\n 37: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 40: invokeinterface #54, 2 // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I\n 45: istore 8\n 47: aload_2\n 48: invokevirtual #60 // Method ISO.getIndex:()I\n 51: istore 9\n 53: new #62 // class java/lang/StringBuilder\n 56: dup\n 57: invokespecial #66 // Method java/lang/StringBuilder.\"<init>\":()V\n 60: ldc #68 // String Set your aperture to\n 62: invokevirtual #72 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 65: getstatic #17 // Field apertures:Ljava/util/List;\n 68: iload 8\n 70: iload 9\n 72: iadd\n 73: invokeinterface #76, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 78: invokevirtual #79 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 81: invokevirtual #83 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 84: areturn\n 85: pop\n 86: iconst_0\n 87: istore 4\n 89: ldc #85 // String Unable to convert distance.\n 91: areturn\n\n public static final java.lang.Double convertDistance(java.lang.String);\n Code:\n 0: nop\n 1: aload_0\n 2: dup\n 3: ifnull 27\n 6: invokestatic #107 // Method java/lang/Double.parseDouble:(Ljava/lang/String;)D\n 9: dstore 4\n 11: iconst_0\n 12: istore 6\n 14: getstatic #12 // Field distances:Ljava/util/List;\n 17: dload 4\n 19: invokestatic #111 // Method closestValue:(Ljava/util/List;D)Ljava/lang/Double;\n 22: nop\n 23: dup\n 24: ifnonnull 31\n 27: pop\n 28: iconst_0\n 29: istore_3\n 30: aconst_null\n 31: astore_1\n 32: goto 38\n 35: astore_2\n 36: aconst_null\n 37: astore_1\n 38: aload_1\n 39: areturn\n Exception table:\n from to target type\n 0 32 35 Class java/lang/NumberFormatException\n\n private static final java.lang.Double closestValue(java.util.List<java.lang.Double>, double);\n Code:\n 0: aload_0\n 1: checkcast #36 // class java/lang/Iterable\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokeinterface #120, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 14: astore 5\n 16: aload 5\n 18: invokeinterface #126, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 23: ifne 30\n 26: aconst_null\n 27: goto 139\n 30: aload 5\n 32: invokeinterface #130, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 37: astore 6\n 39: aload 5\n 41: invokeinterface #126, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 46: ifne 54\n 49: aload 6\n 51: goto 139\n 54: aload 6\n 56: checkcast #30 // class java/lang/Number\n 59: invokevirtual #34 // Method java/lang/Number.doubleValue:()D\n 62: dstore 7\n 64: iconst_0\n 65: istore 9\n 67: dload_1\n 68: dload 7\n 70: dsub\n 71: invokestatic #136 // Method java/lang/Math.abs:(D)D\n 74: nop\n 75: dstore 11\n 77: aload 5\n 79: invokeinterface #130, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 84: astore 13\n 86: aload 13\n 88: checkcast #30 // class java/lang/Number\n 91: invokevirtual #34 // Method java/lang/Number.doubleValue:()D\n 94: dstore 14\n 96: iconst_0\n 97: istore 16\n 99: dload_1\n 100: dload 14\n 102: dsub\n 103: invokestatic #136 // Method java/lang/Math.abs:(D)D\n 106: nop\n 107: dstore 9\n 109: dload 11\n 111: dload 9\n 113: invokestatic #140 // Method java/lang/Double.compare:(DD)I\n 116: ifle 127\n 119: aload 13\n 121: astore 6\n 123: dload 9\n 125: dstore 11\n 127: aload 5\n 129: invokeinterface #126, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 134: ifne 77\n 137: aload 6\n 139: checkcast #44 // class java/lang/Double\n 142: areturn\n\n public static final ISO convertIso(java.lang.String);\n Code:\n 0: aload_0\n 1: dup\n 2: ifnull 17\n 5: checkcast #155 // class java/lang/CharSequence\n 8: invokestatic #161 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 11: invokevirtual #162 // Method java/lang/Object.toString:()Ljava/lang/String;\n 14: goto 19\n 17: pop\n 18: aconst_null\n 19: astore_1\n 20: aload_1\n 21: ifnull 222\n 24: aload_1\n 25: invokevirtual #165 // Method java/lang/String.hashCode:()I\n 28: lookupswitch { // 7\n 1603: 120\n 1691: 168\n 48625: 96\n 49586: 108\n 51508: 132\n 55352: 144\n 1507423: 156\n default: 222\n }\n 96: aload_1\n 97: ldc #167 // String 100\n 99: invokevirtual #171 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 102: ifne 192\n 105: goto 222\n 108: aload_1\n 109: ldc #173 // String 200\n 111: invokevirtual #171 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 114: ifne 198\n 117: goto 222\n 120: aload_1\n 121: ldc #175 // String 25\n 123: invokevirtual #171 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 126: ifne 180\n 129: goto 222\n 132: aload_1\n 133: ldc #177 // String 400\n 135: invokevirtual #171 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 138: ifne 204\n 141: goto 222\n 144: aload_1\n 145: ldc #179 // String 800\n 147: invokevirtual #171 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 150: ifne 210\n 153: goto 222\n 156: aload_1\n 157: ldc #181 // String 1000\n 159: invokevirtual #171 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 162: ifne 216\n 165: goto 222\n 168: aload_1\n 169: ldc #183 // String 50\n 171: invokevirtual #171 // Method java/lang/String.equals:(Ljava/lang/Object;)Z\n 174: ifne 186\n 177: goto 222\n 180: getstatic #186 // Field ISO.I25:LISO;\n 183: goto 225\n 186: getstatic #189 // Field ISO.I50:LISO;\n 189: goto 225\n 192: getstatic #192 // Field ISO.I100:LISO;\n 195: goto 225\n 198: getstatic #195 // Field ISO.I200:LISO;\n 201: goto 225\n 204: getstatic #198 // Field ISO.I400:LISO;\n 207: goto 225\n 210: getstatic #201 // Field ISO.I800:LISO;\n 213: goto 225\n 216: getstatic #204 // Field ISO.I1000:LISO;\n 219: goto 225\n 222: getstatic #192 // Field ISO.I100:LISO;\n 225: areturn\n\n static {};\n Code:\n 0: bipush 6\n 2: anewarray #44 // class java/lang/Double\n 5: astore_0\n 6: aload_0\n 7: iconst_0\n 8: ldc2_w #206 // double 1.2d\n 11: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 14: aastore\n 15: aload_0\n 16: iconst_1\n 17: ldc2_w #208 // double 1.8d\n 20: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 23: aastore\n 24: aload_0\n 25: iconst_2\n 26: ldc2_w #210 // double 2.5d\n 29: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 32: aastore\n 33: aload_0\n 34: iconst_3\n 35: ldc2_w #212 // double 3.5d\n 38: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 41: aastore\n 42: aload_0\n 43: iconst_4\n 44: ldc2_w #214 // double 5.0d\n 47: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 50: aastore\n 51: aload_0\n 52: iconst_5\n 53: ldc2_w #216 // double 7.0d\n 56: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 59: aastore\n 60: aload_0\n 61: invokestatic #221 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 64: putstatic #12 // Field distances:Ljava/util/List;\n 67: bipush 12\n 69: anewarray #4 // class java/lang/Object\n 72: astore_0\n 73: aload_0\n 74: iconst_0\n 75: ldc2_w #206 // double 1.2d\n 78: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 81: aastore\n 82: aload_0\n 83: iconst_1\n 84: ldc2_w #222 // double 1.4d\n 87: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 90: aastore\n 91: aload_0\n 92: iconst_2\n 93: iconst_2\n 94: invokestatic #228 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 97: aastore\n 98: aload_0\n 99: iconst_3\n 100: ldc2_w #229 // double 2.8d\n 103: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 106: aastore\n 107: aload_0\n 108: iconst_4\n 109: iconst_4\n 110: invokestatic #228 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 113: aastore\n 114: aload_0\n 115: iconst_5\n 116: ldc2_w #231 // double 5.6d\n 119: invokestatic #48 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;\n 122: aastore\n 123: aload_0\n 124: bipush 6\n 126: bipush 8\n 128: invokestatic #228 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 131: aastore\n 132: aload_0\n 133: bipush 7\n 135: bipush 11\n 137: invokestatic #228 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 140: aastore\n 141: aload_0\n 142: bipush 8\n 144: bipush 16\n 146: invokestatic #228 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 149: aastore\n 150: aload_0\n 151: bipush 9\n 153: bipush 22\n 155: invokestatic #228 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 158: aastore\n 159: aload_0\n 160: bipush 10\n 162: bipush 32\n 164: invokestatic #228 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 167: aastore\n 168: aload_0\n 169: bipush 11\n 171: bipush 45\n 173: invokestatic #228 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 176: aastore\n 177: aload_0\n 178: invokestatic #221 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;\n 181: putstatic #17 // Field apertures:Ljava/util/List;\n 184: return\n}\n", "javap_err": "" } ]
charlottemach__adventofcode__dc83994/2021/five.kt
import java.io.File import kotlin.math.abs fun main() { val input = File("five.txt").readText() val coord = input.trim().split("\n").map{ it.split(" -> ")} val mat = Array(1000) {Array(1000) {0} } //val mat = Array(10) {Array(10) {0} } for (c in coord) { val start = c.first().split(","); val stop = c.last().split(",") val x1 = start.first().toInt(); val y1 = start.last().toInt() val x2 = stop.first().toInt(); val y2 = stop.last().toInt() if (x1 == x2) { val mnY = minOf(y1,y2); val mxY = maxOf(y1,y2) for (y in mnY..mxY) { mat[y][x1] += 1 } } else if (y1 == y2) { val mnX = minOf(x1,x2); val mxX = maxOf(x1,x2) for (x in mnX..mxX) { mat[y1][x] += 1 } // Part B } else { for (i in 0..abs(x1-x2)) { if (y1 < y2) { if (x1 < x2) { mat[y1 + i][x1 + i] += 1 } else { mat[y1 + i][x1 - i] += 1 } } else { if (x1 < x2) { mat[y1 - i][x1 + i] += 1 } else { mat[y1 - i][x1 - i] += 1 } } } } } //mPrint(mat) print(mCount(mat)) } fun mPrint(mat: Array<Array<Int>>) { for (array in mat) { for (value in array) { print(value) } println() } } fun mCount(mat: Array<Array<Int>>) : Int { var count = 0 for (array in mat) { for (value in array) { if (value >= 2){ count += 1 } } } return(count) }
[ { "class_path": "charlottemach__adventofcode__dc83994/FiveKt.class", "javap": "Compiled from \"five.kt\"\npublic final class FiveKt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 // String five.txt\n 6: invokespecial #14 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 9: aconst_null\n 10: iconst_1\n 11: aconst_null\n 12: invokestatic #20 // Method kotlin/io/FilesKt.readText$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/lang/String;\n 15: astore_0\n 16: aload_0\n 17: checkcast #22 // class java/lang/CharSequence\n 20: invokestatic #28 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;\n 23: invokevirtual #32 // Method java/lang/Object.toString:()Ljava/lang/String;\n 26: checkcast #22 // class java/lang/CharSequence\n 29: iconst_1\n 30: anewarray #34 // class java/lang/String\n 33: astore_2\n 34: aload_2\n 35: iconst_0\n 36: ldc #36 // String \\n\n 38: aastore\n 39: aload_2\n 40: iconst_0\n 41: iconst_0\n 42: bipush 6\n 44: aconst_null\n 45: invokestatic #40 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 48: checkcast #42 // class java/lang/Iterable\n 51: astore_2\n 52: iconst_0\n 53: istore_3\n 54: aload_2\n 55: astore 4\n 57: new #44 // class java/util/ArrayList\n 60: dup\n 61: aload_2\n 62: bipush 10\n 64: invokestatic #50 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 67: invokespecial #53 // Method java/util/ArrayList.\"<init>\":(I)V\n 70: checkcast #55 // class java/util/Collection\n 73: astore 5\n 75: iconst_0\n 76: istore 6\n 78: aload 4\n 80: invokeinterface #59, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 85: astore 7\n 87: aload 7\n 89: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 94: ifeq 159\n 97: aload 7\n 99: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 104: astore 8\n 106: aload 5\n 108: aload 8\n 110: checkcast #34 // class java/lang/String\n 113: astore 9\n 115: astore 16\n 117: iconst_0\n 118: istore 10\n 120: aload 9\n 122: checkcast #22 // class java/lang/CharSequence\n 125: iconst_1\n 126: anewarray #34 // class java/lang/String\n 129: astore 11\n 131: aload 11\n 133: iconst_0\n 134: ldc #71 // String ->\n 136: aastore\n 137: aload 11\n 139: iconst_0\n 140: iconst_0\n 141: bipush 6\n 143: aconst_null\n 144: invokestatic #40 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 147: aload 16\n 149: swap\n 150: invokeinterface #75, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 155: pop\n 156: goto 87\n 159: aload 5\n 161: checkcast #77 // class java/util/List\n 164: nop\n 165: astore_1\n 166: iconst_0\n 167: istore_3\n 168: sipush 1000\n 171: anewarray #79 // class \"[Ljava/lang/Integer;\"\n 174: astore 4\n 176: iload_3\n 177: sipush 1000\n 180: if_icmpge 245\n 183: iload_3\n 184: istore 5\n 186: aload 4\n 188: iload 5\n 190: iconst_0\n 191: istore 6\n 193: sipush 1000\n 196: anewarray #81 // class java/lang/Integer\n 199: astore 7\n 201: istore 17\n 203: astore 16\n 205: iload 6\n 207: sipush 1000\n 210: if_icmpge 232\n 213: iload 6\n 215: istore 8\n 217: aload 7\n 219: iload 8\n 221: iconst_0\n 222: invokestatic #85 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 225: aastore\n 226: iinc 6, 1\n 229: goto 205\n 232: aload 16\n 234: iload 17\n 236: aload 7\n 238: aastore\n 239: iinc 3, 1\n 242: goto 176\n 245: aload 4\n 247: astore_2\n 248: aload_1\n 249: invokeinterface #86, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 254: astore_3\n 255: aload_3\n 256: invokeinterface #65, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 261: ifeq 740\n 264: aload_3\n 265: invokeinterface #69, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 270: checkcast #77 // class java/util/List\n 273: astore 4\n 275: aload 4\n 277: invokestatic #90 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 280: checkcast #22 // class java/lang/CharSequence\n 283: iconst_1\n 284: anewarray #34 // class java/lang/String\n 287: astore 6\n 289: aload 6\n 291: iconst_0\n 292: ldc #92 // String ,\n 294: aastore\n 295: aload 6\n 297: iconst_0\n 298: iconst_0\n 299: bipush 6\n 301: aconst_null\n 302: invokestatic #40 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 305: astore 5\n 307: aload 4\n 309: invokestatic #95 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 312: checkcast #22 // class java/lang/CharSequence\n 315: iconst_1\n 316: anewarray #34 // class java/lang/String\n 319: astore 7\n 321: aload 7\n 323: iconst_0\n 324: ldc #92 // String ,\n 326: aastore\n 327: aload 7\n 329: iconst_0\n 330: iconst_0\n 331: bipush 6\n 333: aconst_null\n 334: invokestatic #40 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 337: astore 6\n 339: aload 5\n 341: invokestatic #90 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 344: checkcast #34 // class java/lang/String\n 347: invokestatic #99 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 350: istore 7\n 352: aload 5\n 354: invokestatic #95 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 357: checkcast #34 // class java/lang/String\n 360: invokestatic #99 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 363: istore 8\n 365: aload 6\n 367: invokestatic #90 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;\n 370: checkcast #34 // class java/lang/String\n 373: invokestatic #99 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 376: istore 9\n 378: aload 6\n 380: invokestatic #95 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 383: checkcast #34 // class java/lang/String\n 386: invokestatic #99 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 389: istore 10\n 391: iload 7\n 393: iload 9\n 395: if_icmpne 464\n 398: iload 8\n 400: iload 10\n 402: invokestatic #105 // Method java/lang/Math.min:(II)I\n 405: istore 11\n 407: iload 8\n 409: iload 10\n 411: invokestatic #108 // Method java/lang/Math.max:(II)I\n 414: istore 12\n 416: iload 11\n 418: istore 13\n 420: iload 13\n 422: iload 12\n 424: if_icmpgt 255\n 427: aload_2\n 428: iload 13\n 430: aaload\n 431: astore 14\n 433: aload 14\n 435: iload 7\n 437: aload 14\n 439: iload 7\n 441: aaload\n 442: invokevirtual #112 // Method java/lang/Integer.intValue:()I\n 445: iconst_1\n 446: iadd\n 447: invokestatic #85 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 450: aastore\n 451: iload 13\n 453: iload 12\n 455: if_icmpeq 255\n 458: iinc 13, 1\n 461: goto 427\n 464: iload 8\n 466: iload 10\n 468: if_icmpne 541\n 471: iload 7\n 473: iload 9\n 475: invokestatic #105 // Method java/lang/Math.min:(II)I\n 478: istore 11\n 480: iload 7\n 482: iload 9\n 484: invokestatic #108 // Method java/lang/Math.max:(II)I\n 487: istore 12\n 489: iload 11\n 491: istore 13\n 493: iload 13\n 495: iload 12\n 497: if_icmpgt 255\n 500: aload_2\n 501: iload 8\n 503: aaload\n 504: astore 14\n 506: iload 13\n 508: istore 15\n 510: aload 14\n 512: iload 15\n 514: aload 14\n 516: iload 15\n 518: aaload\n 519: invokevirtual #112 // Method java/lang/Integer.intValue:()I\n 522: iconst_1\n 523: iadd\n 524: invokestatic #85 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 527: aastore\n 528: iload 13\n 530: iload 12\n 532: if_icmpeq 255\n 535: iinc 13, 1\n 538: goto 500\n 541: iconst_0\n 542: istore 11\n 544: iload 7\n 546: iload 9\n 548: isub\n 549: invokestatic #116 // Method java/lang/Math.abs:(I)I\n 552: istore 12\n 554: iload 11\n 556: iload 12\n 558: if_icmpgt 255\n 561: iload 8\n 563: iload 10\n 565: if_icmpge 649\n 568: iload 7\n 570: iload 9\n 572: if_icmpge 612\n 575: aload_2\n 576: iload 8\n 578: iload 11\n 580: iadd\n 581: aaload\n 582: astore 13\n 584: iload 7\n 586: iload 11\n 588: iadd\n 589: istore 14\n 591: aload 13\n 593: iload 14\n 595: aload 13\n 597: iload 14\n 599: aaload\n 600: invokevirtual #112 // Method java/lang/Integer.intValue:()I\n 603: iconst_1\n 604: iadd\n 605: invokestatic #85 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 608: aastore\n 609: goto 727\n 612: aload_2\n 613: iload 8\n 615: iload 11\n 617: iadd\n 618: aaload\n 619: astore 13\n 621: iload 7\n 623: iload 11\n 625: isub\n 626: istore 14\n 628: aload 13\n 630: iload 14\n 632: aload 13\n 634: iload 14\n 636: aaload\n 637: invokevirtual #112 // Method java/lang/Integer.intValue:()I\n 640: iconst_1\n 641: iadd\n 642: invokestatic #85 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 645: aastore\n 646: goto 727\n 649: iload 7\n 651: iload 9\n 653: if_icmpge 693\n 656: aload_2\n 657: iload 8\n 659: iload 11\n 661: isub\n 662: aaload\n 663: astore 13\n 665: iload 7\n 667: iload 11\n 669: iadd\n 670: istore 14\n 672: aload 13\n 674: iload 14\n 676: aload 13\n 678: iload 14\n 680: aaload\n 681: invokevirtual #112 // Method java/lang/Integer.intValue:()I\n 684: iconst_1\n 685: iadd\n 686: invokestatic #85 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 689: aastore\n 690: goto 727\n 693: aload_2\n 694: iload 8\n 696: iload 11\n 698: isub\n 699: aaload\n 700: astore 13\n 702: iload 7\n 704: iload 11\n 706: isub\n 707: istore 14\n 709: aload 13\n 711: iload 14\n 713: aload 13\n 715: iload 14\n 717: aaload\n 718: invokevirtual #112 // Method java/lang/Integer.intValue:()I\n 721: iconst_1\n 722: iadd\n 723: invokestatic #85 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 726: aastore\n 727: iload 11\n 729: iload 12\n 731: if_icmpeq 255\n 734: iinc 11, 1\n 737: goto 561\n 740: aload_2\n 741: invokestatic #120 // Method mCount:([[Ljava/lang/Integer;)I\n 744: istore_3\n 745: getstatic #126 // Field java/lang/System.out:Ljava/io/PrintStream;\n 748: iload_3\n 749: invokevirtual #131 // Method java/io/PrintStream.print:(I)V\n 752: return\n\n public static final void mPrint(java.lang.Integer[][]);\n Code:\n 0: aload_0\n 1: ldc #168 // String mat\n 3: invokestatic #174 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: aload_0\n 9: checkcast #176 // class \"[Ljava/lang/Object;\"\n 12: arraylength\n 13: istore_2\n 14: iload_1\n 15: iload_2\n 16: if_icmpge 72\n 19: aload_0\n 20: iload_1\n 21: aaload\n 22: astore_3\n 23: iconst_0\n 24: istore 4\n 26: aload_3\n 27: arraylength\n 28: istore 5\n 30: iload 4\n 32: iload 5\n 34: if_icmpge 60\n 37: aload_3\n 38: iload 4\n 40: aaload\n 41: invokevirtual #112 // Method java/lang/Integer.intValue:()I\n 44: istore 6\n 46: getstatic #126 // Field java/lang/System.out:Ljava/io/PrintStream;\n 49: iload 6\n 51: invokevirtual #131 // Method java/io/PrintStream.print:(I)V\n 54: iinc 4, 1\n 57: goto 30\n 60: getstatic #126 // Field java/lang/System.out:Ljava/io/PrintStream;\n 63: invokevirtual #179 // Method java/io/PrintStream.println:()V\n 66: iinc 1, 1\n 69: goto 14\n 72: return\n\n public static final int mCount(java.lang.Integer[][]);\n Code:\n 0: aload_0\n 1: ldc #168 // String mat\n 3: invokestatic #174 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: iconst_0\n 9: istore_2\n 10: aload_0\n 11: checkcast #176 // class \"[Ljava/lang/Object;\"\n 14: arraylength\n 15: istore_3\n 16: iload_2\n 17: iload_3\n 18: if_icmpge 72\n 21: aload_0\n 22: iload_2\n 23: aaload\n 24: astore 4\n 26: iconst_0\n 27: istore 5\n 29: aload 4\n 31: arraylength\n 32: istore 6\n 34: iload 5\n 36: iload 6\n 38: if_icmpge 66\n 41: aload 4\n 43: iload 5\n 45: aaload\n 46: invokevirtual #112 // Method java/lang/Integer.intValue:()I\n 49: istore 7\n 51: iload 7\n 53: iconst_2\n 54: if_icmplt 60\n 57: iinc 1, 1\n 60: iinc 5, 1\n 63: goto 34\n 66: iinc 2, 1\n 69: goto 16\n 72: iload_1\n 73: ireturn\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #185 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
charlottemach__adventofcode__dc83994/2023/11/eleven.kt
import java.io.File import java.math.BigInteger import java.util.Collections fun main() { val input = File("input.txt").readText() println(cosmicExpansion(input,2)) println(cosmicExpansion(input,1000000)) } fun cosmicExpansion(input: String, times: Int):BigInteger{ var lines = input.split("\n").dropLast(1) var n = lines.size var map = Array(n) {Array(n) {""} } var galaxies = arrayOf<Pair<Int,Int>>() for (y in 0..n-1) { val line = lines[y].split("").drop(1).dropLast(1) for (x in 0..n-1) { var v = line[x] map[y][x] = v if (v == "#") { galaxies += Pair(x,y) } } } //pprint(map) var distSum = 0.toBigInteger() var (xs,ys) = getExpandLines(map,n) for (gi in 0..galaxies.size) { for (gj in gi+1..galaxies.size-1) { var p1 = galaxies[gi] var p2 = galaxies[gj] distSum += getDist(p1,p2,xs,ys,times) } } return distSum } fun getDist(p1:Pair<Int,Int>, p2:Pair<Int,Int>, xs:Array<Int>, ys: Array<Int>, times:Int):BigInteger { var (x1,y1) = p1 var (x2,y2) = p2 var dist = Math.abs(x2-x1) + Math.abs(y2-y1) if (x1 < x2) { x2 = x1.apply{x1 = x2} } if (y1 < y2) { y2 = y1.apply{y1 = y2} } var cnt = 0 for (xx in x2..x1) { if (xs.any({x -> x==xx})) { cnt += 1 } } for (yy in y2..y1) { if (ys.any({y -> y==yy})) { cnt += 1 } } return dist.toBigInteger() + (cnt.toBigInteger() * (times-1).toBigInteger()) } fun getExpandLines(map:Array<Array<String>>, n:Int):Pair<Array<Int>,Array<Int>> { var ys = arrayOf<Int>() for (x in 0..n-1) { var col = arrayOf<String>() for (y in 0..n-1) { col += map[y][x] } if (col.all({y -> y=="."})) { ys += x } } var xs = arrayOf<Int>() for (x in 0..n-1) { if (map[x].all({x -> x!="#"})) { xs += x } } return Pair(ys,xs) } fun pprint(map: Array<Array<String>>) { for (line in map) { for (l in line) { print(l) } print("\n") } }
[ { "class_path": "charlottemach__adventofcode__dc83994/ElevenKt.class", "javap": "Compiled from \"eleven.kt\"\npublic final class ElevenKt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 // String input.txt\n 6: invokespecial #14 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 9: aconst_null\n 10: iconst_1\n 11: aconst_null\n 12: invokestatic #20 // Method kotlin/io/FilesKt.readText$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/lang/String;\n 15: astore_0\n 16: aload_0\n 17: iconst_2\n 18: invokestatic #24 // Method cosmicExpansion:(Ljava/lang/String;I)Ljava/math/BigInteger;\n 21: getstatic #30 // Field java/lang/System.out:Ljava/io/PrintStream;\n 24: swap\n 25: invokevirtual #36 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 28: aload_0\n 29: ldc #37 // int 1000000\n 31: invokestatic #24 // Method cosmicExpansion:(Ljava/lang/String;I)Ljava/math/BigInteger;\n 34: getstatic #30 // Field java/lang/System.out:Ljava/io/PrintStream;\n 37: swap\n 38: invokevirtual #36 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 41: return\n\n public static final java.math.BigInteger cosmicExpansion(java.lang.String, int);\n Code:\n 0: aload_0\n 1: ldc #41 // String input\n 3: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: checkcast #49 // class java/lang/CharSequence\n 10: iconst_1\n 11: anewarray #51 // class java/lang/String\n 14: astore_3\n 15: aload_3\n 16: iconst_0\n 17: ldc #53 // String \\n\n 19: aastore\n 20: aload_3\n 21: iconst_0\n 22: iconst_0\n 23: bipush 6\n 25: aconst_null\n 26: invokestatic #59 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 29: iconst_1\n 30: invokestatic #65 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;\n 33: astore_2\n 34: aload_2\n 35: invokeinterface #71, 1 // InterfaceMethod java/util/List.size:()I\n 40: istore_3\n 41: iconst_0\n 42: istore 5\n 44: iload_3\n 45: istore 6\n 47: iload 6\n 49: anewarray #73 // class \"[Ljava/lang/String;\"\n 52: astore 7\n 54: iload 5\n 56: iload 6\n 58: if_icmpge 123\n 61: iload 5\n 63: istore 8\n 65: aload 7\n 67: iload 8\n 69: iconst_0\n 70: istore 9\n 72: iload_3\n 73: istore 10\n 75: iload 10\n 77: anewarray #51 // class java/lang/String\n 80: astore 11\n 82: istore 17\n 84: astore 16\n 86: iload 9\n 88: iload 10\n 90: if_icmpge 110\n 93: iload 9\n 95: istore 12\n 97: aload 11\n 99: iload 12\n 101: ldc #75 // String\n 103: aastore\n 104: iinc 9, 1\n 107: goto 86\n 110: aload 16\n 112: iload 17\n 114: aload 11\n 116: aastore\n 117: iinc 5, 1\n 120: goto 54\n 123: aload 7\n 125: astore 4\n 127: iconst_0\n 128: anewarray #77 // class kotlin/Pair\n 131: astore 5\n 133: iconst_0\n 134: istore 6\n 136: iload_3\n 137: iconst_1\n 138: isub\n 139: istore 7\n 141: iload 6\n 143: iload 7\n 145: if_icmpgt 296\n 148: aload_2\n 149: iload 6\n 151: invokeinterface #81, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 156: checkcast #49 // class java/lang/CharSequence\n 159: iconst_1\n 160: anewarray #51 // class java/lang/String\n 163: astore 9\n 165: aload 9\n 167: iconst_0\n 168: ldc #75 // String\n 170: aastore\n 171: aload 9\n 173: iconst_0\n 174: iconst_0\n 175: bipush 6\n 177: aconst_null\n 178: invokestatic #59 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 181: checkcast #83 // class java/lang/Iterable\n 184: iconst_1\n 185: invokestatic #87 // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;\n 188: iconst_1\n 189: invokestatic #65 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;\n 192: astore 8\n 194: iconst_0\n 195: istore 9\n 197: iload_3\n 198: iconst_1\n 199: isub\n 200: istore 10\n 202: iload 9\n 204: iload 10\n 206: if_icmpgt 283\n 209: aload 8\n 211: iload 9\n 213: invokeinterface #81, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 218: checkcast #51 // class java/lang/String\n 221: astore 11\n 223: aload 4\n 225: iload 6\n 227: aaload\n 228: iload 9\n 230: aload 11\n 232: aastore\n 233: aload 11\n 235: ldc #89 // String #\n 237: invokestatic #93 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 240: ifeq 270\n 243: aload 5\n 245: new #77 // class kotlin/Pair\n 248: dup\n 249: iload 9\n 251: invokestatic #99 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 254: iload 6\n 256: invokestatic #99 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 259: invokespecial #102 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 262: invokestatic #108 // Method kotlin/collections/ArraysKt.plus:([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;\n 265: checkcast #110 // class \"[Lkotlin/Pair;\"\n 268: astore 5\n 270: iload 9\n 272: iload 10\n 274: if_icmpeq 283\n 277: iinc 9, 1\n 280: goto 209\n 283: iload 6\n 285: iload 7\n 287: if_icmpeq 296\n 290: iinc 6, 1\n 293: goto 148\n 296: lconst_0\n 297: invokestatic #115 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 300: dup\n 301: ldc #117 // String valueOf(...)\n 303: invokestatic #120 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 306: astore 6\n 308: aload 4\n 310: iload_3\n 311: invokestatic #124 // Method getExpandLines:([[Ljava/lang/String;I)Lkotlin/Pair;\n 314: astore 7\n 316: aload 7\n 318: invokevirtual #128 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 321: checkcast #130 // class \"[Ljava/lang/Integer;\"\n 324: astore 8\n 326: aload 7\n 328: invokevirtual #133 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 331: checkcast #130 // class \"[Ljava/lang/Integer;\"\n 334: astore 9\n 336: iconst_0\n 337: istore 10\n 339: aload 5\n 341: arraylength\n 342: istore 11\n 344: iload 10\n 346: iload 11\n 348: if_icmpgt 436\n 351: iload 10\n 353: iconst_1\n 354: iadd\n 355: istore 12\n 357: aload 5\n 359: arraylength\n 360: iconst_1\n 361: isub\n 362: istore 13\n 364: iload 12\n 366: iload 13\n 368: if_icmpgt 423\n 371: aload 5\n 373: iload 10\n 375: aaload\n 376: astore 14\n 378: aload 5\n 380: iload 12\n 382: aaload\n 383: astore 15\n 385: aload 6\n 387: aload 14\n 389: aload 15\n 391: aload 8\n 393: aload 9\n 395: iload_1\n 396: invokestatic #137 // Method getDist:(Lkotlin/Pair;Lkotlin/Pair;[Ljava/lang/Integer;[Ljava/lang/Integer;I)Ljava/math/BigInteger;\n 399: invokevirtual #141 // Method java/math/BigInteger.add:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 402: dup\n 403: ldc #143 // String add(...)\n 405: invokestatic #120 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 408: astore 6\n 410: iload 12\n 412: iload 13\n 414: if_icmpeq 423\n 417: iinc 12, 1\n 420: goto 371\n 423: iload 10\n 425: iload 11\n 427: if_icmpeq 436\n 430: iinc 10, 1\n 433: goto 351\n 436: aload 6\n 438: areturn\n\n public static final java.math.BigInteger getDist(kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer[], java.lang.Integer[], int);\n Code:\n 0: aload_0\n 1: ldc #167 // String p1\n 3: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: ldc #168 // String p2\n 9: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 12: aload_2\n 13: ldc #169 // String xs\n 15: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 18: aload_3\n 19: ldc #170 // String ys\n 21: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 24: iconst_0\n 25: istore 5\n 27: aload_0\n 28: invokevirtual #128 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 31: checkcast #172 // class java/lang/Number\n 34: invokevirtual #175 // Method java/lang/Number.intValue:()I\n 37: istore 5\n 39: iconst_0\n 40: istore 6\n 42: aload_0\n 43: invokevirtual #133 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 46: checkcast #172 // class java/lang/Number\n 49: invokevirtual #175 // Method java/lang/Number.intValue:()I\n 52: istore 6\n 54: iconst_0\n 55: istore 7\n 57: aload_1\n 58: invokevirtual #128 // Method kotlin/Pair.component1:()Ljava/lang/Object;\n 61: checkcast #172 // class java/lang/Number\n 64: invokevirtual #175 // Method java/lang/Number.intValue:()I\n 67: istore 7\n 69: iconst_0\n 70: istore 8\n 72: aload_1\n 73: invokevirtual #133 // Method kotlin/Pair.component2:()Ljava/lang/Object;\n 76: checkcast #172 // class java/lang/Number\n 79: invokevirtual #175 // Method java/lang/Number.intValue:()I\n 82: istore 8\n 84: iload 7\n 86: iload 5\n 88: isub\n 89: invokestatic #181 // Method java/lang/Math.abs:(I)I\n 92: iload 8\n 94: iload 6\n 96: isub\n 97: invokestatic #181 // Method java/lang/Math.abs:(I)I\n 100: iadd\n 101: istore 9\n 103: iload 5\n 105: iload 7\n 107: if_icmpge 129\n 110: iload 5\n 112: istore 10\n 114: iload 10\n 116: istore 11\n 118: iconst_0\n 119: istore 12\n 121: iload 7\n 123: istore 5\n 125: iload 10\n 127: istore 7\n 129: iload 6\n 131: iload 8\n 133: if_icmpge 155\n 136: iload 6\n 138: istore 10\n 140: iload 10\n 142: istore 11\n 144: iconst_0\n 145: istore 12\n 147: iload 8\n 149: istore 6\n 151: iload 10\n 153: istore 8\n 155: iconst_0\n 156: istore 10\n 158: iload 7\n 160: istore 11\n 162: iload 5\n 164: istore 12\n 166: iload 11\n 168: iload 12\n 170: if_icmpgt 259\n 173: aload_2\n 174: astore 13\n 176: iconst_0\n 177: istore 14\n 179: iconst_0\n 180: istore 15\n 182: aload 13\n 184: arraylength\n 185: istore 16\n 187: iload 15\n 189: iload 16\n 191: if_icmpge 239\n 194: aload 13\n 196: iload 15\n 198: aaload\n 199: astore 17\n 201: aload 17\n 203: checkcast #172 // class java/lang/Number\n 206: invokevirtual #175 // Method java/lang/Number.intValue:()I\n 209: istore 18\n 211: iconst_0\n 212: istore 19\n 214: iload 18\n 216: iload 11\n 218: if_icmpne 225\n 221: iconst_1\n 222: goto 226\n 225: iconst_0\n 226: ifeq 233\n 229: iconst_1\n 230: goto 240\n 233: iinc 15, 1\n 236: goto 187\n 239: iconst_0\n 240: ifeq 246\n 243: iinc 10, 1\n 246: iload 11\n 248: iload 12\n 250: if_icmpeq 259\n 253: iinc 11, 1\n 256: goto 173\n 259: iload 8\n 261: istore 11\n 263: iload 6\n 265: istore 12\n 267: iload 11\n 269: iload 12\n 271: if_icmpgt 360\n 274: aload_3\n 275: astore 13\n 277: iconst_0\n 278: istore 14\n 280: iconst_0\n 281: istore 15\n 283: aload 13\n 285: arraylength\n 286: istore 16\n 288: iload 15\n 290: iload 16\n 292: if_icmpge 340\n 295: aload 13\n 297: iload 15\n 299: aaload\n 300: astore 17\n 302: aload 17\n 304: checkcast #172 // class java/lang/Number\n 307: invokevirtual #175 // Method java/lang/Number.intValue:()I\n 310: istore 18\n 312: iconst_0\n 313: istore 19\n 315: iload 18\n 317: iload 11\n 319: if_icmpne 326\n 322: iconst_1\n 323: goto 327\n 326: iconst_0\n 327: ifeq 334\n 330: iconst_1\n 331: goto 341\n 334: iinc 15, 1\n 337: goto 288\n 340: iconst_0\n 341: ifeq 347\n 344: iinc 10, 1\n 347: iload 11\n 349: iload 12\n 351: if_icmpeq 360\n 354: iinc 11, 1\n 357: goto 274\n 360: nop\n 361: iload 9\n 363: i2l\n 364: invokestatic #115 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 367: dup\n 368: ldc #117 // String valueOf(...)\n 370: invokestatic #120 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 373: nop\n 374: iload 10\n 376: i2l\n 377: invokestatic #115 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 380: dup\n 381: ldc #117 // String valueOf(...)\n 383: invokestatic #120 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 386: iload 4\n 388: iconst_1\n 389: isub\n 390: i2l\n 391: invokestatic #115 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;\n 394: dup\n 395: ldc #117 // String valueOf(...)\n 397: invokestatic #120 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 400: invokevirtual #184 // Method java/math/BigInteger.multiply:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 403: dup\n 404: ldc #186 // String multiply(...)\n 406: invokestatic #120 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 409: invokevirtual #141 // Method java/math/BigInteger.add:(Ljava/math/BigInteger;)Ljava/math/BigInteger;\n 412: dup\n 413: ldc #143 // String add(...)\n 415: invokestatic #120 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 418: areturn\n\n public static final kotlin.Pair<java.lang.Integer[], java.lang.Integer[]> getExpandLines(java.lang.String[][], int);\n Code:\n 0: aload_0\n 1: ldc #207 // String map\n 3: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: anewarray #95 // class java/lang/Integer\n 10: astore_2\n 11: iconst_0\n 12: istore_3\n 13: iload_1\n 14: iconst_1\n 15: isub\n 16: istore 4\n 18: iload_3\n 19: iload 4\n 21: if_icmpgt 158\n 24: iconst_0\n 25: anewarray #51 // class java/lang/String\n 28: astore 5\n 30: iconst_0\n 31: istore 6\n 33: iload_1\n 34: iconst_1\n 35: isub\n 36: istore 7\n 38: iload 6\n 40: iload 7\n 42: if_icmpgt 74\n 45: aload 5\n 47: aload_0\n 48: iload 6\n 50: aaload\n 51: iload_3\n 52: aaload\n 53: invokestatic #108 // Method kotlin/collections/ArraysKt.plus:([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;\n 56: checkcast #73 // class \"[Ljava/lang/String;\"\n 59: astore 5\n 61: iload 6\n 63: iload 7\n 65: if_icmpeq 74\n 68: iinc 6, 1\n 71: goto 45\n 74: aload 5\n 76: astore 6\n 78: iconst_0\n 79: istore 7\n 81: iconst_0\n 82: istore 8\n 84: aload 6\n 86: arraylength\n 87: istore 9\n 89: iload 8\n 91: iload 9\n 93: if_icmpge 130\n 96: aload 6\n 98: iload 8\n 100: aaload\n 101: astore 10\n 103: aload 10\n 105: astore 11\n 107: iconst_0\n 108: istore 12\n 110: aload 11\n 112: ldc #209 // String .\n 114: invokestatic #93 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 117: ifne 124\n 120: iconst_0\n 121: goto 131\n 124: iinc 8, 1\n 127: goto 89\n 130: iconst_1\n 131: ifeq 146\n 134: aload_2\n 135: iload_3\n 136: invokestatic #99 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 139: invokestatic #108 // Method kotlin/collections/ArraysKt.plus:([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;\n 142: checkcast #130 // class \"[Ljava/lang/Integer;\"\n 145: astore_2\n 146: iload_3\n 147: iload 4\n 149: if_icmpeq 158\n 152: iinc 3, 1\n 155: goto 24\n 158: iconst_0\n 159: anewarray #95 // class java/lang/Integer\n 162: astore_3\n 163: iconst_0\n 164: istore 4\n 166: iload_1\n 167: iconst_1\n 168: isub\n 169: istore 5\n 171: iload 4\n 173: iload 5\n 175: if_icmpgt 274\n 178: aload_0\n 179: iload 4\n 181: aaload\n 182: astore 6\n 184: iconst_0\n 185: istore 7\n 187: iconst_0\n 188: istore 8\n 190: aload 6\n 192: arraylength\n 193: istore 9\n 195: iload 8\n 197: iload 9\n 199: if_icmpge 244\n 202: aload 6\n 204: iload 8\n 206: aaload\n 207: astore 10\n 209: aload 10\n 211: astore 11\n 213: iconst_0\n 214: istore 12\n 216: aload 11\n 218: ldc #89 // String #\n 220: invokestatic #93 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 223: ifne 230\n 226: iconst_1\n 227: goto 231\n 230: iconst_0\n 231: ifne 238\n 234: iconst_0\n 235: goto 245\n 238: iinc 8, 1\n 241: goto 195\n 244: iconst_1\n 245: ifeq 261\n 248: aload_3\n 249: iload 4\n 251: invokestatic #99 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 254: invokestatic #108 // Method kotlin/collections/ArraysKt.plus:([Ljava/lang/Object;Ljava/lang/Object;)[Ljava/lang/Object;\n 257: checkcast #130 // class \"[Ljava/lang/Integer;\"\n 260: astore_3\n 261: iload 4\n 263: iload 5\n 265: if_icmpeq 274\n 268: iinc 4, 1\n 271: goto 178\n 274: new #77 // class kotlin/Pair\n 277: dup\n 278: aload_2\n 279: aload_3\n 280: invokespecial #102 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 283: areturn\n\n public static final void pprint(java.lang.String[][]);\n Code:\n 0: aload_0\n 1: ldc #207 // String map\n 3: invokestatic #47 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: iconst_0\n 7: istore_1\n 8: aload_0\n 9: checkcast #217 // class \"[Ljava/lang/Object;\"\n 12: arraylength\n 13: istore_2\n 14: iload_1\n 15: iload_2\n 16: if_icmpge 72\n 19: aload_0\n 20: iload_1\n 21: aaload\n 22: astore_3\n 23: iconst_0\n 24: istore 4\n 26: aload_3\n 27: arraylength\n 28: istore 5\n 30: iload 4\n 32: iload 5\n 34: if_icmpge 57\n 37: aload_3\n 38: iload 4\n 40: aaload\n 41: astore 6\n 43: getstatic #30 // Field java/lang/System.out:Ljava/io/PrintStream;\n 46: aload 6\n 48: invokevirtual #220 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V\n 51: iinc 4, 1\n 54: goto 30\n 57: ldc #53 // String \\n\n 59: getstatic #30 // Field java/lang/System.out:Ljava/io/PrintStream;\n 62: swap\n 63: invokevirtual #220 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V\n 66: iinc 1, 1\n 69: goto 14\n 72: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #224 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
skrim__AdventOfCode__0e7f425/2021/19/program.kt
data class Coordinate(val x: Int, val y: Int, val z: Int) { fun add(other: Coordinate) : Coordinate = Coordinate(x + other.x, y + other.y, z + other.z) fun subtract(other: Coordinate) : Coordinate = Coordinate(x - other.x, y - other.y, z - other.z) fun manhattanDistance(other: Coordinate) : Int = Math.abs(x - other.x) + Math.abs(y - other.y) + Math.abs(z - other.z) private fun getHeading(heading: Int) : Coordinate { when (heading) { // heading 0 -> return Coordinate(x, y, z) 1 -> return Coordinate(-y, x, z) 2 -> return Coordinate(-x, -y, z) 3 -> return Coordinate(y, -x, z) 4 -> return Coordinate(-z, y, x) 5 -> return Coordinate(z, y, -x) else -> throw Exception("Wut") } } private fun getRotation(rotation: Int) : Coordinate { when (rotation) { // rotation 0 -> return Coordinate(x, y, z); 1 -> return Coordinate(x, -z, y); 2 -> return Coordinate(x, -y, -z); 3 -> return Coordinate(x, z, -y); else -> throw Exception("Wut") } } fun transform(direction: Int) : Coordinate = getHeading(direction / 4).getRotation(direction % 4) } class Scanner() { var coordinates: MutableList<Coordinate> = mutableListOf<Coordinate>() var position: Coordinate = Coordinate(0, 0, 0) fun getRotatedCoordinates(rotation: Int, delta: Coordinate) : MutableList<Coordinate> = coordinates.map({ it.transform(rotation).subtract(delta) }).toMutableList() fun normalize(rotation: Int, delta: Coordinate) { coordinates = getRotatedCoordinates(rotation, delta) position = Coordinate(0, 0, 0).subtract(delta) } } class Program { var pendingLocation : MutableList<Scanner> = mutableListOf<Scanner>() var pendingCompare : MutableList<Scanner> = mutableListOf<Scanner>() var completed : MutableList<Scanner> = mutableListOf<Scanner>() fun load() { var first = true var current : Scanner = Scanner() pendingCompare.add(current) java.io.File("input.txt").forEachLine { if (it.startsWith("---")) { if (!first) { current = Scanner() pendingLocation.add(current) } first = false } else if (!it.isNullOrEmpty()) { val tokens = it.split(",") current.coordinates.add(Coordinate(tokens[0].toInt(), tokens[1].toInt(), tokens[2].toInt())) } } } fun iterate() { val first = pendingCompare[0] var i = 0 while (i < pendingLocation.count()) { val second = pendingLocation[i] var found = false var fi = 0 while (!found && fi < first.coordinates.count()) { val c1 = first.coordinates[fi++] var si = 0 while (!found && si < second.coordinates.count()) { val c2 = second.coordinates[si++] for (rotation in 0..23) { val tc2 = c2.transform(rotation) val delta = tc2.subtract(c1) var matchAttempt = second.getRotatedCoordinates(rotation, delta) var result = first.coordinates.intersect(matchAttempt) if (result.count() == 12) { second.normalize(rotation, delta) found = true } } } } if (found) { pendingLocation.removeAt(i) pendingCompare.add(second) } else { i++ } } pendingCompare.removeAt(0) completed.add(first) } fun coordinateCount() : Int = completed.flatMap { it.coordinates }.distinct().count() fun maxDistance() : Int { var result = 0 completed.forEach { first -> completed.forEach { second -> result = Math.max(result, first.position.manhattanDistance(second.position)) } } return result } fun run() { load() while (pendingLocation.count() + pendingCompare.count() > 0) iterate() println("Part 1: ${coordinateCount()}") println("Part 2: ${maxDistance()}") } } fun main() = Program().run()
[ { "class_path": "skrim__AdventOfCode__0e7f425/ProgramKt.class", "javap": "Compiled from \"program.kt\"\npublic final class ProgramKt {\n public static final void main();\n Code:\n 0: new #8 // class Program\n 3: dup\n 4: invokespecial #11 // Method Program.\"<init>\":()V\n 7: invokevirtual #14 // Method Program.run:()V\n 10: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #17 // Method main:()V\n 3: return\n}\n", "javap_err": "" }, { "class_path": "skrim__AdventOfCode__0e7f425/Program.class", "javap": "Compiled from \"program.kt\"\npublic final class Program {\n private java.util.List<Scanner> pendingLocation;\n\n private java.util.List<Scanner> pendingCompare;\n\n private java.util.List<Scanner> completed;\n\n public Program();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: new #10 // class java/util/ArrayList\n 8: dup\n 9: invokespecial #11 // Method java/util/ArrayList.\"<init>\":()V\n 12: checkcast #13 // class java/util/List\n 15: putfield #17 // Field pendingLocation:Ljava/util/List;\n 18: aload_0\n 19: new #10 // class java/util/ArrayList\n 22: dup\n 23: invokespecial #11 // Method java/util/ArrayList.\"<init>\":()V\n 26: checkcast #13 // class java/util/List\n 29: putfield #20 // Field pendingCompare:Ljava/util/List;\n 32: aload_0\n 33: new #10 // class java/util/ArrayList\n 36: dup\n 37: invokespecial #11 // Method java/util/ArrayList.\"<init>\":()V\n 40: checkcast #13 // class java/util/List\n 43: putfield #23 // Field completed:Ljava/util/List;\n 46: return\n\n public final java.util.List<Scanner> getPendingLocation();\n Code:\n 0: aload_0\n 1: getfield #17 // Field pendingLocation:Ljava/util/List;\n 4: areturn\n\n public final void setPendingLocation(java.util.List<Scanner>);\n Code:\n 0: aload_1\n 1: ldc #34 // String <set-?>\n 3: invokestatic #40 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: putfield #17 // Field pendingLocation:Ljava/util/List;\n 11: return\n\n public final java.util.List<Scanner> getPendingCompare();\n Code:\n 0: aload_0\n 1: getfield #20 // Field pendingCompare:Ljava/util/List;\n 4: areturn\n\n public final void setPendingCompare(java.util.List<Scanner>);\n Code:\n 0: aload_1\n 1: ldc #34 // String <set-?>\n 3: invokestatic #40 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: putfield #20 // Field pendingCompare:Ljava/util/List;\n 11: return\n\n public final java.util.List<Scanner> getCompleted();\n Code:\n 0: aload_0\n 1: getfield #23 // Field completed:Ljava/util/List;\n 4: areturn\n\n public final void setCompleted(java.util.List<Scanner>);\n Code:\n 0: aload_1\n 1: ldc #34 // String <set-?>\n 3: invokestatic #40 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: putfield #23 // Field completed:Ljava/util/List;\n 11: return\n\n public final void load();\n Code:\n 0: new #47 // class kotlin/jvm/internal/Ref$BooleanRef\n 3: dup\n 4: invokespecial #48 // Method kotlin/jvm/internal/Ref$BooleanRef.\"<init>\":()V\n 7: astore_1\n 8: aload_1\n 9: iconst_1\n 10: putfield #52 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 13: new #54 // class kotlin/jvm/internal/Ref$ObjectRef\n 16: dup\n 17: invokespecial #55 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 20: astore_2\n 21: aload_2\n 22: new #57 // class Scanner\n 25: dup\n 26: invokespecial #58 // Method Scanner.\"<init>\":()V\n 29: putfield #61 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 32: aload_0\n 33: getfield #20 // Field pendingCompare:Ljava/util/List;\n 36: aload_2\n 37: getfield #61 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 40: invokeinterface #65, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 45: pop\n 46: new #67 // class java/io/File\n 49: dup\n 50: ldc #69 // String input.txt\n 52: invokespecial #72 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 55: aconst_null\n 56: aload_1\n 57: aload_2\n 58: aload_0\n 59: invokedynamic #92, 0 // InvokeDynamic #0:invoke:(Lkotlin/jvm/internal/Ref$BooleanRef;Lkotlin/jvm/internal/Ref$ObjectRef;LProgram;)Lkotlin/jvm/functions/Function1;\n 64: iconst_1\n 65: aconst_null\n 66: invokestatic #98 // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V\n 69: return\n\n public final void iterate();\n Code:\n 0: aload_0\n 1: getfield #20 // Field pendingCompare:Ljava/util/List;\n 4: iconst_0\n 5: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 10: checkcast #57 // class Scanner\n 13: astore_1\n 14: iconst_0\n 15: istore_2\n 16: iload_2\n 17: aload_0\n 18: getfield #17 // Field pendingLocation:Ljava/util/List;\n 21: checkcast #109 // class java/util/Collection\n 24: invokeinterface #113, 1 // InterfaceMethod java/util/Collection.size:()I\n 29: if_icmpge 262\n 32: aload_0\n 33: getfield #17 // Field pendingLocation:Ljava/util/List;\n 36: iload_2\n 37: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 42: checkcast #57 // class Scanner\n 45: astore_3\n 46: iconst_0\n 47: istore 4\n 49: iconst_0\n 50: istore 5\n 52: iload 4\n 54: ifne 224\n 57: iload 5\n 59: aload_1\n 60: invokevirtual #116 // Method Scanner.getCoordinates:()Ljava/util/List;\n 63: checkcast #109 // class java/util/Collection\n 66: invokeinterface #113, 1 // InterfaceMethod java/util/Collection.size:()I\n 71: if_icmpge 224\n 74: aload_1\n 75: invokevirtual #116 // Method Scanner.getCoordinates:()Ljava/util/List;\n 78: iload 5\n 80: iinc 5, 1\n 83: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 88: checkcast #118 // class Coordinate\n 91: astore 6\n 93: iconst_0\n 94: istore 7\n 96: iload 4\n 98: ifne 52\n 101: iload 7\n 103: aload_3\n 104: invokevirtual #116 // Method Scanner.getCoordinates:()Ljava/util/List;\n 107: checkcast #109 // class java/util/Collection\n 110: invokeinterface #113, 1 // InterfaceMethod java/util/Collection.size:()I\n 115: if_icmpge 52\n 118: aload_3\n 119: invokevirtual #116 // Method Scanner.getCoordinates:()Ljava/util/List;\n 122: iload 7\n 124: iinc 7, 1\n 127: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 132: checkcast #118 // class Coordinate\n 135: astore 8\n 137: iconst_0\n 138: istore 9\n 140: iload 9\n 142: bipush 24\n 144: if_icmpge 96\n 147: aload 8\n 149: iload 9\n 151: invokevirtual #122 // Method Coordinate.transform:(I)LCoordinate;\n 154: astore 10\n 156: aload 10\n 158: aload 6\n 160: invokevirtual #126 // Method Coordinate.subtract:(LCoordinate;)LCoordinate;\n 163: astore 11\n 165: aload_3\n 166: iload 9\n 168: aload 11\n 170: invokevirtual #130 // Method Scanner.getRotatedCoordinates:(ILCoordinate;)Ljava/util/List;\n 173: astore 12\n 175: aload_1\n 176: invokevirtual #116 // Method Scanner.getCoordinates:()Ljava/util/List;\n 179: checkcast #132 // class java/lang/Iterable\n 182: aload 12\n 184: checkcast #132 // class java/lang/Iterable\n 187: invokestatic #138 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;\n 190: astore 13\n 192: aload 13\n 194: checkcast #109 // class java/util/Collection\n 197: invokeinterface #113, 1 // InterfaceMethod java/util/Collection.size:()I\n 202: bipush 12\n 204: if_icmpne 218\n 207: aload_3\n 208: iload 9\n 210: aload 11\n 212: invokevirtual #142 // Method Scanner.normalize:(ILCoordinate;)V\n 215: iconst_1\n 216: istore 4\n 218: iinc 9, 1\n 221: goto 140\n 224: iload 4\n 226: ifeq 254\n 229: aload_0\n 230: getfield #17 // Field pendingLocation:Ljava/util/List;\n 233: iload_2\n 234: invokeinterface #145, 2 // InterfaceMethod java/util/List.remove:(I)Ljava/lang/Object;\n 239: pop\n 240: aload_0\n 241: getfield #20 // Field pendingCompare:Ljava/util/List;\n 244: aload_3\n 245: invokeinterface #65, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 250: pop\n 251: goto 16\n 254: iload_2\n 255: iinc 2, 1\n 258: pop\n 259: goto 16\n 262: aload_0\n 263: getfield #20 // Field pendingCompare:Ljava/util/List;\n 266: iconst_0\n 267: invokeinterface #145, 2 // InterfaceMethod java/util/List.remove:(I)Ljava/lang/Object;\n 272: pop\n 273: aload_0\n 274: getfield #23 // Field completed:Ljava/util/List;\n 277: aload_1\n 278: invokeinterface #65, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 283: pop\n 284: return\n\n public final int coordinateCount();\n Code:\n 0: aload_0\n 1: getfield #23 // Field completed:Ljava/util/List;\n 4: checkcast #132 // class java/lang/Iterable\n 7: astore_1\n 8: iconst_0\n 9: istore_2\n 10: aload_1\n 11: astore_3\n 12: new #10 // class java/util/ArrayList\n 15: dup\n 16: invokespecial #11 // Method java/util/ArrayList.\"<init>\":()V\n 19: checkcast #109 // class java/util/Collection\n 22: astore 4\n 24: iconst_0\n 25: istore 5\n 27: aload_3\n 28: invokeinterface #168, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 33: astore 6\n 35: aload 6\n 37: invokeinterface #174, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 42: ifeq 85\n 45: aload 6\n 47: invokeinterface #178, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 52: astore 7\n 54: aload 7\n 56: checkcast #57 // class Scanner\n 59: astore 8\n 61: iconst_0\n 62: istore 9\n 64: aload 8\n 66: invokevirtual #116 // Method Scanner.getCoordinates:()Ljava/util/List;\n 69: checkcast #132 // class java/lang/Iterable\n 72: astore 8\n 74: aload 4\n 76: aload 8\n 78: invokestatic #182 // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z\n 81: pop\n 82: goto 35\n 85: aload 4\n 87: checkcast #13 // class java/util/List\n 90: nop\n 91: checkcast #132 // class java/lang/Iterable\n 94: invokestatic #186 // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;\n 97: checkcast #109 // class java/util/Collection\n 100: invokeinterface #113, 1 // InterfaceMethod java/util/Collection.size:()I\n 105: ireturn\n\n public final int maxDistance();\n Code:\n 0: iconst_0\n 1: istore_1\n 2: aload_0\n 3: getfield #23 // Field completed:Ljava/util/List;\n 6: checkcast #132 // class java/lang/Iterable\n 9: astore_2\n 10: iconst_0\n 11: istore_3\n 12: aload_2\n 13: invokeinterface #168, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 18: astore 4\n 20: aload 4\n 22: invokeinterface #174, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 27: ifeq 128\n 30: aload 4\n 32: invokeinterface #178, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 37: astore 5\n 39: aload 5\n 41: checkcast #57 // class Scanner\n 44: astore 6\n 46: iconst_0\n 47: istore 7\n 49: aload_0\n 50: getfield #23 // Field completed:Ljava/util/List;\n 53: checkcast #132 // class java/lang/Iterable\n 56: astore 8\n 58: iconst_0\n 59: istore 9\n 61: aload 8\n 63: invokeinterface #168, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 68: astore 10\n 70: aload 10\n 72: invokeinterface #174, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 77: ifeq 122\n 80: aload 10\n 82: invokeinterface #178, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 87: astore 11\n 89: aload 11\n 91: checkcast #57 // class Scanner\n 94: astore 12\n 96: iconst_0\n 97: istore 13\n 99: iload_1\n 100: aload 6\n 102: invokevirtual #202 // Method Scanner.getPosition:()LCoordinate;\n 105: aload 12\n 107: invokevirtual #202 // Method Scanner.getPosition:()LCoordinate;\n 110: invokevirtual #206 // Method Coordinate.manhattanDistance:(LCoordinate;)I\n 113: invokestatic #212 // Method java/lang/Math.max:(II)I\n 116: istore_1\n 117: nop\n 118: nop\n 119: goto 70\n 122: nop\n 123: nop\n 124: nop\n 125: goto 20\n 128: nop\n 129: iload_1\n 130: ireturn\n\n public final void run();\n Code:\n 0: aload_0\n 1: invokevirtual #220 // Method load:()V\n 4: aload_0\n 5: getfield #17 // Field pendingLocation:Ljava/util/List;\n 8: checkcast #109 // class java/util/Collection\n 11: invokeinterface #113, 1 // InterfaceMethod java/util/Collection.size:()I\n 16: aload_0\n 17: getfield #20 // Field pendingCompare:Ljava/util/List;\n 20: checkcast #109 // class java/util/Collection\n 23: invokeinterface #113, 1 // InterfaceMethod java/util/Collection.size:()I\n 28: iadd\n 29: ifle 39\n 32: aload_0\n 33: invokevirtual #222 // Method iterate:()V\n 36: goto 4\n 39: new #224 // class java/lang/StringBuilder\n 42: dup\n 43: invokespecial #225 // Method java/lang/StringBuilder.\"<init>\":()V\n 46: ldc #227 // String Part 1:\n 48: invokevirtual #231 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 51: aload_0\n 52: invokevirtual #233 // Method coordinateCount:()I\n 55: invokevirtual #236 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 58: invokevirtual #240 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 61: getstatic #246 // Field java/lang/System.out:Ljava/io/PrintStream;\n 64: swap\n 65: invokevirtual #252 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 68: new #224 // class java/lang/StringBuilder\n 71: dup\n 72: invokespecial #225 // Method java/lang/StringBuilder.\"<init>\":()V\n 75: ldc #254 // String Part 2:\n 77: invokevirtual #231 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 80: aload_0\n 81: invokevirtual #256 // Method maxDistance:()I\n 84: invokevirtual #236 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 87: invokevirtual #240 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 90: getstatic #246 // Field java/lang/System.out:Ljava/io/PrintStream;\n 93: swap\n 94: invokevirtual #252 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 97: return\n\n private static final kotlin.Unit load$lambda$0(kotlin.jvm.internal.Ref$BooleanRef, kotlin.jvm.internal.Ref$ObjectRef, Program, java.lang.String);\n Code:\n 0: aload_3\n 1: ldc_w #257 // String it\n 4: invokestatic #40 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 7: aload_3\n 8: ldc_w #259 // String ---\n 11: iconst_0\n 12: iconst_2\n 13: aconst_null\n 14: invokestatic #265 // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z\n 17: ifeq 60\n 20: aload_0\n 21: getfield #52 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 24: ifne 52\n 27: aload_1\n 28: new #57 // class Scanner\n 31: dup\n 32: invokespecial #58 // Method Scanner.\"<init>\":()V\n 35: putfield #61 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 38: aload_2\n 39: getfield #17 // Field pendingLocation:Ljava/util/List;\n 42: aload_1\n 43: getfield #61 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 46: invokeinterface #65, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 51: pop\n 52: aload_0\n 53: iconst_0\n 54: putfield #52 // Field kotlin/jvm/internal/Ref$BooleanRef.element:Z\n 57: goto 174\n 60: aload_3\n 61: checkcast #267 // class java/lang/CharSequence\n 64: invokeinterface #270, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 69: ifne 76\n 72: iconst_1\n 73: goto 77\n 76: iconst_0\n 77: ifne 174\n 80: aload_3\n 81: checkcast #267 // class java/lang/CharSequence\n 84: iconst_1\n 85: anewarray #272 // class java/lang/String\n 88: astore 5\n 90: aload 5\n 92: iconst_0\n 93: ldc_w #274 // String ,\n 96: aastore\n 97: aload 5\n 99: iconst_0\n 100: iconst_0\n 101: bipush 6\n 103: aconst_null\n 104: invokestatic #278 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 107: astore 4\n 109: aload_1\n 110: getfield #61 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 113: checkcast #57 // class Scanner\n 116: invokevirtual #116 // Method Scanner.getCoordinates:()Ljava/util/List;\n 119: new #118 // class Coordinate\n 122: dup\n 123: aload 4\n 125: iconst_0\n 126: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 131: checkcast #272 // class java/lang/String\n 134: invokestatic #284 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 137: aload 4\n 139: iconst_1\n 140: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 145: checkcast #272 // class java/lang/String\n 148: invokestatic #284 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 151: aload 4\n 153: iconst_2\n 154: invokeinterface #107, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 159: checkcast #272 // class java/lang/String\n 162: invokestatic #284 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 165: invokespecial #287 // Method Coordinate.\"<init>\":(III)V\n 168: invokeinterface #65, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 173: pop\n 174: getstatic #293 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 177: areturn\n}\n", "javap_err": "" } ]
A1rPun__nurture__295de6a/language/kotlin/fib.kt
import kotlin.math.pow import kotlin.math.round fun fib(n: Int): Int { return if (n < 2) n else fib(n - 1) + fib(n - 2) } fun fibLinear(n: Int): Int { var prevFib = 0 var fib = 1 repeat(n) { val temp = prevFib + fib prevFib = fib fib = temp } return prevFib } fun fibFormula(n: Int): Int { return round((((5.0.pow(0.5) + 1) / 2.0).pow(n)) / 5.0.pow(0.5)).toInt(); } fun fibTailRecursive(n: Int, prevFib: Int = 0, fib: Int = 1): Int { return if (n == 0) prevFib else fibTailRecursive(n - 1, fib, prevFib + fib) } fun fibonacciGenerate(n: Int): List<Int> { var a = 0 var b = 1 fun next(): Int { val result = a + b a = b b = result return a } return generateSequence(::next).take(n).toList() } fun main(args: Array<String>) { var input = if (args.size > 0) args[0].toInt() else 29 println(fibLinear(input)) }
[ { "class_path": "A1rPun__nurture__295de6a/FibKt.class", "javap": "Compiled from \"fib.kt\"\npublic final class FibKt {\n public static final int fib(int);\n Code:\n 0: iload_0\n 1: iconst_2\n 2: if_icmpge 9\n 5: iload_0\n 6: goto 22\n 9: iload_0\n 10: iconst_1\n 11: isub\n 12: invokestatic #8 // Method fib:(I)I\n 15: iload_0\n 16: iconst_2\n 17: isub\n 18: invokestatic #8 // Method fib:(I)I\n 21: iadd\n 22: ireturn\n\n public static final int fibLinear(int);\n Code:\n 0: iconst_0\n 1: istore_1\n 2: iconst_0\n 3: istore_2\n 4: iconst_1\n 5: istore_2\n 6: iconst_0\n 7: istore_3\n 8: iload_3\n 9: iload_0\n 10: if_icmpge 36\n 13: iload_3\n 14: istore 4\n 16: iconst_0\n 17: istore 5\n 19: iload_1\n 20: iload_2\n 21: iadd\n 22: istore 6\n 24: iload_2\n 25: istore_1\n 26: iload 6\n 28: istore_2\n 29: nop\n 30: iinc 3, 1\n 33: goto 8\n 36: iload_1\n 37: ireturn\n\n public static final int fibFormula(int);\n Code:\n 0: ldc2_w #17 // double 5.0d\n 3: ldc2_w #19 // double 0.5d\n 6: invokestatic #26 // Method java/lang/Math.pow:(DD)D\n 9: iconst_1\n 10: i2d\n 11: dadd\n 12: ldc2_w #27 // double 2.0d\n 15: ddiv\n 16: iload_0\n 17: i2d\n 18: invokestatic #26 // Method java/lang/Math.pow:(DD)D\n 21: ldc2_w #17 // double 5.0d\n 24: ldc2_w #19 // double 0.5d\n 27: invokestatic #26 // Method java/lang/Math.pow:(DD)D\n 30: ddiv\n 31: invokestatic #32 // Method java/lang/Math.rint:(D)D\n 34: d2i\n 35: ireturn\n\n public static final int fibTailRecursive(int, int, int);\n Code:\n 0: iload_0\n 1: ifne 8\n 4: iload_1\n 5: goto 18\n 8: iload_0\n 9: iconst_1\n 10: isub\n 11: iload_2\n 12: iload_1\n 13: iload_2\n 14: iadd\n 15: invokestatic #36 // Method fibTailRecursive:(III)I\n 18: ireturn\n\n public static int fibTailRecursive$default(int, int, int, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_2\n 2: iand\n 3: ifeq 8\n 6: iconst_0\n 7: istore_1\n 8: iload_3\n 9: iconst_4\n 10: iand\n 11: ifeq 16\n 14: iconst_1\n 15: istore_2\n 16: iload_0\n 17: iload_1\n 18: iload_2\n 19: invokestatic #36 // Method fibTailRecursive:(III)I\n 22: ireturn\n\n public static final java.util.List<java.lang.Integer> fibonacciGenerate(int);\n Code:\n 0: new #44 // class kotlin/jvm/internal/Ref$IntRef\n 3: dup\n 4: invokespecial #48 // Method kotlin/jvm/internal/Ref$IntRef.\"<init>\":()V\n 7: astore_1\n 8: new #44 // class kotlin/jvm/internal/Ref$IntRef\n 11: dup\n 12: invokespecial #48 // Method kotlin/jvm/internal/Ref$IntRef.\"<init>\":()V\n 15: astore_2\n 16: aload_2\n 17: iconst_1\n 18: putfield #51 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 21: new #53 // class FibKt$fibonacciGenerate$1\n 24: dup\n 25: aload_1\n 26: aload_2\n 27: invokespecial #56 // Method FibKt$fibonacciGenerate$1.\"<init>\":(Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/jvm/internal/Ref$IntRef;)V\n 30: checkcast #58 // class kotlin/jvm/functions/Function0\n 33: invokestatic #64 // Method kotlin/sequences/SequencesKt.generateSequence:(Lkotlin/jvm/functions/Function0;)Lkotlin/sequences/Sequence;\n 36: iload_0\n 37: invokestatic #68 // Method kotlin/sequences/SequencesKt.take:(Lkotlin/sequences/Sequence;I)Lkotlin/sequences/Sequence;\n 40: invokestatic #72 // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;\n 43: areturn\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #79 // String args\n 3: invokestatic #85 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: arraylength\n 8: ifle 20\n 11: aload_0\n 12: iconst_0\n 13: aaload\n 14: invokestatic #91 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 17: goto 22\n 20: bipush 29\n 22: istore_1\n 23: iload_1\n 24: invokestatic #93 // Method fibLinear:(I)I\n 27: istore_2\n 28: getstatic #99 // Field java/lang/System.out:Ljava/io/PrintStream;\n 31: iload_2\n 32: invokevirtual #105 // Method java/io/PrintStream.println:(I)V\n 35: return\n\n private static final int fibonacciGenerate$next(kotlin.jvm.internal.Ref$IntRef, kotlin.jvm.internal.Ref$IntRef);\n Code:\n 0: aload_0\n 1: getfield #51 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 4: aload_1\n 5: getfield #51 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 8: iadd\n 9: istore_2\n 10: aload_0\n 11: aload_1\n 12: getfield #51 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 15: putfield #51 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 18: aload_1\n 19: iload_2\n 20: putfield #51 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 23: aload_0\n 24: getfield #51 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 27: ireturn\n\n public static final int access$fibonacciGenerate$next(kotlin.jvm.internal.Ref$IntRef, kotlin.jvm.internal.Ref$IntRef);\n Code:\n 0: aload_0\n 1: aload_1\n 2: invokestatic #113 // Method fibonacciGenerate$next:(Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/jvm/internal/Ref$IntRef;)I\n 5: ireturn\n}\n", "javap_err": "" }, { "class_path": "A1rPun__nurture__295de6a/FibKt$fibonacciGenerate$1.class", "javap": "Compiled from \"fib.kt\"\nfinal class FibKt$fibonacciGenerate$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function0<java.lang.Integer> {\n final kotlin.jvm.internal.Ref$IntRef $a;\n\n final kotlin.jvm.internal.Ref$IntRef $b;\n\n FibKt$fibonacciGenerate$1(kotlin.jvm.internal.Ref$IntRef, kotlin.jvm.internal.Ref$IntRef);\n Code:\n 0: aload_0\n 1: aload_1\n 2: putfield #13 // Field $a:Lkotlin/jvm/internal/Ref$IntRef;\n 5: aload_0\n 6: aload_2\n 7: putfield #16 // Field $b:Lkotlin/jvm/internal/Ref$IntRef;\n 10: aload_0\n 11: iconst_0\n 12: ldc #18 // class kotlin/jvm/internal/Intrinsics$Kotlin\n 14: ldc #20 // String next\n 16: ldc #22 // String fibonacciGenerate$next(Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/jvm/internal/Ref$IntRef;)I\n 18: iconst_0\n 19: invokespecial #25 // Method kotlin/jvm/internal/FunctionReferenceImpl.\"<init>\":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V\n 22: return\n\n public final java.lang.Integer invoke();\n Code:\n 0: aload_0\n 1: getfield #13 // Field $a:Lkotlin/jvm/internal/Ref$IntRef;\n 4: aload_0\n 5: getfield #16 // Field $b:Lkotlin/jvm/internal/Ref$IntRef;\n 8: invokestatic #35 // Method FibKt.access$fibonacciGenerate$next:(Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/jvm/internal/Ref$IntRef;)I\n 11: invokestatic #41 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 14: areturn\n\n public java.lang.Object invoke();\n Code:\n 0: aload_0\n 1: invokevirtual #44 // Method invoke:()Ljava/lang/Integer;\n 4: areturn\n}\n", "javap_err": "" } ]
a-red-christmas__aoc2017-kt__14e50f4/src/star05.kt
import java.lang.Math.abs import java.lang.Math.pow import kotlin.math.roundToInt import kotlin.math.sqrt fun main(args: Array<String>) { println(findManhattanDistance(368078)) } fun findManhattanDistance(start: Int) : Int { val size = getSpiralArraySize(start) val center = getSpiralArrayCenter(size) // q1, q2 == center, center val last = (pow((size).toDouble(), 2.0)).toInt() val bottomLeft = last - size + 1 val topLeft = bottomLeft - size + 1 val topRight = topLeft - size + 1 /* 1,1 ... size,1 . . . 1,size ... size,size */ val location = when { start >= bottomLeft -> Pair(size - (last - start), size) start >= topLeft -> Pair(1, size - (bottomLeft - start)) start >= topRight -> Pair(topLeft - start + 1, 1) else -> Pair(size, topRight - start + 1) } return abs(location.first - center) + abs(location.second - center) } fun getSpiralArrayCenter(size: Int): Int { val center = roundUp(size / 2.0) // q1, q2 == center, center return center } fun getSpiralArraySize(start: Int): Int { val sqrtStart = roundUp(sqrt(start.toDouble())) val size = if (sqrtStart % 2 == 0) sqrtStart + 1 else sqrtStart return size } fun roundUp(num : Double) : Int { val rounded = num.roundToInt() return if (num > rounded) rounded + 1 else rounded }
[ { "class_path": "a-red-christmas__aoc2017-kt__14e50f4/Star05Kt.class", "javap": "Compiled from \"star05.kt\"\npublic final class Star05Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: ldc #16 // int 368078\n 8: invokestatic #20 // Method findManhattanDistance:(I)I\n 11: istore_1\n 12: getstatic #26 // Field java/lang/System.out:Ljava/io/PrintStream;\n 15: iload_1\n 16: invokevirtual #32 // Method java/io/PrintStream.println:(I)V\n 19: return\n\n public static final int findManhattanDistance(int);\n Code:\n 0: iload_0\n 1: invokestatic #36 // Method getSpiralArraySize:(I)I\n 4: istore_1\n 5: iload_1\n 6: invokestatic #39 // Method getSpiralArrayCenter:(I)I\n 9: istore_2\n 10: iload_1\n 11: i2d\n 12: ldc2_w #40 // double 2.0d\n 15: invokestatic #47 // Method java/lang/Math.pow:(DD)D\n 18: d2i\n 19: istore_3\n 20: iload_3\n 21: iload_1\n 22: isub\n 23: iconst_1\n 24: iadd\n 25: istore 4\n 27: iload 4\n 29: iload_1\n 30: isub\n 31: iconst_1\n 32: iadd\n 33: istore 5\n 35: iload 5\n 37: iload_1\n 38: isub\n 39: iconst_1\n 40: iadd\n 41: istore 6\n 43: nop\n 44: iload_0\n 45: iload 4\n 47: if_icmplt 72\n 50: new #49 // class kotlin/Pair\n 53: dup\n 54: iload_1\n 55: iload_3\n 56: iload_0\n 57: isub\n 58: isub\n 59: invokestatic #55 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 62: iload_1\n 63: invokestatic #55 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 66: invokespecial #59 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 69: goto 150\n 72: iload_0\n 73: iload 5\n 75: if_icmplt 101\n 78: new #49 // class kotlin/Pair\n 81: dup\n 82: iconst_1\n 83: invokestatic #55 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 86: iload_1\n 87: iload 4\n 89: iload_0\n 90: isub\n 91: isub\n 92: invokestatic #55 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 95: invokespecial #59 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 98: goto 150\n 101: iload_0\n 102: iload 6\n 104: if_icmplt 130\n 107: new #49 // class kotlin/Pair\n 110: dup\n 111: iload 5\n 113: iload_0\n 114: isub\n 115: iconst_1\n 116: iadd\n 117: invokestatic #55 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 120: iconst_1\n 121: invokestatic #55 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 124: invokespecial #59 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 127: goto 150\n 130: new #49 // class kotlin/Pair\n 133: dup\n 134: iload_1\n 135: invokestatic #55 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 138: iload 6\n 140: iload_0\n 141: isub\n 142: iconst_1\n 143: iadd\n 144: invokestatic #55 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 147: invokespecial #59 // Method kotlin/Pair.\"<init>\":(Ljava/lang/Object;Ljava/lang/Object;)V\n 150: astore 7\n 152: aload 7\n 154: invokevirtual #63 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;\n 157: checkcast #65 // class java/lang/Number\n 160: invokevirtual #69 // Method java/lang/Number.intValue:()I\n 163: iload_2\n 164: isub\n 165: invokestatic #72 // Method java/lang/Math.abs:(I)I\n 168: aload 7\n 170: invokevirtual #75 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;\n 173: checkcast #65 // class java/lang/Number\n 176: invokevirtual #69 // Method java/lang/Number.intValue:()I\n 179: iload_2\n 180: isub\n 181: invokestatic #72 // Method java/lang/Math.abs:(I)I\n 184: iadd\n 185: ireturn\n\n public static final int getSpiralArrayCenter(int);\n Code:\n 0: iload_0\n 1: i2d\n 2: ldc2_w #40 // double 2.0d\n 5: ddiv\n 6: invokestatic #89 // Method roundUp:(D)I\n 9: istore_1\n 10: iload_1\n 11: ireturn\n\n public static final int getSpiralArraySize(int);\n Code:\n 0: iload_0\n 1: i2d\n 2: invokestatic #93 // Method java/lang/Math.sqrt:(D)D\n 5: invokestatic #89 // Method roundUp:(D)I\n 8: istore_1\n 9: iload_1\n 10: iconst_2\n 11: irem\n 12: ifne 21\n 15: iload_1\n 16: iconst_1\n 17: iadd\n 18: goto 22\n 21: iload_1\n 22: istore_2\n 23: iload_2\n 24: ireturn\n\n public static final int roundUp(double);\n Code:\n 0: dload_0\n 1: invokestatic #99 // Method kotlin/math/MathKt.roundToInt:(D)I\n 4: istore_2\n 5: dload_0\n 6: iload_2\n 7: i2d\n 8: dcmpl\n 9: ifle 18\n 12: iload_2\n 13: iconst_1\n 14: iadd\n 15: goto 19\n 18: iload_2\n 19: ireturn\n}\n", "javap_err": "" } ]
iproduct__course-kotlin__89884f8/03-problems-lab1/src/main/kotlin/Main.kt
import java.io.File data class LongNumberProblem( var n: Int, var a: String, var fm: List<Int>, ) fun main(args: Array<String>) { // read input // val n = readLine()!!.toInt() // val a = readLine()!! // val fm = readLine()!!.split(" ").map { it.toInt() } // read input from file // Using BufferedReader val bf = File("./long-number01.txt").bufferedReader() val problems = mutableListOf<LongNumberProblem>() var i = 0 var n: Int = 0 var a: String = "" var fm: List<Int> = emptyList() bf.forEachLine { when (i++ % 3) { 0 -> n = it.toInt() 1 -> a = it 2 -> { fm = it.split(" ").map { c -> c.toInt() } problems.add(LongNumberProblem(n, a, fm)) } } } // bf.useLines { lines -> // lines.forEach { // when (i++ % 3) { // 0 -> n = it.toInt() // 1 -> a = it // 2 -> { // fm = it.split(" ").map { c -> c.toInt() } // problems.add(LongNumberProblem(n, a, fm)) // } // } // } // } for (p in problems) { println(solveLongNumber(p)) } } private fun solveLongNumber(problem: LongNumberProblem): String { fun f(c: Char) = '0' + problem.fm[c - '1'] // greedy maximum search val s = problem.a.indexOfFirst { f(it) > it } .takeIf { it >= 0 } ?: problem.a.length val e = problem.a.withIndex().indexOfFirst { (i, c) -> i > s && f(c) < c } .takeIf { it >= 0 } ?: problem.a.length val result = problem.a.slice(0 until s) + problem.a.slice(s until e).map { f(it) }.joinToString("") + problem.a.slice(e until problem.a.length) return result }
[ { "class_path": "iproduct__course-kotlin__89884f8/MainKt.class", "javap": "Compiled from \"Main.kt\"\npublic final class MainKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #17 // class java/io/File\n 9: dup\n 10: ldc #19 // String ./long-number01.txt\n 12: invokespecial #23 // Method java/io/File.\"<init>\":(Ljava/lang/String;)V\n 15: astore_2\n 16: getstatic #29 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;\n 19: astore_3\n 20: sipush 8192\n 23: istore 4\n 25: aload_2\n 26: astore 5\n 28: new #31 // class java/io/InputStreamReader\n 31: dup\n 32: new #33 // class java/io/FileInputStream\n 35: dup\n 36: aload 5\n 38: invokespecial #36 // Method java/io/FileInputStream.\"<init>\":(Ljava/io/File;)V\n 41: checkcast #38 // class java/io/InputStream\n 44: aload_3\n 45: invokespecial #41 // Method java/io/InputStreamReader.\"<init>\":(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V\n 48: checkcast #43 // class java/io/Reader\n 51: astore 5\n 53: aload 5\n 55: instanceof #45 // class java/io/BufferedReader\n 58: ifeq 69\n 61: aload 5\n 63: checkcast #45 // class java/io/BufferedReader\n 66: goto 80\n 69: new #45 // class java/io/BufferedReader\n 72: dup\n 73: aload 5\n 75: iload 4\n 77: invokespecial #48 // Method java/io/BufferedReader.\"<init>\":(Ljava/io/Reader;I)V\n 80: astore_1\n 81: new #50 // class java/util/ArrayList\n 84: dup\n 85: invokespecial #53 // Method java/util/ArrayList.\"<init>\":()V\n 88: checkcast #55 // class java/util/List\n 91: astore_2\n 92: new #57 // class kotlin/jvm/internal/Ref$IntRef\n 95: dup\n 96: invokespecial #58 // Method kotlin/jvm/internal/Ref$IntRef.\"<init>\":()V\n 99: astore_3\n 100: new #57 // class kotlin/jvm/internal/Ref$IntRef\n 103: dup\n 104: invokespecial #58 // Method kotlin/jvm/internal/Ref$IntRef.\"<init>\":()V\n 107: astore 4\n 109: new #60 // class kotlin/jvm/internal/Ref$ObjectRef\n 112: dup\n 113: invokespecial #61 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 116: astore 5\n 118: aload 5\n 120: ldc #63 // String\n 122: putfield #67 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 125: new #60 // class kotlin/jvm/internal/Ref$ObjectRef\n 128: dup\n 129: invokespecial #61 // Method kotlin/jvm/internal/Ref$ObjectRef.\"<init>\":()V\n 132: astore 6\n 134: aload 6\n 136: invokestatic #73 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 139: putfield #67 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 142: aload_1\n 143: checkcast #43 // class java/io/Reader\n 146: aload_3\n 147: aload 4\n 149: aload 5\n 151: aload 6\n 153: aload_2\n 154: invokedynamic #93, 0 // InvokeDynamic #0:invoke:(Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/jvm/internal/Ref$IntRef;Lkotlin/jvm/internal/Ref$ObjectRef;Lkotlin/jvm/internal/Ref$ObjectRef;Ljava/util/List;)Lkotlin/jvm/functions/Function1;\n 159: invokestatic #99 // Method kotlin/io/TextStreamsKt.forEachLine:(Ljava/io/Reader;Lkotlin/jvm/functions/Function1;)V\n 162: aload_2\n 163: invokeinterface #103, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 168: astore 7\n 170: aload 7\n 172: invokeinterface #109, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 177: ifeq 207\n 180: aload 7\n 182: invokeinterface #113, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 187: checkcast #115 // class LongNumberProblem\n 190: astore 8\n 192: aload 8\n 194: invokestatic #119 // Method solveLongNumber:(LLongNumberProblem;)Ljava/lang/String;\n 197: getstatic #125 // Field java/lang/System.out:Ljava/io/PrintStream;\n 200: swap\n 201: invokevirtual #131 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 204: goto 170\n 207: return\n\n private static final java.lang.String solveLongNumber(LongNumberProblem);\n Code:\n 0: aload_0\n 1: invokevirtual #151 // Method LongNumberProblem.getA:()Ljava/lang/String;\n 4: checkcast #153 // class java/lang/CharSequence\n 7: astore_3\n 8: iconst_0\n 9: istore 4\n 11: iconst_0\n 12: istore 5\n 14: aload_3\n 15: invokeinterface #157, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 20: istore 6\n 22: iload 5\n 24: iload 6\n 26: if_icmpge 75\n 29: aload_3\n 30: iload 5\n 32: invokeinterface #161, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 37: istore 7\n 39: iconst_0\n 40: istore 8\n 42: aload_0\n 43: iload 7\n 45: invokestatic #165 // Method solveLongNumber$f:(LLongNumberProblem;C)C\n 48: iload 7\n 50: invokestatic #169 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I\n 53: ifle 60\n 56: iconst_1\n 57: goto 61\n 60: iconst_0\n 61: ifeq 69\n 64: iload 5\n 66: goto 76\n 69: iinc 5, 1\n 72: goto 22\n 75: iconst_m1\n 76: invokestatic #175 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 79: astore_3\n 80: aload_3\n 81: checkcast #177 // class java/lang/Number\n 84: invokevirtual #180 // Method java/lang/Number.intValue:()I\n 87: istore 4\n 89: iconst_0\n 90: istore 5\n 92: iload 4\n 94: iflt 101\n 97: iconst_1\n 98: goto 102\n 101: iconst_0\n 102: ifeq 109\n 105: aload_3\n 106: goto 110\n 109: aconst_null\n 110: dup\n 111: ifnull 120\n 114: invokevirtual #181 // Method java/lang/Integer.intValue:()I\n 117: goto 128\n 120: pop\n 121: aload_0\n 122: invokevirtual #151 // Method LongNumberProblem.getA:()Ljava/lang/String;\n 125: invokevirtual #184 // Method java/lang/String.length:()I\n 128: istore_1\n 129: aload_0\n 130: invokevirtual #151 // Method LongNumberProblem.getA:()Ljava/lang/String;\n 133: checkcast #153 // class java/lang/CharSequence\n 136: invokestatic #190 // Method kotlin/text/StringsKt.withIndex:(Ljava/lang/CharSequence;)Ljava/lang/Iterable;\n 139: astore 4\n 141: iconst_0\n 142: istore 5\n 144: iconst_0\n 145: istore 6\n 147: aload 4\n 149: invokeinterface #193, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 154: astore 7\n 156: aload 7\n 158: invokeinterface #109, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 163: ifeq 252\n 166: aload 7\n 168: invokeinterface #113, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 173: astore 8\n 175: iload 6\n 177: ifge 183\n 180: invokestatic #196 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V\n 183: aload 8\n 185: checkcast #198 // class kotlin/collections/IndexedValue\n 188: astore 9\n 190: iconst_0\n 191: istore 10\n 193: aload 9\n 195: invokevirtual #201 // Method kotlin/collections/IndexedValue.component1:()I\n 198: istore 11\n 200: aload 9\n 202: invokevirtual #204 // Method kotlin/collections/IndexedValue.component2:()Ljava/lang/Object;\n 205: checkcast #206 // class java/lang/Character\n 208: invokevirtual #210 // Method java/lang/Character.charValue:()C\n 211: istore 12\n 213: iload 11\n 215: iload_1\n 216: if_icmple 237\n 219: aload_0\n 220: iload 12\n 222: invokestatic #165 // Method solveLongNumber$f:(LLongNumberProblem;C)C\n 225: iload 12\n 227: invokestatic #169 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I\n 230: ifge 237\n 233: iconst_1\n 234: goto 238\n 237: iconst_0\n 238: ifeq 246\n 241: iload 6\n 243: goto 253\n 246: iinc 6, 1\n 249: goto 156\n 252: iconst_m1\n 253: invokestatic #175 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 256: astore 4\n 258: aload 4\n 260: checkcast #177 // class java/lang/Number\n 263: invokevirtual #180 // Method java/lang/Number.intValue:()I\n 266: istore 5\n 268: iconst_0\n 269: istore 6\n 271: iload 5\n 273: iflt 280\n 276: iconst_1\n 277: goto 281\n 280: iconst_0\n 281: ifeq 289\n 284: aload 4\n 286: goto 290\n 289: aconst_null\n 290: dup\n 291: ifnull 300\n 294: invokevirtual #181 // Method java/lang/Integer.intValue:()I\n 297: goto 308\n 300: pop\n 301: aload_0\n 302: invokevirtual #151 // Method LongNumberProblem.getA:()Ljava/lang/String;\n 305: invokevirtual #184 // Method java/lang/String.length:()I\n 308: istore_2\n 309: new #212 // class java/lang/StringBuilder\n 312: dup\n 313: invokespecial #213 // Method java/lang/StringBuilder.\"<init>\":()V\n 316: aload_0\n 317: invokevirtual #151 // Method LongNumberProblem.getA:()Ljava/lang/String;\n 320: iconst_0\n 321: iload_1\n 322: invokestatic #219 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 325: invokestatic #223 // Method kotlin/text/StringsKt.slice:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;\n 328: invokevirtual #227 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 331: aload_0\n 332: invokevirtual #151 // Method LongNumberProblem.getA:()Ljava/lang/String;\n 335: iload_1\n 336: iload_2\n 337: invokestatic #219 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 340: invokestatic #223 // Method kotlin/text/StringsKt.slice:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;\n 343: checkcast #153 // class java/lang/CharSequence\n 346: astore 4\n 348: astore 13\n 350: iconst_0\n 351: istore 5\n 353: aload 4\n 355: astore 6\n 357: new #50 // class java/util/ArrayList\n 360: dup\n 361: aload 4\n 363: invokeinterface #157, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 368: invokespecial #230 // Method java/util/ArrayList.\"<init>\":(I)V\n 371: checkcast #232 // class java/util/Collection\n 374: astore 7\n 376: iconst_0\n 377: istore 8\n 379: iconst_0\n 380: istore 9\n 382: iload 9\n 384: aload 6\n 386: invokeinterface #157, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 391: if_icmpge 440\n 394: aload 6\n 396: iload 9\n 398: invokeinterface #161, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 403: istore 10\n 405: aload 7\n 407: iload 10\n 409: istore 11\n 411: astore 14\n 413: iconst_0\n 414: istore 12\n 416: aload_0\n 417: iload 11\n 419: invokestatic #165 // Method solveLongNumber$f:(LLongNumberProblem;C)C\n 422: invokestatic #235 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;\n 425: aload 14\n 427: swap\n 428: invokeinterface #239, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 433: pop\n 434: iinc 9, 1\n 437: goto 382\n 440: aload 7\n 442: checkcast #55 // class java/util/List\n 445: nop\n 446: aload 13\n 448: swap\n 449: checkcast #192 // class java/lang/Iterable\n 452: ldc #63 // String\n 454: checkcast #153 // class java/lang/CharSequence\n 457: aconst_null\n 458: aconst_null\n 459: iconst_0\n 460: aconst_null\n 461: aconst_null\n 462: bipush 62\n 464: aconst_null\n 465: invokestatic #243 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;\n 468: invokevirtual #227 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 471: aload_0\n 472: invokevirtual #151 // Method LongNumberProblem.getA:()Ljava/lang/String;\n 475: iload_2\n 476: aload_0\n 477: invokevirtual #151 // Method LongNumberProblem.getA:()Ljava/lang/String;\n 480: invokevirtual #184 // Method java/lang/String.length:()I\n 483: invokestatic #219 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;\n 486: invokestatic #223 // Method kotlin/text/StringsKt.slice:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;\n 489: invokevirtual #227 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 492: invokevirtual #246 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 495: astore_3\n 496: aload_3\n 497: areturn\n\n private static final kotlin.Unit main$lambda$1(kotlin.jvm.internal.Ref$IntRef, kotlin.jvm.internal.Ref$IntRef, kotlin.jvm.internal.Ref$ObjectRef, kotlin.jvm.internal.Ref$ObjectRef, java.util.List, java.lang.String);\n Code:\n 0: aload 5\n 2: ldc_w #274 // String it\n 5: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 8: aload_0\n 9: getfield #276 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 12: istore 6\n 14: aload_0\n 15: iload 6\n 17: iconst_1\n 18: iadd\n 19: putfield #276 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 22: iload 6\n 24: iconst_3\n 25: irem\n 26: tableswitch { // 0 to 2\n 0: 52\n 1: 64\n 2: 73\n default: 246\n }\n 52: aload_1\n 53: aload 5\n 55: invokestatic #280 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 58: putfield #276 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 61: goto 246\n 64: aload_2\n 65: aload 5\n 67: putfield #67 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 70: goto 246\n 73: aload_3\n 74: aload 5\n 76: checkcast #153 // class java/lang/CharSequence\n 79: iconst_1\n 80: anewarray #183 // class java/lang/String\n 83: astore 6\n 85: aload 6\n 87: iconst_0\n 88: ldc_w #282 // String\n 91: aastore\n 92: aload 6\n 94: iconst_0\n 95: iconst_0\n 96: bipush 6\n 98: aconst_null\n 99: invokestatic #286 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 102: checkcast #192 // class java/lang/Iterable\n 105: astore 6\n 107: astore 15\n 109: iconst_0\n 110: istore 7\n 112: aload 6\n 114: astore 8\n 116: new #50 // class java/util/ArrayList\n 119: dup\n 120: aload 6\n 122: bipush 10\n 124: invokestatic #290 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 127: invokespecial #230 // Method java/util/ArrayList.\"<init>\":(I)V\n 130: checkcast #232 // class java/util/Collection\n 133: astore 9\n 135: iconst_0\n 136: istore 10\n 138: aload 8\n 140: invokeinterface #193, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 145: astore 11\n 147: aload 11\n 149: invokeinterface #109, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 154: ifeq 201\n 157: aload 11\n 159: invokeinterface #113, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 164: astore 12\n 166: aload 9\n 168: aload 12\n 170: checkcast #183 // class java/lang/String\n 173: astore 13\n 175: astore 16\n 177: iconst_0\n 178: istore 14\n 180: aload 13\n 182: invokestatic #280 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 185: nop\n 186: invokestatic #175 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 189: aload 16\n 191: swap\n 192: invokeinterface #239, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 197: pop\n 198: goto 147\n 201: aload 9\n 203: checkcast #55 // class java/util/List\n 206: nop\n 207: aload 15\n 209: swap\n 210: putfield #67 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 213: aload 4\n 215: new #115 // class LongNumberProblem\n 218: dup\n 219: aload_1\n 220: getfield #276 // Field kotlin/jvm/internal/Ref$IntRef.element:I\n 223: aload_2\n 224: getfield #67 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 227: checkcast #183 // class java/lang/String\n 230: aload_3\n 231: getfield #67 // Field kotlin/jvm/internal/Ref$ObjectRef.element:Ljava/lang/Object;\n 234: checkcast #55 // class java/util/List\n 237: invokespecial #293 // Method LongNumberProblem.\"<init>\":(ILjava/lang/String;Ljava/util/List;)V\n 240: invokeinterface #294, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 245: pop\n 246: getstatic #300 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;\n 249: areturn\n\n private static final char solveLongNumber$f(LongNumberProblem, char);\n Code:\n 0: bipush 48\n 2: aload_0\n 3: invokevirtual #309 // Method LongNumberProblem.getFm:()Ljava/util/List;\n 6: iload_1\n 7: bipush 49\n 9: isub\n 10: invokeinterface #313, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 15: checkcast #177 // class java/lang/Number\n 18: invokevirtual #180 // Method java/lang/Number.intValue:()I\n 21: iadd\n 22: i2c\n 23: ireturn\n}\n", "javap_err": "" } ]
julianferres__Codeforces__14e8369/Kotlin Heroes 6 -Practice/G.kt
data class Edge(val from: Int, val to: Int, val cost: Long) class DSU(val n: Int){ var par: MutableList<Int> = MutableList<Int>(n){ it } var sz: MutableList<Int> = MutableList<Int>(n){ 1 } fun find(x: Int): Int { if(par[x] != x) par[x] = find(par[x]) return par[x] } fun join(ii: Int, jj: Int): Boolean{ var i=find(ii); var j=find(jj); if(i == j) return false; if(sz[i] < sz[j]){ run { val temp = i; i = j; j = temp } } sz[i] += sz[j]; par[j] = i; return true } } fun main() { var (n, m) = readLine()!!.split(" ").map { it.toInt() } var a = readLine()!!.split(" ").map { it.toLong() } var mindex = a.indexOf(a.minBy{ it }) var edges = mutableListOf<Edge>() repeat(m){ var line = readLine()!!.split(" ") var from = line[0].toInt() var to = line[1].toInt() var cost = line[2].toLong() edges.add(Edge(from-1, to-1, cost)) } for (i in 0 until n){ edges.add(Edge(i, mindex, a[mindex] + a[i])) } edges.sortWith(compareBy {it.cost}) var dsu = DSU(n) var ans = 0L for(edge in edges){ if(dsu.find(edge.from) == dsu.find(edge.to)) continue else{ ans += edge.cost dsu.join(edge.from, edge.to) } } println(ans) }
[ { "class_path": "julianferres__Codeforces__14e8369/GKt$main$$inlined$compareBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class GKt$main$$inlined$compareBy$1<T> implements java.util.Comparator {\n public GKt$main$$inlined$compareBy$1();\n Code:\n 0: aload_0\n 1: invokespecial #16 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final int compare(T, T);\n Code:\n 0: aload_1\n 1: checkcast #23 // class Edge\n 4: astore_3\n 5: iconst_0\n 6: istore 4\n 8: aload_3\n 9: invokevirtual #27 // Method Edge.getCost:()J\n 12: invokestatic #33 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 15: checkcast #35 // class java/lang/Comparable\n 18: aload_2\n 19: checkcast #23 // class Edge\n 22: astore_3\n 23: astore 5\n 25: iconst_0\n 26: istore 4\n 28: aload_3\n 29: invokevirtual #27 // Method Edge.getCost:()J\n 32: invokestatic #33 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 35: checkcast #35 // class java/lang/Comparable\n 38: aload 5\n 40: swap\n 41: invokestatic #41 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I\n 44: ireturn\n}\n", "javap_err": "" }, { "class_path": "julianferres__Codeforces__14e8369/GKt.class", "javap": "Compiled from \"G.kt\"\npublic final class GKt {\n public static final void main();\n Code:\n 0: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 3: dup\n 4: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 7: checkcast #20 // class java/lang/CharSequence\n 10: iconst_1\n 11: anewarray #22 // class java/lang/String\n 14: astore_1\n 15: aload_1\n 16: iconst_0\n 17: ldc #24 // String\n 19: aastore\n 20: aload_1\n 21: iconst_0\n 22: iconst_0\n 23: bipush 6\n 25: aconst_null\n 26: invokestatic #30 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 29: checkcast #32 // class java/lang/Iterable\n 32: astore_1\n 33: iconst_0\n 34: istore_2\n 35: aload_1\n 36: astore_3\n 37: new #34 // class java/util/ArrayList\n 40: dup\n 41: aload_1\n 42: bipush 10\n 44: invokestatic #40 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 47: invokespecial #44 // Method java/util/ArrayList.\"<init>\":(I)V\n 50: checkcast #46 // class java/util/Collection\n 53: astore 4\n 55: iconst_0\n 56: istore 5\n 58: aload_3\n 59: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 64: astore 6\n 66: aload 6\n 68: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 73: ifeq 120\n 76: aload 6\n 78: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 83: astore 7\n 85: aload 4\n 87: aload 7\n 89: checkcast #22 // class java/lang/String\n 92: astore 8\n 94: astore 19\n 96: iconst_0\n 97: istore 9\n 99: aload 8\n 101: invokestatic #66 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 104: nop\n 105: invokestatic #70 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;\n 108: aload 19\n 110: swap\n 111: invokeinterface #74, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 116: pop\n 117: goto 66\n 120: aload 4\n 122: checkcast #76 // class java/util/List\n 125: nop\n 126: astore_0\n 127: aload_0\n 128: iconst_0\n 129: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 134: checkcast #82 // class java/lang/Number\n 137: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 140: istore_1\n 141: aload_0\n 142: iconst_1\n 143: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 148: checkcast #82 // class java/lang/Number\n 151: invokevirtual #86 // Method java/lang/Number.intValue:()I\n 154: istore_2\n 155: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 158: dup\n 159: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 162: checkcast #20 // class java/lang/CharSequence\n 165: iconst_1\n 166: anewarray #22 // class java/lang/String\n 169: astore 4\n 171: aload 4\n 173: iconst_0\n 174: ldc #24 // String\n 176: aastore\n 177: aload 4\n 179: iconst_0\n 180: iconst_0\n 181: bipush 6\n 183: aconst_null\n 184: invokestatic #30 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 187: checkcast #32 // class java/lang/Iterable\n 190: astore 4\n 192: iconst_0\n 193: istore 5\n 195: aload 4\n 197: astore 6\n 199: new #34 // class java/util/ArrayList\n 202: dup\n 203: aload 4\n 205: bipush 10\n 207: invokestatic #40 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I\n 210: invokespecial #44 // Method java/util/ArrayList.\"<init>\":(I)V\n 213: checkcast #46 // class java/util/Collection\n 216: astore 7\n 218: iconst_0\n 219: istore 8\n 221: aload 6\n 223: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 228: astore 9\n 230: aload 9\n 232: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 237: ifeq 284\n 240: aload 9\n 242: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 247: astore 10\n 249: aload 7\n 251: aload 10\n 253: checkcast #22 // class java/lang/String\n 256: astore 11\n 258: astore 19\n 260: iconst_0\n 261: istore 13\n 263: aload 11\n 265: invokestatic #92 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 268: nop\n 269: invokestatic #95 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;\n 272: aload 19\n 274: swap\n 275: invokeinterface #74, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 280: pop\n 281: goto 230\n 284: aload 7\n 286: checkcast #76 // class java/util/List\n 289: nop\n 290: astore_3\n 291: aload_3\n 292: aload_3\n 293: checkcast #32 // class java/lang/Iterable\n 296: astore 5\n 298: astore 19\n 300: iconst_0\n 301: istore 6\n 303: aload 5\n 305: invokeinterface #50, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 310: astore 7\n 312: aload 7\n 314: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 319: ifne 330\n 322: new #97 // class java/util/NoSuchElementException\n 325: dup\n 326: invokespecial #99 // Method java/util/NoSuchElementException.\"<init>\":()V\n 329: athrow\n 330: aload 7\n 332: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 337: astore 8\n 339: aload 7\n 341: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 346: ifne 354\n 349: aload 8\n 351: goto 425\n 354: aload 8\n 356: checkcast #82 // class java/lang/Number\n 359: invokevirtual #103 // Method java/lang/Number.longValue:()J\n 362: lstore 9\n 364: iconst_0\n 365: istore 11\n 367: lload 9\n 369: lstore 13\n 371: aload 7\n 373: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 378: astore 15\n 380: aload 15\n 382: checkcast #82 // class java/lang/Number\n 385: invokevirtual #103 // Method java/lang/Number.longValue:()J\n 388: lstore 16\n 390: iconst_0\n 391: istore 18\n 393: lload 16\n 395: lstore 11\n 397: lload 13\n 399: lload 11\n 401: lcmp\n 402: ifle 413\n 405: aload 15\n 407: astore 8\n 409: lload 11\n 411: lstore 13\n 413: aload 7\n 415: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 420: ifne 371\n 423: aload 8\n 425: aload 19\n 427: swap\n 428: invokeinterface #107, 2 // InterfaceMethod java/util/List.indexOf:(Ljava/lang/Object;)I\n 433: istore 4\n 435: aconst_null\n 436: astore 5\n 438: new #34 // class java/util/ArrayList\n 441: dup\n 442: invokespecial #108 // Method java/util/ArrayList.\"<init>\":()V\n 445: checkcast #76 // class java/util/List\n 448: astore 5\n 450: iconst_0\n 451: istore 6\n 453: iload 6\n 455: iload_2\n 456: if_icmpge 580\n 459: iload 6\n 461: istore 7\n 463: iconst_0\n 464: istore 8\n 466: invokestatic #12 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;\n 469: dup\n 470: invokestatic #18 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 473: checkcast #20 // class java/lang/CharSequence\n 476: iconst_1\n 477: anewarray #22 // class java/lang/String\n 480: astore 9\n 482: aload 9\n 484: iconst_0\n 485: ldc #24 // String\n 487: aastore\n 488: aload 9\n 490: iconst_0\n 491: iconst_0\n 492: bipush 6\n 494: aconst_null\n 495: invokestatic #30 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 498: astore 10\n 500: aload 10\n 502: iconst_0\n 503: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 508: checkcast #22 // class java/lang/String\n 511: invokestatic #66 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 514: istore 9\n 516: aload 10\n 518: iconst_1\n 519: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 524: checkcast #22 // class java/lang/String\n 527: invokestatic #66 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 530: istore 11\n 532: aload 10\n 534: iconst_2\n 535: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 540: checkcast #22 // class java/lang/String\n 543: invokestatic #92 // Method java/lang/Long.parseLong:(Ljava/lang/String;)J\n 546: lstore 13\n 548: aload 5\n 550: new #110 // class Edge\n 553: dup\n 554: iload 9\n 556: iconst_1\n 557: isub\n 558: iload 11\n 560: iconst_1\n 561: isub\n 562: lload 13\n 564: invokespecial #113 // Method Edge.\"<init>\":(IIJ)V\n 567: invokeinterface #114, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 572: pop\n 573: nop\n 574: iinc 6, 1\n 577: goto 453\n 580: iconst_0\n 581: istore 6\n 583: iload_1\n 584: istore 7\n 586: iload 6\n 588: iload 7\n 590: if_icmpge 647\n 593: aload 5\n 595: new #110 // class Edge\n 598: dup\n 599: iload 6\n 601: iload 4\n 603: aload_3\n 604: iload 4\n 606: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 611: checkcast #82 // class java/lang/Number\n 614: invokevirtual #103 // Method java/lang/Number.longValue:()J\n 617: aload_3\n 618: iload 6\n 620: invokeinterface #80, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 625: checkcast #82 // class java/lang/Number\n 628: invokevirtual #103 // Method java/lang/Number.longValue:()J\n 631: ladd\n 632: invokespecial #113 // Method Edge.\"<init>\":(IIJ)V\n 635: invokeinterface #114, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z\n 640: pop\n 641: iinc 6, 1\n 644: goto 586\n 647: aload 5\n 649: new #116 // class GKt$main$$inlined$compareBy$1\n 652: dup\n 653: invokespecial #117 // Method GKt$main$$inlined$compareBy$1.\"<init>\":()V\n 656: checkcast #119 // class java/util/Comparator\n 659: invokestatic #123 // Method kotlin/collections/CollectionsKt.sortWith:(Ljava/util/List;Ljava/util/Comparator;)V\n 662: new #125 // class DSU\n 665: dup\n 666: iload_1\n 667: invokespecial #126 // Method DSU.\"<init>\":(I)V\n 670: astore 6\n 672: lconst_0\n 673: lstore 7\n 675: aload 5\n 677: invokeinterface #127, 1 // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;\n 682: astore 9\n 684: aload 9\n 686: invokeinterface #56, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 691: ifeq 758\n 694: aload 9\n 696: invokeinterface #60, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 701: checkcast #110 // class Edge\n 704: astore 10\n 706: aload 6\n 708: aload 10\n 710: invokevirtual #130 // Method Edge.getFrom:()I\n 713: invokevirtual #134 // Method DSU.find:(I)I\n 716: aload 6\n 718: aload 10\n 720: invokevirtual #137 // Method Edge.getTo:()I\n 723: invokevirtual #134 // Method DSU.find:(I)I\n 726: if_icmpeq 684\n 729: lload 7\n 731: aload 10\n 733: invokevirtual #140 // Method Edge.getCost:()J\n 736: ladd\n 737: lstore 7\n 739: aload 6\n 741: aload 10\n 743: invokevirtual #130 // Method Edge.getFrom:()I\n 746: aload 10\n 748: invokevirtual #137 // Method Edge.getTo:()I\n 751: invokevirtual #144 // Method DSU.join:(II)Z\n 754: pop\n 755: goto 684\n 758: getstatic #150 // Field java/lang/System.out:Ljava/io/PrintStream;\n 761: lload 7\n 763: invokevirtual #156 // Method java/io/PrintStream.println:(J)V\n 766: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #200 // Method main:()V\n 3: return\n}\n", "javap_err": "" } ]
charlesfranciscodev__codingame__3ec8060/puzzles/kotlin/src/war/war.kt
import java.util.Scanner import kotlin.system.exitProcess fun main(args : Array<String>) { val game = Game() game.play() } /** * Represents the result of one game turn: * PLAYER1 if player 1 wins this round, * PLAYER2 if player 2 wins this round, * WAR if the two cards played are of equal value * */ enum class Result { PLAYER1, PLAYER2, WAR } class Card(val value: String, val suit: String) : Comparable<Card> { companion object { val intValues: HashMap<String, Int> = hashMapOf( "2" to 2, "3" to 3, "4" to 4, "5" to 5, "6" to 6, "7" to 7, "8" to 8, "9" to 9, "10" to 10, "J" to 11, "Q" to 12, "K" to 13, "A" to 14 ) } override fun compareTo(other: Card): Int { val value1 = intValues.getOrDefault(value, 0) val value2 = intValues.getOrDefault(other.value, 0) return value1 - value2 } } class Game { val input = Scanner(System.`in`) var deck1 = readGameInput() var deck2 = readGameInput() var nbRounds = 0 fun readGameInput(): List<Card> { val n = input.nextInt() // the number of cards for the player val cards = ArrayList<Card>(n) for (i in 0 until n) { val valueSuit = input.next() val value = valueSuit.substring(0, valueSuit.length - 1) val suit = valueSuit.substring(valueSuit.length - 1) cards.add(Card(value, suit)) } return cards } fun play() { var index = 0 while (true) { val result = playTurn(index) val rotateIndex = index + 1 if (result == Result.PLAYER1) { nbRounds++ deck1 = rotate(deck1, rotateIndex) deck1 += deck2.take(rotateIndex) // take other player's cards deck2 = deck2.drop(rotateIndex) // remove other player's cards index = 0 } else if (result == Result.PLAYER2) { nbRounds++ deck2 += deck1.take(rotateIndex) // take other player's cards deck1 = deck1.drop(rotateIndex) // remove other player's cards deck2 = rotate(deck2, rotateIndex) index = 0 } else { // WAR index += 4 } } } fun rotate(deck: List<Card>, index: Int): List<Card> { return deck.drop(index) + deck.take(index) } /** Returns the result of one game turn */ fun playTurn(index: Int): Result { if (index > deck1.size || index > deck2.size) { println("PAT") exitProcess(0) } checkGameOver() val card1 = deck1[index] val card2 = deck2[index] return when { card2 < card1 -> Result.PLAYER1 card1 < card2 -> Result.PLAYER2 else -> Result.WAR } } fun checkGameOver() { if (deck1.isEmpty()) { println("2 $nbRounds") exitProcess(0) } if (deck2.isEmpty()) { println("1 $nbRounds") exitProcess(0) } } }
[ { "class_path": "charlesfranciscodev__codingame__3ec8060/WarKt.class", "javap": "Compiled from \"war.kt\"\npublic final class WarKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #17 // class Game\n 9: dup\n 10: invokespecial #21 // Method Game.\"<init>\":()V\n 13: astore_1\n 14: aload_1\n 15: invokevirtual #24 // Method Game.play:()V\n 18: return\n}\n", "javap_err": "" } ]
charlesfranciscodev__codingame__3ec8060/puzzles/kotlin/src/surface/surface.kt
import java.util.Scanner import java.util.ArrayDeque const val LAND = '#' const val WATER = 'O' const val DEFAULT_INDEX = -1 fun main(args : Array<String>) { val grid = Grid() grid.readGameInput() grid.test() } data class Square(val x: Int, val y: Int, val terrain: Char, var lakeIndex: Int = DEFAULT_INDEX) class Grid { val input = Scanner(System.`in`) var width = 0 var height = 0 val nodes = ArrayList<List<Square>>() val lakes = HashMap<Int, Int>() // lake_index -> surface area fun readGameInput() { width = input.nextInt() height = input.nextInt() if (input.hasNextLine()) { input.nextLine() } for (y in 0 until height) { val row = input.nextLine().withIndex().map { Square(it.index, y, it.value) } nodes.add(row) } } fun test() { val n = input.nextInt() for (i in 0 until n) { val x = input.nextInt() val y = input.nextInt() println(area(x, y)) } } fun area(x: Int, y: Int): Int { val node = nodes[y][x] if (node.terrain == LAND) { return 0 } if (node.lakeIndex == DEFAULT_INDEX) { floodFill(node) } return lakes.getOrDefault(node.lakeIndex, 0) } // Source https://en.wikipedia.org/wiki/Flood_fill fun floodFill(start: Square) { val queue = ArrayDeque<Square>() var totalArea = 0 start.lakeIndex = start.y * width + start.x queue.add(start) while (!queue.isEmpty()) { totalArea++ val current = queue.poll() fillNeighbors(queue, current, start.lakeIndex) } lakes.put(start.lakeIndex, totalArea) } fun fillNeighbors(queue: ArrayDeque<Square>, square: Square, lakeIndex: Int) { if (square.x + 1 < width) { val rightNeighbor = nodes[square.y][square.x + 1] fill(queue, rightNeighbor, lakeIndex) } if (square.x > 0) { val leftNeighbor = nodes[square.y][square.x - 1] fill(queue, leftNeighbor, lakeIndex) } if (square.y + 1 < height) { val downNeighbor = nodes[square.y + 1][square.x] fill(queue, downNeighbor, lakeIndex) } if (square.y > 0) { val upNeighbor = nodes[square.y - 1][square.x] fill(queue, upNeighbor, lakeIndex) } } fun fill(queue: ArrayDeque<Square>, square: Square, lakeIndex: Int) { if (square.terrain == WATER && square.lakeIndex == DEFAULT_INDEX) { square.lakeIndex = lakeIndex queue.add(square) } } }
[ { "class_path": "charlesfranciscodev__codingame__3ec8060/SurfaceKt.class", "javap": "Compiled from \"surface.kt\"\npublic final class SurfaceKt {\n public static final char LAND;\n\n public static final char WATER;\n\n public static final int DEFAULT_INDEX;\n\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #17 // class Grid\n 9: dup\n 10: invokespecial #21 // Method Grid.\"<init>\":()V\n 13: astore_1\n 14: aload_1\n 15: invokevirtual #24 // Method Grid.readGameInput:()V\n 18: aload_1\n 19: invokevirtual #27 // Method Grid.test:()V\n 22: return\n}\n", "javap_err": "" } ]
marc-bouvier-katas__Kotlin_EduTools_Advent_of_Code_2021__12cf74c/Day 5/Part 1/src/Task.kt
fun overlaps(ventsLines: Array<String>): Int { val lines = Lines() return if (ventsLines.size >= 2) { repeat(ventsLines.size){ lines.mergeWith(Line.fromLineOfVent(LineOfVent.fromString(ventsLines[it]))) } return lines.overlaps() } else 0 } data class Lines(private val data:MutableMap<Int,Line> = mutableMapOf() ){ fun mergeWith(line: Line){ data.merge(line.y,line,Line::mergeWith) } fun overlaps(): Int { println(data) return data.values.sumOf { it.overlaps() } } } data class Line(val y: Int, private val xValues: Map<Int, Int> = mutableMapOf()) { fun mergeWith(other:Line): Line { val mergedXValues = xValues.toMutableMap() other.xValues.forEach{ if(mergedXValues.containsKey(it.key)){ mergedXValues[it.key]=it.value+mergedXValues[it.key]!! }else{ mergedXValues[it.key]=it.value } } return Line(y, mergedXValues) } fun overlaps(): Int { return xValues.values.count { it > 1 } } companion object{ fun fromLineOfVent(lineOfVent: LineOfVent):Line{ val xValues = mutableMapOf<Int, Int>() (lineOfVent.x1 .. lineOfVent.x2).forEach{xValues[it]=1} println("fromlineofvent: "+xValues) return Line(lineOfVent.y1, xValues.toMap()) } } } class LineOfVent( val x1: Int, val y1: Int, val x2: Int, val y2: Int ) { fun numberOfOverlapsWith(other: LineOfVent): Int { return if (!onTheSameYCoordinate(other)) 0 else arrayOf(this.x2, other.x2) .minOrNull()!! - arrayOf( this.x1, other.x1 ).maxOrNull()!! + 1 } private fun onTheSameYCoordinate(other: LineOfVent) = this.y1 == other.y1 companion object { fun fromString(string: String): LineOfVent { val (left, right) = string.split(" -> ") val (x1, y1) = left.split(",").map(String::toInt) val (x2, y2) = right.split(",").map(String::toInt) return LineOfVent(x1, y1, x2, y2) } } }
[ { "class_path": "marc-bouvier-katas__Kotlin_EduTools_Advent_of_Code_2021__12cf74c/TaskKt.class", "javap": "Compiled from \"Task.kt\"\npublic final class TaskKt {\n public static final int overlaps(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String ventsLines\n 3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #17 // class Lines\n 9: dup\n 10: aconst_null\n 11: iconst_1\n 12: aconst_null\n 13: invokespecial #21 // Method Lines.\"<init>\":(Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V\n 16: astore_1\n 17: aload_0\n 18: arraylength\n 19: iconst_2\n 20: if_icmplt 71\n 23: aload_0\n 24: arraylength\n 25: istore_2\n 26: iconst_0\n 27: istore_3\n 28: iload_3\n 29: iload_2\n 30: if_icmpge 66\n 33: iload_3\n 34: istore 4\n 36: iconst_0\n 37: istore 5\n 39: aload_1\n 40: getstatic #27 // Field Line.Companion:LLine$Companion;\n 43: getstatic #32 // Field LineOfVent.Companion:LLineOfVent$Companion;\n 46: aload_0\n 47: iload 4\n 49: aaload\n 50: invokevirtual #38 // Method LineOfVent$Companion.fromString:(Ljava/lang/String;)LLineOfVent;\n 53: invokevirtual #44 // Method Line$Companion.fromLineOfVent:(LLineOfVent;)LLine;\n 56: invokevirtual #48 // Method Lines.mergeWith:(LLine;)V\n 59: nop\n 60: iinc 3, 1\n 63: goto 28\n 66: aload_1\n 67: invokevirtual #51 // Method Lines.overlaps:()I\n 70: ireturn\n 71: iconst_0\n 72: ireturn\n}\n", "javap_err": "" } ]
occmundial__Kotlin-Weekly-Challenge__f09ba0a/src/Challenge2.kt
/* * Challenge #2 * * Date: 15/08/2022 * Difficulty: Medium * Create a function that translate from natural text to Morse code and vice versa. * - Must be automatically detect what type it is and perform the conversion. * - In Morse, dash "—", dot ".", a space " " between letters or symbols, and two spaces between words " " are supported. * - The supported morse alphabet will be the one shown in https://es.wikipedia.org/wiki/Código_morse. */ lateinit var naturalDictionary: Map<String, String> var morseDictionary = mutableMapOf<String, String>() fun main() { createDictionaries() val naturalText = "<NAME>" val morseText = ".... --- .-.. .- ---- . -.-. ---" println(decoder(naturalText)) println(decoder(morseText)) } private fun createDictionaries() { naturalDictionary = mapOf( "A" to ".-", "N" to "-.", "0" to "-----", "B" to "-...", "Ñ" to "--.--", "1" to ".----", "C" to "-.-.", "O" to "---", "2" to "..---", "CH" to "----", "P" to ".--.", "3" to "...--", "D" to "-..", "Q" to "--.-", "4" to "....-", "E" to ".", "R" to ".-.", "5" to ".....", "F" to "..-.", "S" to "...", "6" to "-....", "G" to "--.", "T" to "-", "7" to "--...", "H" to "....", "U" to "..-", "8" to "---..", "I" to "..", "V" to "...-", "9" to "----.", "J" to ".---", "W" to ".--", "." to ".-.-.-", "K" to "-.-", "X" to "-..-", "," to "--..--", "L" to ".-..", "Y" to "-.--", "?" to "..--..", "M" to "--", "Z" to "--..", "\"" to ".-..-.", "/" to "-..-." ) naturalDictionary.forEach { morseDictionary[it.value] = it.key } } private fun decoder(input: String): String { var output = "" if (input.contains(Regex("[a-zA-Z0-9]"))) { // texto output = getMorse(input) } else if (input.contains(".") || input.contains("-")) { // morse output = getNatural(input) } return output } private fun getMorse(input: String): String { var index = 0 var ch = false var output = "" input.uppercase().forEach { character -> if (!ch && character.toString() != " ") { val next = index + 1 if (character.toString() == "C" && next < input.length && input.uppercase()[next].toString() == "H") { output += naturalDictionary["CH"] ch = true } else { output += naturalDictionary[character.toString()] } output += " " } else { if (!ch) { output += " " } ch = false } index++ } return output } private fun getNatural(input: String): String { var output = "" input.split(" ").forEach { word -> word.split(" ").forEach { symbol -> if (symbol.isNotEmpty()) { output += morseDictionary[symbol] } } output += " " } return output }
[ { "class_path": "occmundial__Kotlin-Weekly-Challenge__f09ba0a/Challenge2Kt.class", "javap": "Compiled from \"Challenge2.kt\"\npublic final class Challenge2Kt {\n public static java.util.Map<java.lang.String, java.lang.String> naturalDictionary;\n\n private static java.util.Map<java.lang.String, java.lang.String> morseDictionary;\n\n public static final java.util.Map<java.lang.String, java.lang.String> getNaturalDictionary();\n Code:\n 0: getstatic #12 // Field naturalDictionary:Ljava/util/Map;\n 3: dup\n 4: ifnull 8\n 7: areturn\n 8: pop\n 9: ldc #13 // String naturalDictionary\n 11: invokestatic #19 // Method kotlin/jvm/internal/Intrinsics.throwUninitializedPropertyAccessException:(Ljava/lang/String;)V\n 14: aconst_null\n 15: areturn\n\n public static final void setNaturalDictionary(java.util.Map<java.lang.String, java.lang.String>);\n Code:\n 0: aload_0\n 1: ldc #26 // String <set-?>\n 3: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: putstatic #12 // Field naturalDictionary:Ljava/util/Map;\n 10: return\n\n public static final java.util.Map<java.lang.String, java.lang.String> getMorseDictionary();\n Code:\n 0: getstatic #34 // Field morseDictionary:Ljava/util/Map;\n 3: areturn\n\n public static final void setMorseDictionary(java.util.Map<java.lang.String, java.lang.String>);\n Code:\n 0: aload_0\n 1: ldc #26 // String <set-?>\n 3: invokestatic #30 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: putstatic #34 // Field morseDictionary:Ljava/util/Map;\n 10: return\n\n public static final void main();\n Code:\n 0: invokestatic #40 // Method createDictionaries:()V\n 3: ldc #42 // String <NAME>\n 5: astore_0\n 6: ldc #44 // String .... --- .-.. .- ---- . -.-. ---\n 8: astore_1\n 9: aload_0\n 10: invokestatic #48 // Method decoder:(Ljava/lang/String;)Ljava/lang/String;\n 13: getstatic #54 // Field java/lang/System.out:Ljava/io/PrintStream;\n 16: swap\n 17: invokevirtual #60 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 20: aload_1\n 21: invokestatic #48 // Method decoder:(Ljava/lang/String;)Ljava/lang/String;\n 24: getstatic #54 // Field java/lang/System.out:Ljava/io/PrintStream;\n 27: swap\n 28: invokevirtual #60 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V\n 31: return\n\n private static final void createDictionaries();\n Code:\n 0: bipush 43\n 2: anewarray #65 // class kotlin/Pair\n 5: astore_0\n 6: aload_0\n 7: iconst_0\n 8: ldc #67 // String A\n 10: ldc #69 // String .-\n 12: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 15: aastore\n 16: aload_0\n 17: iconst_1\n 18: ldc #77 // String N\n 20: ldc #79 // String -.\n 22: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 25: aastore\n 26: aload_0\n 27: iconst_2\n 28: ldc #81 // String 0\n 30: ldc #83 // String -----\n 32: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 35: aastore\n 36: aload_0\n 37: iconst_3\n 38: ldc #85 // String B\n 40: ldc #87 // String -...\n 42: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 45: aastore\n 46: aload_0\n 47: iconst_4\n 48: ldc #89 // String Ñ\n 50: ldc #91 // String --.--\n 52: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 55: aastore\n 56: aload_0\n 57: iconst_5\n 58: ldc #93 // String 1\n 60: ldc #95 // String .----\n 62: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 65: aastore\n 66: aload_0\n 67: bipush 6\n 69: ldc #97 // String C\n 71: ldc #99 // String -.-.\n 73: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 76: aastore\n 77: aload_0\n 78: bipush 7\n 80: ldc #101 // String O\n 82: ldc #103 // String ---\n 84: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 87: aastore\n 88: aload_0\n 89: bipush 8\n 91: ldc #105 // String 2\n 93: ldc #107 // String ..---\n 95: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 98: aastore\n 99: aload_0\n 100: bipush 9\n 102: ldc #109 // String CH\n 104: ldc #111 // String ----\n 106: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 109: aastore\n 110: aload_0\n 111: bipush 10\n 113: ldc #113 // String P\n 115: ldc #115 // String .--.\n 117: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 120: aastore\n 121: aload_0\n 122: bipush 11\n 124: ldc #117 // String 3\n 126: ldc #119 // String ...--\n 128: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 131: aastore\n 132: aload_0\n 133: bipush 12\n 135: ldc #121 // String D\n 137: ldc #123 // String -..\n 139: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 142: aastore\n 143: aload_0\n 144: bipush 13\n 146: ldc #125 // String Q\n 148: ldc #127 // String --.-\n 150: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 153: aastore\n 154: aload_0\n 155: bipush 14\n 157: ldc #129 // String 4\n 159: ldc #131 // String ....-\n 161: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 164: aastore\n 165: aload_0\n 166: bipush 15\n 168: ldc #133 // String E\n 170: ldc #135 // String .\n 172: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 175: aastore\n 176: aload_0\n 177: bipush 16\n 179: ldc #137 // String R\n 181: ldc #139 // String .-.\n 183: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 186: aastore\n 187: aload_0\n 188: bipush 17\n 190: ldc #141 // String 5\n 192: ldc #143 // String .....\n 194: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 197: aastore\n 198: aload_0\n 199: bipush 18\n 201: ldc #145 // String F\n 203: ldc #147 // String ..-.\n 205: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 208: aastore\n 209: aload_0\n 210: bipush 19\n 212: ldc #149 // String S\n 214: ldc #151 // String ...\n 216: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 219: aastore\n 220: aload_0\n 221: bipush 20\n 223: ldc #153 // String 6\n 225: ldc #155 // String -....\n 227: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 230: aastore\n 231: aload_0\n 232: bipush 21\n 234: ldc #157 // String G\n 236: ldc #159 // String --.\n 238: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 241: aastore\n 242: aload_0\n 243: bipush 22\n 245: ldc #161 // String T\n 247: ldc #163 // String -\n 249: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 252: aastore\n 253: aload_0\n 254: bipush 23\n 256: ldc #165 // String 7\n 258: ldc #167 // String --...\n 260: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 263: aastore\n 264: aload_0\n 265: bipush 24\n 267: ldc #169 // String H\n 269: ldc #171 // String ....\n 271: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 274: aastore\n 275: aload_0\n 276: bipush 25\n 278: ldc #173 // String U\n 280: ldc #175 // String ..-\n 282: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 285: aastore\n 286: aload_0\n 287: bipush 26\n 289: ldc #177 // String 8\n 291: ldc #179 // String ---..\n 293: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 296: aastore\n 297: aload_0\n 298: bipush 27\n 300: ldc #181 // String I\n 302: ldc #183 // String ..\n 304: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 307: aastore\n 308: aload_0\n 309: bipush 28\n 311: ldc #185 // String V\n 313: ldc #187 // String ...-\n 315: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 318: aastore\n 319: aload_0\n 320: bipush 29\n 322: ldc #189 // String 9\n 324: ldc #191 // String ----.\n 326: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 329: aastore\n 330: aload_0\n 331: bipush 30\n 333: ldc #193 // String J\n 335: ldc #195 // String .---\n 337: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 340: aastore\n 341: aload_0\n 342: bipush 31\n 344: ldc #197 // String W\n 346: ldc #199 // String .--\n 348: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 351: aastore\n 352: aload_0\n 353: bipush 32\n 355: ldc #135 // String .\n 357: ldc #201 // String .-.-.-\n 359: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 362: aastore\n 363: aload_0\n 364: bipush 33\n 366: ldc #203 // String K\n 368: ldc #205 // String -.-\n 370: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 373: aastore\n 374: aload_0\n 375: bipush 34\n 377: ldc #207 // String X\n 379: ldc #209 // String -..-\n 381: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 384: aastore\n 385: aload_0\n 386: bipush 35\n 388: ldc #211 // String ,\n 390: ldc #213 // String --..--\n 392: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 395: aastore\n 396: aload_0\n 397: bipush 36\n 399: ldc #215 // String L\n 401: ldc #217 // String .-..\n 403: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 406: aastore\n 407: aload_0\n 408: bipush 37\n 410: ldc #219 // String Y\n 412: ldc #221 // String -.--\n 414: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 417: aastore\n 418: aload_0\n 419: bipush 38\n 421: ldc #223 // String ?\n 423: ldc #225 // String ..--..\n 425: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 428: aastore\n 429: aload_0\n 430: bipush 39\n 432: ldc #227 // String M\n 434: ldc #229 // String --\n 436: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 439: aastore\n 440: aload_0\n 441: bipush 40\n 443: ldc #231 // String Z\n 445: ldc #233 // String --..\n 447: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 450: aastore\n 451: aload_0\n 452: bipush 41\n 454: ldc #235 // String \\\"\n 456: ldc #237 // String .-..-.\n 458: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 461: aastore\n 462: aload_0\n 463: bipush 42\n 465: ldc #239 // String /\n 467: ldc #241 // String -..-.\n 469: invokestatic #75 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;\n 472: aastore\n 473: aload_0\n 474: invokestatic #247 // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;\n 477: invokestatic #249 // Method setNaturalDictionary:(Ljava/util/Map;)V\n 480: invokestatic #251 // Method getNaturalDictionary:()Ljava/util/Map;\n 483: astore_0\n 484: iconst_0\n 485: istore_1\n 486: aload_0\n 487: invokeinterface #255, 1 // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;\n 492: invokeinterface #261, 1 // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;\n 497: astore_2\n 498: aload_2\n 499: invokeinterface #267, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 504: ifeq 551\n 507: aload_2\n 508: invokeinterface #271, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 513: checkcast #273 // class java/util/Map$Entry\n 516: astore_3\n 517: aload_3\n 518: astore 4\n 520: iconst_0\n 521: istore 5\n 523: getstatic #34 // Field morseDictionary:Ljava/util/Map;\n 526: aload 4\n 528: invokeinterface #276, 1 // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;\n 533: aload 4\n 535: invokeinterface #279, 1 // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;\n 540: invokeinterface #283, 3 // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n 545: pop\n 546: nop\n 547: nop\n 548: goto 498\n 551: nop\n 552: return\n\n private static final java.lang.String decoder(java.lang.String);\n Code:\n 0: ldc_w #291 // String\n 3: astore_1\n 4: aload_0\n 5: checkcast #293 // class java/lang/CharSequence\n 8: astore_2\n 9: new #295 // class kotlin/text/Regex\n 12: dup\n 13: ldc_w #297 // String [a-zA-Z0-9]\n 16: invokespecial #300 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 19: aload_2\n 20: invokevirtual #304 // Method kotlin/text/Regex.containsMatchIn:(Ljava/lang/CharSequence;)Z\n 23: ifeq 34\n 26: aload_0\n 27: invokestatic #307 // Method getMorse:(Ljava/lang/String;)Ljava/lang/String;\n 30: astore_1\n 31: goto 75\n 34: aload_0\n 35: checkcast #293 // class java/lang/CharSequence\n 38: ldc #135 // String .\n 40: checkcast #293 // class java/lang/CharSequence\n 43: iconst_0\n 44: iconst_2\n 45: aconst_null\n 46: invokestatic #313 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z\n 49: ifne 70\n 52: aload_0\n 53: checkcast #293 // class java/lang/CharSequence\n 56: ldc #163 // String -\n 58: checkcast #293 // class java/lang/CharSequence\n 61: iconst_0\n 62: iconst_2\n 63: aconst_null\n 64: invokestatic #313 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z\n 67: ifeq 75\n 70: aload_0\n 71: invokestatic #316 // Method getNatural:(Ljava/lang/String;)Ljava/lang/String;\n 74: astore_1\n 75: aload_1\n 76: areturn\n\n private static final java.lang.String getMorse(java.lang.String);\n Code:\n 0: iconst_0\n 1: istore_1\n 2: iconst_0\n 3: istore_2\n 4: aconst_null\n 5: astore_3\n 6: ldc_w #291 // String\n 9: astore_3\n 10: aload_0\n 11: getstatic #326 // Field java/util/Locale.ROOT:Ljava/util/Locale;\n 14: invokevirtual #330 // Method java/lang/String.toUpperCase:(Ljava/util/Locale;)Ljava/lang/String;\n 17: dup\n 18: ldc_w #332 // String toUpperCase(...)\n 21: invokestatic #335 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 24: checkcast #293 // class java/lang/CharSequence\n 27: astore 4\n 29: nop\n 30: iconst_0\n 31: istore 5\n 33: iconst_0\n 34: istore 6\n 36: iload 6\n 38: aload 4\n 40: invokeinterface #339, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 45: if_icmpge 272\n 48: aload 4\n 50: iload 6\n 52: invokeinterface #343, 2 // InterfaceMethod java/lang/CharSequence.charAt:(I)C\n 57: istore 7\n 59: iload 7\n 61: istore 8\n 63: iconst_0\n 64: istore 9\n 66: iload_2\n 67: ifne 234\n 70: iload 8\n 72: invokestatic #347 // Method java/lang/String.valueOf:(C)Ljava/lang/String;\n 75: ldc_w #349 // String\n 78: invokestatic #353 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 81: ifne 234\n 84: iload_1\n 85: iconst_1\n 86: iadd\n 87: istore 10\n 89: iload 8\n 91: invokestatic #347 // Method java/lang/String.valueOf:(C)Ljava/lang/String;\n 94: ldc #97 // String C\n 96: invokestatic #353 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 99: ifeq 177\n 102: iload 10\n 104: aload_0\n 105: invokevirtual #354 // Method java/lang/String.length:()I\n 108: if_icmpge 177\n 111: aload_0\n 112: getstatic #326 // Field java/util/Locale.ROOT:Ljava/util/Locale;\n 115: invokevirtual #330 // Method java/lang/String.toUpperCase:(Ljava/util/Locale;)Ljava/lang/String;\n 118: dup\n 119: ldc_w #332 // String toUpperCase(...)\n 122: invokestatic #335 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V\n 125: iload 10\n 127: invokevirtual #355 // Method java/lang/String.charAt:(I)C\n 130: invokestatic #347 // Method java/lang/String.valueOf:(C)Ljava/lang/String;\n 133: ldc #169 // String H\n 135: invokestatic #353 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 138: ifeq 177\n 141: new #357 // class java/lang/StringBuilder\n 144: dup\n 145: invokespecial #359 // Method java/lang/StringBuilder.\"<init>\":()V\n 148: aload_3\n 149: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 152: invokestatic #251 // Method getNaturalDictionary:()Ljava/util/Map;\n 155: ldc #109 // String CH\n 157: invokeinterface #367, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 162: checkcast #320 // class java/lang/String\n 165: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 168: invokevirtual #371 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 171: astore_3\n 172: iconst_1\n 173: istore_2\n 174: goto 211\n 177: new #357 // class java/lang/StringBuilder\n 180: dup\n 181: invokespecial #359 // Method java/lang/StringBuilder.\"<init>\":()V\n 184: aload_3\n 185: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 188: invokestatic #251 // Method getNaturalDictionary:()Ljava/util/Map;\n 191: iload 8\n 193: invokestatic #347 // Method java/lang/String.valueOf:(C)Ljava/lang/String;\n 196: invokeinterface #367, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 201: checkcast #320 // class java/lang/String\n 204: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 207: invokevirtual #371 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 210: astore_3\n 211: new #357 // class java/lang/StringBuilder\n 214: dup\n 215: invokespecial #359 // Method java/lang/StringBuilder.\"<init>\":()V\n 218: aload_3\n 219: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 222: bipush 32\n 224: invokevirtual #374 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 227: invokevirtual #371 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 230: astore_3\n 231: goto 260\n 234: iload_2\n 235: ifne 258\n 238: new #357 // class java/lang/StringBuilder\n 241: dup\n 242: invokespecial #359 // Method java/lang/StringBuilder.\"<init>\":()V\n 245: aload_3\n 246: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 249: bipush 32\n 251: invokevirtual #374 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 254: invokevirtual #371 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 257: astore_3\n 258: iconst_0\n 259: istore_2\n 260: iload_1\n 261: iconst_1\n 262: iadd\n 263: istore_1\n 264: nop\n 265: nop\n 266: iinc 6, 1\n 269: goto 36\n 272: nop\n 273: aload_3\n 274: areturn\n\n private static final java.lang.String getNatural(java.lang.String);\n Code:\n 0: aconst_null\n 1: astore_1\n 2: ldc_w #291 // String\n 5: astore_1\n 6: aload_0\n 7: checkcast #293 // class java/lang/CharSequence\n 10: iconst_1\n 11: anewarray #320 // class java/lang/String\n 14: astore_2\n 15: aload_2\n 16: iconst_0\n 17: ldc_w #382 // String\n 20: aastore\n 21: aload_2\n 22: iconst_0\n 23: iconst_0\n 24: bipush 6\n 26: aconst_null\n 27: invokestatic #386 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 30: checkcast #388 // class java/lang/Iterable\n 33: astore_2\n 34: iconst_0\n 35: istore_3\n 36: aload_2\n 37: invokeinterface #389, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 42: astore 4\n 44: aload 4\n 46: invokeinterface #267, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 230\n 54: aload 4\n 56: invokeinterface #271, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 61: astore 5\n 63: aload 5\n 65: checkcast #320 // class java/lang/String\n 68: astore 6\n 70: iconst_0\n 71: istore 7\n 73: aload 6\n 75: checkcast #293 // class java/lang/CharSequence\n 78: iconst_1\n 79: anewarray #320 // class java/lang/String\n 82: astore 8\n 84: aload 8\n 86: iconst_0\n 87: ldc_w #349 // String\n 90: aastore\n 91: aload 8\n 93: iconst_0\n 94: iconst_0\n 95: bipush 6\n 97: aconst_null\n 98: invokestatic #386 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 101: checkcast #388 // class java/lang/Iterable\n 104: astore 8\n 106: iconst_0\n 107: istore 9\n 109: aload 8\n 111: invokeinterface #389, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 116: astore 10\n 118: aload 10\n 120: invokeinterface #267, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 125: ifeq 204\n 128: aload 10\n 130: invokeinterface #271, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 135: astore 11\n 137: aload 11\n 139: checkcast #320 // class java/lang/String\n 142: astore 12\n 144: iconst_0\n 145: istore 13\n 147: aload 12\n 149: checkcast #293 // class java/lang/CharSequence\n 152: invokeinterface #339, 1 // InterfaceMethod java/lang/CharSequence.length:()I\n 157: ifle 164\n 160: iconst_1\n 161: goto 165\n 164: iconst_0\n 165: ifeq 199\n 168: new #357 // class java/lang/StringBuilder\n 171: dup\n 172: invokespecial #359 // Method java/lang/StringBuilder.\"<init>\":()V\n 175: aload_1\n 176: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 179: getstatic #34 // Field morseDictionary:Ljava/util/Map;\n 182: aload 12\n 184: invokeinterface #367, 2 // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;\n 189: checkcast #320 // class java/lang/String\n 192: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 195: invokevirtual #371 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 198: astore_1\n 199: nop\n 200: nop\n 201: goto 118\n 204: nop\n 205: new #357 // class java/lang/StringBuilder\n 208: dup\n 209: invokespecial #359 // Method java/lang/StringBuilder.\"<init>\":()V\n 212: aload_1\n 213: invokevirtual #363 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 216: bipush 32\n 218: invokevirtual #374 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 221: invokevirtual #371 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 224: astore_1\n 225: nop\n 226: nop\n 227: goto 44\n 230: nop\n 231: aload_1\n 232: areturn\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #397 // Method main:()V\n 3: return\n\n static {};\n Code:\n 0: new #402 // class java/util/LinkedHashMap\n 3: dup\n 4: invokespecial #403 // Method java/util/LinkedHashMap.\"<init>\":()V\n 7: checkcast #21 // class java/util/Map\n 10: putstatic #34 // Field morseDictionary:Ljava/util/Map;\n 13: return\n}\n", "javap_err": "" } ]
sviams__aoc23__4914a54/src/main/kotlin/day2.kt
object day2 { data class DrawSet(val red: Int, val green: Int, val blue: Int) data class Game(val id: Int, val sets: List<DrawSet>) { val power: Int by lazy { sets.maxOf { it.red } * sets.maxOf { it.blue } * sets.maxOf { it.green } } fun withinLimit(r: Int, b: Int, g: Int): Boolean = sets.all { set -> set.red <= r && set.blue <= b && set.green <= g } } fun parseInput(input: List<String>): List<Game> = input.fold(emptyList()) { games, line -> val (gameId) = Regex("""Game (\d+):""").find(line)!!.destructured val drawSets = line.split(": ")[1].split(';').fold(emptyList<DrawSet>()) { drawSets, setString -> val red = Regex("""(\d+) red""").find(setString)?.groupValues?.last()?.toInt() ?: 0 val blue = Regex("""(\d+) blue""").find(setString)?.groupValues?.last()?.toInt() ?: 0 val green = Regex("""(\d+) green""").find(setString)?.groupValues?.last()?.toInt() ?: 0 drawSets + DrawSet(red, green, blue) } games + Game(gameId.toInt(), drawSets) } fun pt1(input: List<String>): Int = parseInput(input).filter { it.withinLimit(12, 14, 13) }.sumOf { it.id } fun pt2(input: List<String>): Int = parseInput(input).sumOf { it.power } }
[ { "class_path": "sviams__aoc23__4914a54/day2$DrawSet.class", "javap": "Compiled from \"day2.kt\"\npublic final class day2$DrawSet {\n private final int red;\n\n private final int green;\n\n private final int blue;\n\n public day2$DrawSet(int, int, int);\n Code:\n 0: aload_0\n 1: invokespecial #9 // Method java/lang/Object.\"<init>\":()V\n 4: aload_0\n 5: iload_1\n 6: putfield #13 // Field red:I\n 9: aload_0\n 10: iload_2\n 11: putfield #16 // Field green:I\n 14: aload_0\n 15: iload_3\n 16: putfield #19 // Field blue:I\n 19: return\n\n public final int getRed();\n Code:\n 0: aload_0\n 1: getfield #13 // Field red:I\n 4: ireturn\n\n public final int getGreen();\n Code:\n 0: aload_0\n 1: getfield #16 // Field green:I\n 4: ireturn\n\n public final int getBlue();\n Code:\n 0: aload_0\n 1: getfield #19 // Field blue:I\n 4: ireturn\n\n public final int component1();\n Code:\n 0: aload_0\n 1: getfield #13 // Field red:I\n 4: ireturn\n\n public final int component2();\n Code:\n 0: aload_0\n 1: getfield #16 // Field green:I\n 4: ireturn\n\n public final int component3();\n Code:\n 0: aload_0\n 1: getfield #19 // Field blue:I\n 4: ireturn\n\n public final day2$DrawSet copy(int, int, int);\n Code:\n 0: new #2 // class day2$DrawSet\n 3: dup\n 4: iload_1\n 5: iload_2\n 6: iload_3\n 7: invokespecial #33 // Method \"<init>\":(III)V\n 10: areturn\n\n public static day2$DrawSet copy$default(day2$DrawSet, int, int, int, int, java.lang.Object);\n Code:\n 0: iload 4\n 2: iconst_1\n 3: iand\n 4: ifeq 12\n 7: aload_0\n 8: getfield #13 // Field red:I\n 11: istore_1\n 12: iload 4\n 14: iconst_2\n 15: iand\n 16: ifeq 24\n 19: aload_0\n 20: getfield #16 // Field green:I\n 23: istore_2\n 24: iload 4\n 26: iconst_4\n 27: iand\n 28: ifeq 36\n 31: aload_0\n 32: getfield #19 // Field blue:I\n 35: istore_3\n 36: aload_0\n 37: iload_1\n 38: iload_2\n 39: iload_3\n 40: invokevirtual #37 // Method copy:(III)Lday2$DrawSet;\n 43: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #41 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #42 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #44 // String DrawSet(red=\n 9: invokevirtual #48 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #13 // Field red:I\n 16: invokevirtual #51 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 19: ldc #53 // String , green=\n 21: invokevirtual #48 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 24: aload_0\n 25: getfield #16 // Field green:I\n 28: invokevirtual #51 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 31: ldc #55 // String , blue=\n 33: invokevirtual #48 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 36: aload_0\n 37: getfield #19 // Field blue:I\n 40: invokevirtual #51 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 43: bipush 41\n 45: invokevirtual #58 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 48: invokevirtual #60 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 51: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #13 // Field red:I\n 4: invokestatic #66 // Method java/lang/Integer.hashCode:(I)I\n 7: istore_1\n 8: iload_1\n 9: bipush 31\n 11: imul\n 12: aload_0\n 13: getfield #16 // Field green:I\n 16: invokestatic #66 // Method java/lang/Integer.hashCode:(I)I\n 19: iadd\n 20: istore_1\n 21: iload_1\n 22: bipush 31\n 24: imul\n 25: aload_0\n 26: getfield #19 // Field blue:I\n 29: invokestatic #66 // Method java/lang/Integer.hashCode:(I)I\n 32: iadd\n 33: istore_1\n 34: iload_1\n 35: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class day2$DrawSet\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class day2$DrawSet\n 20: astore_2\n 21: aload_0\n 22: getfield #13 // Field red:I\n 25: aload_2\n 26: getfield #13 // Field red:I\n 29: if_icmpeq 34\n 32: iconst_0\n 33: ireturn\n 34: aload_0\n 35: getfield #16 // Field green:I\n 38: aload_2\n 39: getfield #16 // Field green:I\n 42: if_icmpeq 47\n 45: iconst_0\n 46: ireturn\n 47: aload_0\n 48: getfield #19 // Field blue:I\n 51: aload_2\n 52: getfield #19 // Field blue:I\n 55: if_icmpeq 60\n 58: iconst_0\n 59: ireturn\n 60: iconst_1\n 61: ireturn\n}\n", "javap_err": "" }, { "class_path": "sviams__aoc23__4914a54/day2$Game.class", "javap": "Compiled from \"day2.kt\"\npublic final class day2$Game {\n private final int id;\n\n private final java.util.List<day2$DrawSet> sets;\n\n private final kotlin.Lazy power$delegate;\n\n public day2$Game(int, java.util.List<day2$DrawSet>);\n Code:\n 0: aload_2\n 1: ldc #10 // String sets\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: invokespecial #19 // Method java/lang/Object.\"<init>\":()V\n 10: aload_0\n 11: iload_1\n 12: putfield #23 // Field id:I\n 15: aload_0\n 16: aload_2\n 17: putfield #26 // Field sets:Ljava/util/List;\n 20: aload_0\n 21: aload_0\n 22: invokedynamic #46, 0 // InvokeDynamic #0:invoke:(Lday2$Game;)Lkotlin/jvm/functions/Function0;\n 27: invokestatic #52 // Method kotlin/LazyKt.lazy:(Lkotlin/jvm/functions/Function0;)Lkotlin/Lazy;\n 30: putfield #56 // Field power$delegate:Lkotlin/Lazy;\n 33: return\n\n public final int getId();\n Code:\n 0: aload_0\n 1: getfield #23 // Field id:I\n 4: ireturn\n\n public final java.util.List<day2$DrawSet> getSets();\n Code:\n 0: aload_0\n 1: getfield #26 // Field sets:Ljava/util/List;\n 4: areturn\n\n public final int getPower();\n Code:\n 0: aload_0\n 1: getfield #56 // Field power$delegate:Lkotlin/Lazy;\n 4: astore_1\n 5: aload_1\n 6: invokeinterface #69, 1 // InterfaceMethod kotlin/Lazy.getValue:()Ljava/lang/Object;\n 11: checkcast #71 // class java/lang/Number\n 14: invokevirtual #74 // Method java/lang/Number.intValue:()I\n 17: ireturn\n\n public final boolean withinLimit(int, int, int);\n Code:\n 0: aload_0\n 1: getfield #26 // Field sets:Ljava/util/List;\n 4: checkcast #78 // class java/lang/Iterable\n 7: astore 4\n 9: iconst_0\n 10: istore 5\n 12: aload 4\n 14: instanceof #80 // class java/util/Collection\n 17: ifeq 37\n 20: aload 4\n 22: checkcast #80 // class java/util/Collection\n 25: invokeinterface #84, 1 // InterfaceMethod java/util/Collection.isEmpty:()Z\n 30: ifeq 37\n 33: iconst_1\n 34: goto 115\n 37: aload 4\n 39: invokeinterface #88, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 44: astore 6\n 46: aload 6\n 48: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 53: ifeq 114\n 56: aload 6\n 58: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 63: astore 7\n 65: aload 7\n 67: checkcast #98 // class day2$DrawSet\n 70: astore 8\n 72: iconst_0\n 73: istore 9\n 75: aload 8\n 77: invokevirtual #101 // Method day2$DrawSet.getRed:()I\n 80: iload_1\n 81: if_icmpgt 106\n 84: aload 8\n 86: invokevirtual #104 // Method day2$DrawSet.getBlue:()I\n 89: iload_2\n 90: if_icmpgt 106\n 93: aload 8\n 95: invokevirtual #107 // Method day2$DrawSet.getGreen:()I\n 98: iload_3\n 99: if_icmpgt 106\n 102: iconst_1\n 103: goto 107\n 106: iconst_0\n 107: ifne 46\n 110: iconst_0\n 111: goto 115\n 114: iconst_1\n 115: ireturn\n\n public final int component1();\n Code:\n 0: aload_0\n 1: getfield #23 // Field id:I\n 4: ireturn\n\n public final java.util.List<day2$DrawSet> component2();\n Code:\n 0: aload_0\n 1: getfield #26 // Field sets:Ljava/util/List;\n 4: areturn\n\n public final day2$Game copy(int, java.util.List<day2$DrawSet>);\n Code:\n 0: aload_2\n 1: ldc #10 // String sets\n 3: invokestatic #16 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: new #2 // class day2$Game\n 9: dup\n 10: iload_1\n 11: aload_2\n 12: invokespecial #125 // Method \"<init>\":(ILjava/util/List;)V\n 15: areturn\n\n public static day2$Game copy$default(day2$Game, int, java.util.List, int, java.lang.Object);\n Code:\n 0: iload_3\n 1: iconst_1\n 2: iand\n 3: ifeq 11\n 6: aload_0\n 7: getfield #23 // Field id:I\n 10: istore_1\n 11: iload_3\n 12: iconst_2\n 13: iand\n 14: ifeq 22\n 17: aload_0\n 18: getfield #26 // Field sets:Ljava/util/List;\n 21: astore_2\n 22: aload_0\n 23: iload_1\n 24: aload_2\n 25: invokevirtual #129 // Method copy:(ILjava/util/List;)Lday2$Game;\n 28: areturn\n\n public java.lang.String toString();\n Code:\n 0: new #133 // class java/lang/StringBuilder\n 3: dup\n 4: invokespecial #134 // Method java/lang/StringBuilder.\"<init>\":()V\n 7: ldc #136 // String Game(id=\n 9: invokevirtual #140 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 12: aload_0\n 13: getfield #23 // Field id:I\n 16: invokevirtual #143 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;\n 19: ldc #145 // String , sets=\n 21: invokevirtual #140 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;\n 24: aload_0\n 25: getfield #26 // Field sets:Ljava/util/List;\n 28: invokevirtual #148 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;\n 31: bipush 41\n 33: invokevirtual #151 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;\n 36: invokevirtual #153 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;\n 39: areturn\n\n public int hashCode();\n Code:\n 0: aload_0\n 1: getfield #23 // Field id:I\n 4: invokestatic #159 // Method java/lang/Integer.hashCode:(I)I\n 7: istore_1\n 8: iload_1\n 9: bipush 31\n 11: imul\n 12: aload_0\n 13: getfield #26 // Field sets:Ljava/util/List;\n 16: invokevirtual #161 // Method java/lang/Object.hashCode:()I\n 19: iadd\n 20: istore_1\n 21: iload_1\n 22: ireturn\n\n public boolean equals(java.lang.Object);\n Code:\n 0: aload_0\n 1: aload_1\n 2: if_acmpne 7\n 5: iconst_1\n 6: ireturn\n 7: aload_1\n 8: instanceof #2 // class day2$Game\n 11: ifne 16\n 14: iconst_0\n 15: ireturn\n 16: aload_1\n 17: checkcast #2 // class day2$Game\n 20: astore_2\n 21: aload_0\n 22: getfield #23 // Field id:I\n 25: aload_2\n 26: getfield #23 // Field id:I\n 29: if_icmpeq 34\n 32: iconst_0\n 33: ireturn\n 34: aload_0\n 35: getfield #26 // Field sets:Ljava/util/List;\n 38: aload_2\n 39: getfield #26 // Field sets:Ljava/util/List;\n 42: invokestatic #169 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z\n 45: ifne 50\n 48: iconst_0\n 49: ireturn\n 50: iconst_1\n 51: ireturn\n\n private static final int power_delegate$lambda$3(day2$Game);\n Code:\n 0: aload_0\n 1: getfield #26 // Field sets:Ljava/util/List;\n 4: checkcast #78 // class java/lang/Iterable\n 7: invokeinterface #88, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 12: astore_2\n 13: aload_2\n 14: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 19: ifne 30\n 22: new #172 // class java/util/NoSuchElementException\n 25: dup\n 26: invokespecial #173 // Method java/util/NoSuchElementException.\"<init>\":()V\n 29: athrow\n 30: aload_2\n 31: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 36: checkcast #98 // class day2$DrawSet\n 39: astore_3\n 40: iconst_0\n 41: istore 4\n 43: aload_3\n 44: invokevirtual #101 // Method day2$DrawSet.getRed:()I\n 47: istore_3\n 48: aload_2\n 49: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 54: ifeq 90\n 57: aload_2\n 58: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 63: checkcast #98 // class day2$DrawSet\n 66: astore 4\n 68: iconst_0\n 69: istore 5\n 71: aload 4\n 73: invokevirtual #101 // Method day2$DrawSet.getRed:()I\n 76: istore 4\n 78: iload_3\n 79: iload 4\n 81: if_icmpge 48\n 84: iload 4\n 86: istore_3\n 87: goto 48\n 90: iload_3\n 91: aload_0\n 92: getfield #26 // Field sets:Ljava/util/List;\n 95: checkcast #78 // class java/lang/Iterable\n 98: astore_1\n 99: istore 6\n 101: aload_1\n 102: invokeinterface #88, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 107: astore_2\n 108: aload_2\n 109: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 114: ifne 125\n 117: new #172 // class java/util/NoSuchElementException\n 120: dup\n 121: invokespecial #173 // Method java/util/NoSuchElementException.\"<init>\":()V\n 124: athrow\n 125: aload_2\n 126: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 131: checkcast #98 // class day2$DrawSet\n 134: astore_3\n 135: iconst_0\n 136: istore 4\n 138: aload_3\n 139: invokevirtual #104 // Method day2$DrawSet.getBlue:()I\n 142: istore_3\n 143: aload_2\n 144: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 149: ifeq 185\n 152: aload_2\n 153: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 158: checkcast #98 // class day2$DrawSet\n 161: astore 4\n 163: iconst_0\n 164: istore 5\n 166: aload 4\n 168: invokevirtual #104 // Method day2$DrawSet.getBlue:()I\n 171: istore 4\n 173: iload_3\n 174: iload 4\n 176: if_icmpge 143\n 179: iload 4\n 181: istore_3\n 182: goto 143\n 185: iload_3\n 186: istore 7\n 188: iload 6\n 190: iload 7\n 192: imul\n 193: aload_0\n 194: getfield #26 // Field sets:Ljava/util/List;\n 197: checkcast #78 // class java/lang/Iterable\n 200: astore_1\n 201: istore 6\n 203: aload_1\n 204: invokeinterface #88, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 209: astore_2\n 210: aload_2\n 211: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 216: ifne 227\n 219: new #172 // class java/util/NoSuchElementException\n 222: dup\n 223: invokespecial #173 // Method java/util/NoSuchElementException.\"<init>\":()V\n 226: athrow\n 227: aload_2\n 228: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 233: checkcast #98 // class day2$DrawSet\n 236: astore_3\n 237: iconst_0\n 238: istore 4\n 240: aload_3\n 241: invokevirtual #107 // Method day2$DrawSet.getGreen:()I\n 244: istore_3\n 245: aload_2\n 246: invokeinterface #93, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 251: ifeq 287\n 254: aload_2\n 255: invokeinterface #96, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 260: checkcast #98 // class day2$DrawSet\n 263: astore 4\n 265: iconst_0\n 266: istore 5\n 268: aload 4\n 270: invokevirtual #107 // Method day2$DrawSet.getGreen:()I\n 273: istore 4\n 275: iload_3\n 276: iload 4\n 278: if_icmpge 245\n 281: iload 4\n 283: istore_3\n 284: goto 245\n 287: iload_3\n 288: istore 7\n 290: iload 6\n 292: iload 7\n 294: imul\n 295: ireturn\n}\n", "javap_err": "" }, { "class_path": "sviams__aoc23__4914a54/day2.class", "javap": "Compiled from \"day2.kt\"\npublic final class day2 {\n public static final day2 INSTANCE;\n\n private day2();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final java.util.List<day2$Game> parseInput(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #16 // String input\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_1\n 7: checkcast #24 // class java/lang/Iterable\n 10: astore_2\n 11: invokestatic #30 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 14: astore_3\n 15: iconst_0\n 16: istore 4\n 18: aload_3\n 19: astore 5\n 21: aload_2\n 22: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 27: astore 6\n 29: aload 6\n 31: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 36: ifeq 442\n 39: aload 6\n 41: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 46: astore 7\n 48: aload 5\n 50: aload 7\n 52: checkcast #46 // class java/lang/String\n 55: astore 8\n 57: astore 9\n 59: iconst_0\n 60: istore 10\n 62: new #48 // class kotlin/text/Regex\n 65: dup\n 66: ldc #50 // String Game (\\\\d+):\n 68: invokespecial #53 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 71: aload 8\n 73: checkcast #55 // class java/lang/CharSequence\n 76: iconst_0\n 77: iconst_2\n 78: aconst_null\n 79: invokestatic #59 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;\n 82: dup\n 83: invokestatic #63 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V\n 86: invokeinterface #69, 1 // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;\n 91: invokevirtual #75 // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;\n 94: invokeinterface #78, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 99: iconst_1\n 100: invokeinterface #84, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 105: checkcast #46 // class java/lang/String\n 108: astore 11\n 110: aload 8\n 112: checkcast #55 // class java/lang/CharSequence\n 115: iconst_1\n 116: anewarray #46 // class java/lang/String\n 119: astore 12\n 121: aload 12\n 123: iconst_0\n 124: ldc #86 // String :\n 126: aastore\n 127: aload 12\n 129: iconst_0\n 130: iconst_0\n 131: bipush 6\n 133: aconst_null\n 134: invokestatic #92 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;\n 137: iconst_1\n 138: invokeinterface #84, 2 // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;\n 143: checkcast #55 // class java/lang/CharSequence\n 146: iconst_1\n 147: newarray char\n 149: astore 12\n 151: aload 12\n 153: iconst_0\n 154: bipush 59\n 156: castore\n 157: aload 12\n 159: iconst_0\n 160: iconst_0\n 161: bipush 6\n 163: aconst_null\n 164: invokestatic #95 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;\n 167: checkcast #24 // class java/lang/Iterable\n 170: astore 12\n 172: invokestatic #30 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;\n 175: astore 13\n 177: iconst_0\n 178: istore 14\n 180: aload 13\n 182: astore 15\n 184: aload 12\n 186: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 191: astore 16\n 193: aload 16\n 195: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 200: ifeq 411\n 203: aload 16\n 205: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 210: astore 17\n 212: aload 15\n 214: aload 17\n 216: checkcast #46 // class java/lang/String\n 219: astore 18\n 221: astore 19\n 223: iconst_0\n 224: istore 20\n 226: new #48 // class kotlin/text/Regex\n 229: dup\n 230: ldc #97 // String (\\\\d+) red\n 232: invokespecial #53 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 235: aload 18\n 237: checkcast #55 // class java/lang/CharSequence\n 240: iconst_0\n 241: iconst_2\n 242: aconst_null\n 243: invokestatic #59 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;\n 246: dup\n 247: ifnull 275\n 250: invokeinterface #78, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 255: dup\n 256: ifnull 275\n 259: invokestatic #101 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 262: checkcast #46 // class java/lang/String\n 265: dup\n 266: ifnull 275\n 269: invokestatic #107 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 272: goto 277\n 275: pop\n 276: iconst_0\n 277: istore 21\n 279: new #48 // class kotlin/text/Regex\n 282: dup\n 283: ldc #109 // String (\\\\d+) blue\n 285: invokespecial #53 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 288: aload 18\n 290: checkcast #55 // class java/lang/CharSequence\n 293: iconst_0\n 294: iconst_2\n 295: aconst_null\n 296: invokestatic #59 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;\n 299: dup\n 300: ifnull 328\n 303: invokeinterface #78, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 308: dup\n 309: ifnull 328\n 312: invokestatic #101 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 315: checkcast #46 // class java/lang/String\n 318: dup\n 319: ifnull 328\n 322: invokestatic #107 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 325: goto 330\n 328: pop\n 329: iconst_0\n 330: istore 22\n 332: new #48 // class kotlin/text/Regex\n 335: dup\n 336: ldc #111 // String (\\\\d+) green\n 338: invokespecial #53 // Method kotlin/text/Regex.\"<init>\":(Ljava/lang/String;)V\n 341: aload 18\n 343: checkcast #55 // class java/lang/CharSequence\n 346: iconst_0\n 347: iconst_2\n 348: aconst_null\n 349: invokestatic #59 // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;\n 352: dup\n 353: ifnull 381\n 356: invokeinterface #78, 1 // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;\n 361: dup\n 362: ifnull 381\n 365: invokestatic #101 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;\n 368: checkcast #46 // class java/lang/String\n 371: dup\n 372: ifnull 381\n 375: invokestatic #107 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 378: goto 383\n 381: pop\n 382: iconst_0\n 383: istore 23\n 385: aload 19\n 387: checkcast #113 // class java/util/Collection\n 390: new #115 // class day2$DrawSet\n 393: dup\n 394: iload 21\n 396: iload 23\n 398: iload 22\n 400: invokespecial #118 // Method day2$DrawSet.\"<init>\":(III)V\n 403: invokestatic #122 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;\n 406: astore 15\n 408: goto 193\n 411: aload 15\n 413: astore 24\n 415: aload 9\n 417: checkcast #113 // class java/util/Collection\n 420: new #124 // class day2$Game\n 423: dup\n 424: aload 11\n 426: invokestatic #107 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I\n 429: aload 24\n 431: invokespecial #127 // Method day2$Game.\"<init>\":(ILjava/util/List;)V\n 434: invokestatic #122 // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;\n 437: astore 5\n 439: goto 29\n 442: aload 5\n 444: areturn\n\n public final int pt1(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #16 // String input\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: invokevirtual #152 // Method parseInput:(Ljava/util/List;)Ljava/util/List;\n 11: checkcast #24 // class java/lang/Iterable\n 14: astore_2\n 15: iconst_0\n 16: istore_3\n 17: aload_2\n 18: astore 4\n 20: new #154 // class java/util/ArrayList\n 23: dup\n 24: invokespecial #155 // Method java/util/ArrayList.\"<init>\":()V\n 27: checkcast #113 // class java/util/Collection\n 30: astore 5\n 32: iconst_0\n 33: istore 6\n 35: aload 4\n 37: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 42: astore 7\n 44: aload 7\n 46: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 51: ifeq 100\n 54: aload 7\n 56: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 61: astore 8\n 63: aload 8\n 65: checkcast #124 // class day2$Game\n 68: astore 9\n 70: iconst_0\n 71: istore 10\n 73: aload 9\n 75: bipush 12\n 77: bipush 14\n 79: bipush 13\n 81: invokevirtual #159 // Method day2$Game.withinLimit:(III)Z\n 84: ifeq 44\n 87: aload 5\n 89: aload 8\n 91: invokeinterface #163, 2 // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z\n 96: pop\n 97: goto 44\n 100: aload 5\n 102: checkcast #80 // class java/util/List\n 105: nop\n 106: checkcast #24 // class java/lang/Iterable\n 109: astore_2\n 110: iconst_0\n 111: istore_3\n 112: aload_2\n 113: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 118: astore 4\n 120: aload 4\n 122: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 127: ifeq 168\n 130: aload 4\n 132: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 137: astore 5\n 139: iload_3\n 140: aload 5\n 142: checkcast #124 // class day2$Game\n 145: astore 6\n 147: istore 11\n 149: iconst_0\n 150: istore 7\n 152: aload 6\n 154: invokevirtual #167 // Method day2$Game.getId:()I\n 157: istore 12\n 159: iload 11\n 161: iload 12\n 163: iadd\n 164: istore_3\n 165: goto 120\n 168: iload_3\n 169: ireturn\n\n public final int pt2(java.util.List<java.lang.String>);\n Code:\n 0: aload_1\n 1: ldc #16 // String input\n 3: invokestatic #22 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V\n 6: aload_0\n 7: aload_1\n 8: invokevirtual #152 // Method parseInput:(Ljava/util/List;)Ljava/util/List;\n 11: checkcast #24 // class java/lang/Iterable\n 14: astore_2\n 15: iconst_0\n 16: istore_3\n 17: aload_2\n 18: invokeinterface #34, 1 // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;\n 23: astore 4\n 25: aload 4\n 27: invokeinterface #40, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z\n 32: ifeq 73\n 35: aload 4\n 37: invokeinterface #44, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;\n 42: astore 5\n 44: iload_3\n 45: aload 5\n 47: checkcast #124 // class day2$Game\n 50: astore 6\n 52: istore 8\n 54: iconst_0\n 55: istore 7\n 57: aload 6\n 59: invokevirtual #182 // Method day2$Game.getPower:()I\n 62: istore 9\n 64: iload 8\n 66: iload 9\n 68: iadd\n 69: istore_3\n 70: goto 25\n 73: iload_3\n 74: ireturn\n\n static {};\n Code:\n 0: new #2 // class day2\n 3: dup\n 4: invokespecial #185 // Method \"<init>\":()V\n 7: putstatic #188 // Field INSTANCE:Lday2;\n 10: return\n}\n", "javap_err": "" } ]