package All_Filters_and_Built_In_Functions

data class Hero(
        val name: String,
        val age: Int,
        val gender: Gender?
)
enum class Gender { MALE, FEMALE }

fun main (args: Array<String>){
    val heroes = listOf(
            Hero("The Captain", 60, Gender.MALE),
            Hero("Frenchy", 42, Gender.MALE),
            Hero("<NAME>", 9, null),
            Hero("<NAME>", 29, Gender.FEMALE),
            Hero("<NAME>", 29, Gender.MALE),
            Hero("<NAME>", 37, Gender.MALE))

    println(heroes.last().name)
    println(heroes.firstOrNull { it.age == 30 }?.name)
    println()

    try {
        println(heroes.first { it.age == 30 }.name) // It will throw exception
    } catch (e: Exception){
        println(e)}
    println()

    println(heroes.map { it.gender })
    println()

    println(heroes.map { it.age })
    println(heroes.map { it.age }.distinct())
    println(heroes.map { it.age }.distinct().size) // distinct() function will count two 29 ages once
    println()

    println(heroes.filter { it.age<30 }.size) // .filter shows output based on the given condition
    val (youngest, oldest) = heroes.partition { it.age < 30 }  // .partition is similar to .filter
    println(oldest.size)
    println(youngest.size)
    println()

    println(heroes.maxBy { it.age }?.name) // .maxBy shows output based on the maximum value of given condition
    println(heroes.minBy { it.age }?.name) // .minBy shows output based on the minimum value of given condition
    println(heroes.groupBy { it.age==29 })
    println()

    println(heroes.all { it.age<50 }) // here .all checks if all the values of ages are less than 50
    println()

    println(heroes.any { it.gender == Gender.FEMALE }) // checks if any gender is FEMALE
    println()

    val mapByAge: Map<Int, List<Hero>> = heroes.groupBy { it.age }
    val (age, group) = mapByAge.maxBy { (_, group) -> group.size }!!
    println("$age $group")

    val mapByName: Map<String, Hero> = heroes.associateBy { it.name }  // age of Frenchy
    println(mapByName["Frenchy"]?.age) // map[key]
    println(mapByName.getValue("Frenchy").age) // map.getValue(key)
    println(mapByName["Unknown"]?.age) // map[key]
    try {
        println(mapByName.getValue("Unknown").age) // map.getValue(key)
    } catch (e:Exception){ println(e) }

    val mapByName1 = heroes.associate { it.name to it.age }
    println(mapByName1.getOrElse("Unknown") { 0 })

    val mapByName2 = heroes.associateBy { it.name }
    val unknownHero = Hero("Unknown", 25, null)
    println(mapByName2.getOrElse("unknown") { unknownHero }.age)

    // print maximum and minimum value using "flatMap" function
    val allPossiblePairs = heroes
            .flatMap { first -> heroes.map { second -> first to second }}
    val (older, younger) = allPossiblePairs.maxBy { it.first.age - it.second.age }!!
    println(older.name + ", " + younger.name)

}

Compiled from "getOrElse_first_last_map_max_min_filter_all_any_associateBy_groupBy.kt"
public final class All_Filters_and_Built_In_Functions.GetOrElse_first_last_map_max_min_filter_all_any_associateBy_groupByKt {
  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #11                 // String args
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: bipush        6
       8: anewarray     #19                 // class All_Filters_and_Built_In_Functions/Hero
      11: astore_2
      12: aload_2
      13: iconst_0
      14: new           #19                 // class All_Filters_and_Built_In_Functions/Hero
      17: dup
      18: ldc           #21                 // String The Captain
      20: bipush        60
      22: getstatic     #27                 // Field All_Filters_and_Built_In_Functions/Gender.MALE:LAll_Filters_and_Built_In_Functions/Gender;
      25: invokespecial #31                 // Method All_Filters_and_Built_In_Functions/Hero."<init>":(Ljava/lang/String;ILAll_Filters_and_Built_In_Functions/Gender;)V
      28: aastore
      29: aload_2
      30: iconst_1
      31: new           #19                 // class All_Filters_and_Built_In_Functions/Hero
      34: dup
      35: ldc           #33                 // String Frenchy
      37: bipush        42
      39: getstatic     #27                 // Field All_Filters_and_Built_In_Functions/Gender.MALE:LAll_Filters_and_Built_In_Functions/Gender;
      42: invokespecial #31                 // Method All_Filters_and_Built_In_Functions/Hero."<init>":(Ljava/lang/String;ILAll_Filters_and_Built_In_Functions/Gender;)V
      45: aastore
      46: aload_2
      47: iconst_2
      48: new           #19                 // class All_Filters_and_Built_In_Functions/Hero
      51: dup
      52: ldc           #35                 // String <NAME>
      54: bipush        9
      56: aconst_null
      57: invokespecial #31                 // Method All_Filters_and_Built_In_Functions/Hero."<init>":(Ljava/lang/String;ILAll_Filters_and_Built_In_Functions/Gender;)V
      60: aastore
      61: aload_2
      62: iconst_3
      63: new           #19                 // class All_Filters_and_Built_In_Functions/Hero
      66: dup
      67: ldc           #35                 // String <NAME>
      69: bipush        29
      71: getstatic     #38                 // Field All_Filters_and_Built_In_Functions/Gender.FEMALE:LAll_Filters_and_Built_In_Functions/Gender;
      74: invokespecial #31                 // Method All_Filters_and_Built_In_Functions/Hero."<init>":(Ljava/lang/String;ILAll_Filters_and_Built_In_Functions/Gender;)V
      77: aastore
      78: aload_2
      79: iconst_4
      80: new           #19                 // class All_Filters_and_Built_In_Functions/Hero
      83: dup
      84: ldc           #35                 // String <NAME>
      86: bipush        29
      88: getstatic     #27                 // Field All_Filters_and_Built_In_Functions/Gender.MALE:LAll_Filters_and_Built_In_Functions/Gender;
      91: invokespecial #31                 // Method All_Filters_and_Built_In_Functions/Hero."<init>":(Ljava/lang/String;ILAll_Filters_and_Built_In_Functions/Gender;)V
      94: aastore
      95: aload_2
      96: iconst_5
      97: new           #19                 // class All_Filters_and_Built_In_Functions/Hero
     100: dup
     101: ldc           #35                 // String <NAME>
     103: bipush        37
     105: getstatic     #27                 // Field All_Filters_and_Built_In_Functions/Gender.MALE:LAll_Filters_and_Built_In_Functions/Gender;
     108: invokespecial #31                 // Method All_Filters_and_Built_In_Functions/Hero."<init>":(Ljava/lang/String;ILAll_Filters_and_Built_In_Functions/Gender;)V
     111: aastore
     112: aload_2
     113: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     116: astore_1
     117: aload_1
     118: invokestatic  #48                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     121: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     124: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
     127: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     130: swap
     131: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     134: aload_1
     135: checkcast     #66                 // class java/lang/Iterable
     138: astore_3
     139: iconst_0
     140: istore        4
     142: aload_3
     143: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     148: astore        5
     150: aload         5
     152: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     157: ifeq          202
     160: aload         5
     162: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     167: astore        6
     169: aload         6
     171: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     174: astore        7
     176: iconst_0
     177: istore        8
     179: aload         7
     181: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
     184: bipush        30
     186: if_icmpne     193
     189: iconst_1
     190: goto          194
     193: iconst_0
     194: ifeq          150
     197: aload         6
     199: goto          203
     202: aconst_null
     203: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     206: dup
     207: ifnull        216
     210: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
     213: goto          218
     216: pop
     217: aconst_null
     218: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     221: swap
     222: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     225: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     228: invokevirtual #87                 // Method java/io/PrintStream.println:()V
     231: nop
     232: aload_1
     233: checkcast     #66                 // class java/lang/Iterable
     236: astore_2
     237: iconst_0
     238: istore_3
     239: aload_2
     240: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     245: astore        4
     247: aload         4
     249: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     254: ifeq          299
     257: aload         4
     259: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     264: astore        5
     266: aload         5
     268: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     271: astore        6
     273: iconst_0
     274: istore        7
     276: aload         6
     278: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
     281: bipush        30
     283: if_icmpne     290
     286: iconst_1
     287: goto          291
     290: iconst_0
     291: ifeq          247
     294: aload         5
     296: goto          309
     299: new           #89                 // class java/util/NoSuchElementException
     302: dup
     303: ldc           #91                 // String Collection contains no element matching the predicate.
     305: invokespecial #94                 // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
     308: athrow
     309: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     312: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
     315: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     318: swap
     319: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     322: goto          333
     325: astore_2
     326: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     329: aload_2
     330: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     333: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     336: invokevirtual #87                 // Method java/io/PrintStream.println:()V
     339: aload_1
     340: checkcast     #66                 // class java/lang/Iterable
     343: astore_2
     344: iconst_0
     345: istore_3
     346: aload_2
     347: astore        4
     349: new           #96                 // class java/util/ArrayList
     352: dup
     353: aload_2
     354: bipush        10
     356: invokestatic  #100                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     359: invokespecial #103                // Method java/util/ArrayList."<init>":(I)V
     362: checkcast     #105                // class java/util/Collection
     365: astore        5
     367: iconst_0
     368: istore        6
     370: aload         4
     372: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     377: astore        7
     379: aload         7
     381: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     386: ifeq          429
     389: aload         7
     391: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     396: astore        8
     398: aload         5
     400: aload         8
     402: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     405: astore        9
     407: astore        33
     409: iconst_0
     410: istore        10
     412: aload         9
     414: invokevirtual #109                // Method All_Filters_and_Built_In_Functions/Hero.getGender:()LAll_Filters_and_Built_In_Functions/Gender;
     417: aload         33
     419: swap
     420: invokeinterface #113,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     425: pop
     426: goto          379
     429: aload         5
     431: checkcast     #115                // class java/util/List
     434: nop
     435: astore_2
     436: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     439: aload_2
     440: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     443: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     446: invokevirtual #87                 // Method java/io/PrintStream.println:()V
     449: aload_1
     450: checkcast     #66                 // class java/lang/Iterable
     453: astore_2
     454: iconst_0
     455: istore_3
     456: aload_2
     457: astore        4
     459: new           #96                 // class java/util/ArrayList
     462: dup
     463: aload_2
     464: bipush        10
     466: invokestatic  #100                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     469: invokespecial #103                // Method java/util/ArrayList."<init>":(I)V
     472: checkcast     #105                // class java/util/Collection
     475: astore        5
     477: iconst_0
     478: istore        6
     480: aload         4
     482: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     487: astore        7
     489: aload         7
     491: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     496: ifeq          542
     499: aload         7
     501: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     506: astore        8
     508: aload         5
     510: aload         8
     512: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     515: astore        9
     517: astore        33
     519: iconst_0
     520: istore        10
     522: aload         9
     524: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
     527: invokestatic  #121                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     530: aload         33
     532: swap
     533: invokeinterface #113,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     538: pop
     539: goto          489
     542: aload         5
     544: checkcast     #115                // class java/util/List
     547: nop
     548: astore_2
     549: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     552: aload_2
     553: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     556: aload_1
     557: checkcast     #66                 // class java/lang/Iterable
     560: astore_2
     561: iconst_0
     562: istore_3
     563: aload_2
     564: astore        4
     566: new           #96                 // class java/util/ArrayList
     569: dup
     570: aload_2
     571: bipush        10
     573: invokestatic  #100                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     576: invokespecial #103                // Method java/util/ArrayList."<init>":(I)V
     579: checkcast     #105                // class java/util/Collection
     582: astore        5
     584: iconst_0
     585: istore        6
     587: aload         4
     589: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     594: astore        7
     596: aload         7
     598: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     603: ifeq          649
     606: aload         7
     608: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     613: astore        8
     615: aload         5
     617: aload         8
     619: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     622: astore        9
     624: astore        33
     626: iconst_0
     627: istore        10
     629: aload         9
     631: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
     634: invokestatic  #121                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     637: aload         33
     639: swap
     640: invokeinterface #113,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     645: pop
     646: goto          596
     649: aload         5
     651: checkcast     #115                // class java/util/List
     654: nop
     655: checkcast     #66                 // class java/lang/Iterable
     658: invokestatic  #125                // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;
     661: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     664: swap
     665: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     668: aload_1
     669: checkcast     #66                 // class java/lang/Iterable
     672: astore_2
     673: iconst_0
     674: istore_3
     675: aload_2
     676: astore        4
     678: new           #96                 // class java/util/ArrayList
     681: dup
     682: aload_2
     683: bipush        10
     685: invokestatic  #100                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     688: invokespecial #103                // Method java/util/ArrayList."<init>":(I)V
     691: checkcast     #105                // class java/util/Collection
     694: astore        5
     696: iconst_0
     697: istore        6
     699: aload         4
     701: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     706: astore        7
     708: aload         7
     710: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     715: ifeq          761
     718: aload         7
     720: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     725: astore        8
     727: aload         5
     729: aload         8
     731: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     734: astore        9
     736: astore        33
     738: iconst_0
     739: istore        10
     741: aload         9
     743: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
     746: invokestatic  #121                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     749: aload         33
     751: swap
     752: invokeinterface #113,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     757: pop
     758: goto          708
     761: aload         5
     763: checkcast     #115                // class java/util/List
     766: nop
     767: checkcast     #66                 // class java/lang/Iterable
     770: invokestatic  #125                // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;
     773: invokeinterface #128,  1          // InterfaceMethod java/util/List.size:()I
     778: istore_2
     779: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     782: iload_2
     783: invokevirtual #130                // Method java/io/PrintStream.println:(I)V
     786: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     789: invokevirtual #87                 // Method java/io/PrintStream.println:()V
     792: aload_1
     793: checkcast     #66                 // class java/lang/Iterable
     796: astore_2
     797: iconst_0
     798: istore_3
     799: aload_2
     800: astore        4
     802: new           #96                 // class java/util/ArrayList
     805: dup
     806: invokespecial #132                // Method java/util/ArrayList."<init>":()V
     809: checkcast     #105                // class java/util/Collection
     812: astore        5
     814: iconst_0
     815: istore        6
     817: aload         4
     819: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     824: astore        7
     826: aload         7
     828: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     833: ifeq          886
     836: aload         7
     838: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     843: astore        8
     845: aload         8
     847: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     850: astore        9
     852: iconst_0
     853: istore        10
     855: aload         9
     857: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
     860: bipush        30
     862: if_icmpge     869
     865: iconst_1
     866: goto          870
     869: iconst_0
     870: ifeq          826
     873: aload         5
     875: aload         8
     877: invokeinterface #113,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     882: pop
     883: goto          826
     886: aload         5
     888: checkcast     #115                // class java/util/List
     891: nop
     892: invokeinterface #128,  1          // InterfaceMethod java/util/List.size:()I
     897: istore_2
     898: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
     901: iload_2
     902: invokevirtual #130                // Method java/io/PrintStream.println:(I)V
     905: aload_1
     906: checkcast     #66                 // class java/lang/Iterable
     909: astore_3
     910: iconst_0
     911: istore        4
     913: new           #96                 // class java/util/ArrayList
     916: dup
     917: invokespecial #132                // Method java/util/ArrayList."<init>":()V
     920: astore        5
     922: new           #96                 // class java/util/ArrayList
     925: dup
     926: invokespecial #132                // Method java/util/ArrayList."<init>":()V
     929: astore        6
     931: aload_3
     932: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     937: astore        7
     939: aload         7
     941: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     946: ifeq          1007
     949: aload         7
     951: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     956: astore        8
     958: aload         8
     960: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
     963: astore        9
     965: iconst_0
     966: istore        10
     968: aload         9
     970: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
     973: bipush        30
     975: if_icmpge     982
     978: iconst_1
     979: goto          983
     982: iconst_0
     983: ifeq          996
     986: aload         5
     988: aload         8
     990: invokevirtual #133                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     993: goto          1003
     996: aload         6
     998: aload         8
    1000: invokevirtual #133                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
    1003: pop
    1004: goto          939
    1007: new           #135                // class kotlin/Pair
    1010: dup
    1011: aload         5
    1013: aload         6
    1015: invokespecial #138                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
    1018: astore_2
    1019: aload_2
    1020: invokevirtual #141                // Method kotlin/Pair.component1:()Ljava/lang/Object;
    1023: checkcast     #115                // class java/util/List
    1026: astore_3
    1027: aload_2
    1028: invokevirtual #144                // Method kotlin/Pair.component2:()Ljava/lang/Object;
    1031: checkcast     #115                // class java/util/List
    1034: astore        4
    1036: aload         4
    1038: invokeinterface #128,  1          // InterfaceMethod java/util/List.size:()I
    1043: istore        5
    1045: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1048: iload         5
    1050: invokevirtual #130                // Method java/io/PrintStream.println:(I)V
    1053: aload_3
    1054: invokeinterface #128,  1          // InterfaceMethod java/util/List.size:()I
    1059: istore        5
    1061: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1064: iload         5
    1066: invokevirtual #130                // Method java/io/PrintStream.println:(I)V
    1069: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1072: invokevirtual #87                 // Method java/io/PrintStream.println:()V
    1075: aload_1
    1076: checkcast     #66                 // class java/lang/Iterable
    1079: astore        6
    1081: iconst_0
    1082: istore        7
    1084: aload         6
    1086: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1091: astore        8
    1093: aload         8
    1095: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1100: ifne          1111
    1103: new           #89                 // class java/util/NoSuchElementException
    1106: dup
    1107: invokespecial #145                // Method java/util/NoSuchElementException."<init>":()V
    1110: athrow
    1111: aload         8
    1113: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1118: astore        9
    1120: aload         8
    1122: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1127: ifne          1135
    1130: aload         9
    1132: goto          1205
    1135: aload         9
    1137: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1140: astore        10
    1142: iconst_0
    1143: istore        11
    1145: aload         10
    1147: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    1150: istore        10
    1152: aload         8
    1154: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1159: astore        11
    1161: aload         11
    1163: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1166: astore        12
    1168: iconst_0
    1169: istore        13
    1171: aload         12
    1173: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    1176: istore        12
    1178: iload         10
    1180: iload         12
    1182: if_icmpge     1193
    1185: aload         11
    1187: astore        9
    1189: iload         12
    1191: istore        10
    1193: aload         8
    1195: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1200: ifne          1152
    1203: aload         9
    1205: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1208: dup
    1209: ifnull        1218
    1212: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
    1215: goto          1220
    1218: pop
    1219: aconst_null
    1220: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1223: swap
    1224: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1227: aload_1
    1228: checkcast     #66                 // class java/lang/Iterable
    1231: astore        6
    1233: iconst_0
    1234: istore        7
    1236: aload         6
    1238: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1243: astore        8
    1245: aload         8
    1247: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1252: ifne          1263
    1255: new           #89                 // class java/util/NoSuchElementException
    1258: dup
    1259: invokespecial #145                // Method java/util/NoSuchElementException."<init>":()V
    1262: athrow
    1263: aload         8
    1265: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1270: astore        9
    1272: aload         8
    1274: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1279: ifne          1287
    1282: aload         9
    1284: goto          1357
    1287: aload         9
    1289: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1292: astore        10
    1294: iconst_0
    1295: istore        11
    1297: aload         10
    1299: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    1302: istore        10
    1304: aload         8
    1306: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1311: astore        11
    1313: aload         11
    1315: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1318: astore        12
    1320: iconst_0
    1321: istore        13
    1323: aload         12
    1325: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    1328: istore        12
    1330: iload         10
    1332: iload         12
    1334: if_icmple     1345
    1337: aload         11
    1339: astore        9
    1341: iload         12
    1343: istore        10
    1345: aload         8
    1347: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1352: ifne          1304
    1355: aload         9
    1357: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1360: dup
    1361: ifnull        1370
    1364: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
    1367: goto          1372
    1370: pop
    1371: aconst_null
    1372: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1375: swap
    1376: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1379: aload_1
    1380: checkcast     #66                 // class java/lang/Iterable
    1383: astore        5
    1385: iconst_0
    1386: istore        6
    1388: aload         5
    1390: astore        7
    1392: new           #147                // class java/util/LinkedHashMap
    1395: dup
    1396: invokespecial #148                // Method java/util/LinkedHashMap."<init>":()V
    1399: checkcast     #150                // class java/util/Map
    1402: astore        8
    1404: iconst_0
    1405: istore        9
    1407: aload         7
    1409: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1414: astore        10
    1416: aload         10
    1418: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1423: ifeq          1541
    1426: aload         10
    1428: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1433: astore        11
    1435: aload         11
    1437: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1440: astore        12
    1442: iconst_0
    1443: istore        13
    1445: aload         12
    1447: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    1450: bipush        29
    1452: if_icmpne     1459
    1455: iconst_1
    1456: goto          1460
    1459: iconst_0
    1460: invokestatic  #155                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
    1463: astore        14
    1465: aload         8
    1467: astore        15
    1469: iconst_0
    1470: istore        16
    1472: aload         15
    1474: aload         14
    1476: invokeinterface #159,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1481: astore        17
    1483: aload         17
    1485: ifnonnull     1520
    1488: iconst_0
    1489: istore        18
    1491: new           #96                 // class java/util/ArrayList
    1494: dup
    1495: invokespecial #132                // Method java/util/ArrayList."<init>":()V
    1498: checkcast     #115                // class java/util/List
    1501: astore        18
    1503: aload         15
    1505: aload         14
    1507: aload         18
    1509: invokeinterface #163,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1514: pop
    1515: aload         18
    1517: goto          1522
    1520: aload         17
    1522: nop
    1523: checkcast     #115                // class java/util/List
    1526: astore        12
    1528: aload         12
    1530: aload         11
    1532: invokeinterface #164,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
    1537: pop
    1538: goto          1416
    1541: aload         8
    1543: nop
    1544: astore        5
    1546: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1549: aload         5
    1551: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    1554: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1557: invokevirtual #87                 // Method java/io/PrintStream.println:()V
    1560: aload_1
    1561: checkcast     #66                 // class java/lang/Iterable
    1564: astore        5
    1566: iconst_0
    1567: istore        6
    1569: aload         5
    1571: instanceof    #105                // class java/util/Collection
    1574: ifeq          1594
    1577: aload         5
    1579: checkcast     #105                // class java/util/Collection
    1582: invokeinterface #167,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
    1587: ifeq          1594
    1590: iconst_1
    1591: goto          1655
    1594: aload         5
    1596: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1601: astore        7
    1603: aload         7
    1605: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1610: ifeq          1654
    1613: aload         7
    1615: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1620: astore        8
    1622: aload         8
    1624: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1627: astore        9
    1629: iconst_0
    1630: istore        10
    1632: aload         9
    1634: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    1637: bipush        50
    1639: if_icmpge     1646
    1642: iconst_1
    1643: goto          1647
    1646: iconst_0
    1647: ifne          1603
    1650: iconst_0
    1651: goto          1655
    1654: iconst_1
    1655: istore        5
    1657: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1660: iload         5
    1662: invokevirtual #170                // Method java/io/PrintStream.println:(Z)V
    1665: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1668: invokevirtual #87                 // Method java/io/PrintStream.println:()V
    1671: aload_1
    1672: checkcast     #66                 // class java/lang/Iterable
    1675: astore        5
    1677: iconst_0
    1678: istore        6
    1680: aload         5
    1682: instanceof    #105                // class java/util/Collection
    1685: ifeq          1705
    1688: aload         5
    1690: checkcast     #105                // class java/util/Collection
    1693: invokeinterface #167,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
    1698: ifeq          1705
    1701: iconst_0
    1702: goto          1767
    1705: aload         5
    1707: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1712: astore        7
    1714: aload         7
    1716: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1721: ifeq          1766
    1724: aload         7
    1726: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1731: astore        8
    1733: aload         8
    1735: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1738: astore        9
    1740: iconst_0
    1741: istore        10
    1743: aload         9
    1745: invokevirtual #109                // Method All_Filters_and_Built_In_Functions/Hero.getGender:()LAll_Filters_and_Built_In_Functions/Gender;
    1748: getstatic     #38                 // Field All_Filters_and_Built_In_Functions/Gender.FEMALE:LAll_Filters_and_Built_In_Functions/Gender;
    1751: if_acmpne     1758
    1754: iconst_1
    1755: goto          1759
    1758: iconst_0
    1759: ifeq          1714
    1762: iconst_1
    1763: goto          1767
    1766: iconst_0
    1767: istore        5
    1769: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1772: iload         5
    1774: invokevirtual #170                // Method java/io/PrintStream.println:(Z)V
    1777: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    1780: invokevirtual #87                 // Method java/io/PrintStream.println:()V
    1783: aload_1
    1784: checkcast     #66                 // class java/lang/Iterable
    1787: astore        6
    1789: iconst_0
    1790: istore        7
    1792: aload         6
    1794: astore        8
    1796: new           #147                // class java/util/LinkedHashMap
    1799: dup
    1800: invokespecial #148                // Method java/util/LinkedHashMap."<init>":()V
    1803: checkcast     #150                // class java/util/Map
    1806: astore        9
    1808: iconst_0
    1809: istore        10
    1811: aload         8
    1813: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1818: astore        11
    1820: aload         11
    1822: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1827: ifeq          1935
    1830: aload         11
    1832: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1837: astore        12
    1839: aload         12
    1841: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    1844: astore        13
    1846: iconst_0
    1847: istore        14
    1849: aload         13
    1851: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    1854: invokestatic  #121                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1857: astore        15
    1859: aload         9
    1861: astore        16
    1863: iconst_0
    1864: istore        17
    1866: aload         16
    1868: aload         15
    1870: invokeinterface #159,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1875: astore        18
    1877: aload         18
    1879: ifnonnull     1914
    1882: iconst_0
    1883: istore        19
    1885: new           #96                 // class java/util/ArrayList
    1888: dup
    1889: invokespecial #132                // Method java/util/ArrayList."<init>":()V
    1892: checkcast     #115                // class java/util/List
    1895: astore        19
    1897: aload         16
    1899: aload         15
    1901: aload         19
    1903: invokeinterface #163,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1908: pop
    1909: aload         19
    1911: goto          1916
    1914: aload         18
    1916: nop
    1917: checkcast     #115                // class java/util/List
    1920: astore        13
    1922: aload         13
    1924: aload         12
    1926: invokeinterface #164,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
    1931: pop
    1932: goto          1820
    1935: aload         9
    1937: nop
    1938: astore        5
    1940: aload         5
    1942: invokeinterface #174,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
    1947: checkcast     #66                 // class java/lang/Iterable
    1950: astore        8
    1952: aload         8
    1954: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1959: astore        9
    1961: aload         9
    1963: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1968: ifne          1979
    1971: new           #89                 // class java/util/NoSuchElementException
    1974: dup
    1975: invokespecial #145                // Method java/util/NoSuchElementException."<init>":()V
    1978: athrow
    1979: aload         9
    1981: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1986: astore        10
    1988: aload         9
    1990: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1995: ifne          2003
    1998: aload         10
    2000: goto          2101
    2003: aload         10
    2005: checkcast     #176                // class java/util/Map$Entry
    2008: astore        11
    2010: iconst_0
    2011: istore        12
    2013: aload         11
    2015: invokeinterface #179,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    2020: checkcast     #115                // class java/util/List
    2023: astore        13
    2025: aload         13
    2027: invokeinterface #128,  1          // InterfaceMethod java/util/List.size:()I
    2032: istore        11
    2034: aload         9
    2036: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2041: astore        12
    2043: aload         12
    2045: checkcast     #176                // class java/util/Map$Entry
    2048: astore        13
    2050: iconst_0
    2051: istore        14
    2053: aload         13
    2055: invokeinterface #179,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    2060: checkcast     #115                // class java/util/List
    2063: astore        15
    2065: aload         15
    2067: invokeinterface #128,  1          // InterfaceMethod java/util/List.size:()I
    2072: istore        13
    2074: iload         11
    2076: iload         13
    2078: if_icmpge     2089
    2081: aload         12
    2083: astore        10
    2085: iload         13
    2087: istore        11
    2089: aload         9
    2091: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2096: ifne          2034
    2099: aload         10
    2101: checkcast     #176                // class java/util/Map$Entry
    2104: dup
    2105: invokestatic  #182                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    2108: astore        6
    2110: aload         6
    2112: invokeinterface #185,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
    2117: checkcast     #187                // class java/lang/Number
    2120: invokevirtual #190                // Method java/lang/Number.intValue:()I
    2123: istore        7
    2125: aload         6
    2127: invokeinterface #179,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    2132: checkcast     #115                // class java/util/List
    2135: astore        8
    2137: new           #192                // class java/lang/StringBuilder
    2140: dup
    2141: invokespecial #193                // Method java/lang/StringBuilder."<init>":()V
    2144: iload         7
    2146: invokevirtual #197                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
    2149: bipush        32
    2151: invokevirtual #200                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
    2154: aload         8
    2156: invokevirtual #203                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    2159: invokevirtual #206                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    2162: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    2165: swap
    2166: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2169: aload_1
    2170: checkcast     #66                 // class java/lang/Iterable
    2173: astore        10
    2175: iconst_0
    2176: istore        11
    2178: aload         10
    2180: bipush        10
    2182: invokestatic  #100                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    2185: invokestatic  #212                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
    2188: bipush        16
    2190: invokestatic  #218                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
    2193: istore        12
    2195: aload         10
    2197: astore        13
    2199: new           #147                // class java/util/LinkedHashMap
    2202: dup
    2203: iload         12
    2205: invokespecial #219                // Method java/util/LinkedHashMap."<init>":(I)V
    2208: checkcast     #150                // class java/util/Map
    2211: astore        14
    2213: iconst_0
    2214: istore        15
    2216: aload         13
    2218: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    2223: astore        16
    2225: aload         16
    2227: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2232: ifeq          2277
    2235: aload         16
    2237: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2242: astore        17
    2244: aload         14
    2246: aload         17
    2248: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2251: astore        18
    2253: astore        33
    2255: iconst_0
    2256: istore        19
    2258: aload         18
    2260: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
    2263: aload         33
    2265: swap
    2266: aload         17
    2268: invokeinterface #163,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    2273: pop
    2274: goto          2225
    2277: aload         14
    2279: nop
    2280: astore        9
    2282: aload         9
    2284: ldc           #33                 // String Frenchy
    2286: invokeinterface #159,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    2291: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2294: dup
    2295: ifnull        2307
    2298: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    2301: invokestatic  #121                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    2304: goto          2309
    2307: pop
    2308: aconst_null
    2309: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    2312: swap
    2313: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2316: aload         9
    2318: ldc           #33                 // String Frenchy
    2320: invokestatic  #222                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
    2323: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2326: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    2329: istore        10
    2331: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    2334: iload         10
    2336: invokevirtual #130                // Method java/io/PrintStream.println:(I)V
    2339: aload         9
    2341: ldc           #224                // String Unknown
    2343: invokeinterface #159,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    2348: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2351: dup
    2352: ifnull        2364
    2355: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    2358: invokestatic  #121                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    2361: goto          2366
    2364: pop
    2365: aconst_null
    2366: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    2369: swap
    2370: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2373: nop
    2374: aload         9
    2376: ldc           #224                // String Unknown
    2378: invokestatic  #222                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
    2381: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2384: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    2387: istore        10
    2389: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    2392: iload         10
    2394: invokevirtual #130                // Method java/io/PrintStream.println:(I)V
    2397: goto          2410
    2400: astore        10
    2402: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    2405: aload         10
    2407: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    2410: aload_1
    2411: checkcast     #66                 // class java/lang/Iterable
    2414: astore        11
    2416: iconst_0
    2417: istore        12
    2419: aload         11
    2421: bipush        10
    2423: invokestatic  #100                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    2426: invokestatic  #212                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
    2429: bipush        16
    2431: invokestatic  #218                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
    2434: istore        13
    2436: aload         11
    2438: astore        14
    2440: new           #147                // class java/util/LinkedHashMap
    2443: dup
    2444: iload         13
    2446: invokespecial #219                // Method java/util/LinkedHashMap."<init>":(I)V
    2449: checkcast     #150                // class java/util/Map
    2452: astore        15
    2454: iconst_0
    2455: istore        16
    2457: aload         14
    2459: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    2464: astore        17
    2466: aload         17
    2468: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2473: ifeq          2538
    2476: aload         17
    2478: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2483: astore        18
    2485: aload         15
    2487: astore        19
    2489: aload         18
    2491: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2494: astore        20
    2496: iconst_0
    2497: istore        21
    2499: aload         20
    2501: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
    2504: aload         20
    2506: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    2509: invokestatic  #121                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    2512: invokestatic  #230                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    2515: astore        20
    2517: aload         19
    2519: aload         20
    2521: invokevirtual #233                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
    2524: aload         20
    2526: invokevirtual #236                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
    2529: invokeinterface #163,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    2534: pop
    2535: goto          2466
    2538: aload         15
    2540: nop
    2541: astore        10
    2543: aload         10
    2545: astore        11
    2547: aload         11
    2549: ldc           #224                // String Unknown
    2551: invokeinterface #159,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    2556: dup
    2557: ifnonnull     2568
    2560: pop
    2561: iconst_0
    2562: istore        13
    2564: iconst_0
    2565: invokestatic  #121                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    2568: checkcast     #187                // class java/lang/Number
    2571: invokevirtual #190                // Method java/lang/Number.intValue:()I
    2574: istore        11
    2576: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    2579: iload         11
    2581: invokevirtual #130                // Method java/io/PrintStream.println:(I)V
    2584: aload_1
    2585: checkcast     #66                 // class java/lang/Iterable
    2588: astore        12
    2590: iconst_0
    2591: istore        13
    2593: aload         12
    2595: bipush        10
    2597: invokestatic  #100                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    2600: invokestatic  #212                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
    2603: bipush        16
    2605: invokestatic  #218                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
    2608: istore        14
    2610: aload         12
    2612: astore        15
    2614: new           #147                // class java/util/LinkedHashMap
    2617: dup
    2618: iload         14
    2620: invokespecial #219                // Method java/util/LinkedHashMap."<init>":(I)V
    2623: checkcast     #150                // class java/util/Map
    2626: astore        16
    2628: iconst_0
    2629: istore        17
    2631: aload         15
    2633: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    2638: astore        18
    2640: aload         18
    2642: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2647: ifeq          2692
    2650: aload         18
    2652: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2657: astore        19
    2659: aload         16
    2661: aload         19
    2663: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2666: astore        20
    2668: astore        33
    2670: iconst_0
    2671: istore        21
    2673: aload         20
    2675: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
    2678: aload         33
    2680: swap
    2681: aload         19
    2683: invokeinterface #163,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    2688: pop
    2689: goto          2640
    2692: aload         16
    2694: nop
    2695: astore        11
    2697: new           #19                 // class All_Filters_and_Built_In_Functions/Hero
    2700: dup
    2701: ldc           #224                // String Unknown
    2703: bipush        25
    2705: aconst_null
    2706: invokespecial #31                 // Method All_Filters_and_Built_In_Functions/Hero."<init>":(Ljava/lang/String;ILAll_Filters_and_Built_In_Functions/Gender;)V
    2709: astore        12
    2711: aload         11
    2713: astore        13
    2715: aload         13
    2717: ldc           #238                // String unknown
    2719: invokeinterface #159,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    2724: dup
    2725: ifnonnull     2734
    2728: pop
    2729: iconst_0
    2730: istore        15
    2732: aload         12
    2734: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2737: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    2740: istore        13
    2742: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    2745: iload         13
    2747: invokevirtual #130                // Method java/io/PrintStream.println:(I)V
    2750: aload_1
    2751: checkcast     #66                 // class java/lang/Iterable
    2754: astore        14
    2756: nop
    2757: iconst_0
    2758: istore        15
    2760: aload         14
    2762: astore        16
    2764: new           #96                 // class java/util/ArrayList
    2767: dup
    2768: invokespecial #132                // Method java/util/ArrayList."<init>":()V
    2771: checkcast     #105                // class java/util/Collection
    2774: astore        17
    2776: iconst_0
    2777: istore        18
    2779: aload         16
    2781: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    2786: astore        19
    2788: aload         19
    2790: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2795: ifeq          2936
    2798: aload         19
    2800: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2805: astore        20
    2807: aload         20
    2809: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2812: astore        21
    2814: iconst_0
    2815: istore        22
    2817: aload_1
    2818: checkcast     #66                 // class java/lang/Iterable
    2821: astore        23
    2823: iconst_0
    2824: istore        24
    2826: aload         23
    2828: astore        25
    2830: new           #96                 // class java/util/ArrayList
    2833: dup
    2834: aload         23
    2836: bipush        10
    2838: invokestatic  #100                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    2841: invokespecial #103                // Method java/util/ArrayList."<init>":(I)V
    2844: checkcast     #105                // class java/util/Collection
    2847: astore        26
    2849: iconst_0
    2850: istore        27
    2852: aload         25
    2854: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    2859: astore        28
    2861: aload         28
    2863: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2868: ifeq          2913
    2871: aload         28
    2873: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2878: astore        29
    2880: aload         26
    2882: aload         29
    2884: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    2887: astore        30
    2889: astore        31
    2891: iconst_0
    2892: istore        32
    2894: aload         21
    2896: aload         30
    2898: invokestatic  #230                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    2901: aload         31
    2903: swap
    2904: invokeinterface #113,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    2909: pop
    2910: goto          2861
    2913: aload         26
    2915: checkcast     #115                // class java/util/List
    2918: nop
    2919: checkcast     #66                 // class java/lang/Iterable
    2922: nop
    2923: astore        21
    2925: aload         17
    2927: aload         21
    2929: invokestatic  #242                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
    2932: pop
    2933: goto          2788
    2936: aload         17
    2938: checkcast     #115                // class java/util/List
    2941: nop
    2942: astore        13
    2944: aload         13
    2946: checkcast     #66                 // class java/lang/Iterable
    2949: astore        15
    2951: iconst_0
    2952: istore        16
    2954: aload         15
    2956: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    2961: astore        17
    2963: aload         17
    2965: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2970: ifne          2981
    2973: new           #89                 // class java/util/NoSuchElementException
    2976: dup
    2977: invokespecial #145                // Method java/util/NoSuchElementException."<init>":()V
    2980: athrow
    2981: aload         17
    2983: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    2988: astore        18
    2990: aload         17
    2992: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    2997: ifne          3005
    3000: aload         18
    3002: goto          3111
    3005: aload         18
    3007: checkcast     #135                // class kotlin/Pair
    3010: astore        19
    3012: iconst_0
    3013: istore        20
    3015: aload         19
    3017: invokevirtual #233                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
    3020: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    3023: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    3026: aload         19
    3028: invokevirtual #236                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
    3031: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    3034: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    3037: isub
    3038: istore        19
    3040: aload         17
    3042: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    3047: astore        20
    3049: aload         20
    3051: checkcast     #135                // class kotlin/Pair
    3054: astore        21
    3056: iconst_0
    3057: istore        22
    3059: aload         21
    3061: invokevirtual #233                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
    3064: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    3067: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    3070: aload         21
    3072: invokevirtual #236                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
    3075: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    3078: invokevirtual #84                 // Method All_Filters_and_Built_In_Functions/Hero.getAge:()I
    3081: isub
    3082: istore        21
    3084: iload         19
    3086: iload         21
    3088: if_icmpge     3099
    3091: aload         20
    3093: astore        18
    3095: iload         21
    3097: istore        19
    3099: aload         17
    3101: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    3106: ifne          3040
    3109: aload         18
    3111: dup
    3112: invokestatic  #182                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
    3115: checkcast     #135                // class kotlin/Pair
    3118: astore        14
    3120: aload         14
    3122: invokevirtual #141                // Method kotlin/Pair.component1:()Ljava/lang/Object;
    3125: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    3128: astore        15
    3130: aload         14
    3132: invokevirtual #144                // Method kotlin/Pair.component2:()Ljava/lang/Object;
    3135: checkcast     #19                 // class All_Filters_and_Built_In_Functions/Hero
    3138: astore        16
    3140: new           #192                // class java/lang/StringBuilder
    3143: dup
    3144: invokespecial #193                // Method java/lang/StringBuilder."<init>":()V
    3147: aload         15
    3149: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
    3152: invokevirtual #245                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    3155: ldc           #247                // String ,
    3157: invokevirtual #245                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    3160: aload         16
    3162: invokevirtual #52                 // Method All_Filters_and_Built_In_Functions/Hero.getName:()Ljava/lang/String;
    3165: invokevirtual #245                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    3168: invokevirtual #206                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    3171: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
    3174: swap
    3175: invokevirtual #64                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    3178: return
    Exception table:
       from    to  target type
         231   322   325   Class java/lang/Exception
        2373  2397  2400   Class java/lang/Exception
}


package fr.pturpin.coursera.greedy

import java.util.*

class MaximumValueOfTheLoot(private val knapsackCapacity: Int) {

    private val formatPrecision = 4
    private var weightOfCandidates = 0
    private val sortedByLowValuationCandidates = PriorityQueue<Item>()

    fun addPotentialItem(itemValue: Int, itemWeight: Int) {
        addNewCandidate(Item(itemValue, itemWeight))

        if (!isLowestCandidateUseful()) {
            removeLowestCandidate()
        }
    }

    private fun isLowestCandidateUseful(): Boolean {
        if (weightOfCandidates <= knapsackCapacity) {
            return true
        }

        val lowestValuableCandidate = sortedByLowValuationCandidates.element()
        return weightOfCandidates - lowestValuableCandidate.weight < knapsackCapacity
    }

    private fun addNewCandidate(newCandidate: Item) {
        sortedByLowValuationCandidates.add(newCandidate)
        weightOfCandidates += newCandidate.weight
    }

    private fun removeLowestCandidate() {
        val lowestCandidate = sortedByLowValuationCandidates.remove()
        weightOfCandidates -= lowestCandidate.weight
    }

    fun getMaximalValueOfFractionsOfItemsFittingIn(): Double {
        if (knapsackCapacity == 0) {
            return 0.0
        }

        val highestValuationsValue = sortedByLowValuationCandidates.stream()
            .skip(1)
            .mapToDouble { it.value.toDouble() }
            .sum()

        val lowestValuableCandidate = sortedByLowValuationCandidates.element()
        val partialValue = if (weightOfCandidates <= knapsackCapacity) {
            lowestValuableCandidate.value.toDouble()
        } else {
            val remainingWeight = knapsackCapacity - (weightOfCandidates - lowestValuableCandidate.weight)
            lowestValuableCandidate.value * remainingWeight.toDouble() / lowestValuableCandidate.weight
        }

        return highestValuationsValue + partialValue
    }

    fun formatOutput(value: Double): String {
        val format = "%." + formatPrecision + "f"
        return format.format(Locale.US, value)
    }

    private data class Item(val value: Int, val weight: Int) : Comparable<Item> {

        private fun getValueByWeight() = value.toDouble() / weight

        override fun compareTo(other: Item): Int {
            return getValueByWeight().compareTo(other.getValueByWeight())
        }

    }

}

fun main(args: Array<String>) {
    val (n, knapsackCapacity) = readLine()!!.split(" ").map { it.toInt() }

    val maximumValueOfTheLoot = MaximumValueOfTheLoot(knapsackCapacity)

    for (i in 0 until n) {
        val (value, weight) = readLine()!!.split(" ").map { it.toInt() }

        maximumValueOfTheLoot.addPotentialItem(value, weight)
    }

    val maximalValue = maximumValueOfTheLoot.getMaximalValueOfFractionsOfItemsFittingIn()

    print(maximumValueOfTheLoot.formatOutput(maximalValue))
}

Compiled from "MaximumValueOfTheLoot.kt"
final class fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item implements java.lang.Comparable<fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item> {
  private final int value;

  private final int weight;

  public fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item(int, int);
    Code:
       0: aload_0
       1: invokespecial #12                 // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #16                 // Field value:I
       9: aload_0
      10: iload_2
      11: putfield      #19                 // Field weight:I
      14: return

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

  public final int getWeight();
    Code:
       0: aload_0
       1: getfield      #19                 // Field weight:I
       4: ireturn

  private final double getValueByWeight();
    Code:
       0: aload_0
       1: getfield      #16                 // Field value:I
       4: i2d
       5: aload_0
       6: getfield      #19                 // Field weight:I
       9: i2d
      10: ddiv
      11: dreturn

  public int compareTo(fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item);
    Code:
       0: aload_1
       1: ldc           #31                 // String other
       3: invokestatic  #37                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #39                 // Method getValueByWeight:()D
      10: aload_1
      11: invokespecial #39                 // Method getValueByWeight:()D
      14: invokestatic  #45                 // Method java/lang/Double.compare:(DD)I
      17: ireturn

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

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

  public final fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item copy(int, int);
    Code:
       0: new           #2                  // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item
       3: dup
       4: iload_1
       5: iload_2
       6: invokespecial #51                 // Method "<init>":(II)V
       9: areturn

  public static fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item copy$default(fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item, int, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #16                 // Field value:I
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #19                 // Field weight:I
      21: istore_2
      22: aload_0
      23: iload_1
      24: iload_2
      25: invokevirtual #55                 // Method copy:(II)Lfr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #59                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #62                 // String Item(value=
       9: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #16                 // Field value:I
      16: invokevirtual #69                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #71                 // String , weight=
      21: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #19                 // Field weight:I
      28: invokevirtual #69                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #74                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #76                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

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

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item
      20: astore_2
      21: aload_0
      22: getfield      #16                 // Field value:I
      25: aload_2
      26: getfield      #16                 // Field value:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #19                 // Field weight:I
      38: aload_2
      39: getfield      #19                 // Field weight:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: iconst_1
      48: ireturn

  public int compareTo(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #2                  // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item
       5: invokevirtual #90                 // Method compareTo:(Lfr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item;)I
       8: ireturn
}

Compiled from "MaximumValueOfTheLoot.kt"
public final class fr.pturpin.coursera.greedy.MaximumValueOfTheLoot {
  private final int knapsackCapacity;

  private final int formatPrecision;

  private int weightOfCandidates;

  private final java.util.PriorityQueue<fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item> sortedByLowValuationCandidates;

  public fr.pturpin.coursera.greedy.MaximumValueOfTheLoot(int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field knapsackCapacity:I
       9: aload_0
      10: iconst_4
      11: putfield      #16                 // Field formatPrecision:I
      14: aload_0
      15: new           #18                 // class java/util/PriorityQueue
      18: dup
      19: invokespecial #19                 // Method java/util/PriorityQueue."<init>":()V
      22: putfield      #23                 // Field sortedByLowValuationCandidates:Ljava/util/PriorityQueue;
      25: return

  public final void addPotentialItem(int, int);
    Code:
       0: aload_0
       1: new           #29                 // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item
       4: dup
       5: iload_1
       6: iload_2
       7: invokespecial #31                 // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item."<init>":(II)V
      10: invokespecial #35                 // Method addNewCandidate:(Lfr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item;)V
      13: aload_0
      14: invokespecial #39                 // Method isLowestCandidateUseful:()Z
      17: ifne          24
      20: aload_0
      21: invokespecial #42                 // Method removeLowestCandidate:()V
      24: return

  private final boolean isLowestCandidateUseful();
    Code:
       0: aload_0
       1: getfield      #47                 // Field weightOfCandidates:I
       4: aload_0
       5: getfield      #13                 // Field knapsackCapacity:I
       8: if_icmpgt     13
      11: iconst_1
      12: ireturn
      13: aload_0
      14: getfield      #23                 // Field sortedByLowValuationCandidates:Ljava/util/PriorityQueue;
      17: invokevirtual #51                 // Method java/util/PriorityQueue.element:()Ljava/lang/Object;
      20: checkcast     #29                 // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item
      23: astore_1
      24: aload_0
      25: getfield      #47                 // Field weightOfCandidates:I
      28: aload_1
      29: invokevirtual #55                 // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item.getWeight:()I
      32: isub
      33: aload_0
      34: getfield      #13                 // Field knapsackCapacity:I
      37: if_icmpge     44
      40: iconst_1
      41: goto          45
      44: iconst_0
      45: ireturn

  private final void addNewCandidate(fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item);
    Code:
       0: aload_0
       1: getfield      #23                 // Field sortedByLowValuationCandidates:Ljava/util/PriorityQueue;
       4: aload_1
       5: invokevirtual #61                 // Method java/util/PriorityQueue.add:(Ljava/lang/Object;)Z
       8: pop
       9: aload_0
      10: aload_0
      11: getfield      #47                 // Field weightOfCandidates:I
      14: aload_1
      15: invokevirtual #55                 // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item.getWeight:()I
      18: iadd
      19: putfield      #47                 // Field weightOfCandidates:I
      22: return

  private final void removeLowestCandidate();
    Code:
       0: aload_0
       1: getfield      #23                 // Field sortedByLowValuationCandidates:Ljava/util/PriorityQueue;
       4: invokevirtual #65                 // Method java/util/PriorityQueue.remove:()Ljava/lang/Object;
       7: checkcast     #29                 // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item
      10: astore_1
      11: aload_0
      12: aload_0
      13: getfield      #47                 // Field weightOfCandidates:I
      16: aload_1
      17: invokevirtual #55                 // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item.getWeight:()I
      20: isub
      21: putfield      #47                 // Field weightOfCandidates:I
      24: return

  public final double getMaximalValueOfFractionsOfItemsFittingIn();
    Code:
       0: aload_0
       1: getfield      #13                 // Field knapsackCapacity:I
       4: ifne          9
       7: dconst_0
       8: dreturn
       9: aload_0
      10: getfield      #23                 // Field sortedByLowValuationCandidates:Ljava/util/PriorityQueue;
      13: invokevirtual #72                 // Method java/util/PriorityQueue.stream:()Ljava/util/stream/Stream;
      16: lconst_1
      17: invokeinterface #78,  3           // InterfaceMethod java/util/stream/Stream.skip:(J)Ljava/util/stream/Stream;
      22: invokedynamic #98,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      27: invokedynamic #109,  0            // InvokeDynamic #1:applyAsDouble:(Lkotlin/jvm/functions/Function1;)Ljava/util/function/ToDoubleFunction;
      32: invokeinterface #113,  2          // InterfaceMethod java/util/stream/Stream.mapToDouble:(Ljava/util/function/ToDoubleFunction;)Ljava/util/stream/DoubleStream;
      37: invokeinterface #118,  1          // InterfaceMethod java/util/stream/DoubleStream.sum:()D
      42: dstore_1
      43: aload_0
      44: getfield      #23                 // Field sortedByLowValuationCandidates:Ljava/util/PriorityQueue;
      47: invokevirtual #51                 // Method java/util/PriorityQueue.element:()Ljava/lang/Object;
      50: checkcast     #29                 // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item
      53: astore_3
      54: aload_0
      55: getfield      #47                 // Field weightOfCandidates:I
      58: aload_0
      59: getfield      #13                 // Field knapsackCapacity:I
      62: if_icmpgt     73
      65: aload_3
      66: invokevirtual #121                // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item.getValue:()I
      69: i2d
      70: goto          104
      73: aload_0
      74: getfield      #13                 // Field knapsackCapacity:I
      77: aload_0
      78: getfield      #47                 // Field weightOfCandidates:I
      81: aload_3
      82: invokevirtual #55                 // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item.getWeight:()I
      85: isub
      86: isub
      87: istore        6
      89: aload_3
      90: invokevirtual #121                // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item.getValue:()I
      93: i2d
      94: iload         6
      96: i2d
      97: dmul
      98: aload_3
      99: invokevirtual #55                 // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item.getWeight:()I
     102: i2d
     103: ddiv
     104: dstore        4
     106: dload_1
     107: dload         4
     109: dadd
     110: dreturn

  public final java.lang.String formatOutput(double);
    Code:
       0: new           #130                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #131                // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #133                // String %.
       9: invokevirtual #137                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #16                 // Field formatPrecision:I
      16: invokevirtual #140                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: bipush        102
      21: invokevirtual #143                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      24: invokevirtual #147                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      27: astore_3
      28: aload_3
      29: astore        4
      31: getstatic     #153                // Field java/util/Locale.US:Ljava/util/Locale;
      34: astore        5
      36: iconst_1
      37: anewarray     #4                  // class java/lang/Object
      40: astore        6
      42: aload         6
      44: iconst_0
      45: dload_1
      46: invokestatic  #159                // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      49: aastore
      50: aload         6
      52: astore        6
      54: aload         5
      56: aload         4
      58: aload         6
      60: aload         6
      62: arraylength
      63: invokestatic  #165                // Method java/util/Arrays.copyOf:([Ljava/lang/Object;I)[Ljava/lang/Object;
      66: invokestatic  #171                // Method java/lang/String.format:(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
      69: dup
      70: ldc           #173                // String format(...)
      72: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      75: areturn

  private static final double getMaximalValueOfFractionsOfItemsFittingIn$lambda$0(fr.pturpin.coursera.greedy.MaximumValueOfTheLoot$Item);
    Code:
       0: aload_0
       1: invokevirtual #121                // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot$Item.getValue:()I
       4: i2d
       5: dreturn

  private static final double getMaximalValueOfFractionsOfItemsFittingIn$lambda$1(kotlin.jvm.functions.Function1, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokeinterface #186,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
       7: checkcast     #188                // class java/lang/Number
      10: invokevirtual #191                // Method java/lang/Number.doubleValue:()D
      13: dreturn
}

Compiled from "MaximumValueOfTheLoot.kt"
public final class fr.pturpin.coursera.greedy.MaximumValueOfTheLootKt {
  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String args
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: invokestatic  #21                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
       9: dup
      10: invokestatic  #25                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      13: checkcast     #27                 // class java/lang/CharSequence
      16: iconst_1
      17: anewarray     #29                 // class java/lang/String
      20: astore_2
      21: aload_2
      22: iconst_0
      23: ldc           #31                 // String
      25: aastore
      26: aload_2
      27: iconst_0
      28: iconst_0
      29: bipush        6
      31: aconst_null
      32: invokestatic  #37                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      35: checkcast     #39                 // class java/lang/Iterable
      38: astore_2
      39: iconst_0
      40: istore_3
      41: aload_2
      42: astore        4
      44: new           #41                 // class java/util/ArrayList
      47: dup
      48: aload_2
      49: bipush        10
      51: invokestatic  #47                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      54: invokespecial #51                 // Method java/util/ArrayList."<init>":(I)V
      57: checkcast     #53                 // class java/util/Collection
      60: astore        5
      62: iconst_0
      63: istore        6
      65: aload         4
      67: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      72: astore        7
      74: aload         7
      76: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      81: ifeq          128
      84: aload         7
      86: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      91: astore        8
      93: aload         5
      95: aload         8
      97: checkcast     #29                 // class java/lang/String
     100: astore        9
     102: astore        16
     104: iconst_0
     105: istore        10
     107: aload         9
     109: invokestatic  #73                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     112: nop
     113: invokestatic  #77                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     116: aload         16
     118: swap
     119: invokeinterface #81,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     124: pop
     125: goto          74
     128: aload         5
     130: checkcast     #83                 // class java/util/List
     133: nop
     134: astore_1
     135: aload_1
     136: iconst_0
     137: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     142: checkcast     #89                 // class java/lang/Number
     145: invokevirtual #93                 // Method java/lang/Number.intValue:()I
     148: istore_2
     149: aload_1
     150: iconst_1
     151: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     156: checkcast     #89                 // class java/lang/Number
     159: invokevirtual #93                 // Method java/lang/Number.intValue:()I
     162: istore_3
     163: new           #95                 // class fr/pturpin/coursera/greedy/MaximumValueOfTheLoot
     166: dup
     167: iload_3
     168: invokespecial #96                 // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot."<init>":(I)V
     171: astore        4
     173: iconst_0
     174: istore        5
     176: iload         5
     178: iload_2
     179: if_icmpge     366
     182: invokestatic  #21                 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lang/String;
     185: dup
     186: invokestatic  #25                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     189: checkcast     #27                 // class java/lang/CharSequence
     192: iconst_1
     193: anewarray     #29                 // class java/lang/String
     196: astore        7
     198: aload         7
     200: iconst_0
     201: ldc           #31                 // String
     203: aastore
     204: aload         7
     206: iconst_0
     207: iconst_0
     208: bipush        6
     210: aconst_null
     211: invokestatic  #37                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     214: checkcast     #39                 // class java/lang/Iterable
     217: astore        7
     219: iconst_0
     220: istore        8
     222: aload         7
     224: astore        9
     226: new           #41                 // class java/util/ArrayList
     229: dup
     230: aload         7
     232: bipush        10
     234: invokestatic  #47                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     237: invokespecial #51                 // Method java/util/ArrayList."<init>":(I)V
     240: checkcast     #53                 // class java/util/Collection
     243: astore        10
     245: iconst_0
     246: istore        11
     248: aload         9
     250: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     255: astore        12
     257: aload         12
     259: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     264: ifeq          311
     267: aload         12
     269: invokeinterface #67,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     274: astore        13
     276: aload         10
     278: aload         13
     280: checkcast     #29                 // class java/lang/String
     283: astore        14
     285: astore        16
     287: iconst_0
     288: istore        15
     290: aload         14
     292: invokestatic  #73                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     295: nop
     296: invokestatic  #77                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     299: aload         16
     301: swap
     302: invokeinterface #81,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     307: pop
     308: goto          257
     311: aload         10
     313: checkcast     #83                 // class java/util/List
     316: nop
     317: astore        6
     319: aload         6
     321: iconst_0
     322: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     327: checkcast     #89                 // class java/lang/Number
     330: invokevirtual #93                 // Method java/lang/Number.intValue:()I
     333: istore        7
     335: aload         6
     337: iconst_1
     338: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     343: checkcast     #89                 // class java/lang/Number
     346: invokevirtual #93                 // Method java/lang/Number.intValue:()I
     349: istore        8
     351: aload         4
     353: iload         7
     355: iload         8
     357: invokevirtual #100                // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot.addPotentialItem:(II)V
     360: iinc          5, 1
     363: goto          176
     366: aload         4
     368: invokevirtual #104                // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot.getMaximalValueOfFractionsOfItemsFittingIn:()D
     371: dstore        5
     373: aload         4
     375: dload         5
     377: invokevirtual #108                // Method fr/pturpin/coursera/greedy/MaximumValueOfTheLoot.formatOutput:(D)Ljava/lang/String;
     380: getstatic     #114                // Field java/lang/System.out:Ljava/io/PrintStream;
     383: swap
     384: invokevirtual #119                // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     387: return
}