package name.valery1707.problem.leet.code

/**
 * # 12. Integer to Roman
 *
 * Roman numerals are represented by seven different symbols: `I`, `V`, `X`, `L`, `C`, `D` and `M`.
 *
 * | Symbol | Value |
 * |--------|-------|
 * | `I` | `1` |
 * | `V` | `5` |
 * | `X` | `10` |
 * | `L` | `50` |
 * | `C` | `100` |
 * | `D` | `500` |
 * | `M` | `1000` |
 *
 * For example, `2` is written as `II` in Roman numeral, just two ones added together.
 * `12` is written as `XII`, which is simply `X + II`.
 * The number `27` is written as `XXVII`, which is `XX + V + II`.
 *
 * Roman numerals are usually written largest to smallest from left to right.
 * However, the numeral for four is not `IIII`.
 * Instead, the number four is written as `IV`.
 * Because the one is before the five we subtract it making four.
 * The same principle applies to the number nine, which is written as `IX`.
 * There are six instances where subtraction is used:
 * * `I` can be placed before `V` (`5`) and `X` (`10`) to make `4` and `9`.
 * * `X` can be placed before `L` (`50`) and `C` (`100`) to make `40` and `90`.
 * * `C` can be placed before `D` (`500`) and `M` (`1000`) to make `400` and `900`.
 *
 * Given an integer, convert it to a roman numeral.
 *
 * ### Constraints
 * * `1 <= num <= 3999`
 *
 * 12. Integer to Roman
 */
interface IntegerToRomanK {
    fun intToRoman(num: Int): String

    @Suppress("EnumEntryName", "unused")
    enum class Implementation : IntegerToRomanK {
        simple {
            //Should be static
            private val mapper = sortedMapOf(
                Comparator.reverseOrder(),
                1 to "I", 5 to "V", 10 to "X", 50 to "L", 100 to "C", 500 to "D", 1000 to "M",
                4 to "IV", 9 to "IX", 40 to "XL", 90 to "XC", 400 to "CD", 900 to "CM",
            )

            override fun intToRoman(num: Int): String {
                var v = num
                val s = StringBuilder()
                for ((int, roman) in mapper) {
                    while (v >= int) {
                        s.append(roman)
                        v -= int
                    }
                }
                return s.toString()

            }
        },
        optimized {
            //Should be static
            private val mapper = sortedMapOf(
                Comparator.reverseOrder(),
                1 to "I", 5 to "V", 10 to "X", 50 to "L", 100 to "C", 500 to "D", 1000 to "M",
                4 to "IV", 9 to "IX", 40 to "XL", 90 to "XC", 400 to "CD", 900 to "CM",
            )

            override fun intToRoman(num: Int): String {
                var v = num
                val s = StringBuilder()
                for ((int, roman) in mapper) {
                    if (v >= int) {
                        s.append(roman.repeat(v / int))
                        v %= int
                    }
                }
                return s.toString()
            }
        },
        arrays {
            //Should be static
            private val integers = intArrayOf(1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1)
            private val romans = arrayOf("M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I")
            override fun intToRoman(num: Int): String {
                var v = num
                var i = 0
                val s = StringBuilder()
                while (i < integers.size && v > 0) {
                    val int = integers[i]
                    if (v >= int) {
                        s.append(romans[i].repeat(v / int))
                        v %= int
                    }
                    i++
                }
                return s.toString()
            }
        },
    }
}

Compiled from "IntegerToRomanK.kt"
public interface name.valery1707.problem.leet.code.IntegerToRomanK {
  public abstract java.lang.String intToRoman(int);
}

Compiled from "IntegerToRomanK.kt"
final class name.valery1707.problem.leet.code.IntegerToRomanK$Implementation$arrays extends name.valery1707.problem.leet.code.IntegerToRomanK$Implementation {
  private final int[] integers;

  private final java.lang.String[] romans;

  name.valery1707.problem.leet.code.IntegerToRomanK$Implementation$arrays();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/IntegerToRomanK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: aload_0
       8: bipush        13
      10: newarray       int
      12: astore_3
      13: aload_3
      14: iconst_0
      15: sipush        1000
      18: iastore
      19: aload_3
      20: iconst_1
      21: sipush        900
      24: iastore
      25: aload_3
      26: iconst_2
      27: sipush        500
      30: iastore
      31: aload_3
      32: iconst_3
      33: sipush        400
      36: iastore
      37: aload_3
      38: iconst_4
      39: bipush        100
      41: iastore
      42: aload_3
      43: iconst_5
      44: bipush        90
      46: iastore
      47: aload_3
      48: bipush        6
      50: bipush        50
      52: iastore
      53: aload_3
      54: bipush        7
      56: bipush        40
      58: iastore
      59: aload_3
      60: bipush        8
      62: bipush        10
      64: iastore
      65: aload_3
      66: bipush        9
      68: bipush        9
      70: iastore
      71: aload_3
      72: bipush        10
      74: iconst_5
      75: iastore
      76: aload_3
      77: bipush        11
      79: iconst_4
      80: iastore
      81: aload_3
      82: bipush        12
      84: iconst_1
      85: iastore
      86: aload_3
      87: putfield      #14                 // Field integers:[I
      90: aload_0
      91: bipush        13
      93: anewarray     #16                 // class java/lang/String
      96: astore_3
      97: aload_3
      98: iconst_0
      99: ldc           #18                 // String M
     101: aastore
     102: aload_3
     103: iconst_1
     104: ldc           #20                 // String CM
     106: aastore
     107: aload_3
     108: iconst_2
     109: ldc           #22                 // String D
     111: aastore
     112: aload_3
     113: iconst_3
     114: ldc           #24                 // String CD
     116: aastore
     117: aload_3
     118: iconst_4
     119: ldc           #26                 // String C
     121: aastore
     122: aload_3
     123: iconst_5
     124: ldc           #28                 // String XC
     126: aastore
     127: aload_3
     128: bipush        6
     130: ldc           #30                 // String L
     132: aastore
     133: aload_3
     134: bipush        7
     136: ldc           #32                 // String XL
     138: aastore
     139: aload_3
     140: bipush        8
     142: ldc           #34                 // String X
     144: aastore
     145: aload_3
     146: bipush        9
     148: ldc           #36                 // String IX
     150: aastore
     151: aload_3
     152: bipush        10
     154: ldc           #38                 // String V
     156: aastore
     157: aload_3
     158: bipush        11
     160: ldc           #40                 // String IV
     162: aastore
     163: aload_3
     164: bipush        12
     166: ldc           #42                 // String I
     168: aastore
     169: aload_3
     170: putfield      #46                 // Field romans:[Ljava/lang/String;
     173: return

  public java.lang.String intToRoman(int);
    Code:
       0: iload_1
       1: istore_2
       2: iconst_0
       3: istore_3
       4: new           #56                 // class java/lang/StringBuilder
       7: dup
       8: invokespecial #58                 // Method java/lang/StringBuilder."<init>":()V
      11: astore        4
      13: iload_3
      14: aload_0
      15: getfield      #14                 // Field integers:[I
      18: arraylength
      19: if_icmpge     73
      22: iload_2
      23: ifle          73
      26: aload_0
      27: getfield      #14                 // Field integers:[I
      30: iload_3
      31: iaload
      32: istore        5
      34: iload_2
      35: iload         5
      37: if_icmplt     67
      40: aload         4
      42: aload_0
      43: getfield      #46                 // Field romans:[Ljava/lang/String;
      46: iload_3
      47: aaload
      48: checkcast     #60                 // class java/lang/CharSequence
      51: iload_2
      52: iload         5
      54: idiv
      55: invokestatic  #66                 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
      58: invokevirtual #70                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      61: pop
      62: iload_2
      63: iload         5
      65: irem
      66: istore_2
      67: iinc          3, 1
      70: goto          13
      73: aload         4
      75: invokevirtual #74                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      78: dup
      79: ldc           #76                 // String toString(...)
      81: invokestatic  #82                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      84: areturn
}

Compiled from "IntegerToRomanK.kt"
public abstract class name.valery1707.problem.leet.code.IntegerToRomanK$Implementation extends java.lang.Enum<name.valery1707.problem.leet.code.IntegerToRomanK$Implementation> implements name.valery1707.problem.leet.code.IntegerToRomanK {
  public static final name.valery1707.problem.leet.code.IntegerToRomanK$Implementation simple;

  public static final name.valery1707.problem.leet.code.IntegerToRomanK$Implementation optimized;

  public static final name.valery1707.problem.leet.code.IntegerToRomanK$Implementation arrays;

  private static final name.valery1707.problem.leet.code.IntegerToRomanK$Implementation[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private name.valery1707.problem.leet.code.IntegerToRomanK$Implementation();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #12                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: return

  public static name.valery1707.problem.leet.code.IntegerToRomanK$Implementation[] values();
    Code:
       0: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
       3: invokevirtual #30                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #31                 // class "[Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;"
       9: areturn

  public static name.valery1707.problem.leet.code.IntegerToRomanK$Implementation valueOf(java.lang.String);
    Code:
       0: ldc           #2                  // class name/valery1707/problem/leet/code/IntegerToRomanK$Implementation
       2: aload_0
       3: invokestatic  #36                 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
       6: checkcast     #2                  // class name/valery1707/problem/leet/code/IntegerToRomanK$Implementation
       9: areturn

  public static kotlin.enums.EnumEntries<name.valery1707.problem.leet.code.IntegerToRomanK$Implementation> getEntries();
    Code:
       0: getstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
       3: areturn

  private static final name.valery1707.problem.leet.code.IntegerToRomanK$Implementation[] $values();
    Code:
       0: iconst_3
       1: anewarray     #2                  // class name/valery1707/problem/leet/code/IntegerToRomanK$Implementation
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #49                 // Field simple:Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #52                 // Field optimized:Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #55                 // Field arrays:Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      22: aastore
      23: aload_0
      24: areturn

  public name.valery1707.problem.leet.code.IntegerToRomanK$Implementation(java.lang.String, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #57                 // Method "<init>":(Ljava/lang/String;I)V
       6: return

  static {};
    Code:
       0: new           #62                 // class name/valery1707/problem/leet/code/IntegerToRomanK$Implementation$simple
       3: dup
       4: ldc           #63                 // String simple
       6: iconst_0
       7: invokespecial #64                 // Method name/valery1707/problem/leet/code/IntegerToRomanK$Implementation$simple."<init>":(Ljava/lang/String;I)V
      10: putstatic     #49                 // Field simple:Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      13: new           #66                 // class name/valery1707/problem/leet/code/IntegerToRomanK$Implementation$optimized
      16: dup
      17: ldc           #67                 // String optimized
      19: iconst_1
      20: invokespecial #68                 // Method name/valery1707/problem/leet/code/IntegerToRomanK$Implementation$optimized."<init>":(Ljava/lang/String;I)V
      23: putstatic     #52                 // Field optimized:Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      26: new           #70                 // class name/valery1707/problem/leet/code/IntegerToRomanK$Implementation$arrays
      29: dup
      30: ldc           #71                 // String arrays
      32: iconst_2
      33: invokespecial #72                 // Method name/valery1707/problem/leet/code/IntegerToRomanK$Implementation$arrays."<init>":(Ljava/lang/String;I)V
      36: putstatic     #55                 // Field arrays:Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      39: invokestatic  #74                 // Method $values:()[Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      42: putstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      45: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/IntegerToRomanK$Implementation;
      48: checkcast     #76                 // class "[Ljava/lang/Enum;"
      51: invokestatic  #82                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      54: putstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      57: return
}

Compiled from "IntegerToRomanK.kt"
final class name.valery1707.problem.leet.code.IntegerToRomanK$Implementation$simple extends name.valery1707.problem.leet.code.IntegerToRomanK$Implementation {
  private final java.util.SortedMap<java.lang.Integer, java.lang.String> mapper;

  name.valery1707.problem.leet.code.IntegerToRomanK$Implementation$simple();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/IntegerToRomanK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: aload_0
       8: invokestatic  #16                 // InterfaceMethod java/util/Comparator.reverseOrder:()Ljava/util/Comparator;
      11: dup
      12: ldc           #18                 // String reverseOrder(...)
      14: invokestatic  #24                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      17: bipush        13
      19: anewarray     #26                 // class kotlin/Pair
      22: astore_3
      23: aload_3
      24: iconst_0
      25: iconst_1
      26: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      29: ldc           #34                 // String I
      31: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      34: aastore
      35: aload_3
      36: iconst_1
      37: iconst_5
      38: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      41: ldc           #42                 // String V
      43: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      46: aastore
      47: aload_3
      48: iconst_2
      49: bipush        10
      51: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      54: ldc           #44                 // String X
      56: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      59: aastore
      60: aload_3
      61: iconst_3
      62: bipush        50
      64: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      67: ldc           #46                 // String L
      69: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      72: aastore
      73: aload_3
      74: iconst_4
      75: bipush        100
      77: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: ldc           #48                 // String C
      82: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      85: aastore
      86: aload_3
      87: iconst_5
      88: sipush        500
      91: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      94: ldc           #50                 // String D
      96: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      99: aastore
     100: aload_3
     101: bipush        6
     103: sipush        1000
     106: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     109: ldc           #52                 // String M
     111: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     114: aastore
     115: aload_3
     116: bipush        7
     118: iconst_4
     119: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     122: ldc           #54                 // String IV
     124: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     127: aastore
     128: aload_3
     129: bipush        8
     131: bipush        9
     133: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     136: ldc           #56                 // String IX
     138: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     141: aastore
     142: aload_3
     143: bipush        9
     145: bipush        40
     147: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     150: ldc           #58                 // String XL
     152: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     155: aastore
     156: aload_3
     157: bipush        10
     159: bipush        90
     161: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     164: ldc           #60                 // String XC
     166: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     169: aastore
     170: aload_3
     171: bipush        11
     173: sipush        400
     176: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     179: ldc           #62                 // String CD
     181: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     184: aastore
     185: aload_3
     186: bipush        12
     188: sipush        900
     191: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     194: ldc           #64                 // String CM
     196: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     199: aastore
     200: aload_3
     201: invokestatic  #70                 // Method kotlin/collections/MapsKt.sortedMapOf:(Ljava/util/Comparator;[Lkotlin/Pair;)Ljava/util/SortedMap;
     204: putfield      #74                 // Field mapper:Ljava/util/SortedMap;
     207: return

  public java.lang.String intToRoman(int);
    Code:
       0: iload_1
       1: istore_2
       2: new           #84                 // class java/lang/StringBuilder
       5: dup
       6: invokespecial #86                 // Method java/lang/StringBuilder."<init>":()V
       9: astore_3
      10: aload_0
      11: getfield      #74                 // Field mapper:Ljava/util/SortedMap;
      14: checkcast     #88                 // class java/util/Map
      17: invokeinterface #92,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      22: invokeinterface #98,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      27: astore        4
      29: aload         4
      31: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          107
      39: aload         4
      41: invokeinterface #108,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: checkcast     #110                // class java/util/Map$Entry
      49: astore        5
      51: aload         5
      53: invokeinterface #113,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      58: checkcast     #28                 // class java/lang/Integer
      61: astore        6
      63: aload         5
      65: invokeinterface #116,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      70: checkcast     #118                // class java/lang/String
      73: astore        7
      75: iload_2
      76: aload         6
      78: invokevirtual #122                // Method java/lang/Integer.intValue:()I
      81: if_icmplt     29
      84: aload_3
      85: aload         7
      87: invokevirtual #126                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      90: pop
      91: iload_2
      92: aload         6
      94: invokestatic  #130                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      97: aload         6
      99: invokevirtual #122                // Method java/lang/Integer.intValue:()I
     102: isub
     103: istore_2
     104: goto          75
     107: aload_3
     108: invokevirtual #134                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     111: dup
     112: ldc           #136                // String toString(...)
     114: invokestatic  #24                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     117: areturn
}

Compiled from "IntegerToRomanK.kt"
final class name.valery1707.problem.leet.code.IntegerToRomanK$Implementation$optimized extends name.valery1707.problem.leet.code.IntegerToRomanK$Implementation {
  private final java.util.SortedMap<java.lang.Integer, java.lang.String> mapper;

  name.valery1707.problem.leet.code.IntegerToRomanK$Implementation$optimized();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/IntegerToRomanK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: aload_0
       8: invokestatic  #16                 // InterfaceMethod java/util/Comparator.reverseOrder:()Ljava/util/Comparator;
      11: dup
      12: ldc           #18                 // String reverseOrder(...)
      14: invokestatic  #24                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      17: bipush        13
      19: anewarray     #26                 // class kotlin/Pair
      22: astore_3
      23: aload_3
      24: iconst_0
      25: iconst_1
      26: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      29: ldc           #34                 // String I
      31: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      34: aastore
      35: aload_3
      36: iconst_1
      37: iconst_5
      38: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      41: ldc           #42                 // String V
      43: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      46: aastore
      47: aload_3
      48: iconst_2
      49: bipush        10
      51: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      54: ldc           #44                 // String X
      56: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      59: aastore
      60: aload_3
      61: iconst_3
      62: bipush        50
      64: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      67: ldc           #46                 // String L
      69: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      72: aastore
      73: aload_3
      74: iconst_4
      75: bipush        100
      77: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: ldc           #48                 // String C
      82: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      85: aastore
      86: aload_3
      87: iconst_5
      88: sipush        500
      91: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      94: ldc           #50                 // String D
      96: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      99: aastore
     100: aload_3
     101: bipush        6
     103: sipush        1000
     106: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     109: ldc           #52                 // String M
     111: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     114: aastore
     115: aload_3
     116: bipush        7
     118: iconst_4
     119: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     122: ldc           #54                 // String IV
     124: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     127: aastore
     128: aload_3
     129: bipush        8
     131: bipush        9
     133: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     136: ldc           #56                 // String IX
     138: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     141: aastore
     142: aload_3
     143: bipush        9
     145: bipush        40
     147: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     150: ldc           #58                 // String XL
     152: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     155: aastore
     156: aload_3
     157: bipush        10
     159: bipush        90
     161: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     164: ldc           #60                 // String XC
     166: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     169: aastore
     170: aload_3
     171: bipush        11
     173: sipush        400
     176: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     179: ldc           #62                 // String CD
     181: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     184: aastore
     185: aload_3
     186: bipush        12
     188: sipush        900
     191: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     194: ldc           #64                 // String CM
     196: invokestatic  #40                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     199: aastore
     200: aload_3
     201: invokestatic  #70                 // Method kotlin/collections/MapsKt.sortedMapOf:(Ljava/util/Comparator;[Lkotlin/Pair;)Ljava/util/SortedMap;
     204: putfield      #74                 // Field mapper:Ljava/util/SortedMap;
     207: return

  public java.lang.String intToRoman(int);
    Code:
       0: iload_1
       1: istore_2
       2: new           #84                 // class java/lang/StringBuilder
       5: dup
       6: invokespecial #86                 // Method java/lang/StringBuilder."<init>":()V
       9: astore_3
      10: aload_0
      11: getfield      #74                 // Field mapper:Ljava/util/SortedMap;
      14: checkcast     #88                 // class java/util/Map
      17: invokeinterface #92,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      22: invokeinterface #98,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      27: astore        4
      29: aload         4
      31: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          125
      39: aload         4
      41: invokeinterface #108,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: checkcast     #110                // class java/util/Map$Entry
      49: astore        5
      51: aload         5
      53: invokeinterface #113,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      58: checkcast     #28                 // class java/lang/Integer
      61: astore        6
      63: aload         5
      65: invokeinterface #116,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      70: checkcast     #118                // class java/lang/String
      73: astore        7
      75: iload_2
      76: aload         6
      78: invokevirtual #122                // Method java/lang/Integer.intValue:()I
      81: if_icmplt     29
      84: aload_3
      85: aload         7
      87: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      90: aload         7
      92: checkcast     #128                // class java/lang/CharSequence
      95: iload_2
      96: aload         6
      98: invokestatic  #126                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     101: aload         6
     103: invokevirtual #122                // Method java/lang/Integer.intValue:()I
     106: idiv
     107: invokestatic  #134                // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
     110: invokevirtual #138                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     113: pop
     114: iload_2
     115: aload         6
     117: invokevirtual #122                // Method java/lang/Integer.intValue:()I
     120: irem
     121: istore_2
     122: goto          29
     125: aload_3
     126: invokevirtual #142                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     129: dup
     130: ldc           #144                // String toString(...)
     132: invokestatic  #24                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     135: areturn
}


package name.valery1707.problem.leet.code

import kotlin.math.max
import kotlin.math.roundToInt

/**
 * # 605. Can Place Flowers
 *
 * You have a long flowerbed in which some of the plots are planted, and some are not.
 * However, flowers cannot be planted in **adjacent** plots.
 *
 * Given an integer array `flowerbed` containing `0`'s and `1`'s, where `0` means *empty* and `1` means not *empty*, and an integer `n`,
 * return *if* `n` new flowers can be planted in the `flowerbed` without violating the no-adjacent-flowers rule.
 *
 * ### Constraints
 * * `1 <= flowerbed.length <= 2 * 10^4`
 * * `flowerbed[i]` is `0` or `1`
 * * There are no two adjacent flowers in `flowerbed`
 * * `0 <= n <= flowerbed.length`
 *
 * @see 605. Can Place Flowers
 */
interface CanPlaceFlowersK {
    fun canPlaceFlowers(flowerbed: IntArray, n: Int): Boolean

    @Suppress("EnumEntryName", "unused")
    enum class Implementation : CanPlaceFlowersK {
        regexp {
            override fun canPlaceFlowers(flowerbed: IntArray, n: Int): Boolean {
                //Цветов больше чем возможных мест в принципе
                if (n > (flowerbed.size / 2.0).roundToInt()) {
                    return false
                }
                //0 цветов всегда поместится
                if (n == 0) {
                    return true
                }

                val str = flowerbed
                    .joinToString(separator = "", prefix = "0", postfix = "0", transform = Int::toString)
                val count = "00+".toRegex()
                    .findAll(str)
                    .map { it.value.length }
                    //"0"->[1]->0
                    //"00"->[2]->0
                    //"000"->[3]->1
                    //"0000"->[4]->1
                    //"00000"->[5]->2
                    //"000000"->[6]->2
                    //"0000000"->[7]->3
                    .map { (it + 1) / 2 - 1 }
                    .filter { it > 0 }.sum()
                return n <= count
            }
        },
        indexes {
            override fun canPlaceFlowers(flowerbed: IntArray, n: Int): Boolean {
                //Цветов больше чем возможных мест в принципе
                if (n > (flowerbed.size / 2.0).roundToInt()) {
                    return false
                }
                //0 цветов всегда поместится
                if (n == 0) {
                    return true
                }

                val count: (curr: Int, prev: Int) -> Int = { curr, prev ->
                    val count = curr - prev - 1
                    //1->0, 2->0, 3->1, 4->1, 5->2, 6->2
                    max(0, (count + 1) / 2 - 1)
                }
                var possible = 0
                var prevUsed = -2
                for (i in flowerbed.indices) {
                    if (flowerbed[i] == 1) {
                        possible += count(i, prevUsed)
                        prevUsed = i
                    }
                }
                possible += count(flowerbed.lastIndex + 2, prevUsed)
                return n <= possible
            }
        },
    }
}

Compiled from "CanPlaceFlowersK.kt"
final class name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation$regexp$canPlaceFlowers$str$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.Integer, java.lang.String> {
  public static final name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation$regexp$canPlaceFlowers$str$1 INSTANCE;

  name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation$regexp$canPlaceFlowers$str$1();
    Code:
       0: aload_0
       1: iconst_1
       2: getstatic     #15                 // Field java/lang/Integer.TYPE:Ljava/lang/Class;
       5: ldc           #17                 // String toString
       7: ldc           #19                 // String toString()Ljava/lang/String;
       9: iconst_0
      10: invokespecial #22                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      13: return

  public final java.lang.String invoke(int);
    Code:
       0: iload_1
       1: invokestatic  #31                 // Method java/lang/String.valueOf:(I)Ljava/lang/String;
       4: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #36                 // class java/lang/Number
       5: invokevirtual #40                 // Method java/lang/Number.intValue:()I
       8: invokevirtual #42                 // Method invoke:(I)Ljava/lang/String;
      11: areturn

  static {};
    Code:
       0: new           #2                  // class name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation$regexp$canPlaceFlowers$str$1
       3: dup
       4: invokespecial #47                 // Method "<init>":()V
       7: putstatic     #50                 // Field INSTANCE:Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation$regexp$canPlaceFlowers$str$1;
      10: return
}

Compiled from "CanPlaceFlowersK.kt"
final class name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation$indexes extends name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation {
  name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation$indexes();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public boolean canPlaceFlowers(int[], int);
    Code:
       0: aload_1
       1: ldc           #21                 // String flowerbed
       3: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_2
       7: aload_1
       8: arraylength
       9: i2d
      10: ldc2_w        #28                 // double 2.0d
      13: ddiv
      14: invokestatic  #35                 // Method kotlin/math/MathKt.roundToInt:(D)I
      17: if_icmple     22
      20: iconst_0
      21: ireturn
      22: iload_2
      23: ifne          28
      26: iconst_1
      27: ireturn
      28: invokedynamic #55,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;
      33: astore_3
      34: iconst_0
      35: istore        4
      37: bipush        -2
      39: istore        5
      41: iconst_0
      42: istore        6
      44: aload_1
      45: arraylength
      46: istore        7
      48: iload         6
      50: iload         7
      52: if_icmpge     100
      55: aload_1
      56: iload         6
      58: iaload
      59: iconst_1
      60: if_icmpne     94
      63: iload         4
      65: aload_3
      66: iload         6
      68: invokestatic  #61                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      71: iload         5
      73: invokestatic  #61                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      76: invokeinterface #65,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      81: checkcast     #67                 // class java/lang/Number
      84: invokevirtual #71                 // Method java/lang/Number.intValue:()I
      87: iadd
      88: istore        4
      90: iload         6
      92: istore        5
      94: iinc          6, 1
      97: goto          48
     100: iload         4
     102: aload_3
     103: aload_1
     104: invokestatic  #77                 // Method kotlin/collections/ArraysKt.getLastIndex:([I)I
     107: iconst_2
     108: iadd
     109: invokestatic  #61                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     112: iload         5
     114: invokestatic  #61                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     117: invokeinterface #65,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     122: checkcast     #67                 // class java/lang/Number
     125: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     128: iadd
     129: istore        4
     131: iload_2
     132: iload         4
     134: if_icmpgt     141
     137: iconst_1
     138: goto          142
     141: iconst_0
     142: ireturn

  private static final int canPlaceFlowers$lambda$0(int, int);
    Code:
       0: iload_0
       1: iload_1
       2: isub
       3: iconst_1
       4: isub
       5: istore_2
       6: iconst_0
       7: iload_2
       8: iconst_1
       9: iadd
      10: iconst_2
      11: idiv
      12: iconst_1
      13: isub
      14: invokestatic  #90                 // Method java/lang/Math.max:(II)I
      17: ireturn
}

Compiled from "CanPlaceFlowersK.kt"
final class name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation$regexp extends name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation {
  name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation$regexp();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public boolean canPlaceFlowers(int[], int);
    Code:
       0: aload_1
       1: ldc           #21                 // String flowerbed
       3: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_2
       7: aload_1
       8: arraylength
       9: i2d
      10: ldc2_w        #28                 // double 2.0d
      13: ddiv
      14: invokestatic  #35                 // Method kotlin/math/MathKt.roundToInt:(D)I
      17: if_icmple     22
      20: iconst_0
      21: ireturn
      22: iload_2
      23: ifne          28
      26: iconst_1
      27: ireturn
      28: aload_1
      29: ldc           #37                 // String
      31: checkcast     #39                 // class java/lang/CharSequence
      34: ldc           #41                 // String 0
      36: checkcast     #39                 // class java/lang/CharSequence
      39: ldc           #41                 // String 0
      41: checkcast     #39                 // class java/lang/CharSequence
      44: iconst_0
      45: aconst_null
      46: getstatic     #47                 // Field name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation$regexp$canPlaceFlowers$str$1.INSTANCE:Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation$regexp$canPlaceFlowers$str$1;
      49: checkcast     #49                 // class kotlin/jvm/functions/Function1
      52: bipush        24
      54: aconst_null
      55: invokestatic  #55                 // Method kotlin/collections/ArraysKt.joinToString$default:([ILjava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
      58: astore_3
      59: new           #57                 // class kotlin/text/Regex
      62: dup
      63: ldc           #59                 // String 00+
      65: invokespecial #62                 // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      68: aload_3
      69: checkcast     #39                 // class java/lang/CharSequence
      72: iconst_0
      73: iconst_2
      74: aconst_null
      75: invokestatic  #66                 // Method kotlin/text/Regex.findAll$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/sequences/Sequence;
      78: invokedynamic #86,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      83: invokestatic  #92                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      86: invokedynamic #100,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
      91: invokestatic  #92                 // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
      94: invokedynamic #108,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
      99: invokestatic  #111                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     102: invokestatic  #115                // Method kotlin/sequences/SequencesKt.sumOfInt:(Lkotlin/sequences/Sequence;)I
     105: istore        4
     107: iload_2
     108: iload         4
     110: if_icmpgt     117
     113: iconst_1
     114: goto          118
     117: iconst_0
     118: ireturn

  private static final int canPlaceFlowers$lambda$0(kotlin.text.MatchResult);
    Code:
       0: aload_0
       1: ldc           #123                // String it
       3: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #129,  1          // InterfaceMethod kotlin/text/MatchResult.getValue:()Ljava/lang/String;
      12: invokevirtual #133                // Method java/lang/String.length:()I
      15: ireturn

  private static final int canPlaceFlowers$lambda$1(int);
    Code:
       0: iload_0
       1: iconst_1
       2: iadd
       3: iconst_2
       4: idiv
       5: iconst_1
       6: isub
       7: ireturn

  private static final boolean canPlaceFlowers$lambda$2(int);
    Code:
       0: iload_0
       1: ifle          8
       4: iconst_1
       5: goto          9
       8: iconst_0
       9: ireturn
}

Compiled from "CanPlaceFlowersK.kt"
public interface name.valery1707.problem.leet.code.CanPlaceFlowersK {
  public abstract boolean canPlaceFlowers(int[], int);
}

Compiled from "CanPlaceFlowersK.kt"
public abstract class name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation extends java.lang.Enum<name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation> implements name.valery1707.problem.leet.code.CanPlaceFlowersK {
  public static final name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation regexp;

  public static final name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation indexes;

  private static final name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #12                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: return

  public static name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation[] values();
    Code:
       0: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;
       3: invokevirtual #30                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #31                 // class "[Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;"
       9: areturn

  public static name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation valueOf(java.lang.String);
    Code:
       0: ldc           #2                  // class name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation
       2: aload_0
       3: invokestatic  #36                 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
       6: checkcast     #2                  // class name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation
       9: areturn

  public static kotlin.enums.EnumEntries<name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation> getEntries();
    Code:
       0: getstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
       3: areturn

  private static final name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation[] $values();
    Code:
       0: iconst_2
       1: anewarray     #2                  // class name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #49                 // Field regexp:Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #52                 // Field indexes:Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;
      16: aastore
      17: aload_0
      18: areturn

  public name.valery1707.problem.leet.code.CanPlaceFlowersK$Implementation(java.lang.String, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #54                 // Method "<init>":(Ljava/lang/String;I)V
       6: return

  static {};
    Code:
       0: new           #59                 // class name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation$regexp
       3: dup
       4: ldc           #60                 // String regexp
       6: iconst_0
       7: invokespecial #61                 // Method name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation$regexp."<init>":(Ljava/lang/String;I)V
      10: putstatic     #49                 // Field regexp:Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;
      13: new           #63                 // class name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation$indexes
      16: dup
      17: ldc           #64                 // String indexes
      19: iconst_1
      20: invokespecial #65                 // Method name/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation$indexes."<init>":(Ljava/lang/String;I)V
      23: putstatic     #52                 // Field indexes:Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;
      26: invokestatic  #67                 // Method $values:()[Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;
      29: putstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;
      32: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/CanPlaceFlowersK$Implementation;
      35: checkcast     #69                 // class "[Ljava/lang/Enum;"
      38: invokestatic  #75                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      41: putstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      44: return
}


package name.valery1707.problem.leet.code

/**
 * # 412. Fizz Buzz
 *
 * Given an integer `n`, return a string array answer (**1-indexed**) where:
 * * `answer[i] == "FizzBuzz"` if `i` is divisible by `3` and `5`.
 * * `answer[i] == "Fizz"` if `i` is divisible by `3`.
 * * `answer[i] == "Buzz"` if `i` is divisible by `5`.
 * * `answer[i] == i` (as a string) if none of the above conditions are true.
 *
 * ### Constraints
 * * `1 <= n <= 10^4`
 *
 * 412. Fizz Buzz
 */
interface FizzBuzzK {
    fun fizzBuzz(n: Int): List<String>

    @Suppress("EnumEntryName", "unused")
    enum class Implementation : FizzBuzzK {
        pure {
            override fun fizzBuzz(n: Int): List<String> {
                return (1..n).map {
                    val div3 = it % 3 == 0
                    val div5 = it % 5 == 0
                    if (div3 && div5) "FizzBuzz"
                    else if (div3) "Fizz"
                    else if (div5) "Buzz"
                    else it.toString()
                }
            }
        },
        mutable {
            override fun fizzBuzz(n: Int): List<String> {
                val res = ArrayList<String>(n)
                for (it in 1..n) {
                    val div3 = it % 3 == 0
                    val div5 = it % 5 == 0
                    res.add(
                        if (div3 && div5) "FizzBuzz"
                        else if (div3) "Fizz"
                        else if (div5) "Buzz"
                        else it.toString()
                    )
                }
                return res
            }
        },
    }
}

Compiled from "FizzBuzzK.kt"
public interface name.valery1707.problem.leet.code.FizzBuzzK {
  public abstract java.util.List<java.lang.String> fizzBuzz(int);
}

Compiled from "FizzBuzzK.kt"
public abstract class name.valery1707.problem.leet.code.FizzBuzzK$Implementation extends java.lang.Enum<name.valery1707.problem.leet.code.FizzBuzzK$Implementation> implements name.valery1707.problem.leet.code.FizzBuzzK {
  public static final name.valery1707.problem.leet.code.FizzBuzzK$Implementation pure;

  public static final name.valery1707.problem.leet.code.FizzBuzzK$Implementation mutable;

  private static final name.valery1707.problem.leet.code.FizzBuzzK$Implementation[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private name.valery1707.problem.leet.code.FizzBuzzK$Implementation();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #12                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: return

  public static name.valery1707.problem.leet.code.FizzBuzzK$Implementation[] values();
    Code:
       0: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;
       3: invokevirtual #30                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #31                 // class "[Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;"
       9: areturn

  public static name.valery1707.problem.leet.code.FizzBuzzK$Implementation valueOf(java.lang.String);
    Code:
       0: ldc           #2                  // class name/valery1707/problem/leet/code/FizzBuzzK$Implementation
       2: aload_0
       3: invokestatic  #36                 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
       6: checkcast     #2                  // class name/valery1707/problem/leet/code/FizzBuzzK$Implementation
       9: areturn

  public static kotlin.enums.EnumEntries<name.valery1707.problem.leet.code.FizzBuzzK$Implementation> getEntries();
    Code:
       0: getstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
       3: areturn

  private static final name.valery1707.problem.leet.code.FizzBuzzK$Implementation[] $values();
    Code:
       0: iconst_2
       1: anewarray     #2                  // class name/valery1707/problem/leet/code/FizzBuzzK$Implementation
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #49                 // Field pure:Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #52                 // Field mutable:Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;
      16: aastore
      17: aload_0
      18: areturn

  public name.valery1707.problem.leet.code.FizzBuzzK$Implementation(java.lang.String, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #54                 // Method "<init>":(Ljava/lang/String;I)V
       6: return

  static {};
    Code:
       0: new           #59                 // class name/valery1707/problem/leet/code/FizzBuzzK$Implementation$pure
       3: dup
       4: ldc           #60                 // String pure
       6: iconst_0
       7: invokespecial #61                 // Method name/valery1707/problem/leet/code/FizzBuzzK$Implementation$pure."<init>":(Ljava/lang/String;I)V
      10: putstatic     #49                 // Field pure:Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;
      13: new           #63                 // class name/valery1707/problem/leet/code/FizzBuzzK$Implementation$mutable
      16: dup
      17: ldc           #64                 // String mutable
      19: iconst_1
      20: invokespecial #65                 // Method name/valery1707/problem/leet/code/FizzBuzzK$Implementation$mutable."<init>":(Ljava/lang/String;I)V
      23: putstatic     #52                 // Field mutable:Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;
      26: invokestatic  #67                 // Method $values:()[Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;
      29: putstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;
      32: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/FizzBuzzK$Implementation;
      35: checkcast     #69                 // class "[Ljava/lang/Enum;"
      38: invokestatic  #75                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      41: putstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      44: return
}

Compiled from "FizzBuzzK.kt"
final class name.valery1707.problem.leet.code.FizzBuzzK$Implementation$pure extends name.valery1707.problem.leet.code.FizzBuzzK$Implementation {
  name.valery1707.problem.leet.code.FizzBuzzK$Implementation$pure();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/FizzBuzzK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public java.util.List<java.lang.String> fizzBuzz(int);
    Code:
       0: new           #22                 // class kotlin/ranges/IntRange
       3: dup
       4: iconst_1
       5: iload_1
       6: invokespecial #25                 // Method kotlin/ranges/IntRange."<init>":(II)V
       9: checkcast     #27                 // class java/lang/Iterable
      12: astore_2
      13: iconst_0
      14: istore_3
      15: aload_2
      16: astore        4
      18: new           #29                 // class java/util/ArrayList
      21: dup
      22: aload_2
      23: bipush        10
      25: invokestatic  #35                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      28: invokespecial #38                 // Method java/util/ArrayList."<init>":(I)V
      31: checkcast     #40                 // class java/util/Collection
      34: astore        5
      36: iconst_0
      37: istore        6
      39: aload         4
      41: invokeinterface #44,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      46: astore        7
      48: aload         7
      50: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      55: ifeq          159
      58: aload         7
      60: checkcast     #52                 // class kotlin/collections/IntIterator
      63: invokevirtual #56                 // Method kotlin/collections/IntIterator.nextInt:()I
      66: istore        8
      68: aload         5
      70: iload         8
      72: istore        9
      74: astore        13
      76: iconst_0
      77: istore        10
      79: iload         9
      81: iconst_3
      82: irem
      83: ifne          90
      86: iconst_1
      87: goto          91
      90: iconst_0
      91: istore        11
      93: iload         9
      95: iconst_5
      96: irem
      97: ifne          104
     100: iconst_1
     101: goto          105
     104: iconst_0
     105: istore        12
     107: iload         11
     109: ifeq          122
     112: iload         12
     114: ifeq          122
     117: ldc           #58                 // String FizzBuzz
     119: goto          147
     122: iload         11
     124: ifeq          132
     127: ldc           #60                 // String Fizz
     129: goto          147
     132: iload         12
     134: ifeq          142
     137: ldc           #62                 // String Buzz
     139: goto          147
     142: iload         9
     144: invokestatic  #68                 // Method java/lang/String.valueOf:(I)Ljava/lang/String;
     147: aload         13
     149: swap
     150: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     155: pop
     156: goto          48
     159: aload         5
     161: checkcast     #74                 // class java/util/List
     164: nop
     165: areturn
}

Compiled from "FizzBuzzK.kt"
final class name.valery1707.problem.leet.code.FizzBuzzK$Implementation$mutable extends name.valery1707.problem.leet.code.FizzBuzzK$Implementation {
  name.valery1707.problem.leet.code.FizzBuzzK$Implementation$mutable();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/FizzBuzzK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public java.util.List<java.lang.String> fizzBuzz(int);
    Code:
       0: new           #22                 // class java/util/ArrayList
       3: dup
       4: iload_1
       5: invokespecial #25                 // Method java/util/ArrayList."<init>":(I)V
       8: astore_2
       9: iconst_1
      10: istore_3
      11: iload_3
      12: iload_1
      13: if_icmpgt     97
      16: iload_3
      17: iconst_3
      18: irem
      19: ifne          26
      22: iconst_1
      23: goto          27
      26: iconst_0
      27: istore        4
      29: iload_3
      30: iconst_5
      31: irem
      32: ifne          39
      35: iconst_1
      36: goto          40
      39: iconst_0
      40: istore        5
      42: aload_2
      43: iload         4
      45: ifeq          58
      48: iload         5
      50: ifeq          58
      53: ldc           #27                 // String FizzBuzz
      55: goto          82
      58: iload         4
      60: ifeq          68
      63: ldc           #29                 // String Fizz
      65: goto          82
      68: iload         5
      70: ifeq          78
      73: ldc           #31                 // String Buzz
      75: goto          82
      78: iload_3
      79: invokestatic  #37                 // Method java/lang/String.valueOf:(I)Ljava/lang/String;
      82: invokevirtual #41                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      85: pop
      86: iload_3
      87: iload_1
      88: if_icmpeq     97
      91: iinc          3, 1
      94: goto          16
      97: aload_2
      98: checkcast     #43                 // class java/util/List
     101: areturn
}


package name.valery1707.problem.leet.code

import java.math.BigInteger

/**
 * # 1680. Concatenation of Consecutive Binary Numbers
 *
 * Given an integer `n`, return the **decimal value** of the binary string formed by concatenating the binary representations of `1` to `n` in order,
 * **modulo** `10^9 + 7`.
 *
 * ### Constraints
 * * `1 <= n <= 10^5`
 *
 * @see 1680. Concatenation of Consecutive Binary Numbers
 */
interface ConcatenationOfConsecutiveBinaryNumbersK {
    fun concatenatedBinary(n: Int): Int

    @Suppress("EnumEntryName", "unused")
    enum class Implementation : ConcatenationOfConsecutiveBinaryNumbersK {
        naive {
            override fun concatenatedBinary(n: Int): Int {
                val modulo = (1e9 + 7).toLong().toBigInteger()
                return (1..n)
                    .joinToString(separator = "") { it.toString(2) }
                    .toBigInteger(2)
                    .mod(modulo)
                    .intValueExact()
            }
        },
        sumThenModulo_fold {
            override fun concatenatedBinary(n: Int): Int {
                val modulo = (1e9 + 7).toLong().toBigInteger()
                return n.downTo(1)
                    .fold(Pair(BigInteger.ZERO, 0)) { sumAndShift, item ->
                        val shift = sumAndShift.second
                        val sum = item.toBigInteger().shl(shift).plus(sumAndShift.first)
                        Pair(sum, shift + item.toString(2).length)
                    }
                    .first
                    .mod(modulo)
                    .intValueExact()
            }
        },
        sumThenModulo_for {
            override fun concatenatedBinary(n: Int): Int {
                val modulo = (1e9 + 7).toLong().toBigInteger()
                var sum = BigInteger.ZERO
                var shift = 0
                for (item in n.downTo(1)) {
                    sum = item.toBigInteger().shl(shift).plus(sum)
                    shift += item.toString(2).length
                }
                return sum.mod(modulo).intValueExact()
            }
        },

        /**
         * @see Java || 👍Explained in Detail👍 || Fast O(N) Solution✅ || Bit Manipulation & Math
         */
        cheehwatang {
            override fun concatenatedBinary(n: Int): Int {
                val modulo = (1e9 + 7).toLong()
                return (1..n)
                    .fold(Pair(0L, 0)) { sumAndShift, item ->
                        // Если мы на текущем элементе перешли на новую степень двойки
                        val shift = if (item.and(item - 1) == 0) sumAndShift.second + 1 else sumAndShift.second
                        // Предыдущую накопленную сумму смещаем на количество бит у текущего числа и добавляем к нему текущее число
                        val sum = sumAndShift.first.shl(shift) + item
                        // Чтобы не выскочить за границу Int нужно ограничить сумму по указанному модулю
                        Pair(sum % modulo, shift)
                    }
                    .first
                    .toInt()
            }
        },
    }
}

Compiled from "ConcatenationOfConsecutiveBinaryNumbersK.kt"
final class name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation$sumThenModulo_fold extends name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation {
  name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation$sumThenModulo_fold();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public int concatenatedBinary(int);
    Code:
       0: ldc2_w        #19                 // long 1000000007l
       3: invokestatic  #26                 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;
       6: dup
       7: ldc           #28                 // String valueOf(...)
       9: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      12: astore_2
      13: iload_1
      14: iconst_1
      15: invokestatic  #40                 // Method kotlin/ranges/RangesKt.downTo:(II)Lkotlin/ranges/IntProgression;
      18: checkcast     #42                 // class java/lang/Iterable
      21: astore_3
      22: new           #44                 // class kotlin/Pair
      25: dup
      26: getstatic     #48                 // Field java/math/BigInteger.ZERO:Ljava/math/BigInteger;
      29: iconst_0
      30: invokestatic  #53                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      33: invokespecial #56                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      36: astore        4
      38: iconst_0
      39: istore        5
      41: aload         4
      43: astore        6
      45: aload_3
      46: invokeinterface #60,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      51: astore        7
      53: aload         7
      55: invokeinterface #66,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      60: ifeq          189
      63: aload         7
      65: checkcast     #68                 // class kotlin/collections/IntIterator
      68: invokevirtual #72                 // Method kotlin/collections/IntIterator.nextInt:()I
      71: istore        8
      73: aload         6
      75: iload         8
      77: istore        9
      79: astore        10
      81: iconst_0
      82: istore        11
      84: aload         10
      86: invokevirtual #76                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      89: checkcast     #78                 // class java/lang/Number
      92: invokevirtual #81                 // Method java/lang/Number.intValue:()I
      95: istore        12
      97: nop
      98: iload         9
     100: i2l
     101: invokestatic  #26                 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;
     104: dup
     105: ldc           #28                 // String valueOf(...)
     107: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     110: iload         12
     112: invokevirtual #85                 // Method java/math/BigInteger.shiftLeft:(I)Ljava/math/BigInteger;
     115: dup
     116: ldc           #87                 // String shiftLeft(...)
     118: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     121: astore        13
     123: aload         10
     125: invokevirtual #90                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     128: dup
     129: ldc           #92                 // String <get-first>(...)
     131: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     134: checkcast     #22                 // class java/math/BigInteger
     137: aload         13
     139: swap
     140: invokevirtual #96                 // Method java/math/BigInteger.add:(Ljava/math/BigInteger;)Ljava/math/BigInteger;
     143: dup
     144: ldc           #98                 // String add(...)
     146: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     149: astore        14
     151: new           #44                 // class kotlin/Pair
     154: dup
     155: aload         14
     157: iload         12
     159: iload         9
     161: iconst_2
     162: invokestatic  #103                // Method kotlin/text/CharsKt.checkRadix:(I)I
     165: invokestatic  #107                // Method java/lang/Integer.toString:(II)Ljava/lang/String;
     168: dup
     169: ldc           #109                // String toString(...)
     171: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     174: invokevirtual #114                // Method java/lang/String.length:()I
     177: iadd
     178: invokestatic  #53                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     181: invokespecial #56                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     184: astore        6
     186: goto          53
     189: aload         6
     191: invokevirtual #90                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     194: checkcast     #22                 // class java/math/BigInteger
     197: aload_2
     198: invokevirtual #117                // Method java/math/BigInteger.mod:(Ljava/math/BigInteger;)Ljava/math/BigInteger;
     201: invokevirtual #120                // Method java/math/BigInteger.intValueExact:()I
     204: ireturn
}

Compiled from "ConcatenationOfConsecutiveBinaryNumbersK.kt"
public abstract class name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation extends java.lang.Enum<name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation> implements name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK {
  public static final name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation naive;

  public static final name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation sumThenModulo_fold;

  public static final name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation sumThenModulo_for;

  public static final name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation cheehwatang;

  private static final name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #12                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: return

  public static name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation[] values();
    Code:
       0: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
       3: invokevirtual #30                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #31                 // class "[Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;"
       9: areturn

  public static name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation valueOf(java.lang.String);
    Code:
       0: ldc           #2                  // class name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation
       2: aload_0
       3: invokestatic  #36                 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
       6: checkcast     #2                  // class name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation
       9: areturn

  public static kotlin.enums.EnumEntries<name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation> getEntries();
    Code:
       0: getstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
       3: areturn

  private static final name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation[] $values();
    Code:
       0: iconst_4
       1: anewarray     #2                  // class name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #49                 // Field naive:Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #52                 // Field sumThenModulo_fold:Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #55                 // Field sumThenModulo_for:Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      22: aastore
      23: aload_0
      24: iconst_3
      25: getstatic     #58                 // Field cheehwatang:Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      28: aastore
      29: aload_0
      30: areturn

  public name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation(java.lang.String, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #60                 // Method "<init>":(Ljava/lang/String;I)V
       6: return

  static {};
    Code:
       0: new           #65                 // class name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation$naive
       3: dup
       4: ldc           #66                 // String naive
       6: iconst_0
       7: invokespecial #67                 // Method name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation$naive."<init>":(Ljava/lang/String;I)V
      10: putstatic     #49                 // Field naive:Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      13: new           #69                 // class name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation$sumThenModulo_fold
      16: dup
      17: ldc           #70                 // String sumThenModulo_fold
      19: iconst_1
      20: invokespecial #71                 // Method name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation$sumThenModulo_fold."<init>":(Ljava/lang/String;I)V
      23: putstatic     #52                 // Field sumThenModulo_fold:Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      26: new           #73                 // class name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation$sumThenModulo_for
      29: dup
      30: ldc           #74                 // String sumThenModulo_for
      32: iconst_2
      33: invokespecial #75                 // Method name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation$sumThenModulo_for."<init>":(Ljava/lang/String;I)V
      36: putstatic     #55                 // Field sumThenModulo_for:Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      39: new           #77                 // class name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation$cheehwatang
      42: dup
      43: ldc           #78                 // String cheehwatang
      45: iconst_3
      46: invokespecial #79                 // Method name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation$cheehwatang."<init>":(Ljava/lang/String;I)V
      49: putstatic     #58                 // Field cheehwatang:Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      52: invokestatic  #81                 // Method $values:()[Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      55: putstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      58: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation;
      61: checkcast     #83                 // class "[Ljava/lang/Enum;"
      64: invokestatic  #89                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      67: putstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      70: return
}

Compiled from "ConcatenationOfConsecutiveBinaryNumbersK.kt"
final class name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation$sumThenModulo_for extends name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation {
  name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation$sumThenModulo_for();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public int concatenatedBinary(int);
    Code:
       0: ldc2_w        #19                 // long 1000000007l
       3: invokestatic  #26                 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;
       6: dup
       7: ldc           #28                 // String valueOf(...)
       9: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      12: astore_2
      13: getstatic     #38                 // Field java/math/BigInteger.ZERO:Ljava/math/BigInteger;
      16: astore_3
      17: iconst_0
      18: istore        4
      20: iload_1
      21: istore        5
      23: iconst_0
      24: iload         5
      26: if_icmpge     105
      29: iload         5
      31: i2l
      32: invokestatic  #26                 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;
      35: dup
      36: ldc           #28                 // String valueOf(...)
      38: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      41: iload         4
      43: invokevirtual #42                 // Method java/math/BigInteger.shiftLeft:(I)Ljava/math/BigInteger;
      46: dup
      47: ldc           #44                 // String shiftLeft(...)
      49: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      52: astore        6
      54: aload_3
      55: astore        7
      57: aload         7
      59: invokestatic  #48                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      62: aload         6
      64: aload         7
      66: invokevirtual #52                 // Method java/math/BigInteger.add:(Ljava/math/BigInteger;)Ljava/math/BigInteger;
      69: dup
      70: ldc           #54                 // String add(...)
      72: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      75: astore_3
      76: iload         4
      78: iload         5
      80: iconst_2
      81: invokestatic  #59                 // Method kotlin/text/CharsKt.checkRadix:(I)I
      84: invokestatic  #65                 // Method java/lang/Integer.toString:(II)Ljava/lang/String;
      87: dup
      88: ldc           #67                 // String toString(...)
      90: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      93: invokevirtual #73                 // Method java/lang/String.length:()I
      96: iadd
      97: istore        4
      99: iinc          5, -1
     102: goto          23
     105: aload_3
     106: aload_2
     107: invokevirtual #76                 // Method java/math/BigInteger.mod:(Ljava/math/BigInteger;)Ljava/math/BigInteger;
     110: invokevirtual #79                 // Method java/math/BigInteger.intValueExact:()I
     113: ireturn
}

Compiled from "ConcatenationOfConsecutiveBinaryNumbersK.kt"
final class name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation$naive extends name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation {
  name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation$naive();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public int concatenatedBinary(int);
    Code:
       0: ldc2_w        #19                 // long 1000000007l
       3: invokestatic  #26                 // Method java/math/BigInteger.valueOf:(J)Ljava/math/BigInteger;
       6: dup
       7: ldc           #28                 // String valueOf(...)
       9: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      12: astore_2
      13: new           #22                 // class java/math/BigInteger
      16: dup
      17: new           #36                 // class kotlin/ranges/IntRange
      20: dup
      21: iconst_1
      22: iload_1
      23: invokespecial #39                 // Method kotlin/ranges/IntRange."<init>":(II)V
      26: checkcast     #41                 // class java/lang/Iterable
      29: ldc           #43                 // String
      31: checkcast     #45                 // class java/lang/CharSequence
      34: aconst_null
      35: aconst_null
      36: iconst_0
      37: aconst_null
      38: invokedynamic #65,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      43: bipush        30
      45: aconst_null
      46: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
      49: iconst_2
      50: invokestatic  #76                 // Method kotlin/text/CharsKt.checkRadix:(I)I
      53: invokespecial #78                 // Method java/math/BigInteger."<init>":(Ljava/lang/String;I)V
      56: aload_2
      57: invokevirtual #82                 // Method java/math/BigInteger.mod:(Ljava/math/BigInteger;)Ljava/math/BigInteger;
      60: invokevirtual #86                 // Method java/math/BigInteger.intValueExact:()I
      63: ireturn

  private static final java.lang.CharSequence concatenatedBinary$lambda$0(int);
    Code:
       0: iload_0
       1: iconst_2
       2: invokestatic  #76                 // Method kotlin/text/CharsKt.checkRadix:(I)I
       5: invokestatic  #95                 // Method java/lang/Integer.toString:(II)Ljava/lang/String;
       8: dup
       9: ldc           #97                 // String toString(...)
      11: invokestatic  #34                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      14: checkcast     #45                 // class java/lang/CharSequence
      17: areturn
}

Compiled from "ConcatenationOfConsecutiveBinaryNumbersK.kt"
public interface name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK {
  public abstract int concatenatedBinary(int);
}

Compiled from "ConcatenationOfConsecutiveBinaryNumbersK.kt"
final class name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation$cheehwatang extends name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation {
  name.valery1707.problem.leet.code.ConcatenationOfConsecutiveBinaryNumbersK$Implementation$cheehwatang();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/ConcatenationOfConsecutiveBinaryNumbersK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public int concatenatedBinary(int);
    Code:
       0: ldc2_w        #19                 // long 1000000007l
       3: lstore_2
       4: new           #22                 // class kotlin/ranges/IntRange
       7: dup
       8: iconst_1
       9: iload_1
      10: invokespecial #25                 // Method kotlin/ranges/IntRange."<init>":(II)V
      13: checkcast     #27                 // class java/lang/Iterable
      16: astore        4
      18: new           #29                 // class kotlin/Pair
      21: dup
      22: lconst_0
      23: invokestatic  #35                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      26: iconst_0
      27: invokestatic  #40                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      30: invokespecial #43                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      33: astore        5
      35: iconst_0
      36: istore        6
      38: aload         5
      40: astore        7
      42: aload         4
      44: invokeinterface #47,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      49: astore        8
      51: aload         8
      53: invokeinterface #53,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      58: ifeq          165
      61: aload         8
      63: checkcast     #55                 // class kotlin/collections/IntIterator
      66: invokevirtual #59                 // Method kotlin/collections/IntIterator.nextInt:()I
      69: istore        9
      71: aload         7
      73: iload         9
      75: istore        10
      77: astore        11
      79: iconst_0
      80: istore        12
      82: iload         10
      84: iload         10
      86: iconst_1
      87: isub
      88: iand
      89: ifne          108
      92: aload         11
      94: invokevirtual #63                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      97: checkcast     #65                 // class java/lang/Number
     100: invokevirtual #68                 // Method java/lang/Number.intValue:()I
     103: iconst_1
     104: iadd
     105: goto          119
     108: aload         11
     110: invokevirtual #63                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     113: checkcast     #65                 // class java/lang/Number
     116: invokevirtual #68                 // Method java/lang/Number.intValue:()I
     119: istore        13
     121: aload         11
     123: invokevirtual #71                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     126: checkcast     #65                 // class java/lang/Number
     129: invokevirtual #75                 // Method java/lang/Number.longValue:()J
     132: iload         13
     134: lshl
     135: iload         10
     137: i2l
     138: ladd
     139: lstore        14
     141: new           #29                 // class kotlin/Pair
     144: dup
     145: lload         14
     147: lload_2
     148: lrem
     149: invokestatic  #35                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     152: iload         13
     154: invokestatic  #40                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     157: invokespecial #43                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     160: astore        7
     162: goto          51
     165: aload         7
     167: invokevirtual #71                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     170: checkcast     #65                 // class java/lang/Number
     173: invokevirtual #75                 // Method java/lang/Number.longValue:()J
     176: l2i
     177: ireturn
}


package name.valery1707.problem.leet.code

import kotlin.math.max

/**
 * # 868. Binary Gap
 *
 * Given a positive integer `n`, find and return the **longest distance** between any two **adjacent** `1`'s in the *binary representation* of `n`.
 * If there are no two adjacent `1`'s, return `0`.
 *
 * Two `1`'s are **adjacent** if there are only `0`'s separating them (possibly no `0`'s).
 * The **distance** between two `1`'s is the absolute difference between their bit positions.
 * For example, the two `1`'s in "1001" have a distance of `3`.
 *
 * ### Constraints
 * * `1 <= n <= 10^9`
 *
 * @see 868. Binary Gap
 */
interface BinaryGapK {
    fun binaryGap(n: Int): Int

    @Suppress("EnumEntryName", "unused")
    enum class Implementation : BinaryGapK {
        naive {
            override fun binaryGap(n: Int): Int {
                var max = 0
                var mask = 1
                var curr = 0
                var prev = -1
                while (mask < n) {
                    if (n.and(mask) == mask) {
                        if (prev in 0 until curr) {
                            max = max(curr - prev, max)
                        }
                        prev = curr
                    }
                    mask = mask shl 1
                    curr++
                }
                return max
            }
        },
    }
}

Compiled from "BinaryGapK.kt"
public interface name.valery1707.problem.leet.code.BinaryGapK {
  public abstract int binaryGap(int);
}

Compiled from "BinaryGapK.kt"
public abstract class name.valery1707.problem.leet.code.BinaryGapK$Implementation extends java.lang.Enum<name.valery1707.problem.leet.code.BinaryGapK$Implementation> implements name.valery1707.problem.leet.code.BinaryGapK {
  public static final name.valery1707.problem.leet.code.BinaryGapK$Implementation naive;

  private static final name.valery1707.problem.leet.code.BinaryGapK$Implementation[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private name.valery1707.problem.leet.code.BinaryGapK$Implementation();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #12                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: return

  public static name.valery1707.problem.leet.code.BinaryGapK$Implementation[] values();
    Code:
       0: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/BinaryGapK$Implementation;
       3: invokevirtual #30                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #31                 // class "[Lname/valery1707/problem/leet/code/BinaryGapK$Implementation;"
       9: areturn

  public static name.valery1707.problem.leet.code.BinaryGapK$Implementation valueOf(java.lang.String);
    Code:
       0: ldc           #2                  // class name/valery1707/problem/leet/code/BinaryGapK$Implementation
       2: aload_0
       3: invokestatic  #36                 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
       6: checkcast     #2                  // class name/valery1707/problem/leet/code/BinaryGapK$Implementation
       9: areturn

  public static kotlin.enums.EnumEntries<name.valery1707.problem.leet.code.BinaryGapK$Implementation> getEntries();
    Code:
       0: getstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
       3: areturn

  private static final name.valery1707.problem.leet.code.BinaryGapK$Implementation[] $values();
    Code:
       0: iconst_1
       1: anewarray     #2                  // class name/valery1707/problem/leet/code/BinaryGapK$Implementation
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #49                 // Field naive:Lname/valery1707/problem/leet/code/BinaryGapK$Implementation;
      10: aastore
      11: aload_0
      12: areturn

  public name.valery1707.problem.leet.code.BinaryGapK$Implementation(java.lang.String, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #51                 // Method "<init>":(Ljava/lang/String;I)V
       6: return

  static {};
    Code:
       0: new           #56                 // class name/valery1707/problem/leet/code/BinaryGapK$Implementation$naive
       3: dup
       4: ldc           #57                 // String naive
       6: iconst_0
       7: invokespecial #58                 // Method name/valery1707/problem/leet/code/BinaryGapK$Implementation$naive."<init>":(Ljava/lang/String;I)V
      10: putstatic     #49                 // Field naive:Lname/valery1707/problem/leet/code/BinaryGapK$Implementation;
      13: invokestatic  #60                 // Method $values:()[Lname/valery1707/problem/leet/code/BinaryGapK$Implementation;
      16: putstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/BinaryGapK$Implementation;
      19: getstatic     #24                 // Field $VALUES:[Lname/valery1707/problem/leet/code/BinaryGapK$Implementation;
      22: checkcast     #62                 // class "[Ljava/lang/Enum;"
      25: invokestatic  #68                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
      28: putstatic     #45                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
      31: return
}

Compiled from "BinaryGapK.kt"
final class name.valery1707.problem.leet.code.BinaryGapK$Implementation$naive extends name.valery1707.problem.leet.code.BinaryGapK$Implementation {
  name.valery1707.problem.leet.code.BinaryGapK$Implementation$naive();
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: aconst_null
       4: invokespecial #10                 // Method name/valery1707/problem/leet/code/BinaryGapK$Implementation."<init>":(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
       7: return

  public int binaryGap(int);
    Code:
       0: iconst_0
       1: istore_2
       2: iconst_1
       3: istore_3
       4: iconst_0
       5: istore        4
       7: iconst_m1
       8: istore        5
      10: iload_3
      11: iload_1
      12: if_icmpge     71
      15: iload_1
      16: iload_3
      17: iand
      18: iload_3
      19: if_icmpne     61
      22: iconst_0
      23: iload         5
      25: if_icmpgt     43
      28: iload         5
      30: iload         4
      32: if_icmpge     39
      35: iconst_1
      36: goto          44
      39: iconst_0
      40: goto          44
      43: iconst_0
      44: ifeq          57
      47: iload         4
      49: iload         5
      51: isub
      52: iload_2
      53: invokestatic  #24                 // Method java/lang/Math.max:(II)I
      56: istore_2
      57: iload         4
      59: istore        5
      61: iload_3
      62: iconst_1
      63: ishl
      64: istore_3
      65: iinc          4, 1
      68: goto          10
      71: iload_2
      72: ireturn
}