package leetcode

/**
 * https://leetcode.com/problems/largest-number-after-digit-swaps-by-parity/
 */
class Problem2231 {
    fun largestInteger(num: Int): Int {
        val oddIndexes = mutableListOf<Int>()
        val evenIndexes = mutableListOf<Int>()
        val numString = num.toString()
        for ((i, n) in numString.withIndex()) {
            if (n.toInt() % 2 != 0) {
                oddIndexes += i
            } else {
                evenIndexes += i
            }
        }
        var answer = CharArray(numString.length)
        val sortedOddIndexes = oddIndexes.sortedWith(Comparator {a, b -> numString[b].compareTo(numString[a])})
        val sortedEvenIndexes = evenIndexes.sortedWith(Comparator {a, b -> numString[b].compareTo(numString[a])})
        if (numString[0].toInt() % 2 != 0) {
            for ((i, j) in oddIndexes.withIndex()) {
                answer[j] = numString[sortedOddIndexes[i]]
            }
            for ((i, j) in evenIndexes.withIndex()) {
                answer[j] = numString[sortedEvenIndexes[i]]
            }
        } else {
            for ((i, j) in evenIndexes.withIndex()) {
                answer[j] = numString[sortedEvenIndexes[i]]
            }
            for ((i, j) in oddIndexes.withIndex()) {
                answer[j] = numString[sortedOddIndexes[i]]
            }
        }
        return String(answer).toInt()
    }
}

Compiled from "Problem2231.kt"
public final class leetcode.Problem2231 {
  public leetcode.Problem2231();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int largestInteger(int);
    Code:
       0: new           #14                 // class java/util/ArrayList
       3: dup
       4: invokespecial #15                 // Method java/util/ArrayList."<init>":()V
       7: checkcast     #17                 // class java/util/List
      10: astore_2
      11: new           #14                 // class java/util/ArrayList
      14: dup
      15: invokespecial #15                 // Method java/util/ArrayList."<init>":()V
      18: checkcast     #17                 // class java/util/List
      21: astore_3
      22: iload_1
      23: invokestatic  #23                 // Method java/lang/String.valueOf:(I)Ljava/lang/String;
      26: astore        4
      28: iconst_0
      29: istore        5
      31: aload         4
      33: invokevirtual #27                 // Method java/lang/String.length:()I
      36: istore        6
      38: iload         5
      40: iload         6
      42: if_icmpge     112
      45: iload         5
      47: istore        7
      49: aload         4
      51: iload         5
      53: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      56: istore        8
      58: iload         8
      60: iconst_2
      61: irem
      62: ifeq          87
      65: iload         7
      67: invokestatic  #36                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      70: astore        10
      72: aload_2
      73: checkcast     #38                 // class java/util/Collection
      76: aload         10
      78: invokeinterface #42,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      83: pop
      84: goto          106
      87: iload         7
      89: invokestatic  #36                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      92: astore        10
      94: aload_3
      95: checkcast     #38                 // class java/util/Collection
      98: aload         10
     100: invokeinterface #42,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     105: pop
     106: iinc          5, 1
     109: goto          38
     112: aload         4
     114: invokevirtual #27                 // Method java/lang/String.length:()I
     117: newarray       char
     119: astore        5
     121: aload_2
     122: checkcast     #44                 // class java/lang/Iterable
     125: aload         4
     127: invokedynamic #64,  0             // InvokeDynamic #0:compare:(Ljava/lang/String;)Ljava/util/Comparator;
     132: invokestatic  #70                 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     135: astore        6
     137: aload_3
     138: checkcast     #44                 // class java/lang/Iterable
     141: aload         4
     143: invokedynamic #75,  0             // InvokeDynamic #1:compare:(Ljava/lang/String;)Ljava/util/Comparator;
     148: invokestatic  #70                 // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     151: astore        7
     153: aload         4
     155: iconst_0
     156: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
     159: iconst_2
     160: irem
     161: ifeq          318
     164: aload_2
     165: checkcast     #44                 // class java/lang/Iterable
     168: invokeinterface #79,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     173: astore        8
     175: iconst_0
     176: istore        9
     178: aload         8
     180: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     185: ifeq          241
     188: iload         9
     190: istore        10
     192: iload         9
     194: iconst_1
     195: iadd
     196: istore        9
     198: aload         8
     200: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     205: checkcast     #91                 // class java/lang/Number
     208: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     211: istore        11
     213: aload         5
     215: iload         11
     217: aload         4
     219: aload         6
     221: iload         10
     223: invokeinterface #98,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     228: checkcast     #91                 // class java/lang/Number
     231: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     234: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
     237: castore
     238: goto          178
     241: aload_3
     242: checkcast     #44                 // class java/lang/Iterable
     245: invokeinterface #79,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     250: astore        8
     252: iconst_0
     253: istore        9
     255: aload         8
     257: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     262: ifeq          472
     265: iload         9
     267: istore        10
     269: iload         9
     271: iconst_1
     272: iadd
     273: istore        9
     275: aload         8
     277: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     282: checkcast     #91                 // class java/lang/Number
     285: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     288: istore        11
     290: aload         5
     292: iload         11
     294: aload         4
     296: aload         7
     298: iload         10
     300: invokeinterface #98,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     305: checkcast     #91                 // class java/lang/Number
     308: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     311: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
     314: castore
     315: goto          255
     318: aload_3
     319: checkcast     #44                 // class java/lang/Iterable
     322: invokeinterface #79,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     327: astore        8
     329: iconst_0
     330: istore        9
     332: aload         8
     334: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     339: ifeq          395
     342: iload         9
     344: istore        10
     346: iload         9
     348: iconst_1
     349: iadd
     350: istore        9
     352: aload         8
     354: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     359: checkcast     #91                 // class java/lang/Number
     362: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     365: istore        11
     367: aload         5
     369: iload         11
     371: aload         4
     373: aload         7
     375: iload         10
     377: invokeinterface #98,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     382: checkcast     #91                 // class java/lang/Number
     385: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     388: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
     391: castore
     392: goto          332
     395: aload_2
     396: checkcast     #44                 // class java/lang/Iterable
     399: invokeinterface #79,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     404: astore        8
     406: iconst_0
     407: istore        9
     409: aload         8
     411: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     416: ifeq          472
     419: iload         9
     421: istore        10
     423: iload         9
     425: iconst_1
     426: iadd
     427: istore        9
     429: aload         8
     431: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     436: checkcast     #91                 // class java/lang/Number
     439: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     442: istore        11
     444: aload         5
     446: iload         11
     448: aload         4
     450: aload         6
     452: iload         10
     454: invokeinterface #98,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     459: checkcast     #91                 // class java/lang/Number
     462: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     465: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
     468: castore
     469: goto          409
     472: nop
     473: new           #19                 // class java/lang/String
     476: dup
     477: aload         5
     479: invokespecial #101                // Method java/lang/String."<init>":([C)V
     482: invokestatic  #105                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     485: ireturn

  private static final int largestInteger$lambda$0(java.lang.String, java.lang.Integer, java.lang.Integer);
    Code:
       0: aload_0
       1: aload_2
       2: invokestatic  #127                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       5: aload_2
       6: invokevirtual #128                // Method java/lang/Integer.intValue:()I
       9: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      12: aload_0
      13: aload_1
      14: invokestatic  #127                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      17: aload_1
      18: invokevirtual #128                // Method java/lang/Integer.intValue:()I
      21: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      24: invokestatic  #131                // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      27: ireturn

  private static final int largestInteger$lambda$1(java.lang.String, java.lang.Integer, java.lang.Integer);
    Code:
       0: aload_0
       1: aload_2
       2: invokestatic  #127                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
       5: aload_2
       6: invokevirtual #128                // Method java/lang/Integer.intValue:()I
       9: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      12: aload_0
      13: aload_1
      14: invokestatic  #127                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      17: aload_1
      18: invokevirtual #128                // Method java/lang/Integer.intValue:()I
      21: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      24: invokestatic  #131                // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      27: ireturn
}


package leetcode

/**
 * https://leetcode.com/problems/plates-between-candles/
 */
class Problem2055 {
    fun platesBetweenCandles(s: String, queries: Array<IntArray>): IntArray {
        val answer = IntArray(queries.size)
        var startIndex = 0
        while (startIndex < s.length && s[startIndex] != '|') {
            startIndex++
        }
        var endIndex = s.length - 1
        while (endIndex >= 0 && s[endIndex] != '|') {
            endIndex--
        }
        if (endIndex <= startIndex) {
            return answer
        }
        val prefixSums = IntArray(s.length)
        val candles = mutableListOf<Int>()
        // Keep track of the previous and next candle index positions for each plate index.
        for ((index, value) in s.withIndex()) {
            if (value == '*') {
                prefixSums[index] = if (index - 1 < 0) 1  else prefixSums[index - 1] + 1
            } else {
                candles += index
                prefixSums[index] = if (index - 1 < 0) 0 else prefixSums[index - 1]
            }
        }
        data class PreviousNextCandle(val previous: Int, val next: Int)
        val previousNextCandles = Array(s.length) { PreviousNextCandle(-1, -1) }
        var candleIndex = 0
        var index = startIndex
        while (index <= endIndex) {
            if (index != startIndex && s[index] == '|') {
                candleIndex++
            } else if (s[index] == '*') {
                previousNextCandles[index] =
                    PreviousNextCandle(candles[candleIndex], candles[candleIndex + 1])
            }
            index++
        }
        for ((index, query) in queries.withIndex()) {
            var start = query[0]
            if (s[start] == '*') {
                start = if (start < startIndex) {
                    startIndex
                } else if (start > endIndex) {
                    endIndex
                } else {
                    previousNextCandles[start].next
                }
            }
            var end = query[1]
            if (s[end] == '*') {
                end = if (end < startIndex) {
                    startIndex
                } else if (end > endIndex) {
                    endIndex
                } else {
                    previousNextCandles[end].previous
                }
            }
            answer[index] = if (start > end) 0 else prefixSums[end] - prefixSums[start]
        }
        return answer
    }
}

Compiled from "Problem2055.kt"
public final class leetcode.Problem2055 {
  public leetcode.Problem2055();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int[] platesBetweenCandles(java.lang.String, int[][]);
    Code:
       0: aload_1
       1: ldc           #15                 // String s
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #23                 // String queries
       9: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: checkcast     #25                 // class "[Ljava/lang/Object;"
      16: arraylength
      17: newarray       int
      19: astore_3
      20: iconst_0
      21: istore        4
      23: iload         4
      25: aload_1
      26: invokevirtual #31                 // Method java/lang/String.length:()I
      29: if_icmpge     49
      32: aload_1
      33: iload         4
      35: invokevirtual #35                 // Method java/lang/String.charAt:(I)C
      38: bipush        124
      40: if_icmpeq     49
      43: iinc          4, 1
      46: goto          23
      49: aload_1
      50: invokevirtual #31                 // Method java/lang/String.length:()I
      53: iconst_1
      54: isub
      55: istore        5
      57: iload         5
      59: iflt          79
      62: aload_1
      63: iload         5
      65: invokevirtual #35                 // Method java/lang/String.charAt:(I)C
      68: bipush        124
      70: if_icmpeq     79
      73: iinc          5, -1
      76: goto          57
      79: iload         5
      81: iload         4
      83: if_icmpgt     88
      86: aload_3
      87: areturn
      88: aload_1
      89: invokevirtual #31                 // Method java/lang/String.length:()I
      92: newarray       int
      94: astore        6
      96: new           #37                 // class java/util/ArrayList
      99: dup
     100: invokespecial #38                 // Method java/util/ArrayList."<init>":()V
     103: checkcast     #40                 // class java/util/List
     106: astore        7
     108: iconst_0
     109: istore        8
     111: aload_1
     112: invokevirtual #31                 // Method java/lang/String.length:()I
     115: istore        9
     117: iload         8
     119: iload         9
     121: if_icmpge     220
     124: iload         8
     126: istore        10
     128: aload_1
     129: iload         8
     131: invokevirtual #35                 // Method java/lang/String.charAt:(I)C
     134: istore        11
     136: iload         11
     138: bipush        42
     140: if_icmpne     171
     143: aload         6
     145: iload         10
     147: iload         10
     149: iconst_1
     150: isub
     151: ifge          158
     154: iconst_1
     155: goto          167
     158: aload         6
     160: iload         10
     162: iconst_1
     163: isub
     164: iaload
     165: iconst_1
     166: iadd
     167: iastore
     168: goto          214
     171: iload         10
     173: invokestatic  #46                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     176: astore        13
     178: aload         7
     180: checkcast     #48                 // class java/util/Collection
     183: aload         13
     185: invokeinterface #52,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     190: pop
     191: aload         6
     193: iload         10
     195: iload         10
     197: iconst_1
     198: isub
     199: ifge          206
     202: iconst_0
     203: goto          213
     206: aload         6
     208: iload         10
     210: iconst_1
     211: isub
     212: iaload
     213: iastore
     214: iinc          8, 1
     217: goto          117
     220: iconst_0
     221: istore        9
     223: aload_1
     224: invokevirtual #31                 // Method java/lang/String.length:()I
     227: istore        10
     229: iload         10
     231: anewarray     #54                 // class leetcode/Problem2055$platesBetweenCandles$PreviousNextCandle
     234: astore        11
     236: iload         9
     238: iload         10
     240: if_icmpge     267
     243: iload         9
     245: istore        12
     247: aload         11
     249: iload         12
     251: new           #54                 // class leetcode/Problem2055$platesBetweenCandles$PreviousNextCandle
     254: dup
     255: iconst_m1
     256: iconst_m1
     257: invokespecial #57                 // Method leetcode/Problem2055$platesBetweenCandles$PreviousNextCandle."<init>":(II)V
     260: aastore
     261: iinc          9, 1
     264: goto          236
     267: aload         11
     269: astore        8
     271: iconst_0
     272: istore        9
     274: iload         4
     276: istore        10
     278: iload         10
     280: iload         5
     282: if_icmpgt     370
     285: iload         10
     287: iload         4
     289: if_icmpeq     309
     292: aload_1
     293: iload         10
     295: invokevirtual #35                 // Method java/lang/String.charAt:(I)C
     298: bipush        124
     300: if_icmpne     309
     303: iinc          9, 1
     306: goto          364
     309: aload_1
     310: iload         10
     312: invokevirtual #35                 // Method java/lang/String.charAt:(I)C
     315: bipush        42
     317: if_icmpne     364
     320: aload         8
     322: iload         10
     324: new           #54                 // class leetcode/Problem2055$platesBetweenCandles$PreviousNextCandle
     327: dup
     328: aload         7
     330: iload         9
     332: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     337: checkcast     #63                 // class java/lang/Number
     340: invokevirtual #66                 // Method java/lang/Number.intValue:()I
     343: aload         7
     345: iload         9
     347: iconst_1
     348: iadd
     349: invokeinterface #61,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     354: checkcast     #63                 // class java/lang/Number
     357: invokevirtual #66                 // Method java/lang/Number.intValue:()I
     360: invokespecial #57                 // Method leetcode/Problem2055$platesBetweenCandles$PreviousNextCandle."<init>":(II)V
     363: aastore
     364: iinc          10, 1
     367: goto          278
     370: iconst_0
     371: istore        11
     373: aload_2
     374: checkcast     #25                 // class "[Ljava/lang/Object;"
     377: arraylength
     378: istore        12
     380: iload         11
     382: iload         12
     384: if_icmpge     531
     387: iload         11
     389: istore        13
     391: aload_2
     392: iload         11
     394: aaload
     395: astore        14
     397: aload         14
     399: iconst_0
     400: iaload
     401: istore        15
     403: aload_1
     404: iload         15
     406: invokevirtual #35                 // Method java/lang/String.charAt:(I)C
     409: bipush        42
     411: if_icmpne     448
     414: iload         15
     416: iload         4
     418: if_icmpge     426
     421: iload         4
     423: goto          446
     426: iload         15
     428: iload         5
     430: if_icmple     438
     433: iload         5
     435: goto          446
     438: aload         8
     440: iload         15
     442: aaload
     443: invokevirtual #69                 // Method leetcode/Problem2055$platesBetweenCandles$PreviousNextCandle.getNext:()I
     446: istore        15
     448: aload         14
     450: iconst_1
     451: iaload
     452: istore        16
     454: aload_1
     455: iload         16
     457: invokevirtual #35                 // Method java/lang/String.charAt:(I)C
     460: bipush        42
     462: if_icmpne     499
     465: iload         16
     467: iload         4
     469: if_icmpge     477
     472: iload         4
     474: goto          497
     477: iload         16
     479: iload         5
     481: if_icmple     489
     484: iload         5
     486: goto          497
     489: aload         8
     491: iload         16
     493: aaload
     494: invokevirtual #72                 // Method leetcode/Problem2055$platesBetweenCandles$PreviousNextCandle.getPrevious:()I
     497: istore        16
     499: aload_3
     500: iload         13
     502: iload         15
     504: iload         16
     506: if_icmple     513
     509: iconst_0
     510: goto          524
     513: aload         6
     515: iload         16
     517: iaload
     518: aload         6
     520: iload         15
     522: iaload
     523: isub
     524: iastore
     525: iinc          11, 1
     528: goto          380
     531: aload_3
     532: areturn
}

Compiled from "Problem2055.kt"
public final class leetcode.Problem2055$platesBetweenCandles$PreviousNextCandle {
  private final int previous;

  private final int next;

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

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

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

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

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

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

  public static leetcode.Problem2055$platesBetweenCandles$PreviousNextCandle copy$default(leetcode.Problem2055$platesBetweenCandles$PreviousNextCandle, int, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #13                 // Field previous:I
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #16                 // Field next:I
      21: istore_2
      22: aload_0
      23: iload_1
      24: iload_2
      25: invokevirtual #31                 // Method copy:(II)Lleetcode/Problem2055$platesBetweenCandles$PreviousNextCandle;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #35                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #36                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #38                 // String PreviousNextCandle(previous=
       9: invokevirtual #42                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field previous:I
      16: invokevirtual #45                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #47                 // String , next=
      21: invokevirtual #42                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field next:I
      28: invokevirtual #45                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #50                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

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

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


package leetcode

import kotlin.math.min

/**
 * https://leetcode.com/problems/minimum-sideway-jumps/
 */
class Problem1824 {
    fun minSideJumps(obstacles: IntArray): Int {
        return minSideJumps(obstacles, lane = 2, index = 0,
            memo = Array(obstacles.size) { IntArray(4) { -1 } })
    }

    private fun minSideJumps(obstacles: IntArray, lane: Int, index: Int, memo: Array<IntArray>): Int {
        if (obstacles.size == index) {
            return 0
        }
        if (obstacles[index] == lane) {
            return Int.MAX_VALUE
        }
        if (memo[index][lane] != -1) {
            return memo[index][lane]
        }
        val noSideJump = minSideJumps(obstacles, lane, index + 1, memo)
        var hasSideJump = Int.MAX_VALUE
        for (l in 1..3) {
            if (l == lane || obstacles[index] == l) {
                continue
            }
            var sideJump = minSideJumps(obstacles, l, index + 1, memo)
            if (sideJump != Int.MAX_VALUE) {
                sideJump++
            }
            hasSideJump = min(hasSideJump, sideJump)
        }
        val min = min(noSideJump, hasSideJump)
        memo[index][lane] = min
        return min
    }
}

Compiled from "Problem1824.kt"
public final class leetcode.Problem1824 {
  public leetcode.Problem1824();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int minSideJumps(int[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String obstacles
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: iconst_2
       9: iconst_0
      10: iconst_0
      11: istore_2
      12: aload_1
      13: arraylength
      14: istore_3
      15: iload_3
      16: anewarray     #23                 // class "[I"
      19: astore        4
      21: istore        12
      23: istore        11
      25: astore        10
      27: astore        9
      29: iload_2
      30: iload_3
      31: if_icmpge     88
      34: iload_2
      35: istore        5
      37: aload         4
      39: iload         5
      41: iconst_0
      42: istore        6
      44: iconst_4
      45: newarray       int
      47: astore        7
      49: istore        14
      51: astore        13
      53: iload         6
      55: iconst_4
      56: if_icmpge     75
      59: iload         6
      61: istore        8
      63: aload         7
      65: iload         8
      67: iconst_m1
      68: iastore
      69: iinc          6, 1
      72: goto          53
      75: aload         13
      77: iload         14
      79: aload         7
      81: aastore
      82: iinc          2, 1
      85: goto          29
      88: aload         9
      90: aload         10
      92: iload         11
      94: iload         12
      96: aload         4
      98: invokespecial #26                 // Method minSideJumps:([III[[I)I
     101: ireturn

  private final int minSideJumps(int[], int, int, int[][]);
    Code:
       0: aload_1
       1: arraylength
       2: iload_3
       3: if_icmpne     8
       6: iconst_0
       7: ireturn
       8: aload_1
       9: iload_3
      10: iaload
      11: iload_2
      12: if_icmpne     18
      15: ldc           #29                 // int 2147483647
      17: ireturn
      18: aload         4
      20: iload_3
      21: aaload
      22: iload_2
      23: iaload
      24: iconst_m1
      25: if_icmpeq     35
      28: aload         4
      30: iload_3
      31: aaload
      32: iload_2
      33: iaload
      34: ireturn
      35: aload_0
      36: aload_1
      37: iload_2
      38: iload_3
      39: iconst_1
      40: iadd
      41: aload         4
      43: invokespecial #26                 // Method minSideJumps:([III[[I)I
      46: istore        5
      48: ldc           #29                 // int 2147483647
      50: istore        6
      52: iconst_1
      53: istore        7
      55: iload         7
      57: iconst_4
      58: if_icmpge     117
      61: iload         7
      63: iload_2
      64: if_icmpeq     75
      67: aload_1
      68: iload_3
      69: iaload
      70: iload         7
      72: if_icmpne     78
      75: goto          111
      78: aload_0
      79: aload_1
      80: iload         7
      82: iload_3
      83: iconst_1
      84: iadd
      85: aload         4
      87: invokespecial #26                 // Method minSideJumps:([III[[I)I
      90: istore        8
      92: iload         8
      94: ldc           #29                 // int 2147483647
      96: if_icmpeq     102
      99: iinc          8, 1
     102: iload         6
     104: iload         8
     106: invokestatic  #35                 // Method java/lang/Math.min:(II)I
     109: istore        6
     111: iinc          7, 1
     114: goto          55
     117: iload         5
     119: iload         6
     121: invokestatic  #35                 // Method java/lang/Math.min:(II)I
     124: istore        7
     126: aload         4
     128: iload_3
     129: aaload
     130: iload_2
     131: iload         7
     133: iastore
     134: iload         7
     136: ireturn
}


package leetcode

import kotlin.math.max
import kotlin.math.min

/**
 * https://leetcode.com/problems/sum-of-beauty-in-the-array/
 */
class Problem2012 {
    fun sumOfBeauties(nums: IntArray): Int {
        val left = IntArray(nums.size)
        for ((i, n) in nums.withIndex()) {
            left[i] = if (i == 0) n else max(left[i - 1], n)
        }
        val right = IntArray(nums.size)
        for (i in nums.size - 1 downTo 0) {
            right[i] = if (i == nums.size - 1) nums[i] else min(right[i + 1], nums[i])
        }
        var answer = 0
        for (i in 1..nums.size - 2) {
            if (left[i - 1] < nums[i] && nums[i] < right[i + 1]) {
                answer += 2
            } else if (nums[i - 1] < nums[i] && nums[i] < nums[i + 1]) {
                answer++
            }
        }
        return answer
    }
}

Compiled from "Problem2012.kt"
public final class leetcode.Problem2012 {
  public leetcode.Problem2012();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int sumOfBeauties(int[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String nums
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: arraylength
       8: newarray       int
      10: astore_2
      11: iconst_0
      12: istore_3
      13: aload_1
      14: arraylength
      15: istore        4
      17: iload_3
      18: iload         4
      20: if_icmpge     62
      23: iload_3
      24: istore        5
      26: aload_1
      27: iload_3
      28: iaload
      29: istore        6
      31: aload_2
      32: iload         5
      34: iload         5
      36: ifne          44
      39: iload         6
      41: goto          55
      44: aload_2
      45: iload         5
      47: iconst_1
      48: isub
      49: iaload
      50: iload         6
      52: invokestatic  #27                 // Method java/lang/Math.max:(II)I
      55: iastore
      56: iinc          3, 1
      59: goto          17
      62: aload_1
      63: arraylength
      64: newarray       int
      66: astore_3
      67: aload_1
      68: arraylength
      69: iconst_1
      70: isub
      71: istore        4
      73: iconst_m1
      74: iload         4
      76: if_icmpge     118
      79: aload_3
      80: iload         4
      82: iload         4
      84: aload_1
      85: arraylength
      86: iconst_1
      87: isub
      88: if_icmpne     98
      91: aload_1
      92: iload         4
      94: iaload
      95: goto          111
      98: aload_3
      99: iload         4
     101: iconst_1
     102: iadd
     103: iaload
     104: aload_1
     105: iload         4
     107: iaload
     108: invokestatic  #30                 // Method java/lang/Math.min:(II)I
     111: iastore
     112: iinc          4, -1
     115: goto          73
     118: iconst_0
     119: istore        4
     121: iconst_1
     122: istore        5
     124: aload_1
     125: arraylength
     126: iconst_2
     127: isub
     128: istore        6
     130: iload         5
     132: iload         6
     134: if_icmpgt     211
     137: aload_2
     138: iload         5
     140: iconst_1
     141: isub
     142: iaload
     143: aload_1
     144: iload         5
     146: iaload
     147: if_icmpge     169
     150: aload_1
     151: iload         5
     153: iaload
     154: aload_3
     155: iload         5
     157: iconst_1
     158: iadd
     159: iaload
     160: if_icmpge     169
     163: iinc          4, 2
     166: goto          198
     169: aload_1
     170: iload         5
     172: iconst_1
     173: isub
     174: iaload
     175: aload_1
     176: iload         5
     178: iaload
     179: if_icmpge     198
     182: aload_1
     183: iload         5
     185: iaload
     186: aload_1
     187: iload         5
     189: iconst_1
     190: iadd
     191: iaload
     192: if_icmpge     198
     195: iinc          4, 1
     198: iload         5
     200: iload         6
     202: if_icmpeq     211
     205: iinc          5, 1
     208: goto          137
     211: iload         4
     213: ireturn
}


package leetcode

import kotlin.math.min

/**
 * https://leetcode.com/problems/next-greater-numerically-balanced-number/
 */
class Problem2048 {
    fun nextBeautifulNumber(n: Int): Int {
        var answer = Answer()
        val s = n.toString()
        val numbers = arrayOf("1", "22", "122", "333", "1333", "4444", "14444", "22333",
            "55555", "122333", "155555", "224444", "666666")
        for (num in numbers) {
            if (s.length > num.length) {
                continue
            }
            permutations(num.toCharArray(), n = n, answer = answer)
        }
        return answer.value
    }

    private data class Answer(var value: Int = 1224444 /* maximum possible */)

    private fun permutations(chars: CharArray, index: Int = 0, n: Int, answer: Answer) {
        if (index == chars.size) {
            val next = String(chars).toInt()
            if (next > n) {
                answer.value = min(answer.value, next)
            }
        }
        for (i in index until chars.size) {
            val tmp1 = chars[i]
            val tmp2 = chars[index]
            chars[i] = tmp2
            chars[index] = tmp1
            permutations(chars, index + 1, n, answer)
            chars[i] = tmp1
            chars[index] = tmp2
        }
    }
}

Compiled from "Problem2048.kt"
final class leetcode.Problem2048$Answer {
  private int value;

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

  public leetcode.Problem2048$Answer(int, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          9
       6: ldc           #17                 // int 1224444
       8: istore_1
       9: aload_0
      10: iload_1
      11: invokespecial #19                 // Method "<init>":(I)V
      14: return

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

  public final void setValue(int);
    Code:
       0: aload_0
       1: iload_1
       2: putfield      #13                 // Field value:I
       5: return

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

  public final leetcode.Problem2048$Answer copy(int);
    Code:
       0: new           #2                  // class leetcode/Problem2048$Answer
       3: dup
       4: iload_1
       5: invokespecial #19                 // Method "<init>":(I)V
       8: areturn

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

  public java.lang.String toString();
    Code:
       0: new           #35                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #36                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #38                 // String Answer(value=
       9: invokevirtual #42                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field value:I
      16: invokevirtual #45                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: bipush        41
      21: invokevirtual #48                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      24: invokevirtual #50                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      27: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field value:I
       4: invokestatic  #56                 // Method java/lang/Integer.hashCode:(I)I
       7: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class leetcode/Problem2048$Answer
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class leetcode/Problem2048$Answer
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field value:I
      25: aload_2
      26: getfield      #13                 // Field value:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: iconst_1
      35: ireturn

  public leetcode.Problem2048$Answer();
    Code:
       0: aload_0
       1: iconst_0
       2: iconst_1
       3: aconst_null
       4: invokespecial #63                 // Method "<init>":(IILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return
}

Compiled from "Problem2048.kt"
public final class leetcode.Problem2048 {
  public leetcode.Problem2048();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int nextBeautifulNumber(int);
    Code:
       0: new           #14                 // class leetcode/Problem2048$Answer
       3: dup
       4: iconst_0
       5: iconst_1
       6: aconst_null
       7: invokespecial #17                 // Method leetcode/Problem2048$Answer."<init>":(IILkotlin/jvm/internal/DefaultConstructorMarker;)V
      10: astore_2
      11: iload_1
      12: invokestatic  #23                 // Method java/lang/String.valueOf:(I)Ljava/lang/String;
      15: astore_3
      16: bipush        13
      18: anewarray     #19                 // class java/lang/String
      21: astore        5
      23: aload         5
      25: iconst_0
      26: ldc           #25                 // String 1
      28: aastore
      29: aload         5
      31: iconst_1
      32: ldc           #27                 // String 22
      34: aastore
      35: aload         5
      37: iconst_2
      38: ldc           #29                 // String 122
      40: aastore
      41: aload         5
      43: iconst_3
      44: ldc           #31                 // String 333
      46: aastore
      47: aload         5
      49: iconst_4
      50: ldc           #33                 // String 1333
      52: aastore
      53: aload         5
      55: iconst_5
      56: ldc           #35                 // String 4444
      58: aastore
      59: aload         5
      61: bipush        6
      63: ldc           #37                 // String 14444
      65: aastore
      66: aload         5
      68: bipush        7
      70: ldc           #39                 // String 22333
      72: aastore
      73: aload         5
      75: bipush        8
      77: ldc           #41                 // String 55555
      79: aastore
      80: aload         5
      82: bipush        9
      84: ldc           #43                 // String 122333
      86: aastore
      87: aload         5
      89: bipush        10
      91: ldc           #45                 // String 155555
      93: aastore
      94: aload         5
      96: bipush        11
      98: ldc           #47                 // String 224444
     100: aastore
     101: aload         5
     103: bipush        12
     105: ldc           #49                 // String 666666
     107: aastore
     108: aload         5
     110: astore        4
     112: iconst_0
     113: istore        5
     115: aload         4
     117: arraylength
     118: istore        6
     120: iload         5
     122: iload         6
     124: if_icmpge     175
     127: aload         4
     129: iload         5
     131: aaload
     132: astore        7
     134: aload_3
     135: invokevirtual #53                 // Method java/lang/String.length:()I
     138: aload         7
     140: invokevirtual #53                 // Method java/lang/String.length:()I
     143: if_icmple     149
     146: goto          169
     149: aload_0
     150: aload         7
     152: invokevirtual #57                 // Method java/lang/String.toCharArray:()[C
     155: dup
     156: ldc           #59                 // String toCharArray(...)
     158: invokestatic  #65                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     161: iconst_0
     162: iload_1
     163: aload_2
     164: iconst_2
     165: aconst_null
     166: invokestatic  #69                 // Method permutations$default:(Lleetcode/Problem2048;[CIILleetcode/Problem2048$Answer;ILjava/lang/Object;)V
     169: iinc          5, 1
     172: goto          120
     175: aload_2
     176: invokevirtual #72                 // Method leetcode/Problem2048$Answer.getValue:()I
     179: ireturn

  private final void permutations(char[], int, int, leetcode.Problem2048$Answer);
    Code:
       0: iload_2
       1: aload_1
       2: arraylength
       3: if_icmpne     41
       6: nop
       7: new           #19                 // class java/lang/String
      10: dup
      11: aload_1
      12: invokespecial #87                 // Method java/lang/String."<init>":([C)V
      15: invokestatic  #93                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      18: istore        5
      20: iload         5
      22: iload_3
      23: if_icmple     41
      26: aload         4
      28: aload         4
      30: invokevirtual #72                 // Method leetcode/Problem2048$Answer.getValue:()I
      33: iload         5
      35: invokestatic  #99                 // Method java/lang/Math.min:(II)I
      38: invokevirtual #103                // Method leetcode/Problem2048$Answer.setValue:(I)V
      41: iload_2
      42: istore        5
      44: aload_1
      45: arraylength
      46: istore        6
      48: iload         5
      50: iload         6
      52: if_icmpge     105
      55: aload_1
      56: iload         5
      58: caload
      59: istore        7
      61: aload_1
      62: iload_2
      63: caload
      64: istore        8
      66: aload_1
      67: iload         5
      69: iload         8
      71: castore
      72: aload_1
      73: iload_2
      74: iload         7
      76: castore
      77: aload_0
      78: aload_1
      79: iload_2
      80: iconst_1
      81: iadd
      82: iload_3
      83: aload         4
      85: invokespecial #105                // Method permutations:([CIILleetcode/Problem2048$Answer;)V
      88: aload_1
      89: iload         5
      91: iload         7
      93: castore
      94: aload_1
      95: iload_2
      96: iload         8
      98: castore
      99: iinc          5, 1
     102: goto          48
     105: return

  static void permutations$default(leetcode.Problem2048, char[], int, int, leetcode.Problem2048$Answer, int, java.lang.Object);
    Code:
       0: iload         5
       2: iconst_2
       3: iand
       4: ifeq          9
       7: iconst_0
       8: istore_2
       9: aload_0
      10: aload_1
      11: iload_2
      12: iload_3
      13: aload         4
      15: invokespecial #105                // Method permutations:([CIILleetcode/Problem2048$Answer;)V
      18: return
}


package leetcode

import java.util.PriorityQueue

/**
 * https://leetcode.com/problems/construct-string-with-repeat-limit/
 */
class Problem2182 {
    fun repeatLimitedString(s: String, repeatLimit: Int): String {
        data class CharCount(val char: Char, val count: Int)
        val array = IntArray(26)
        for (char in s) {
            array[char - 'a']++
        }
        val queue = PriorityQueue<CharCount> {a, b -> b.char.compareTo(a.char)}
        for (i in array.indices) {
            if (array[i] == 0) {
                continue
            }
            queue += CharCount((i + 'a'.toInt()).toChar(), array[i])
        }
        val answer = StringBuilder()
        var lastChar: Char? = null
        var lastCount = 0
        while (queue.isNotEmpty()) {
            var e1: CharCount? = null
            if (queue.isNotEmpty()) {
                e1 = queue.remove()
                if (lastChar == e1.char && lastCount == repeatLimit && queue.isEmpty()) {
                    break
                }
                var n = if (lastChar == e1.char) lastCount else 0
                var count = 0
                if (e1.count > repeatLimit - n) {
                    answer.append(e1.char.toString().repeat(repeatLimit - n))
                    count = repeatLimit - n
                    e1 = CharCount(e1.char, e1.count - (repeatLimit - n))
                } else { // if (e1.count <= repeatLimit - n) {
                    answer.append(e1.char.toString().repeat(e1.count))
                    count = e1.count
                    e1 = null
                }
                if (lastChar == e1?.char) {
                    lastCount += count
                } else {
                    lastChar = e1?.char
                    lastCount = count
                }
            }
            var e2: CharCount? = null
            if (queue.isNotEmpty()) {
                e2 = queue.remove()
                answer.append(e2?.char)
                if (e2.count - 1 > 0) {
                    e2 = CharCount(e2.char, e2.count - 1)
                } else if (e2.count - 1 == 0) {
                    e2 = null
                }
                lastChar = e2?.char
                lastCount = 1
            }
            if (e1 != null) {
                queue += e1
            }
            if (e2 != null) {
                queue += e2
            }
        }
        return answer.toString()
    }
}

Compiled from "Problem2182.kt"
public final class leetcode.Problem2182$repeatLimitedString$CharCount {
  private final char char;

  private final int count;

  public leetcode.Problem2182$repeatLimitedString$CharCount(char, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field char:C
       9: aload_0
      10: iload_2
      11: putfield      #17                 // Field count:I
      14: return

  public final char getChar();
    Code:
       0: aload_0
       1: getfield      #13                 // Field char:C
       4: ireturn

  public final int getCount();
    Code:
       0: aload_0
       1: getfield      #17                 // Field count:I
       4: ireturn

  public final char component1();
    Code:
       0: aload_0
       1: getfield      #13                 // Field char:C
       4: ireturn

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

  public final leetcode.Problem2182$repeatLimitedString$CharCount copy(char, int);
    Code:
       0: new           #2                  // class leetcode/Problem2182$repeatLimitedString$CharCount
       3: dup
       4: iload_1
       5: iload_2
       6: invokespecial #29                 // Method "<init>":(CI)V
       9: areturn

  public static leetcode.Problem2182$repeatLimitedString$CharCount copy$default(leetcode.Problem2182$repeatLimitedString$CharCount, char, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #13                 // Field char:C
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #17                 // Field count:I
      21: istore_2
      22: aload_0
      23: iload_1
      24: iload_2
      25: invokevirtual #33                 // Method copy:(CI)Lleetcode/Problem2182$repeatLimitedString$CharCount;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #37                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #38                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #40                 // String CharCount(char=
       9: invokevirtual #44                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field char:C
      16: invokevirtual #47                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      19: ldc           #49                 // String , count=
      21: invokevirtual #44                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #17                 // Field count:I
      28: invokevirtual #52                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #47                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #54                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

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

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

Compiled from "Problem2182.kt"
public final class leetcode.Problem2182 {
  public leetcode.Problem2182();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.lang.String repeatLimitedString(java.lang.String, int);
    Code:
       0: aload_1
       1: ldc           #15                 // String s
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: bipush        26
       8: newarray       int
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_1
      15: invokevirtual #27                 // Method java/lang/String.length:()I
      18: istore        5
      20: iload         4
      22: iload         5
      24: if_icmpge     62
      27: aload_1
      28: iload         4
      30: invokevirtual #31                 // Method java/lang/String.charAt:(I)C
      33: istore        6
      35: iload         6
      37: bipush        97
      39: isub
      40: istore        7
      42: aload_3
      43: iload         7
      45: iaload
      46: istore        8
      48: aload_3
      49: iload         7
      51: iload         8
      53: iconst_1
      54: iadd
      55: iastore
      56: iinc          4, 1
      59: goto          20
      62: new           #33                 // class java/util/PriorityQueue
      65: dup
      66: invokedynamic #53,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;
      71: invokedynamic #64,  0             // InvokeDynamic #1:compare:(Lkotlin/jvm/functions/Function2;)Ljava/util/Comparator;
      76: invokespecial #67                 // Method java/util/PriorityQueue."<init>":(Ljava/util/Comparator;)V
      79: astore        4
      81: iconst_0
      82: istore        5
      84: aload_3
      85: arraylength
      86: istore        6
      88: iload         5
      90: iload         6
      92: if_icmpge     139
      95: aload_3
      96: iload         5
      98: iaload
      99: ifne          105
     102: goto          133
     105: aload         4
     107: checkcast     #69                 // class java/util/Collection
     110: new           #71                 // class leetcode/Problem2182$repeatLimitedString$CharCount
     113: dup
     114: iload         5
     116: bipush        97
     118: iadd
     119: i2c
     120: aload_3
     121: iload         5
     123: iaload
     124: invokespecial #74                 // Method leetcode/Problem2182$repeatLimitedString$CharCount."<init>":(CI)V
     127: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     132: pop
     133: iinc          5, 1
     136: goto          88
     139: new           #80                 // class java/lang/StringBuilder
     142: dup
     143: invokespecial #81                 // Method java/lang/StringBuilder."<init>":()V
     146: astore        5
     148: aconst_null
     149: astore        6
     151: iconst_0
     152: istore        7
     154: aload         4
     156: checkcast     #69                 // class java/util/Collection
     159: invokeinterface #85,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     164: ifne          171
     167: iconst_1
     168: goto          172
     171: iconst_0
     172: ifeq          614
     175: aconst_null
     176: astore        8
     178: aload         4
     180: checkcast     #69                 // class java/util/Collection
     183: invokeinterface #85,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     188: ifne          195
     191: iconst_1
     192: goto          196
     195: iconst_0
     196: ifeq          449
     199: aload         4
     201: invokevirtual #89                 // Method java/util/PriorityQueue.remove:()Ljava/lang/Object;
     204: checkcast     #71                 // class leetcode/Problem2182$repeatLimitedString$CharCount
     207: astore        8
     209: aload         6
     211: aload         8
     213: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     216: istore        9
     218: dup
     219: ifnonnull     226
     222: pop
     223: goto          251
     226: invokevirtual #98                 // Method java/lang/Character.charValue:()C
     229: iload         9
     231: if_icmpne     251
     234: iload         7
     236: iload_2
     237: if_icmpne     251
     240: aload         4
     242: invokevirtual #99                 // Method java/util/PriorityQueue.isEmpty:()Z
     245: ifeq          251
     248: goto          614
     251: aload         6
     253: aload         8
     255: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     258: istore        10
     260: dup
     261: ifnonnull     268
     264: pop
     265: goto          281
     268: invokevirtual #98                 // Method java/lang/Character.charValue:()C
     271: iload         10
     273: if_icmpne     281
     276: iload         7
     278: goto          282
     281: iconst_0
     282: istore        9
     284: iconst_0
     285: istore        10
     287: aload         8
     289: invokevirtual #102                // Method leetcode/Problem2182$repeatLimitedString$CharCount.getCount:()I
     292: iload_2
     293: iload         9
     295: isub
     296: if_icmple     356
     299: aload         5
     301: aload         8
     303: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     306: invokestatic  #106                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
     309: checkcast     #108                // class java/lang/CharSequence
     312: iload_2
     313: iload         9
     315: isub
     316: invokestatic  #114                // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
     319: invokevirtual #118                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     322: pop
     323: iload_2
     324: iload         9
     326: isub
     327: istore        10
     329: new           #71                 // class leetcode/Problem2182$repeatLimitedString$CharCount
     332: dup
     333: aload         8
     335: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     338: aload         8
     340: invokevirtual #102                // Method leetcode/Problem2182$repeatLimitedString$CharCount.getCount:()I
     343: iload_2
     344: iload         9
     346: isub
     347: isub
     348: invokespecial #74                 // Method leetcode/Problem2182$repeatLimitedString$CharCount."<init>":(CI)V
     351: astore        8
     353: goto          391
     356: aload         5
     358: aload         8
     360: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     363: invokestatic  #106                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
     366: checkcast     #108                // class java/lang/CharSequence
     369: aload         8
     371: invokevirtual #102                // Method leetcode/Problem2182$repeatLimitedString$CharCount.getCount:()I
     374: invokestatic  #114                // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
     377: invokevirtual #118                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     380: pop
     381: aload         8
     383: invokevirtual #102                // Method leetcode/Problem2182$repeatLimitedString$CharCount.getCount:()I
     386: istore        10
     388: aconst_null
     389: astore        8
     391: aload         6
     393: aload         8
     395: dup
     396: ifnull        408
     399: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     402: invokestatic  #121                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     405: goto          410
     408: pop
     409: aconst_null
     410: invokestatic  #125                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     413: ifeq          426
     416: iload         7
     418: iload         10
     420: iadd
     421: istore        7
     423: goto          449
     426: aload         8
     428: dup
     429: ifnull        441
     432: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     435: invokestatic  #121                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     438: goto          443
     441: pop
     442: aconst_null
     443: astore        6
     445: iload         10
     447: istore        7
     449: aconst_null
     450: astore        9
     452: aload         4
     454: checkcast     #69                 // class java/util/Collection
     457: invokeinterface #85,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     462: ifne          469
     465: iconst_1
     466: goto          470
     469: iconst_0
     470: ifeq          575
     473: aload         4
     475: invokevirtual #89                 // Method java/util/PriorityQueue.remove:()Ljava/lang/Object;
     478: checkcast     #71                 // class leetcode/Problem2182$repeatLimitedString$CharCount
     481: astore        9
     483: aload         5
     485: aload         9
     487: dup
     488: ifnull        500
     491: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     494: invokestatic  #121                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     497: goto          502
     500: pop
     501: aconst_null
     502: invokevirtual #128                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     505: pop
     506: aload         9
     508: invokevirtual #102                // Method leetcode/Problem2182$repeatLimitedString$CharCount.getCount:()I
     511: iconst_1
     512: isub
     513: ifle          540
     516: new           #71                 // class leetcode/Problem2182$repeatLimitedString$CharCount
     519: dup
     520: aload         9
     522: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     525: aload         9
     527: invokevirtual #102                // Method leetcode/Problem2182$repeatLimitedString$CharCount.getCount:()I
     530: iconst_1
     531: isub
     532: invokespecial #74                 // Method leetcode/Problem2182$repeatLimitedString$CharCount."<init>":(CI)V
     535: astore        9
     537: goto          553
     540: aload         9
     542: invokevirtual #102                // Method leetcode/Problem2182$repeatLimitedString$CharCount.getCount:()I
     545: iconst_1
     546: isub
     547: ifne          553
     550: aconst_null
     551: astore        9
     553: aload         9
     555: dup
     556: ifnull        568
     559: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
     562: invokestatic  #121                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     565: goto          570
     568: pop
     569: aconst_null
     570: astore        6
     572: iconst_1
     573: istore        7
     575: aload         8
     577: ifnull        593
     580: aload         4
     582: checkcast     #69                 // class java/util/Collection
     585: aload         8
     587: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     592: pop
     593: aload         9
     595: ifnull        154
     598: aload         4
     600: checkcast     #69                 // class java/util/Collection
     603: aload         9
     605: invokeinterface #78,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     610: pop
     611: goto          154
     614: aload         5
     616: invokevirtual #132                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     619: dup
     620: ldc           #134                // String toString(...)
     622: invokestatic  #137                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     625: areturn

  private static final int repeatLimitedString$lambda$0(leetcode.Problem2182$repeatLimitedString$CharCount, leetcode.Problem2182$repeatLimitedString$CharCount);
    Code:
       0: aload_1
       1: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
       4: aload_0
       5: invokevirtual #93                 // Method leetcode/Problem2182$repeatLimitedString$CharCount.getChar:()C
       8: invokestatic  #161                // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      11: ireturn

  private static final int repeatLimitedString$lambda$1(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #167,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #169                // class java/lang/Number
      11: invokevirtual #172                // Method java/lang/Number.intValue:()I
      14: ireturn
}


package leetcode

/**
 * https://leetcode.com/problems/count-number-of-maximum-bitwise-or-subsets/
 */
class Problem2044 {
    fun countMaxOrSubsets(nums: IntArray): Int {
        var max = 0
        for (num in nums) {
            max = max or num
        }
        var answer = 0
        for (i in nums.indices) {
            answer += countMaxOrSubsets(nums, max, i + 1, false, nums[i])
        }
        return answer
    }

    private fun countMaxOrSubsets(nums: IntArray, max: Int, index: Int, skipped: Boolean, accu: Int): Int {
        if (index == nums.size) {
            return if (!skipped && accu == max) 1 else 0
        }
        val count = if (!skipped && accu == max) 1 else 0
        val a = countMaxOrSubsets(nums, max, index + 1, false, accu or nums[index])
        val b = countMaxOrSubsets(nums, max, index + 1, true, accu)
        return a + b + count
    }
}

Compiled from "Problem2044.kt"
public final class leetcode.Problem2044 {
  public leetcode.Problem2044();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int countMaxOrSubsets(int[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String nums
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_2
       8: iconst_0
       9: istore_3
      10: aload_1
      11: arraylength
      12: istore        4
      14: iload_3
      15: iload         4
      17: if_icmpge     36
      20: aload_1
      21: iload_3
      22: iaload
      23: istore        5
      25: iload_2
      26: iload         5
      28: ior
      29: istore_2
      30: iinc          3, 1
      33: goto          14
      36: iconst_0
      37: istore_3
      38: iconst_0
      39: istore        4
      41: aload_1
      42: arraylength
      43: istore        5
      45: iload         4
      47: iload         5
      49: if_icmpge     76
      52: iload_3
      53: aload_0
      54: aload_1
      55: iload_2
      56: iload         4
      58: iconst_1
      59: iadd
      60: iconst_0
      61: aload_1
      62: iload         4
      64: iaload
      65: invokespecial #24                 // Method countMaxOrSubsets:([IIIZI)I
      68: iadd
      69: istore_3
      70: iinc          4, 1
      73: goto          45
      76: iload_3
      77: ireturn

  private final int countMaxOrSubsets(int[], int, int, boolean, int);
    Code:
       0: iload_3
       1: aload_1
       2: arraylength
       3: if_icmpne     23
       6: iload         4
       8: ifne          21
      11: iload         5
      13: iload_2
      14: if_icmpne     21
      17: iconst_1
      18: goto          22
      21: iconst_0
      22: ireturn
      23: iload         4
      25: ifne          38
      28: iload         5
      30: iload_2
      31: if_icmpne     38
      34: iconst_1
      35: goto          39
      38: iconst_0
      39: istore        6
      41: aload_0
      42: aload_1
      43: iload_2
      44: iload_3
      45: iconst_1
      46: iadd
      47: iconst_0
      48: iload         5
      50: aload_1
      51: iload_3
      52: iaload
      53: ior
      54: invokespecial #24                 // Method countMaxOrSubsets:([IIIZI)I
      57: istore        7
      59: aload_0
      60: aload_1
      61: iload_2
      62: iload_3
      63: iconst_1
      64: iadd
      65: iconst_1
      66: iload         5
      68: invokespecial #24                 // Method countMaxOrSubsets:([IIIZI)I
      71: istore        8
      73: iload         7
      75: iload         8
      77: iadd
      78: iload         6
      80: iadd
      81: ireturn
}


package leetcode

/**
 * https://leetcode.com/problems/number-of-ways-to-select-buildings/
 */
class Problem2222 {
    fun numberOfWays(s: String): Long {
        data class Binary(val zero: Int = 0, val one: Int = 0)
        val left = Array(s.length) { Binary() }
        for (i in s.indices) {
            val zero = if (s[i] == '0') 1 else 0
            val one = if (s[i] == '1') 1 else 0
            left[i] = if (i == 0) {
                Binary(zero, one)
            } else {
                Binary(zero + left[i - 1].zero, one + left[i - 1].one)
            }
        }
        val right = Array(s.length) { Binary() }
        for (i in s.length - 1 downTo 0) {
            val zero = if (s[i] == '0') 1 else 0
            val one = if (s[i] == '1') 1 else 0
            right[i] = if (i == s.length - 1) {
                Binary(zero, one)
            } else {
                Binary(zero + right[i + 1].zero, one + right[i + 1].one)
            }
        }
        var answer = 0L
        for (i in 1..s.length - 2) {
            if (s[i] == '0') { // look for 101
                answer += left[i - 1].one * right[i + 1].one
            } else { // look for 010
                answer += left[i - 1].zero * right[i + 1].zero
            }
        }
        return answer
    }
}

Compiled from "Problem2222.kt"
public final class leetcode.Problem2222 {
  public leetcode.Problem2222();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final long numberOfWays(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String s
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_3
       8: aload_1
       9: invokevirtual #27                 // Method java/lang/String.length:()I
      12: istore        4
      14: iload         4
      16: anewarray     #29                 // class leetcode/Problem2222$numberOfWays$Binary
      19: astore        5
      21: iload_3
      22: iload         4
      24: if_icmpge     52
      27: iload_3
      28: istore        6
      30: aload         5
      32: iload         6
      34: new           #29                 // class leetcode/Problem2222$numberOfWays$Binary
      37: dup
      38: iconst_0
      39: iconst_0
      40: iconst_3
      41: aconst_null
      42: invokespecial #32                 // Method leetcode/Problem2222$numberOfWays$Binary."<init>":(IIILkotlin/jvm/internal/DefaultConstructorMarker;)V
      45: aastore
      46: iinc          3, 1
      49: goto          21
      52: aload         5
      54: astore_2
      55: iconst_0
      56: istore_3
      57: aload_1
      58: checkcast     #34                 // class java/lang/CharSequence
      61: invokeinterface #35,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      66: istore        4
      68: iload_3
      69: iload         4
      71: if_icmpge     164
      74: aload_1
      75: iload_3
      76: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
      79: bipush        48
      81: if_icmpne     88
      84: iconst_1
      85: goto          89
      88: iconst_0
      89: istore        5
      91: aload_1
      92: iload_3
      93: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
      96: bipush        49
      98: if_icmpne     105
     101: iconst_1
     102: goto          106
     105: iconst_0
     106: istore        6
     108: aload_2
     109: iload_3
     110: iload_3
     111: ifne          128
     114: new           #29                 // class leetcode/Problem2222$numberOfWays$Binary
     117: dup
     118: iload         5
     120: iload         6
     122: invokespecial #42                 // Method leetcode/Problem2222$numberOfWays$Binary."<init>":(II)V
     125: goto          157
     128: new           #29                 // class leetcode/Problem2222$numberOfWays$Binary
     131: dup
     132: iload         5
     134: aload_2
     135: iload_3
     136: iconst_1
     137: isub
     138: aaload
     139: invokevirtual #45                 // Method leetcode/Problem2222$numberOfWays$Binary.getZero:()I
     142: iadd
     143: iload         6
     145: aload_2
     146: iload_3
     147: iconst_1
     148: isub
     149: aaload
     150: invokevirtual #48                 // Method leetcode/Problem2222$numberOfWays$Binary.getOne:()I
     153: iadd
     154: invokespecial #42                 // Method leetcode/Problem2222$numberOfWays$Binary."<init>":(II)V
     157: aastore
     158: iinc          3, 1
     161: goto          68
     164: iconst_0
     165: istore        4
     167: aload_1
     168: invokevirtual #27                 // Method java/lang/String.length:()I
     171: istore        5
     173: iload         5
     175: anewarray     #29                 // class leetcode/Problem2222$numberOfWays$Binary
     178: astore        6
     180: iload         4
     182: iload         5
     184: if_icmpge     213
     187: iload         4
     189: istore        7
     191: aload         6
     193: iload         7
     195: new           #29                 // class leetcode/Problem2222$numberOfWays$Binary
     198: dup
     199: iconst_0
     200: iconst_0
     201: iconst_3
     202: aconst_null
     203: invokespecial #32                 // Method leetcode/Problem2222$numberOfWays$Binary."<init>":(IIILkotlin/jvm/internal/DefaultConstructorMarker;)V
     206: aastore
     207: iinc          4, 1
     210: goto          180
     213: aload         6
     215: astore_3
     216: aload_1
     217: invokevirtual #27                 // Method java/lang/String.length:()I
     220: iconst_1
     221: isub
     222: istore        4
     224: iconst_m1
     225: iload         4
     227: if_icmpge     332
     230: aload_1
     231: iload         4
     233: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
     236: bipush        48
     238: if_icmpne     245
     241: iconst_1
     242: goto          246
     245: iconst_0
     246: istore        5
     248: aload_1
     249: iload         4
     251: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
     254: bipush        49
     256: if_icmpne     263
     259: iconst_1
     260: goto          264
     263: iconst_0
     264: istore        6
     266: aload_3
     267: iload         4
     269: iload         4
     271: aload_1
     272: invokevirtual #27                 // Method java/lang/String.length:()I
     275: iconst_1
     276: isub
     277: if_icmpne     294
     280: new           #29                 // class leetcode/Problem2222$numberOfWays$Binary
     283: dup
     284: iload         5
     286: iload         6
     288: invokespecial #42                 // Method leetcode/Problem2222$numberOfWays$Binary."<init>":(II)V
     291: goto          325
     294: new           #29                 // class leetcode/Problem2222$numberOfWays$Binary
     297: dup
     298: iload         5
     300: aload_3
     301: iload         4
     303: iconst_1
     304: iadd
     305: aaload
     306: invokevirtual #45                 // Method leetcode/Problem2222$numberOfWays$Binary.getZero:()I
     309: iadd
     310: iload         6
     312: aload_3
     313: iload         4
     315: iconst_1
     316: iadd
     317: aaload
     318: invokevirtual #48                 // Method leetcode/Problem2222$numberOfWays$Binary.getOne:()I
     321: iadd
     322: invokespecial #42                 // Method leetcode/Problem2222$numberOfWays$Binary."<init>":(II)V
     325: aastore
     326: iinc          4, -1
     329: goto          224
     332: lconst_0
     333: lstore        4
     335: iconst_1
     336: istore        6
     338: aload_1
     339: invokevirtual #27                 // Method java/lang/String.length:()I
     342: iconst_2
     343: isub
     344: istore        7
     346: iload         6
     348: iload         7
     350: if_icmpgt     430
     353: aload_1
     354: iload         6
     356: invokevirtual #39                 // Method java/lang/String.charAt:(I)C
     359: bipush        48
     361: if_icmpne     392
     364: lload         4
     366: aload_2
     367: iload         6
     369: iconst_1
     370: isub
     371: aaload
     372: invokevirtual #48                 // Method leetcode/Problem2222$numberOfWays$Binary.getOne:()I
     375: aload_3
     376: iload         6
     378: iconst_1
     379: iadd
     380: aaload
     381: invokevirtual #48                 // Method leetcode/Problem2222$numberOfWays$Binary.getOne:()I
     384: imul
     385: i2l
     386: ladd
     387: lstore        4
     389: goto          417
     392: lload         4
     394: aload_2
     395: iload         6
     397: iconst_1
     398: isub
     399: aaload
     400: invokevirtual #45                 // Method leetcode/Problem2222$numberOfWays$Binary.getZero:()I
     403: aload_3
     404: iload         6
     406: iconst_1
     407: iadd
     408: aaload
     409: invokevirtual #45                 // Method leetcode/Problem2222$numberOfWays$Binary.getZero:()I
     412: imul
     413: i2l
     414: ladd
     415: lstore        4
     417: iload         6
     419: iload         7
     421: if_icmpeq     430
     424: iinc          6, 1
     427: goto          353
     430: lload         4
     432: lreturn
}

Compiled from "Problem2222.kt"
public final class leetcode.Problem2222$numberOfWays$Binary {
  private final int zero;

  private final int one;

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

  public leetcode.Problem2222$numberOfWays$Binary(int, int, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          8
       6: iconst_0
       7: istore_1
       8: iload_3
       9: iconst_2
      10: iand
      11: ifeq          16
      14: iconst_0
      15: istore_2
      16: aload_0
      17: iload_1
      18: iload_2
      19: invokespecial #21                 // Method "<init>":(II)V
      22: return

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

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

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

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

  public final leetcode.Problem2222$numberOfWays$Binary copy(int, int);
    Code:
       0: new           #2                  // class leetcode/Problem2222$numberOfWays$Binary
       3: dup
       4: iload_1
       5: iload_2
       6: invokespecial #21                 // Method "<init>":(II)V
       9: areturn

  public static leetcode.Problem2222$numberOfWays$Binary copy$default(leetcode.Problem2222$numberOfWays$Binary, int, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #13                 // Field zero:I
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #16                 // Field one:I
      21: istore_2
      22: aload_0
      23: iload_1
      24: iload_2
      25: invokevirtual #32                 // Method copy:(II)Lleetcode/Problem2222$numberOfWays$Binary;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #36                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #37                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #39                 // String Binary(zero=
       9: invokevirtual #43                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field zero:I
      16: invokevirtual #46                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #48                 // String , one=
      21: invokevirtual #43                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field one:I
      28: invokevirtual #46                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #51                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #53                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

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

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


package leetcode

import kotlin.math.max

/**
 * https://leetcode.com/problems/reducing-dishes/
 */
class Problem1402 {
    fun maxSatisfaction(satisfaction: IntArray): Int {
        satisfaction.sort()
        return maxSatisfaction(satisfaction, 0, 1, Array(satisfaction.size) {
            IntArray(
                satisfaction.size + 1
            ) { -1 }
        })
    }

    private fun maxSatisfaction(satisfaction: IntArray, index: Int, time: Int, memo: Array<IntArray>): Int {
        if (satisfaction.size == index) {
            return 0
        }
        if (memo[index][time] != -1) {
            return memo[index][time]
        }
        val m = max(
            maxSatisfaction(satisfaction, index + 1, time, memo),
            maxSatisfaction(satisfaction, index + 1, time + 1, memo) + satisfaction[index] * time)
        memo[index][time] = m
        return m
    }
}

Compiled from "Problem1402.kt"
public final class leetcode.Problem1402 {
  public leetcode.Problem1402();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int maxSatisfaction(int[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String satisfaction
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokestatic  #27                 // Method kotlin/collections/ArraysKt.sort:([I)V
      10: aload_0
      11: aload_1
      12: iconst_0
      13: iconst_1
      14: iconst_0
      15: istore_2
      16: aload_1
      17: arraylength
      18: istore_3
      19: iload_3
      20: anewarray     #29                 // class "[I"
      23: astore        4
      25: istore        13
      27: istore        12
      29: astore        11
      31: astore        10
      33: iload_2
      34: iload_3
      35: if_icmpge     100
      38: iload_2
      39: istore        5
      41: aload         4
      43: iload         5
      45: iconst_0
      46: istore        6
      48: aload_1
      49: arraylength
      50: iconst_1
      51: iadd
      52: istore        7
      54: iload         7
      56: newarray       int
      58: astore        8
      60: istore        15
      62: astore        14
      64: iload         6
      66: iload         7
      68: if_icmpge     87
      71: iload         6
      73: istore        9
      75: aload         8
      77: iload         9
      79: iconst_m1
      80: iastore
      81: iinc          6, 1
      84: goto          64
      87: aload         14
      89: iload         15
      91: aload         8
      93: aastore
      94: iinc          2, 1
      97: goto          33
     100: aload         10
     102: aload         11
     104: iload         12
     106: iload         13
     108: aload         4
     110: invokespecial #32                 // Method maxSatisfaction:([III[[I)I
     113: ireturn

  private final int maxSatisfaction(int[], int, int, int[][]);
    Code:
       0: aload_1
       1: arraylength
       2: iload_2
       3: if_icmpne     8
       6: iconst_0
       7: ireturn
       8: aload         4
      10: iload_2
      11: aaload
      12: iload_3
      13: iaload
      14: iconst_m1
      15: if_icmpeq     25
      18: aload         4
      20: iload_2
      21: aaload
      22: iload_3
      23: iaload
      24: ireturn
      25: nop
      26: aload_0
      27: aload_1
      28: iload_2
      29: iconst_1
      30: iadd
      31: iload_3
      32: aload         4
      34: invokespecial #32                 // Method maxSatisfaction:([III[[I)I
      37: aload_0
      38: aload_1
      39: iload_2
      40: iconst_1
      41: iadd
      42: iload_3
      43: iconst_1
      44: iadd
      45: aload         4
      47: invokespecial #32                 // Method maxSatisfaction:([III[[I)I
      50: aload_1
      51: iload_2
      52: iaload
      53: iload_3
      54: imul
      55: iadd
      56: invokestatic  #40                 // Method java/lang/Math.max:(II)I
      59: istore        5
      61: aload         4
      63: iload_2
      64: aaload
      65: iload_3
      66: iload         5
      68: iastore
      69: iload         5
      71: ireturn
}


package leetcode

import kotlin.math.max

/**
 * https://leetcode.com/problems/minimized-maximum-of-products-distributed-to-any-store/
 */
class Problem2064 {
    fun minimizedMaximum(n: Int, quantities: IntArray): Int {
        var min = 1
        var max = quantities[0]
        for (i in 1 until quantities.size) {
            max = max(max, quantities[i])
        }
        var answer = 0
        while (min <= max) {
            val mid = (min + max) / 2
            if (canDistribute(n, quantities, mid)) {
                max = mid - 1
                answer = mid
            } else {
                min = mid + 1
            }
        }
        return answer
    }

    private fun canDistribute(stores: Int, quantities: IntArray, x: Int): Boolean {
        var n = stores
        for (quantity in quantities) {
            n -= if (quantity % x == 0) quantity / x else (quantity / x) + 1
            if (n < 0) {
                return false
            }
        }
        return true
    }
}

Compiled from "Problem2064.kt"
public final class leetcode.Problem2064 {
  public leetcode.Problem2064();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int minimizedMaximum(int, int[]);
    Code:
       0: aload_2
       1: ldc           #15                 // String quantities
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_1
       7: istore_3
       8: aload_2
       9: iconst_0
      10: iaload
      11: istore        4
      13: iconst_1
      14: istore        5
      16: aload_2
      17: arraylength
      18: istore        6
      20: iload         5
      22: iload         6
      24: if_icmpge     44
      27: iload         4
      29: aload_2
      30: iload         5
      32: iaload
      33: invokestatic  #27                 // Method java/lang/Math.max:(II)I
      36: istore        4
      38: iinc          5, 1
      41: goto          20
      44: iconst_0
      45: istore        5
      47: iload_3
      48: iload         4
      50: if_icmpgt     93
      53: iload_3
      54: iload         4
      56: iadd
      57: iconst_2
      58: idiv
      59: istore        6
      61: aload_0
      62: iload_1
      63: aload_2
      64: iload         6
      66: invokespecial #31                 // Method canDistribute:(I[II)Z
      69: ifeq          85
      72: iload         6
      74: iconst_1
      75: isub
      76: istore        4
      78: iload         6
      80: istore        5
      82: goto          47
      85: iload         6
      87: iconst_1
      88: iadd
      89: istore_3
      90: goto          47
      93: iload         5
      95: ireturn

  private final boolean canDistribute(int, int[], int);
    Code:
       0: iload_1
       1: istore        4
       3: iconst_0
       4: istore        5
       6: aload_2
       7: arraylength
       8: istore        6
      10: iload         5
      12: iload         6
      14: if_icmpge     61
      17: aload_2
      18: iload         5
      20: iaload
      21: istore        7
      23: iload         4
      25: iload         7
      27: iload_3
      28: irem
      29: ifne          39
      32: iload         7
      34: iload_3
      35: idiv
      36: goto          45
      39: iload         7
      41: iload_3
      42: idiv
      43: iconst_1
      44: iadd
      45: isub
      46: istore        4
      48: iload         4
      50: ifge          55
      53: iconst_0
      54: ireturn
      55: iinc          5, 1
      58: goto          10
      61: iconst_1
      62: ireturn
}