package solutions.CHK

object CheckoutSolution {
    fun checkout(skus: String): Int {
        val skuList = skus.map { it.toString() }
        if (containsInvalidSkus(skuList)) {
            return -1
        }

        val checkoutItemsMap = getCheckoutItemsMap(skuList)
        val items = setupItems()
        return getSumOfItems(checkoutItemsMap, items)
    }

    private fun getSumOfItems(checkoutItemsMap: Map<Char, Int>, items: List<Item>): Int {
        val remainingCheckoutItemsMap = removeFreeItems(checkoutItemsMap, items).toMutableMap()
        val totalBundlePrice = setupBundleOffers().sumOf {
            applyMostExpensiveBundle(remainingCheckoutItemsMap, items, it)
        }

        val remainingItemsSum = remainingCheckoutItemsMap.entries.sumOf { (sku, quantity) ->
            calculateItemCost(sku, quantity, items) ?: return -1
        }

        return totalBundlePrice + remainingItemsSum
    }

    private fun calculateItemCost(sku: Char, quantity: Int, items: List<Item>): Int? {
        val item = items.find { it.sku == sku } ?: return null
        return calculateCostWithSpecialOffers(item, quantity)
    }

    private fun calculateCostWithSpecialOffers(item: Item, quantity: Int): Int {
        val sortedSpecialOffers = item.specialOffers.sortedByDescending { it.quantity }

        var totalCost = 0
        var remainingQuantity = quantity

        for (specialOffer in sortedSpecialOffers) {
            if (specialOffer.price != null) {
                val applicableTimes = remainingQuantity / specialOffer.quantity
                totalCost += applicableTimes * specialOffer.price
                remainingQuantity -= applicableTimes * specialOffer.quantity
            } else if (specialOffer.freeSku != null) {
                remainingQuantity -= specialOffer.quantity
                totalCost += item.price * specialOffer.quantity
            }
        }

        totalCost += remainingQuantity * item.price
        return totalCost
    }

    private fun applyMostExpensiveBundle(checkoutItemsMap: MutableMap<Char, Int>, items: List<Item>, bundleOffer: BundleOffer): Int {
        var totalBundlePrice = 0

        while (canFormBundle(checkoutItemsMap, bundleOffer.skus, bundleOffer.quantity)) {
            val sortedEligibleItems = items.filter { it.sku in bundleOffer.skus && checkoutItemsMap.getOrDefault(it.sku, 0) > 0 }
                .sortedByDescending { it.price }

            val selectedItems = selectItemsForBundle(checkoutItemsMap, sortedEligibleItems, bundleOffer.quantity)
            if (selectedItems.isNotEmpty()) {
                selectedItems.forEach { sku ->
                    checkoutItemsMap[sku] = checkoutItemsMap[sku]!! - 1
                    if (checkoutItemsMap[sku]!! <= 0) {
                        checkoutItemsMap.remove(sku)
                    }
                }

                totalBundlePrice += bundleOffer.price
            } else {
                break
            }
        }

        return totalBundlePrice
    }

    private fun canFormBundle(checkoutItemsMap: Map<Char, Int>, skus: List<Char>, bundleQuantity: Int): Boolean {
        return checkoutItemsMap.filterKeys { it in skus }.values.sum() >= bundleQuantity
    }

    private fun selectItemsForBundle(checkoutItemsMap: Map<Char, Int>, sortedItems: List<Item>, bundleQuantity: Int): List<Char> {
        val selectedItems = mutableListOf<Char>()
        var count = 0

        for (item in sortedItems) {
            val availableQuantity = checkoutItemsMap.getOrDefault(item.sku, 0)
            val quantityToAdd = minOf(availableQuantity, bundleQuantity - count)
            repeat(quantityToAdd) { selectedItems.add(item.sku) }
            count += quantityToAdd

            if (count >= bundleQuantity) break
        }

        return if (count >= bundleQuantity) selectedItems else listOf()
    }

    private fun removeFreeItems(checkoutItemsMap: Map<Char, Int>, items: List<Item>): Map<Char, Int> {
        val updatedCheckoutItemsMap = checkoutItemsMap.toMutableMap()

        checkoutItemsMap.forEach { (sku, quantity) ->
            items.find { it.sku == sku }?.let { item ->
                processItemForFreeOffers(updatedCheckoutItemsMap, item, quantity)
            }
        }

        return updatedCheckoutItemsMap.filter { it.value > 0 }
    }

    private fun processItemForFreeOffers(updatedCheckoutItemsMap: MutableMap<Char, Int>, item: Item, quantity: Int) {
        item.specialOffers.sortedByDescending { it.quantity }
            .forEach { offer ->
                applySpecialOffer(updatedCheckoutItemsMap, offer, quantity)
            }
    }

    private fun applySpecialOffer(updatedCheckoutItemsMap: MutableMap<Char, Int>, offer: SpecialOffer, quantity: Int) {
        var applicableTimes = quantity / offer.quantity

        while (applicableTimes > 0 && offer.freeSku != null) {
            val freeItemQuantity = updatedCheckoutItemsMap[offer.freeSku]
            if (freeItemQuantity != null && freeItemQuantity > 0) {
                updatedCheckoutItemsMap[offer.freeSku] = freeItemQuantity - 1
                applicableTimes--
            } else {
                break
            }
        }
    }

    private fun getCheckoutItemsMap(skuList: List<String>): Map<Char, Int> {
        return skuList
            .flatMap { it.toList() }
            .groupingBy { it }
            .eachCount()
    }

    private fun containsInvalidSkus(skuList: List<String>): Boolean {
        return skuList.any { it.none(Char::isLetter) }
    }

    private fun setupItems(): List<Item> {
        return listOf(
            Item('A', 50, listOf(SpecialOffer(3, 130), SpecialOffer(5, 200))),
            Item('B', 30, listOf(SpecialOffer(2, 45))),
            Item('C', 20),
            Item('D', 15),
            Item('E', 40, listOf(SpecialOffer(2, freeSku = 'B'))),
            Item('F', 10, listOf(SpecialOffer(3, freeSku = 'F'))),
            Item('G', 20),
            Item('H', 10, listOf(SpecialOffer(5, price = 45), SpecialOffer(10, price = 80))),
            Item('I', 35),
            Item('J', 60),
            Item('K', 70, listOf(SpecialOffer(2, price = 120))),
            Item('L', 90),
            Item('M', 15),
            Item('N', 40, listOf(SpecialOffer(3, freeSku = 'M'))),
            Item('O', 10),
            Item('P', 50, listOf(SpecialOffer(5, price = 200))),
            Item('Q', 30, listOf(SpecialOffer(3, price = 80))),
            Item('R', 50, listOf(SpecialOffer(3, freeSku = 'Q'))),
            Item('S', 20),
            Item('T', 20),
            Item('U', 40, listOf(SpecialOffer(4, freeSku = 'U'))),
            Item('V', 50, listOf(SpecialOffer(2, price = 90), SpecialOffer(3, price = 130))),
            Item('W', 20),
            Item('X', 17),
            Item('Y', 20),
            Item('Z', 21),
        )
    }

    private fun setupBundleOffers(): List<BundleOffer> {
        return listOf(
            BundleOffer(
                3,
                45,
                listOf('S', 'T', 'X', 'Y', 'Z'),
            ),
        )
    }
}

data class Item(
    val sku: Char,
    val price: Int,
    val specialOffers: List<SpecialOffer> = emptyList(),
)

data class SpecialOffer(
    val quantity: Int,
    val price: Int? = null,
    val freeSku: Char? = null
)

data class BundleOffer(
    val quantity: Int,
    val price: Int,
    val skus: List<Char> = emptyList(),
)

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

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

Compiled from "CheckoutSolution.kt"
public final class solutions.CHK.CheckoutSolution {
  public static final solutions.CHK.CheckoutSolution INSTANCE;

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

  public final int checkout(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String skus
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #23                 // class java/lang/CharSequence
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #25                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: invokeinterface #29,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      27: invokespecial #32                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #34                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: iconst_0
      39: istore        8
      41: iload         8
      43: aload         5
      45: invokeinterface #29,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      50: if_icmpge     95
      53: aload         5
      55: iload         8
      57: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      62: istore        9
      64: aload         6
      66: iload         9
      68: istore        10
      70: astore        12
      72: iconst_0
      73: istore        11
      75: iload         10
      77: invokestatic  #44                 // Method java/lang/String.valueOf:(C)Ljava/lang/String;
      80: aload         12
      82: swap
      83: invokeinterface #48,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      88: pop
      89: iinc          8, 1
      92: goto          41
      95: aload         6
      97: checkcast     #50                 // class java/util/List
     100: nop
     101: astore_2
     102: aload_0
     103: aload_2
     104: invokespecial #54                 // Method containsInvalidSkus:(Ljava/util/List;)Z
     107: ifeq          112
     110: iconst_m1
     111: ireturn
     112: aload_0
     113: aload_2
     114: invokespecial #58                 // Method getCheckoutItemsMap:(Ljava/util/List;)Ljava/util/Map;
     117: astore_3
     118: aload_0
     119: invokespecial #62                 // Method setupItems:()Ljava/util/List;
     122: astore        4
     124: aload_0
     125: aload_3
     126: aload         4
     128: invokespecial #66                 // Method getSumOfItems:(Ljava/util/Map;Ljava/util/List;)I
     131: ireturn

  private final int getSumOfItems(java.util.Map<java.lang.Character, java.lang.Integer>, java.util.List<solutions.CHK.Item>);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokespecial #89                 // Method removeFreeItems:(Ljava/util/Map;Ljava/util/List;)Ljava/util/Map;
       6: invokestatic  #95                 // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
       9: astore_3
      10: aload_0
      11: invokespecial #98                 // Method setupBundleOffers:()Ljava/util/List;
      14: checkcast     #100                // class java/lang/Iterable
      17: astore        5
      19: iconst_0
      20: istore        6
      22: aload         5
      24: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      29: astore        7
      31: aload         7
      33: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      38: ifeq          86
      41: aload         7
      43: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      48: astore        8
      50: iload         6
      52: aload         8
      54: checkcast     #116                // class solutions/CHK/BundleOffer
      57: astore        9
      59: istore        14
      61: iconst_0
      62: istore        10
      64: getstatic     #119                // Field INSTANCE:Lsolutions/CHK/CheckoutSolution;
      67: aload_3
      68: aload_2
      69: aload         9
      71: invokespecial #123                // Method applyMostExpensiveBundle:(Ljava/util/Map;Ljava/util/List;Lsolutions/CHK/BundleOffer;)I
      74: istore        15
      76: iload         14
      78: iload         15
      80: iadd
      81: istore        6
      83: goto          31
      86: iload         6
      88: istore        4
      90: aload_3
      91: invokeinterface #129,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      96: checkcast     #100                // class java/lang/Iterable
      99: astore        6
     101: iconst_0
     102: istore        7
     104: aload         6
     106: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     111: astore        8
     113: aload         8
     115: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     120: ifeq          212
     123: aload         8
     125: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     130: astore        9
     132: iload         7
     134: aload         9
     136: checkcast     #131                // class java/util/Map$Entry
     139: astore        10
     141: istore        14
     143: iconst_0
     144: istore        11
     146: aload         10
     148: invokeinterface #134,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     153: checkcast     #136                // class java/lang/Character
     156: invokevirtual #140                // Method java/lang/Character.charValue:()C
     159: istore        12
     161: aload         10
     163: invokeinterface #143,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     168: checkcast     #145                // class java/lang/Number
     171: invokevirtual #148                // Method java/lang/Number.intValue:()I
     174: istore        13
     176: getstatic     #119                // Field INSTANCE:Lsolutions/CHK/CheckoutSolution;
     179: iload         12
     181: iload         13
     183: aload_2
     184: invokespecial #152                // Method calculateItemCost:(CILjava/util/List;)Ljava/lang/Integer;
     187: dup
     188: ifnull        197
     191: invokevirtual #155                // Method java/lang/Integer.intValue:()I
     194: goto          200
     197: pop
     198: iconst_m1
     199: ireturn
     200: istore        15
     202: iload         14
     204: iload         15
     206: iadd
     207: istore        7
     209: goto          113
     212: iload         7
     214: istore        5
     216: iload         4
     218: iload         5
     220: iadd
     221: ireturn

  private final java.lang.Integer calculateItemCost(char, int, java.util.List<solutions.CHK.Item>);
    Code:
       0: aload_3
       1: checkcast     #100                // class java/lang/Iterable
       4: astore        5
       6: aload         5
       8: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore        6
      15: aload         6
      17: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      22: ifeq          66
      25: aload         6
      27: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        7
      34: aload         7
      36: checkcast     #166                // class solutions/CHK/Item
      39: astore        8
      41: iconst_0
      42: istore        9
      44: aload         8
      46: invokevirtual #169                // Method solutions/CHK/Item.getSku:()C
      49: iload_1
      50: if_icmpne     57
      53: iconst_1
      54: goto          58
      57: iconst_0
      58: ifeq          15
      61: aload         7
      63: goto          67
      66: aconst_null
      67: checkcast     #166                // class solutions/CHK/Item
      70: dup
      71: ifnonnull     77
      74: pop
      75: aconst_null
      76: areturn
      77: astore        4
      79: aload_0
      80: aload         4
      82: iload_2
      83: invokespecial #173                // Method calculateCostWithSpecialOffers:(Lsolutions/CHK/Item;I)I
      86: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      89: areturn

  private final int calculateCostWithSpecialOffers(solutions.CHK.Item, int);
    Code:
       0: aload_1
       1: invokevirtual #182                // Method solutions/CHK/Item.getSpecialOffers:()Ljava/util/List;
       4: checkcast     #100                // class java/lang/Iterable
       7: astore        4
       9: iconst_0
      10: istore        5
      12: aload         4
      14: new           #184                // class solutions/CHK/CheckoutSolution$calculateCostWithSpecialOffers$$inlined$sortedByDescending$1
      17: dup
      18: invokespecial #185                // Method solutions/CHK/CheckoutSolution$calculateCostWithSpecialOffers$$inlined$sortedByDescending$1."<init>":()V
      21: checkcast     #187                // class java/util/Comparator
      24: invokestatic  #193                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
      27: astore_3
      28: iconst_0
      29: istore        4
      31: iload_2
      32: istore        5
      34: aload_3
      35: invokeinterface #194,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      40: astore        6
      42: aload         6
      44: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      49: ifeq          150
      52: aload         6
      54: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      59: checkcast     #196                // class solutions/CHK/SpecialOffer
      62: astore        7
      64: aload         7
      66: invokevirtual #200                // Method solutions/CHK/SpecialOffer.getPrice:()Ljava/lang/Integer;
      69: ifnull        114
      72: iload         5
      74: aload         7
      76: invokevirtual #203                // Method solutions/CHK/SpecialOffer.getQuantity:()I
      79: idiv
      80: istore        8
      82: iload         4
      84: iload         8
      86: aload         7
      88: invokevirtual #200                // Method solutions/CHK/SpecialOffer.getPrice:()Ljava/lang/Integer;
      91: invokevirtual #155                // Method java/lang/Integer.intValue:()I
      94: imul
      95: iadd
      96: istore        4
      98: iload         5
     100: iload         8
     102: aload         7
     104: invokevirtual #203                // Method solutions/CHK/SpecialOffer.getQuantity:()I
     107: imul
     108: isub
     109: istore        5
     111: goto          42
     114: aload         7
     116: invokevirtual #207                // Method solutions/CHK/SpecialOffer.getFreeSku:()Ljava/lang/Character;
     119: ifnull        42
     122: iload         5
     124: aload         7
     126: invokevirtual #203                // Method solutions/CHK/SpecialOffer.getQuantity:()I
     129: isub
     130: istore        5
     132: iload         4
     134: aload_1
     135: invokevirtual #209                // Method solutions/CHK/Item.getPrice:()I
     138: aload         7
     140: invokevirtual #203                // Method solutions/CHK/SpecialOffer.getQuantity:()I
     143: imul
     144: iadd
     145: istore        4
     147: goto          42
     150: iload         4
     152: iload         5
     154: aload_1
     155: invokevirtual #209                // Method solutions/CHK/Item.getPrice:()I
     158: imul
     159: iadd
     160: istore        4
     162: iload         4
     164: ireturn

  private final int applyMostExpensiveBundle(java.util.Map<java.lang.Character, java.lang.Integer>, java.util.List<solutions.CHK.Item>, solutions.CHK.BundleOffer);
    Code:
       0: iconst_0
       1: istore        4
       3: aload_0
       4: aload_1
       5: aload_3
       6: invokevirtual #222                // Method solutions/CHK/BundleOffer.getSkus:()Ljava/util/List;
       9: aload_3
      10: invokevirtual #223                // Method solutions/CHK/BundleOffer.getQuantity:()I
      13: invokespecial #227                // Method canFormBundle:(Ljava/util/Map;Ljava/util/List;I)Z
      16: ifeq          369
      19: aload_2
      20: checkcast     #100                // class java/lang/Iterable
      23: astore        6
      25: iconst_0
      26: istore        7
      28: aload         6
      30: astore        8
      32: new           #25                 // class java/util/ArrayList
      35: dup
      36: invokespecial #228                // Method java/util/ArrayList."<init>":()V
      39: checkcast     #34                 // class java/util/Collection
      42: astore        9
      44: iconst_0
      45: istore        10
      47: aload         8
      49: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      54: astore        11
      56: aload         11
      58: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          153
      66: aload         11
      68: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: astore        12
      75: aload         12
      77: checkcast     #166                // class solutions/CHK/Item
      80: astore        13
      82: iconst_0
      83: istore        14
      85: aload_3
      86: invokevirtual #222                // Method solutions/CHK/BundleOffer.getSkus:()Ljava/util/List;
      89: aload         13
      91: invokevirtual #169                // Method solutions/CHK/Item.getSku:()C
      94: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      97: invokeinterface #234,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     102: ifeq          136
     105: aload_1
     106: aload         13
     108: invokevirtual #169                // Method solutions/CHK/Item.getSku:()C
     111: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     114: iconst_0
     115: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     118: invokeinterface #238,  3          // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     123: checkcast     #145                // class java/lang/Number
     126: invokevirtual #148                // Method java/lang/Number.intValue:()I
     129: ifle          136
     132: iconst_1
     133: goto          137
     136: iconst_0
     137: ifeq          56
     140: aload         9
     142: aload         12
     144: invokeinterface #48,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     149: pop
     150: goto          56
     153: aload         9
     155: checkcast     #50                 // class java/util/List
     158: nop
     159: checkcast     #100                // class java/lang/Iterable
     162: astore        6
     164: nop
     165: iconst_0
     166: istore        7
     168: aload         6
     170: new           #240                // class solutions/CHK/CheckoutSolution$applyMostExpensiveBundle$$inlined$sortedByDescending$1
     173: dup
     174: invokespecial #241                // Method solutions/CHK/CheckoutSolution$applyMostExpensiveBundle$$inlined$sortedByDescending$1."<init>":()V
     177: checkcast     #187                // class java/util/Comparator
     180: invokestatic  #193                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     183: astore        5
     185: aload_0
     186: aload_1
     187: aload         5
     189: aload_3
     190: invokevirtual #223                // Method solutions/CHK/BundleOffer.getQuantity:()I
     193: invokespecial #245                // Method selectItemsForBundle:(Ljava/util/Map;Ljava/util/List;I)Ljava/util/List;
     196: astore        6
     198: aload         6
     200: checkcast     #34                 // class java/util/Collection
     203: invokeinterface #248,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     208: ifne          215
     211: iconst_1
     212: goto          216
     215: iconst_0
     216: ifeq          366
     219: aload         6
     221: checkcast     #100                // class java/lang/Iterable
     224: astore        7
     226: iconst_0
     227: istore        8
     229: aload         7
     231: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     236: astore        9
     238: aload         9
     240: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     245: ifeq          353
     248: aload         9
     250: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     255: astore        10
     257: aload         10
     259: checkcast     #136                // class java/lang/Character
     262: invokevirtual #140                // Method java/lang/Character.charValue:()C
     265: istore        11
     267: iconst_0
     268: istore        12
     270: iload         11
     272: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     275: astore        13
     277: aload_1
     278: aload         13
     280: aload_1
     281: iload         11
     283: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     286: invokeinterface #252,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     291: dup
     292: invokestatic  #256                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     295: checkcast     #145                // class java/lang/Number
     298: invokevirtual #148                // Method java/lang/Number.intValue:()I
     301: iconst_1
     302: isub
     303: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     306: invokeinterface #259,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     311: pop
     312: aload_1
     313: iload         11
     315: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     318: invokeinterface #252,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     323: dup
     324: invokestatic  #256                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     327: checkcast     #145                // class java/lang/Number
     330: invokevirtual #148                // Method java/lang/Number.intValue:()I
     333: ifgt          348
     336: aload_1
     337: iload         11
     339: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     342: invokeinterface #262,  2          // InterfaceMethod java/util/Map.remove:(Ljava/lang/Object;)Ljava/lang/Object;
     347: pop
     348: nop
     349: nop
     350: goto          238
     353: nop
     354: iload         4
     356: aload_3
     357: invokevirtual #263                // Method solutions/CHK/BundleOffer.getPrice:()I
     360: iadd
     361: istore        4
     363: goto          3
     366: goto          369
     369: iload         4
     371: ireturn

  private final boolean canFormBundle(java.util.Map<java.lang.Character, java.lang.Integer>, java.util.List<java.lang.Character>, int);
    Code:
       0: aload_1
       1: astore        4
       3: iconst_0
       4: istore        5
       6: new           #280                // class java/util/LinkedHashMap
       9: dup
      10: invokespecial #281                // Method java/util/LinkedHashMap."<init>":()V
      13: astore        6
      15: aload         4
      17: invokeinterface #129,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      22: invokeinterface #284,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      27: astore        7
      29: aload         7
      31: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          106
      39: aload         7
      41: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: checkcast     #131                // class java/util/Map$Entry
      49: astore        8
      51: aload         8
      53: invokeinterface #134,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      58: checkcast     #136                // class java/lang/Character
      61: invokevirtual #140                // Method java/lang/Character.charValue:()C
      64: istore        9
      66: iconst_0
      67: istore        10
      69: aload_2
      70: iload         9
      72: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      75: invokeinterface #234,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
      80: ifeq          29
      83: aload         6
      85: aload         8
      87: invokeinterface #134,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      92: aload         8
      94: invokeinterface #143,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      99: invokevirtual #285                // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     102: pop
     103: goto          29
     106: aload         6
     108: checkcast     #125                // class java/util/Map
     111: invokeinterface #289,  1          // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
     116: checkcast     #100                // class java/lang/Iterable
     119: invokestatic  #293                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     122: iload_3
     123: if_icmplt     130
     126: iconst_1
     127: goto          131
     130: iconst_0
     131: ireturn

  private final java.util.List<java.lang.Character> selectItemsForBundle(java.util.Map<java.lang.Character, java.lang.Integer>, java.util.List<solutions.CHK.Item>, int);
    Code:
       0: new           #25                 // class java/util/ArrayList
       3: dup
       4: invokespecial #228                // Method java/util/ArrayList."<init>":()V
       7: checkcast     #50                 // class java/util/List
      10: astore        4
      12: iconst_0
      13: istore        5
      15: aload_2
      16: invokeinterface #194,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      21: astore        6
      23: aload         6
      25: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      30: ifeq          137
      33: aload         6
      35: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      40: checkcast     #166                // class solutions/CHK/Item
      43: astore        7
      45: aload_1
      46: aload         7
      48: invokevirtual #169                // Method solutions/CHK/Item.getSku:()C
      51: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      54: iconst_0
      55: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      58: invokeinterface #238,  3          // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      63: checkcast     #145                // class java/lang/Number
      66: invokevirtual #148                // Method java/lang/Number.intValue:()I
      69: istore        8
      71: iload         8
      73: iload_3
      74: iload         5
      76: isub
      77: invokestatic  #308                // Method java/lang/Math.min:(II)I
      80: istore        9
      82: iconst_0
      83: istore        10
      85: iload         10
      87: iload         9
      89: if_icmpge     121
      92: iload         10
      94: istore        11
      96: iconst_0
      97: istore        12
      99: aload         4
     101: aload         7
     103: invokevirtual #169                // Method solutions/CHK/Item.getSku:()C
     106: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     109: invokeinterface #309,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     114: pop
     115: iinc          10, 1
     118: goto          85
     121: iload         5
     123: iload         9
     125: iadd
     126: istore        5
     128: iload         5
     130: iload_3
     131: if_icmplt     23
     134: goto          137
     137: iload         5
     139: iload_3
     140: if_icmplt     148
     143: aload         4
     145: goto          151
     148: invokestatic  #312                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
     151: areturn

  private final java.util.Map<java.lang.Character, java.lang.Integer> removeFreeItems(java.util.Map<java.lang.Character, java.lang.Integer>, java.util.List<solutions.CHK.Item>);
    Code:
       0: aload_1
       1: invokestatic  #95                 // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
       4: astore_3
       5: aload_1
       6: astore        4
       8: iconst_0
       9: istore        5
      11: aload         4
      13: invokeinterface #129,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      18: invokeinterface #284,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      23: astore        6
      25: aload         6
      27: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      32: ifeq          186
      35: aload         6
      37: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      42: checkcast     #131                // class java/util/Map$Entry
      45: astore        7
      47: aload         7
      49: astore        8
      51: iconst_0
      52: istore        9
      54: aload         8
      56: invokeinterface #134,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      61: checkcast     #136                // class java/lang/Character
      64: invokevirtual #140                // Method java/lang/Character.charValue:()C
      67: istore        10
      69: aload         8
      71: invokeinterface #143,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      76: checkcast     #145                // class java/lang/Number
      79: invokevirtual #148                // Method java/lang/Number.intValue:()I
      82: istore        11
      84: aload_2
      85: checkcast     #100                // class java/lang/Iterable
      88: astore        12
      90: aload         12
      92: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      97: astore        13
      99: aload         13
     101: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     106: ifeq          151
     109: aload         13
     111: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     116: astore        14
     118: aload         14
     120: checkcast     #166                // class solutions/CHK/Item
     123: astore        15
     125: iconst_0
     126: istore        16
     128: aload         15
     130: invokevirtual #169                // Method solutions/CHK/Item.getSku:()C
     133: iload         10
     135: if_icmpne     142
     138: iconst_1
     139: goto          143
     142: iconst_0
     143: ifeq          99
     146: aload         14
     148: goto          152
     151: aconst_null
     152: checkcast     #166                // class solutions/CHK/Item
     155: dup
     156: ifnull        179
     159: astore        12
     161: iconst_0
     162: istore        13
     164: getstatic     #119                // Field INSTANCE:Lsolutions/CHK/CheckoutSolution;
     167: aload_3
     168: aload         12
     170: iload         11
     172: invokespecial #322                // Method processItemForFreeOffers:(Ljava/util/Map;Lsolutions/CHK/Item;I)V
     175: nop
     176: goto          181
     179: pop
     180: nop
     181: nop
     182: nop
     183: goto          25
     186: nop
     187: aload_3
     188: astore        4
     190: iconst_0
     191: istore        5
     193: aload         4
     195: astore        6
     197: new           #280                // class java/util/LinkedHashMap
     200: dup
     201: invokespecial #281                // Method java/util/LinkedHashMap."<init>":()V
     204: checkcast     #125                // class java/util/Map
     207: astore        7
     209: iconst_0
     210: istore        8
     212: aload         6
     214: invokeinterface #129,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     219: invokeinterface #284,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     224: astore        9
     226: aload         9
     228: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     233: ifeq          304
     236: aload         9
     238: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     243: checkcast     #131                // class java/util/Map$Entry
     246: astore        10
     248: aload         10
     250: astore        11
     252: iconst_0
     253: istore        12
     255: aload         11
     257: invokeinterface #143,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     262: checkcast     #145                // class java/lang/Number
     265: invokevirtual #148                // Method java/lang/Number.intValue:()I
     268: ifle          275
     271: iconst_1
     272: goto          276
     275: iconst_0
     276: ifeq          226
     279: aload         7
     281: aload         10
     283: invokeinterface #134,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     288: aload         10
     290: invokeinterface #143,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     295: invokeinterface #259,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     300: pop
     301: goto          226
     304: aload         7
     306: nop
     307: areturn

  private final void processItemForFreeOffers(java.util.Map<java.lang.Character, java.lang.Integer>, solutions.CHK.Item, int);
    Code:
       0: aload_2
       1: invokevirtual #182                // Method solutions/CHK/Item.getSpecialOffers:()Ljava/util/List;
       4: checkcast     #100                // class java/lang/Iterable
       7: astore        4
       9: iconst_0
      10: istore        5
      12: aload         4
      14: new           #330                // class solutions/CHK/CheckoutSolution$processItemForFreeOffers$$inlined$sortedByDescending$1
      17: dup
      18: invokespecial #331                // Method solutions/CHK/CheckoutSolution$processItemForFreeOffers$$inlined$sortedByDescending$1."<init>":()V
      21: checkcast     #187                // class java/util/Comparator
      24: invokestatic  #193                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
      27: checkcast     #100                // class java/lang/Iterable
      30: astore        4
      32: nop
      33: iconst_0
      34: istore        5
      36: aload         4
      38: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      43: astore        6
      45: aload         6
      47: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      52: ifeq          89
      55: aload         6
      57: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      62: astore        7
      64: aload         7
      66: checkcast     #196                // class solutions/CHK/SpecialOffer
      69: astore        8
      71: iconst_0
      72: istore        9
      74: getstatic     #119                // Field INSTANCE:Lsolutions/CHK/CheckoutSolution;
      77: aload_1
      78: aload         8
      80: iload_3
      81: invokespecial #335                // Method applySpecialOffer:(Ljava/util/Map;Lsolutions/CHK/SpecialOffer;I)V
      84: nop
      85: nop
      86: goto          45
      89: nop
      90: return

  private final void applySpecialOffer(java.util.Map<java.lang.Character, java.lang.Integer>, solutions.CHK.SpecialOffer, int);
    Code:
       0: iload_3
       1: aload_2
       2: invokevirtual #203                // Method solutions/CHK/SpecialOffer.getQuantity:()I
       5: idiv
       6: istore        4
       8: iload         4
      10: ifle          78
      13: aload_2
      14: invokevirtual #207                // Method solutions/CHK/SpecialOffer.getFreeSku:()Ljava/lang/Character;
      17: ifnull        78
      20: aload_1
      21: aload_2
      22: invokevirtual #207                // Method solutions/CHK/SpecialOffer.getFreeSku:()Ljava/lang/Character;
      25: invokeinterface #252,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      30: checkcast     #154                // class java/lang/Integer
      33: astore        5
      35: aload         5
      37: ifnull        75
      40: aload         5
      42: invokevirtual #155                // Method java/lang/Integer.intValue:()I
      45: ifle          75
      48: aload_1
      49: aload_2
      50: invokevirtual #207                // Method solutions/CHK/SpecialOffer.getFreeSku:()Ljava/lang/Character;
      53: aload         5
      55: invokevirtual #155                // Method java/lang/Integer.intValue:()I
      58: iconst_1
      59: isub
      60: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      63: invokeinterface #259,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      68: pop
      69: iinc          4, -1
      72: goto          8
      75: goto          78
      78: return

  private final java.util.Map<java.lang.Character, java.lang.Integer> getCheckoutItemsMap(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: checkcast     #100                // class java/lang/Iterable
       4: astore_2
       5: nop
       6: iconst_0
       7: istore_3
       8: aload_2
       9: astore        4
      11: new           #25                 // class java/util/ArrayList
      14: dup
      15: invokespecial #228                // Method java/util/ArrayList."<init>":()V
      18: checkcast     #34                 // class java/util/Collection
      21: astore        5
      23: iconst_0
      24: istore        6
      26: aload         4
      28: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      33: astore        7
      35: aload         7
      37: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      42: ifeq          88
      45: aload         7
      47: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      52: astore        8
      54: aload         8
      56: checkcast     #40                 // class java/lang/String
      59: astore        9
      61: iconst_0
      62: istore        10
      64: aload         9
      66: checkcast     #23                 // class java/lang/CharSequence
      69: invokestatic  #347                // Method kotlin/text/StringsKt.toList:(Ljava/lang/CharSequence;)Ljava/util/List;
      72: checkcast     #100                // class java/lang/Iterable
      75: astore        9
      77: aload         5
      79: aload         9
      81: invokestatic  #351                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
      84: pop
      85: goto          35
      88: aload         5
      90: checkcast     #50                 // class java/util/List
      93: nop
      94: checkcast     #100                // class java/lang/Iterable
      97: astore_2
      98: nop
      99: iconst_0
     100: istore_3
     101: new           #353                // class solutions/CHK/CheckoutSolution$getCheckoutItemsMap$$inlined$groupingBy$1
     104: dup
     105: aload_2
     106: invokespecial #356                // Method solutions/CHK/CheckoutSolution$getCheckoutItemsMap$$inlined$groupingBy$1."<init>":(Ljava/lang/Iterable;)V
     109: checkcast     #358                // class kotlin/collections/Grouping
     112: invokestatic  #364                // Method kotlin/collections/GroupingKt.eachCount:(Lkotlin/collections/Grouping;)Ljava/util/Map;
     115: areturn

  private final boolean containsInvalidSkus(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: checkcast     #100                // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: instanceof    #34                 // class java/util/Collection
      11: ifeq          30
      14: aload_2
      15: checkcast     #34                 // class java/util/Collection
      18: invokeinterface #248,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      23: ifeq          30
      26: iconst_0
      27: goto          139
      30: aload_2
      31: invokeinterface #104,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      36: astore        4
      38: aload         4
      40: invokeinterface #110,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          138
      48: aload         4
      50: invokeinterface #114,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: astore        5
      57: aload         5
      59: checkcast     #40                 // class java/lang/String
      62: astore        6
      64: iconst_0
      65: istore        7
      67: aload         6
      69: checkcast     #23                 // class java/lang/CharSequence
      72: astore        8
      74: iconst_0
      75: istore        9
      77: iconst_0
      78: istore        10
      80: iload         10
      82: aload         8
      84: invokeinterface #29,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      89: if_icmpge     129
      92: aload         8
      94: iload         10
      96: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     101: istore        11
     103: iload         11
     105: istore        12
     107: iconst_0
     108: istore        13
     110: iload         12
     112: invokestatic  #377                // Method java/lang/Character.isLetter:(C)Z
     115: nop
     116: ifeq          123
     119: iconst_0
     120: goto          130
     123: iinc          10, 1
     126: goto          80
     129: iconst_1
     130: nop
     131: ifeq          38
     134: iconst_1
     135: goto          139
     138: iconst_0
     139: ireturn

  private final java.util.List<solutions.CHK.Item> setupItems();
    Code:
       0: bipush        26
       2: anewarray     #166                // class solutions/CHK/Item
       5: astore_1
       6: aload_1
       7: iconst_0
       8: new           #166                // class solutions/CHK/Item
      11: dup
      12: bipush        65
      14: bipush        50
      16: iconst_2
      17: anewarray     #196                // class solutions/CHK/SpecialOffer
      20: astore_2
      21: aload_2
      22: iconst_0
      23: new           #196                // class solutions/CHK/SpecialOffer
      26: dup
      27: iconst_3
      28: sipush        130
      31: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      34: aconst_null
      35: iconst_4
      36: aconst_null
      37: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      40: aastore
      41: aload_2
      42: iconst_1
      43: new           #196                // class solutions/CHK/SpecialOffer
      46: dup
      47: iconst_5
      48: sipush        200
      51: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      54: aconst_null
      55: iconst_4
      56: aconst_null
      57: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      60: aastore
      61: aload_2
      62: invokestatic  #392                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      65: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
      68: aastore
      69: aload_1
      70: iconst_1
      71: new           #166                // class solutions/CHK/Item
      74: dup
      75: bipush        66
      77: bipush        30
      79: new           #196                // class solutions/CHK/SpecialOffer
      82: dup
      83: iconst_2
      84: bipush        45
      86: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      89: aconst_null
      90: iconst_4
      91: aconst_null
      92: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      95: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      98: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     101: aastore
     102: aload_1
     103: iconst_2
     104: new           #166                // class solutions/CHK/Item
     107: dup
     108: bipush        67
     110: bipush        20
     112: aconst_null
     113: iconst_4
     114: aconst_null
     115: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     118: aastore
     119: aload_1
     120: iconst_3
     121: new           #166                // class solutions/CHK/Item
     124: dup
     125: bipush        68
     127: bipush        15
     129: aconst_null
     130: iconst_4
     131: aconst_null
     132: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     135: aastore
     136: aload_1
     137: iconst_4
     138: new           #166                // class solutions/CHK/Item
     141: dup
     142: bipush        69
     144: bipush        40
     146: new           #196                // class solutions/CHK/SpecialOffer
     149: dup
     150: iconst_2
     151: aconst_null
     152: bipush        66
     154: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     157: iconst_2
     158: aconst_null
     159: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     162: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     165: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     168: aastore
     169: aload_1
     170: iconst_5
     171: new           #166                // class solutions/CHK/Item
     174: dup
     175: bipush        70
     177: bipush        10
     179: new           #196                // class solutions/CHK/SpecialOffer
     182: dup
     183: iconst_3
     184: aconst_null
     185: bipush        70
     187: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     190: iconst_2
     191: aconst_null
     192: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     195: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     198: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     201: aastore
     202: aload_1
     203: bipush        6
     205: new           #166                // class solutions/CHK/Item
     208: dup
     209: bipush        71
     211: bipush        20
     213: aconst_null
     214: iconst_4
     215: aconst_null
     216: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     219: aastore
     220: aload_1
     221: bipush        7
     223: new           #166                // class solutions/CHK/Item
     226: dup
     227: bipush        72
     229: bipush        10
     231: iconst_2
     232: anewarray     #196                // class solutions/CHK/SpecialOffer
     235: astore_2
     236: aload_2
     237: iconst_0
     238: new           #196                // class solutions/CHK/SpecialOffer
     241: dup
     242: iconst_5
     243: bipush        45
     245: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     248: aconst_null
     249: iconst_4
     250: aconst_null
     251: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     254: aastore
     255: aload_2
     256: iconst_1
     257: new           #196                // class solutions/CHK/SpecialOffer
     260: dup
     261: bipush        10
     263: bipush        80
     265: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     268: aconst_null
     269: iconst_4
     270: aconst_null
     271: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     274: aastore
     275: aload_2
     276: invokestatic  #392                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     279: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     282: aastore
     283: aload_1
     284: bipush        8
     286: new           #166                // class solutions/CHK/Item
     289: dup
     290: bipush        73
     292: bipush        35
     294: aconst_null
     295: iconst_4
     296: aconst_null
     297: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     300: aastore
     301: aload_1
     302: bipush        9
     304: new           #166                // class solutions/CHK/Item
     307: dup
     308: bipush        74
     310: bipush        60
     312: aconst_null
     313: iconst_4
     314: aconst_null
     315: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     318: aastore
     319: aload_1
     320: bipush        10
     322: new           #166                // class solutions/CHK/Item
     325: dup
     326: bipush        75
     328: bipush        70
     330: new           #196                // class solutions/CHK/SpecialOffer
     333: dup
     334: iconst_2
     335: bipush        120
     337: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     340: aconst_null
     341: iconst_4
     342: aconst_null
     343: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     346: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     349: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     352: aastore
     353: aload_1
     354: bipush        11
     356: new           #166                // class solutions/CHK/Item
     359: dup
     360: bipush        76
     362: bipush        90
     364: aconst_null
     365: iconst_4
     366: aconst_null
     367: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     370: aastore
     371: aload_1
     372: bipush        12
     374: new           #166                // class solutions/CHK/Item
     377: dup
     378: bipush        77
     380: bipush        15
     382: aconst_null
     383: iconst_4
     384: aconst_null
     385: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     388: aastore
     389: aload_1
     390: bipush        13
     392: new           #166                // class solutions/CHK/Item
     395: dup
     396: bipush        78
     398: bipush        40
     400: new           #196                // class solutions/CHK/SpecialOffer
     403: dup
     404: iconst_3
     405: aconst_null
     406: bipush        77
     408: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     411: iconst_2
     412: aconst_null
     413: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     416: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     419: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     422: aastore
     423: aload_1
     424: bipush        14
     426: new           #166                // class solutions/CHK/Item
     429: dup
     430: bipush        79
     432: bipush        10
     434: aconst_null
     435: iconst_4
     436: aconst_null
     437: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     440: aastore
     441: aload_1
     442: bipush        15
     444: new           #166                // class solutions/CHK/Item
     447: dup
     448: bipush        80
     450: bipush        50
     452: new           #196                // class solutions/CHK/SpecialOffer
     455: dup
     456: iconst_5
     457: sipush        200
     460: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     463: aconst_null
     464: iconst_4
     465: aconst_null
     466: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     469: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     472: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     475: aastore
     476: aload_1
     477: bipush        16
     479: new           #166                // class solutions/CHK/Item
     482: dup
     483: bipush        81
     485: bipush        30
     487: new           #196                // class solutions/CHK/SpecialOffer
     490: dup
     491: iconst_3
     492: bipush        80
     494: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     497: aconst_null
     498: iconst_4
     499: aconst_null
     500: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     503: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     506: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     509: aastore
     510: aload_1
     511: bipush        17
     513: new           #166                // class solutions/CHK/Item
     516: dup
     517: bipush        82
     519: bipush        50
     521: new           #196                // class solutions/CHK/SpecialOffer
     524: dup
     525: iconst_3
     526: aconst_null
     527: bipush        81
     529: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     532: iconst_2
     533: aconst_null
     534: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     537: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     540: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     543: aastore
     544: aload_1
     545: bipush        18
     547: new           #166                // class solutions/CHK/Item
     550: dup
     551: bipush        83
     553: bipush        20
     555: aconst_null
     556: iconst_4
     557: aconst_null
     558: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     561: aastore
     562: aload_1
     563: bipush        19
     565: new           #166                // class solutions/CHK/Item
     568: dup
     569: bipush        84
     571: bipush        20
     573: aconst_null
     574: iconst_4
     575: aconst_null
     576: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     579: aastore
     580: aload_1
     581: bipush        20
     583: new           #166                // class solutions/CHK/Item
     586: dup
     587: bipush        85
     589: bipush        40
     591: new           #196                // class solutions/CHK/SpecialOffer
     594: dup
     595: iconst_4
     596: aconst_null
     597: bipush        85
     599: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     602: iconst_2
     603: aconst_null
     604: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     607: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     610: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     613: aastore
     614: aload_1
     615: bipush        21
     617: new           #166                // class solutions/CHK/Item
     620: dup
     621: bipush        86
     623: bipush        50
     625: iconst_2
     626: anewarray     #196                // class solutions/CHK/SpecialOffer
     629: astore_2
     630: aload_2
     631: iconst_0
     632: new           #196                // class solutions/CHK/SpecialOffer
     635: dup
     636: iconst_2
     637: bipush        90
     639: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     642: aconst_null
     643: iconst_4
     644: aconst_null
     645: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     648: aastore
     649: aload_2
     650: iconst_1
     651: new           #196                // class solutions/CHK/SpecialOffer
     654: dup
     655: iconst_3
     656: sipush        130
     659: invokestatic  #176                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     662: aconst_null
     663: iconst_4
     664: aconst_null
     665: invokespecial #388                // Method solutions/CHK/SpecialOffer."<init>":(ILjava/lang/Integer;Ljava/lang/Character;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     668: aastore
     669: aload_2
     670: invokestatic  #392                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     673: invokespecial #395                // Method solutions/CHK/Item."<init>":(CILjava/util/List;)V
     676: aastore
     677: aload_1
     678: bipush        22
     680: new           #166                // class solutions/CHK/Item
     683: dup
     684: bipush        87
     686: bipush        20
     688: aconst_null
     689: iconst_4
     690: aconst_null
     691: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     694: aastore
     695: aload_1
     696: bipush        23
     698: new           #166                // class solutions/CHK/Item
     701: dup
     702: bipush        88
     704: bipush        17
     706: aconst_null
     707: iconst_4
     708: aconst_null
     709: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     712: aastore
     713: aload_1
     714: bipush        24
     716: new           #166                // class solutions/CHK/Item
     719: dup
     720: bipush        89
     722: bipush        20
     724: aconst_null
     725: iconst_4
     726: aconst_null
     727: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     730: aastore
     731: aload_1
     732: bipush        25
     734: new           #166                // class solutions/CHK/Item
     737: dup
     738: bipush        90
     740: bipush        21
     742: aconst_null
     743: iconst_4
     744: aconst_null
     745: invokespecial #401                // Method solutions/CHK/Item."<init>":(CILjava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     748: aastore
     749: aload_1
     750: invokestatic  #392                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     753: areturn

  private final java.util.List<solutions.CHK.BundleOffer> setupBundleOffers();
    Code:
       0: new           #116                // class solutions/CHK/BundleOffer
       3: dup
       4: iconst_3
       5: bipush        45
       7: iconst_5
       8: anewarray     #136                // class java/lang/Character
      11: astore_1
      12: aload_1
      13: iconst_0
      14: bipush        83
      16: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      19: aastore
      20: aload_1
      21: iconst_1
      22: bipush        84
      24: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      27: aastore
      28: aload_1
      29: iconst_2
      30: bipush        88
      32: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      35: aastore
      36: aload_1
      37: iconst_3
      38: bipush        89
      40: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      43: aastore
      44: aload_1
      45: iconst_4
      46: bipush        90
      48: invokestatic  #231                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      51: aastore
      52: aload_1
      53: invokestatic  #392                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      56: invokespecial #405                // Method solutions/CHK/BundleOffer."<init>":(IILjava/util/List;)V
      59: invokestatic  #398                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
      62: areturn

  static {};
    Code:
       0: new           #2                  // class solutions/CHK/CheckoutSolution
       3: dup
       4: invokespecial #407                // Method "<init>":()V
       7: putstatic     #119                // Field INSTANCE:Lsolutions/CHK/CheckoutSolution;
      10: return
}

Compiled from "_Collections.kt"
public final class solutions.CHK.CheckoutSolution$getCheckoutItemsMap$$inlined$groupingBy$1 implements kotlin.collections.Grouping<java.lang.Character, java.lang.Character> {
  final java.lang.Iterable $this_groupingBy;

  public solutions.CHK.CheckoutSolution$getCheckoutItemsMap$$inlined$groupingBy$1(java.lang.Iterable);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #18                 // Field $this_groupingBy:Ljava/lang/Iterable;
       5: aload_0
       6: invokespecial #21                 // Method java/lang/Object."<init>":()V
       9: return

  public java.util.Iterator<java.lang.Character> sourceIterator();
    Code:
       0: aload_0
       1: getfield      #18                 // Field $this_groupingBy:Ljava/lang/Iterable;
       4: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
       9: areturn

  public java.lang.Character keyOf(java.lang.Character);
    Code:
       0: aload_1
       1: checkcast     #37                 // class java/lang/Character
       4: invokevirtual #41                 // Method java/lang/Character.charValue:()C
       7: istore_2
       8: iconst_0
       9: istore_3
      10: iload_2
      11: invokestatic  #45                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      14: areturn
}

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

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

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

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