package com.github.brpeterman.advent2022

class CampSections {
    fun countOverlaps(assignments: List<Pair<IntRange, IntRange>>): Int {
        return assignments.fold(0, { total, assignment ->
            if ((assignment.second.contains(assignment.first.first)) ||
                (assignment.second.contains(assignment.first.endInclusive))) {
                total + 1
            } else {
                total
            }
        })
    }

    fun countRedundancies(assignments: List<Pair<IntRange, IntRange>>): Int {
        return assignments.fold(0, { total, assignment ->
            if ((assignment.second.contains(assignment.first.start)) &&
                (assignment.second.contains(assignment.first.endInclusive))) {
                total + 1
            } else {
                total
            }
        })
    }

    companion object {
        fun parseInput(input: String): List<Pair<IntRange, IntRange>> {
            return input.split("\n")
                .filter { it.isNotBlank() }
                .map { line ->
                    val ranges = line.split(",")
                        .map { section ->
                            val (start, end) = section.split("-")
                            start.toInt()..end.toInt()
                        }
                        .sortedBy { it.endInclusive - it.start }
                    Pair(ranges[0], ranges[1])
                }
        }
    }
}

Compiled from "CampSections.kt"
public final class com.github.brpeterman.advent2022.CampSections {
  public static final com.github.brpeterman.advent2022.CampSections$Companion Companion;

  public com.github.brpeterman.advent2022.CampSections();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int countOverlaps(java.util.List<kotlin.Pair<kotlin.ranges.IntRange, kotlin.ranges.IntRange>>);
    Code:
       0: aload_1
       1: ldc           #16                 // String assignments
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_2
      11: iconst_0
      12: istore_3
      13: iconst_0
      14: istore        4
      16: iload_3
      17: istore        5
      19: aload_2
      20: invokeinterface #28,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      25: astore        6
      27: aload         6
      29: invokeinterface #34,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      34: ifeq          128
      37: aload         6
      39: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      44: astore        7
      46: iload         5
      48: aload         7
      50: checkcast     #40                 // class kotlin/Pair
      53: astore        8
      55: istore        9
      57: iconst_0
      58: istore        10
      60: aload         8
      62: invokevirtual #43                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      65: checkcast     #45                 // class kotlin/ranges/IntRange
      68: aload         8
      70: invokevirtual #48                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      73: checkcast     #45                 // class kotlin/ranges/IntRange
      76: invokevirtual #51                 // Method kotlin/ranges/IntRange.getFirst:()I
      79: invokevirtual #55                 // Method kotlin/ranges/IntRange.contains:(I)Z
      82: ifne          113
      85: aload         8
      87: invokevirtual #43                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      90: checkcast     #45                 // class kotlin/ranges/IntRange
      93: aload         8
      95: invokevirtual #48                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      98: checkcast     #45                 // class kotlin/ranges/IntRange
     101: invokevirtual #59                 // Method kotlin/ranges/IntRange.getEndInclusive:()Ljava/lang/Integer;
     104: invokevirtual #64                 // Method java/lang/Integer.intValue:()I
     107: invokevirtual #55                 // Method kotlin/ranges/IntRange.contains:(I)Z
     110: ifeq          120
     113: iload         9
     115: iconst_1
     116: iadd
     117: goto          122
     120: iload         9
     122: nop
     123: istore        5
     125: goto          27
     128: iload         5
     130: ireturn

  public final int countRedundancies(java.util.List<kotlin.Pair<kotlin.ranges.IntRange, kotlin.ranges.IntRange>>);
    Code:
       0: aload_1
       1: ldc           #16                 // String assignments
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_2
      11: iconst_0
      12: istore_3
      13: iconst_0
      14: istore        4
      16: iload_3
      17: istore        5
      19: aload_2
      20: invokeinterface #28,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      25: astore        6
      27: aload         6
      29: invokeinterface #34,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      34: ifeq          131
      37: aload         6
      39: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      44: astore        7
      46: iload         5
      48: aload         7
      50: checkcast     #40                 // class kotlin/Pair
      53: astore        8
      55: istore        9
      57: iconst_0
      58: istore        10
      60: aload         8
      62: invokevirtual #43                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      65: checkcast     #45                 // class kotlin/ranges/IntRange
      68: aload         8
      70: invokevirtual #48                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      73: checkcast     #45                 // class kotlin/ranges/IntRange
      76: invokevirtual #83                 // Method kotlin/ranges/IntRange.getStart:()Ljava/lang/Integer;
      79: invokevirtual #64                 // Method java/lang/Integer.intValue:()I
      82: invokevirtual #55                 // Method kotlin/ranges/IntRange.contains:(I)Z
      85: ifeq          123
      88: aload         8
      90: invokevirtual #43                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      93: checkcast     #45                 // class kotlin/ranges/IntRange
      96: aload         8
      98: invokevirtual #48                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     101: checkcast     #45                 // class kotlin/ranges/IntRange
     104: invokevirtual #59                 // Method kotlin/ranges/IntRange.getEndInclusive:()Ljava/lang/Integer;
     107: invokevirtual #64                 // Method java/lang/Integer.intValue:()I
     110: invokevirtual #55                 // Method kotlin/ranges/IntRange.contains:(I)Z
     113: ifeq          123
     116: iload         9
     118: iconst_1
     119: iadd
     120: goto          125
     123: iload         9
     125: nop
     126: istore        5
     128: goto          27
     131: iload         5
     133: ireturn

  static {};
    Code:
       0: new           #87                 // class com/github/brpeterman/advent2022/CampSections$Companion
       3: dup
       4: aconst_null
       5: invokespecial #90                 // Method com/github/brpeterman/advent2022/CampSections$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #94                 // Field Companion:Lcom/github/brpeterman/advent2022/CampSections$Companion;
      11: return
}

Compiled from "Comparisons.kt"
public final class com.github.brpeterman.advent2022.CampSections$Companion$parseInput$lambda$3$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public com.github.brpeterman.advent2022.CampSections$Companion$parseInput$lambda$3$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class kotlin/ranges/IntRange
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokevirtual #27                 // Method kotlin/ranges/IntRange.getEndInclusive:()Ljava/lang/Integer;
      12: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      15: aload_3
      16: invokevirtual #36                 // Method kotlin/ranges/IntRange.getStart:()Ljava/lang/Integer;
      19: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      22: isub
      23: invokestatic  #40                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      26: checkcast     #42                 // class java/lang/Comparable
      29: aload_2
      30: checkcast     #23                 // class kotlin/ranges/IntRange
      33: astore_3
      34: astore        5
      36: iconst_0
      37: istore        4
      39: aload_3
      40: invokevirtual #27                 // Method kotlin/ranges/IntRange.getEndInclusive:()Ljava/lang/Integer;
      43: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      46: aload_3
      47: invokevirtual #36                 // Method kotlin/ranges/IntRange.getStart:()Ljava/lang/Integer;
      50: invokevirtual #33                 // Method java/lang/Integer.intValue:()I
      53: isub
      54: invokestatic  #40                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      57: aload         5
      59: swap
      60: checkcast     #42                 // class java/lang/Comparable
      63: invokestatic  #48                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      66: ireturn
}

Compiled from "CampSections.kt"
public final class com.github.brpeterman.advent2022.CampSections$Companion {
  private com.github.brpeterman.advent2022.CampSections$Companion();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.util.List<kotlin.Pair<kotlin.ranges.IntRange, kotlin.ranges.IntRange>> parseInput(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #26                 // class java/lang/String
      14: astore_2
      15: aload_2
      16: iconst_0
      17: ldc           #28                 // String \n
      19: aastore
      20: aload_2
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #34                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: checkcast     #36                 // class java/lang/Iterable
      32: astore_2
      33: nop
      34: iconst_0
      35: istore_3
      36: aload_2
      37: astore        4
      39: new           #38                 // class java/util/ArrayList
      42: dup
      43: invokespecial #39                 // Method java/util/ArrayList."<init>":()V
      46: checkcast     #41                 // class java/util/Collection
      49: astore        5
      51: iconst_0
      52: istore        6
      54: aload         4
      56: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      61: astore        7
      63: aload         7
      65: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      70: ifeq          125
      73: aload         7
      75: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      80: astore        8
      82: aload         8
      84: checkcast     #26                 // class java/lang/String
      87: astore        9
      89: iconst_0
      90: istore        10
      92: aload         9
      94: checkcast     #24                 // class java/lang/CharSequence
      97: invokestatic  #59                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     100: ifne          107
     103: iconst_1
     104: goto          108
     107: iconst_0
     108: nop
     109: ifeq          63
     112: aload         5
     114: aload         8
     116: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     121: pop
     122: goto          63
     125: aload         5
     127: checkcast     #65                 // class java/util/List
     130: nop
     131: checkcast     #36                 // class java/lang/Iterable
     134: astore_2
     135: nop
     136: iconst_0
     137: istore_3
     138: aload_2
     139: astore        4
     141: new           #38                 // class java/util/ArrayList
     144: dup
     145: aload_2
     146: bipush        10
     148: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     151: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
     154: checkcast     #41                 // class java/util/Collection
     157: astore        5
     159: iconst_0
     160: istore        6
     162: aload         4
     164: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     169: astore        7
     171: aload         7
     173: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     178: ifeq          459
     181: aload         7
     183: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     188: astore        8
     190: aload         5
     192: aload         8
     194: checkcast     #26                 // class java/lang/String
     197: astore        9
     199: astore        25
     201: iconst_0
     202: istore        10
     204: aload         9
     206: checkcast     #24                 // class java/lang/CharSequence
     209: iconst_1
     210: anewarray     #26                 // class java/lang/String
     213: astore        11
     215: aload         11
     217: iconst_0
     218: ldc           #76                 // String ,
     220: aastore
     221: aload         11
     223: iconst_0
     224: iconst_0
     225: bipush        6
     227: aconst_null
     228: invokestatic  #34                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     231: checkcast     #36                 // class java/lang/Iterable
     234: astore        11
     236: nop
     237: iconst_0
     238: istore        12
     240: aload         11
     242: astore        13
     244: new           #38                 // class java/util/ArrayList
     247: dup
     248: aload         11
     250: bipush        10
     252: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     255: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
     258: checkcast     #41                 // class java/util/Collection
     261: astore        14
     263: iconst_0
     264: istore        15
     266: aload         13
     268: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     273: astore        16
     275: aload         16
     277: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     282: ifeq          392
     285: aload         16
     287: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     292: astore        17
     294: aload         14
     296: aload         17
     298: checkcast     #26                 // class java/lang/String
     301: astore        18
     303: astore        19
     305: iconst_0
     306: istore        20
     308: aload         18
     310: checkcast     #24                 // class java/lang/CharSequence
     313: iconst_1
     314: anewarray     #26                 // class java/lang/String
     317: astore        21
     319: aload         21
     321: iconst_0
     322: ldc           #78                 // String -
     324: aastore
     325: aload         21
     327: iconst_0
     328: iconst_0
     329: bipush        6
     331: aconst_null
     332: invokestatic  #34                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     335: astore        22
     337: aload         22
     339: iconst_0
     340: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     345: checkcast     #26                 // class java/lang/String
     348: astore        21
     350: aload         22
     352: iconst_1
     353: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     358: checkcast     #26                 // class java/lang/String
     361: astore        23
     363: new           #84                 // class kotlin/ranges/IntRange
     366: dup
     367: aload         21
     369: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     372: aload         23
     374: invokestatic  #90                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     377: invokespecial #93                 // Method kotlin/ranges/IntRange."<init>":(II)V
     380: aload         19
     382: swap
     383: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     388: pop
     389: goto          275
     392: aload         14
     394: checkcast     #65                 // class java/util/List
     397: nop
     398: checkcast     #36                 // class java/lang/Iterable
     401: astore        11
     403: nop
     404: iconst_0
     405: istore        12
     407: aload         11
     409: new           #95                 // class com/github/brpeterman/advent2022/CampSections$Companion$parseInput$lambda$3$$inlined$sortedBy$1
     412: dup
     413: invokespecial #96                 // Method com/github/brpeterman/advent2022/CampSections$Companion$parseInput$lambda$3$$inlined$sortedBy$1."<init>":()V
     416: checkcast     #98                 // class java/util/Comparator
     419: invokestatic  #102                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     422: astore        24
     424: new           #104                // class kotlin/Pair
     427: dup
     428: aload         24
     430: iconst_0
     431: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     436: aload         24
     438: iconst_1
     439: invokeinterface #82,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     444: invokespecial #107                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     447: aload         25
     449: swap
     450: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     455: pop
     456: goto          171
     459: aload         5
     461: checkcast     #65                 // class java/util/List
     464: nop
     465: areturn

  public com.github.brpeterman.advent2022.CampSections$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #137                // Method "<init>":()V
       4: return
}


package com.github.brpeterman.advent2022

class Rucksacks {
    fun scoreMisfits(rucksacks: List<Pair<Set<String>, Set<String>>>): Int {
        return rucksacks.fold(0) { total, sack ->
            val misfit = sack.first.intersect(sack.second).first()
            total + score(misfit)
        }
    }

    fun scoreBadges(rucksacks: List<Pair<Set<String>, Set<String>>>): Int {
        return rucksacks.chunked(3)
            .fold(0) { total, group ->
                val badge = unify(group[0])
                    .intersect(unify(group[1]))
                    .intersect(unify(group[2]))
                    .first()
                total + score(badge)
            }
    }

    fun unify(rucksack: Pair<Set<String>, Set<String>>): Set<String> {
        return rucksack.first + rucksack.second
    }

    fun score(item: String): Int {
        if (item.matches("[a-z]".toRegex())) {
            return item[0].code - 96
        } else if (item.matches("[A-Z]".toRegex())) {
            return item[0].code - 38
        }
        return 0
    }

    companion object {
        fun parseInput(input: String): List<Pair<Set<String>, Set<String>>> {
            return input.split("\n")
                .filter { it.isNotBlank() }
                .map { line ->
                    val left = line.substring(0, (line.length/2))
                    val right = line.substring(line.length/2)
                    Pair(
                        left.split("").filter {it.isNotBlank()}.toSet(),
                        right.split("").filter {it.isNotBlank()}.toSet())
                }
        }
    }
}

Compiled from "Rucksacks.kt"
public final class com.github.brpeterman.advent2022.Rucksacks$Companion {
  private com.github.brpeterman.advent2022.Rucksacks$Companion();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.util.List<kotlin.Pair<java.util.Set<java.lang.String>, java.util.Set<java.lang.String>>> parseInput(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #26                 // class java/lang/String
      14: astore_2
      15: aload_2
      16: iconst_0
      17: ldc           #28                 // String \n
      19: aastore
      20: aload_2
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #34                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: checkcast     #36                 // class java/lang/Iterable
      32: astore_2
      33: nop
      34: iconst_0
      35: istore_3
      36: aload_2
      37: astore        4
      39: new           #38                 // class java/util/ArrayList
      42: dup
      43: invokespecial #39                 // Method java/util/ArrayList."<init>":()V
      46: checkcast     #41                 // class java/util/Collection
      49: astore        5
      51: iconst_0
      52: istore        6
      54: aload         4
      56: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      61: astore        7
      63: aload         7
      65: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      70: ifeq          125
      73: aload         7
      75: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      80: astore        8
      82: aload         8
      84: checkcast     #26                 // class java/lang/String
      87: astore        9
      89: iconst_0
      90: istore        10
      92: aload         9
      94: checkcast     #24                 // class java/lang/CharSequence
      97: invokestatic  #59                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     100: ifne          107
     103: iconst_1
     104: goto          108
     107: iconst_0
     108: nop
     109: ifeq          63
     112: aload         5
     114: aload         8
     116: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     121: pop
     122: goto          63
     125: aload         5
     127: checkcast     #65                 // class java/util/List
     130: nop
     131: checkcast     #36                 // class java/lang/Iterable
     134: astore_2
     135: nop
     136: iconst_0
     137: istore_3
     138: aload_2
     139: astore        4
     141: new           #38                 // class java/util/ArrayList
     144: dup
     145: aload_2
     146: bipush        10
     148: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     151: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
     154: checkcast     #41                 // class java/util/Collection
     157: astore        5
     159: iconst_0
     160: istore        6
     162: aload         4
     164: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     169: astore        7
     171: aload         7
     173: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     178: ifeq          552
     181: aload         7
     183: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     188: astore        8
     190: aload         5
     192: aload         8
     194: checkcast     #26                 // class java/lang/String
     197: astore        9
     199: astore        23
     201: iconst_0
     202: istore        10
     204: aload         9
     206: iconst_0
     207: aload         9
     209: invokevirtual #78                 // Method java/lang/String.length:()I
     212: iconst_2
     213: idiv
     214: invokevirtual #82                 // Method java/lang/String.substring:(II)Ljava/lang/String;
     217: dup
     218: ldc           #84                 // String substring(...)
     220: invokestatic  #87                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     223: astore        11
     225: aload         9
     227: aload         9
     229: invokevirtual #78                 // Method java/lang/String.length:()I
     232: iconst_2
     233: idiv
     234: invokevirtual #90                 // Method java/lang/String.substring:(I)Ljava/lang/String;
     237: dup
     238: ldc           #84                 // String substring(...)
     240: invokestatic  #87                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     243: astore        12
     245: aload         11
     247: checkcast     #24                 // class java/lang/CharSequence
     250: iconst_1
     251: anewarray     #26                 // class java/lang/String
     254: astore        13
     256: aload         13
     258: iconst_0
     259: ldc           #92                 // String
     261: aastore
     262: aload         13
     264: iconst_0
     265: iconst_0
     266: bipush        6
     268: aconst_null
     269: invokestatic  #34                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     272: checkcast     #36                 // class java/lang/Iterable
     275: astore        13
     277: iconst_0
     278: istore        14
     280: aload         13
     282: astore        15
     284: new           #38                 // class java/util/ArrayList
     287: dup
     288: invokespecial #39                 // Method java/util/ArrayList."<init>":()V
     291: checkcast     #41                 // class java/util/Collection
     294: astore        16
     296: iconst_0
     297: istore        17
     299: aload         15
     301: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     306: astore        18
     308: aload         18
     310: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     315: ifeq          370
     318: aload         18
     320: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     325: astore        19
     327: aload         19
     329: checkcast     #26                 // class java/lang/String
     332: astore        20
     334: iconst_0
     335: istore        21
     337: aload         20
     339: checkcast     #24                 // class java/lang/CharSequence
     342: invokestatic  #59                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     345: ifne          352
     348: iconst_1
     349: goto          353
     352: iconst_0
     353: nop
     354: ifeq          308
     357: aload         16
     359: aload         19
     361: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     366: pop
     367: goto          308
     370: aload         16
     372: checkcast     #65                 // class java/util/List
     375: nop
     376: checkcast     #36                 // class java/lang/Iterable
     379: invokestatic  #96                 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     382: aload         12
     384: checkcast     #24                 // class java/lang/CharSequence
     387: iconst_1
     388: anewarray     #26                 // class java/lang/String
     391: astore        13
     393: aload         13
     395: iconst_0
     396: ldc           #92                 // String
     398: aastore
     399: aload         13
     401: iconst_0
     402: iconst_0
     403: bipush        6
     405: aconst_null
     406: invokestatic  #34                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     409: checkcast     #36                 // class java/lang/Iterable
     412: astore        13
     414: astore        22
     416: iconst_0
     417: istore        14
     419: aload         13
     421: astore        15
     423: new           #38                 // class java/util/ArrayList
     426: dup
     427: invokespecial #39                 // Method java/util/ArrayList."<init>":()V
     430: checkcast     #41                 // class java/util/Collection
     433: astore        16
     435: iconst_0
     436: istore        17
     438: aload         15
     440: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     445: astore        18
     447: aload         18
     449: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     454: ifeq          509
     457: aload         18
     459: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     464: astore        19
     466: aload         19
     468: checkcast     #26                 // class java/lang/String
     471: astore        20
     473: iconst_0
     474: istore        21
     476: aload         20
     478: checkcast     #24                 // class java/lang/CharSequence
     481: invokestatic  #59                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     484: ifne          491
     487: iconst_1
     488: goto          492
     491: iconst_0
     492: nop
     493: ifeq          447
     496: aload         16
     498: aload         19
     500: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     505: pop
     506: goto          447
     509: aload         16
     511: checkcast     #65                 // class java/util/List
     514: nop
     515: aload         22
     517: swap
     518: checkcast     #36                 // class java/lang/Iterable
     521: invokestatic  #96                 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     524: astore        24
     526: astore        25
     528: new           #98                 // class kotlin/Pair
     531: dup
     532: aload         25
     534: aload         24
     536: invokespecial #101                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     539: nop
     540: aload         23
     542: swap
     543: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     548: pop
     549: goto          171
     552: aload         5
     554: checkcast     #65                 // class java/util/List
     557: nop
     558: areturn

  public com.github.brpeterman.advent2022.Rucksacks$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #129                // Method "<init>":()V
       4: return
}

Compiled from "Rucksacks.kt"
public final class com.github.brpeterman.advent2022.Rucksacks {
  public static final com.github.brpeterman.advent2022.Rucksacks$Companion Companion;

  public com.github.brpeterman.advent2022.Rucksacks();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int scoreMisfits(java.util.List<? extends kotlin.Pair<? extends java.util.Set<java.lang.String>, ? extends java.util.Set<java.lang.String>>>);
    Code:
       0: aload_1
       1: ldc           #16                 // String rucksacks
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: astore_2
      11: iconst_0
      12: istore_3
      13: iconst_0
      14: istore        4
      16: iload_3
      17: istore        5
      19: aload_2
      20: invokeinterface #28,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      25: astore        6
      27: aload         6
      29: invokeinterface #34,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      34: ifeq          104
      37: aload         6
      39: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      44: astore        7
      46: iload         5
      48: aload         7
      50: checkcast     #40                 // class kotlin/Pair
      53: astore        8
      55: istore        9
      57: iconst_0
      58: istore        10
      60: aload         8
      62: invokevirtual #43                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      65: checkcast     #24                 // class java/lang/Iterable
      68: aload         8
      70: invokevirtual #46                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      73: checkcast     #24                 // class java/lang/Iterable
      76: invokestatic  #52                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      79: checkcast     #24                 // class java/lang/Iterable
      82: invokestatic  #56                 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
      85: checkcast     #58                 // class java/lang/String
      88: astore        11
      90: iload         9
      92: aload_0
      93: aload         11
      95: invokevirtual #62                 // Method score:(Ljava/lang/String;)I
      98: iadd
      99: istore        5
     101: goto          27
     104: iload         5
     106: ireturn

  public final int scoreBadges(java.util.List<? extends kotlin.Pair<? extends java.util.Set<java.lang.String>, ? extends java.util.Set<java.lang.String>>>);
    Code:
       0: aload_1
       1: ldc           #16                 // String rucksacks
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/Iterable
      10: iconst_3
      11: invokestatic  #84                 // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;I)Ljava/util/List;
      14: checkcast     #24                 // class java/lang/Iterable
      17: astore_2
      18: iconst_0
      19: istore_3
      20: iconst_0
      21: istore        4
      23: iload_3
      24: istore        5
      26: aload_2
      27: invokeinterface #28,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      32: astore        6
      34: aload         6
      36: invokeinterface #34,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      41: ifeq          155
      44: aload         6
      46: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      51: astore        7
      53: iload         5
      55: aload         7
      57: checkcast     #79                 // class java/util/List
      60: astore        8
      62: istore        9
      64: iconst_0
      65: istore        10
      67: aload_0
      68: aload         8
      70: iconst_0
      71: invokeinterface #88,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      76: checkcast     #40                 // class kotlin/Pair
      79: invokevirtual #92                 // Method unify:(Lkotlin/Pair;)Ljava/util/Set;
      82: checkcast     #24                 // class java/lang/Iterable
      85: aload_0
      86: aload         8
      88: iconst_1
      89: invokeinterface #88,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      94: checkcast     #40                 // class kotlin/Pair
      97: invokevirtual #92                 // Method unify:(Lkotlin/Pair;)Ljava/util/Set;
     100: checkcast     #24                 // class java/lang/Iterable
     103: invokestatic  #52                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     106: checkcast     #24                 // class java/lang/Iterable
     109: aload_0
     110: aload         8
     112: iconst_2
     113: invokeinterface #88,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     118: checkcast     #40                 // class kotlin/Pair
     121: invokevirtual #92                 // Method unify:(Lkotlin/Pair;)Ljava/util/Set;
     124: checkcast     #24                 // class java/lang/Iterable
     127: invokestatic  #52                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     130: checkcast     #24                 // class java/lang/Iterable
     133: invokestatic  #56                 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
     136: checkcast     #58                 // class java/lang/String
     139: astore        11
     141: iload         9
     143: aload_0
     144: aload         11
     146: invokevirtual #62                 // Method score:(Ljava/lang/String;)I
     149: iadd
     150: istore        5
     152: goto          34
     155: iload         5
     157: ireturn

  public final java.util.Set<java.lang.String> unify(kotlin.Pair<? extends java.util.Set<java.lang.String>, ? extends java.util.Set<java.lang.String>>);
    Code:
       0: aload_1
       1: ldc           #98                 // String rucksack
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokevirtual #43                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      10: checkcast     #100                // class java/util/Set
      13: aload_1
      14: invokevirtual #46                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      17: checkcast     #24                 // class java/lang/Iterable
      20: invokestatic  #106                // Method kotlin/collections/SetsKt.plus:(Ljava/util/Set;Ljava/lang/Iterable;)Ljava/util/Set;
      23: areturn

  public final int score(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #108                // String item
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #110                // class java/lang/CharSequence
      10: astore_2
      11: new           #112                // class kotlin/text/Regex
      14: dup
      15: ldc           #114                // String [a-z]
      17: invokespecial #117                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      20: aload_2
      21: invokevirtual #121                // Method kotlin/text/Regex.matches:(Ljava/lang/CharSequence;)Z
      24: ifeq          36
      27: aload_1
      28: iconst_0
      29: invokevirtual #125                // Method java/lang/String.charAt:(I)C
      32: bipush        96
      34: isub
      35: ireturn
      36: aload_1
      37: checkcast     #110                // class java/lang/CharSequence
      40: astore_2
      41: new           #112                // class kotlin/text/Regex
      44: dup
      45: ldc           #127                // String [A-Z]
      47: invokespecial #117                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      50: aload_2
      51: invokevirtual #121                // Method kotlin/text/Regex.matches:(Ljava/lang/CharSequence;)Z
      54: ifeq          66
      57: aload_1
      58: iconst_0
      59: invokevirtual #125                // Method java/lang/String.charAt:(I)C
      62: bipush        38
      64: isub
      65: ireturn
      66: iconst_0
      67: ireturn

  static {};
    Code:
       0: new           #130                // class com/github/brpeterman/advent2022/Rucksacks$Companion
       3: dup
       4: aconst_null
       5: invokespecial #133                // Method com/github/brpeterman/advent2022/Rucksacks$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #137                // Field Companion:Lcom/github/brpeterman/advent2022/Rucksacks$Companion;
      11: return
}


package de.bitfroest.aoc2020

object Day01 {

    private fun Pair<Int, Int>.sum() = first + second
    private fun Pair<Int, Int>.product() = first * second
    private fun List<Int>.toPairs(): Sequence<Pair<Int, Int>> {
        return this.asSequence().flatMapIndexed { i, first ->
            this.drop(i).map { second -> Pair(first, second) }
        }
    }

    fun solve(inputs: List<String>): Int {
        val numericInputs = inputs.map(String::toInt)

        return numericInputs.toPairs()
            .filter { it.sum() == 2020 }
            .first().product()
    }

    // --- Second Task
    private fun Triple<Int, Int, Int>.sum() = first + second + third
    private fun Triple<Int, Int, Int>.product() = first * second * third
    private fun List<Int>.toTriples(): Sequence<Triple<Int, Int, Int>> {
        return this.asSequence().flatMapIndexed() { i, first ->
            this.drop(i).flatMapIndexed { j, second ->
                this.drop(j).map { third -> Triple(first, second, third) }
            }
        }
    }

    fun solve2(inputs: List<String>): Int {
        val numericInputs = inputs.map(String::toInt)

        return numericInputs.toTriples()
            .filter { it.sum() == 2020 }
            .first().product()
    }
}

Compiled from "Day01.kt"
public final class de.bitfroest.aoc2020.Day01 {
  public static final de.bitfroest.aoc2020.Day01 INSTANCE;

  private de.bitfroest.aoc2020.Day01();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  private final int sum(kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_1
       1: invokevirtual #19                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       4: checkcast     #21                 // class java/lang/Number
       7: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      10: aload_1
      11: invokevirtual #28                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      14: checkcast     #21                 // class java/lang/Number
      17: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      20: iadd
      21: ireturn

  private final int product(kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_1
       1: invokevirtual #19                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
       4: checkcast     #21                 // class java/lang/Number
       7: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      10: aload_1
      11: invokevirtual #28                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      14: checkcast     #21                 // class java/lang/Number
      17: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      20: imul
      21: ireturn

  private final kotlin.sequences.Sequence<kotlin.Pair<java.lang.Integer, java.lang.Integer>> toPairs(java.util.List<java.lang.Integer>);
    Code:
       0: aload_1
       1: checkcast     #37                 // class java/lang/Iterable
       4: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;
       7: aload_1
       8: invokedynamic #63,  0             // InvokeDynamic #0:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function2;
      13: invokestatic  #69                 // Method kotlin/sequences/SequencesKt.flatMapIndexedIterable:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
      16: areturn

  public final int solve(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #77                 // String inputs
       3: invokestatic  #83                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #37                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #85                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: bipush        10
      24: invokestatic  #89                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #92                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #94                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: aload         5
      40: invokeinterface #98,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        8
      47: aload         8
      49: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          101
      57: aload         8
      59: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        9
      66: aload         6
      68: aload         9
      70: checkcast     #109                // class java/lang/String
      73: astore        10
      75: astore        12
      77: iconst_0
      78: istore        11
      80: aload         10
      82: invokestatic  #115                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      85: nop
      86: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      89: aload         12
      91: swap
      92: invokeinterface #123,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      97: pop
      98: goto          47
     101: aload         6
     103: checkcast     #125                // class java/util/List
     106: nop
     107: astore_2
     108: aload_0
     109: aload_0
     110: aload_2
     111: invokespecial #127                // Method toPairs:(Ljava/util/List;)Lkotlin/sequences/Sequence;
     114: invokedynamic #139,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
     119: invokestatic  #143                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     122: invokestatic  #147                // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;
     125: checkcast     #15                 // class kotlin/Pair
     128: invokespecial #149                // Method product:(Lkotlin/Pair;)I
     131: ireturn

  private final int sum(kotlin.Triple<java.lang.Integer, java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_1
       1: invokevirtual #168                // Method kotlin/Triple.getFirst:()Ljava/lang/Object;
       4: checkcast     #21                 // class java/lang/Number
       7: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      10: aload_1
      11: invokevirtual #169                // Method kotlin/Triple.getSecond:()Ljava/lang/Object;
      14: checkcast     #21                 // class java/lang/Number
      17: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      20: iadd
      21: aload_1
      22: invokevirtual #172                // Method kotlin/Triple.getThird:()Ljava/lang/Object;
      25: checkcast     #21                 // class java/lang/Number
      28: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      31: iadd
      32: ireturn

  private final int product(kotlin.Triple<java.lang.Integer, java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_1
       1: invokevirtual #168                // Method kotlin/Triple.getFirst:()Ljava/lang/Object;
       4: checkcast     #21                 // class java/lang/Number
       7: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      10: aload_1
      11: invokevirtual #169                // Method kotlin/Triple.getSecond:()Ljava/lang/Object;
      14: checkcast     #21                 // class java/lang/Number
      17: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      20: imul
      21: aload_1
      22: invokevirtual #172                // Method kotlin/Triple.getThird:()Ljava/lang/Object;
      25: checkcast     #21                 // class java/lang/Number
      28: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      31: imul
      32: ireturn

  private final kotlin.sequences.Sequence<kotlin.Triple<java.lang.Integer, java.lang.Integer, java.lang.Integer>> toTriples(java.util.List<java.lang.Integer>);
    Code:
       0: aload_1
       1: checkcast     #37                 // class java/lang/Iterable
       4: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;
       7: aload_1
       8: invokedynamic #180,  0            // InvokeDynamic #2:invoke:(Ljava/util/List;)Lkotlin/jvm/functions/Function2;
      13: invokestatic  #69                 // Method kotlin/sequences/SequencesKt.flatMapIndexedIterable:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
      16: areturn

  public final int solve2(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #77                 // String inputs
       3: invokestatic  #83                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #37                 // class java/lang/Iterable
      10: astore_3
      11: iconst_0
      12: istore        4
      14: aload_3
      15: astore        5
      17: new           #85                 // class java/util/ArrayList
      20: dup
      21: aload_3
      22: bipush        10
      24: invokestatic  #89                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      27: invokespecial #92                 // Method java/util/ArrayList."<init>":(I)V
      30: checkcast     #94                 // class java/util/Collection
      33: astore        6
      35: iconst_0
      36: istore        7
      38: aload         5
      40: invokeinterface #98,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      45: astore        8
      47: aload         8
      49: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          101
      57: aload         8
      59: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      64: astore        9
      66: aload         6
      68: aload         9
      70: checkcast     #109                // class java/lang/String
      73: astore        10
      75: astore        12
      77: iconst_0
      78: istore        11
      80: aload         10
      82: invokestatic  #115                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      85: nop
      86: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      89: aload         12
      91: swap
      92: invokeinterface #123,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      97: pop
      98: goto          47
     101: aload         6
     103: checkcast     #125                // class java/util/List
     106: nop
     107: astore_2
     108: aload_0
     109: aload_0
     110: aload_2
     111: invokespecial #184                // Method toTriples:(Ljava/util/List;)Lkotlin/sequences/Sequence;
     114: invokedynamic #192,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
     119: invokestatic  #143                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     122: invokestatic  #147                // Method kotlin/sequences/SequencesKt.first:(Lkotlin/sequences/Sequence;)Ljava/lang/Object;
     125: checkcast     #167                // class kotlin/Triple
     128: invokespecial #194                // Method product:(Lkotlin/Triple;)I
     131: ireturn

  private static final java.lang.Iterable toPairs$lambda$1(java.util.List, int, int);
    Code:
       0: aload_0
       1: checkcast     #37                 // class java/lang/Iterable
       4: iload_1
       5: invokestatic  #199                // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
       8: checkcast     #37                 // class java/lang/Iterable
      11: astore_3
      12: iconst_0
      13: istore        4
      15: aload_3
      16: astore        5
      18: new           #85                 // class java/util/ArrayList
      21: dup
      22: aload_3
      23: bipush        10
      25: invokestatic  #89                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      28: invokespecial #92                 // Method java/util/ArrayList."<init>":(I)V
      31: checkcast     #94                 // class java/util/Collection
      34: astore        6
      36: iconst_0
      37: istore        7
      39: aload         5
      41: invokeinterface #98,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      46: astore        8
      48: aload         8
      50: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      55: ifeq          112
      58: aload         8
      60: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      65: astore        9
      67: aload         6
      69: aload         9
      71: checkcast     #21                 // class java/lang/Number
      74: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      77: istore        10
      79: astore        12
      81: iconst_0
      82: istore        11
      84: new           #15                 // class kotlin/Pair
      87: dup
      88: iload_2
      89: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      92: iload         10
      94: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      97: invokespecial #202                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     100: aload         12
     102: swap
     103: invokeinterface #123,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     108: pop
     109: goto          48
     112: aload         6
     114: checkcast     #125                // class java/util/List
     117: nop
     118: checkcast     #37                 // class java/lang/Iterable
     121: areturn

  private static final boolean solve$lambda$2(kotlin.Pair);
    Code:
       0: aload_0
       1: ldc           #208                // String it
       3: invokestatic  #83                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: getstatic     #211                // Field INSTANCE:Lde/bitfroest/aoc2020/Day01;
       9: aload_0
      10: invokespecial #213                // Method sum:(Lkotlin/Pair;)I
      13: sipush        2020
      16: if_icmpne     23
      19: iconst_1
      20: goto          24
      23: iconst_0
      24: ireturn

  private static final java.lang.Iterable toTriples$lambda$5(java.util.List, int, int);
    Code:
       0: aload_0
       1: checkcast     #37                 // class java/lang/Iterable
       4: iload_1
       5: invokestatic  #199                // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
       8: checkcast     #37                 // class java/lang/Iterable
      11: astore_3
      12: new           #85                 // class java/util/ArrayList
      15: dup
      16: invokespecial #214                // Method java/util/ArrayList."<init>":()V
      19: checkcast     #94                 // class java/util/Collection
      22: astore        4
      24: iconst_0
      25: istore        5
      27: aload_3
      28: invokeinterface #98,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      33: astore        6
      35: aload         6
      37: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      42: ifeq          227
      45: aload         6
      47: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      52: astore        7
      54: iload         5
      56: iinc          5, 1
      59: istore        8
      61: iload         8
      63: ifge          69
      66: invokestatic  #217                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      69: iload         8
      71: aload         7
      73: checkcast     #21                 // class java/lang/Number
      76: invokevirtual #25                 // Method java/lang/Number.intValue:()I
      79: istore        9
      81: istore        10
      83: iconst_0
      84: istore        11
      86: aload_0
      87: checkcast     #37                 // class java/lang/Iterable
      90: iload         10
      92: invokestatic  #199                // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      95: checkcast     #37                 // class java/lang/Iterable
      98: astore        12
     100: iconst_0
     101: istore        13
     103: aload         12
     105: astore        14
     107: new           #85                 // class java/util/ArrayList
     110: dup
     111: aload         12
     113: bipush        10
     115: invokestatic  #89                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     118: invokespecial #92                 // Method java/util/ArrayList."<init>":(I)V
     121: checkcast     #94                 // class java/util/Collection
     124: astore        15
     126: iconst_0
     127: istore        16
     129: aload         14
     131: invokeinterface #98,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     136: astore        17
     138: aload         17
     140: invokeinterface #104,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     145: ifeq          207
     148: aload         17
     150: invokeinterface #107,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     155: astore        18
     157: aload         15
     159: aload         18
     161: checkcast     #21                 // class java/lang/Number
     164: invokevirtual #25                 // Method java/lang/Number.intValue:()I
     167: istore        19
     169: astore        20
     171: iconst_0
     172: istore        21
     174: new           #167                // class kotlin/Triple
     177: dup
     178: iload_2
     179: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     182: iload         9
     184: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     187: iload         19
     189: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     192: invokespecial #220                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
     195: aload         20
     197: swap
     198: invokeinterface #123,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     203: pop
     204: goto          138
     207: aload         15
     209: checkcast     #125                // class java/util/List
     212: nop
     213: checkcast     #37                 // class java/lang/Iterable
     216: nop
     217: aload         4
     219: swap
     220: invokestatic  #224                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     223: pop
     224: goto          35
     227: aload         4
     229: checkcast     #125                // class java/util/List
     232: checkcast     #37                 // class java/lang/Iterable
     235: areturn

  private static final boolean solve2$lambda$7(kotlin.Triple);
    Code:
       0: aload_0
       1: ldc           #208                // String it
       3: invokestatic  #83                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: getstatic     #211                // Field INSTANCE:Lde/bitfroest/aoc2020/Day01;
       9: aload_0
      10: invokespecial #231                // Method sum:(Lkotlin/Triple;)I
      13: sipush        2020
      16: if_icmpne     23
      19: iconst_1
      20: goto          24
      23: iconst_0
      24: ireturn

  static {};
    Code:
       0: new           #2                  // class de/bitfroest/aoc2020/Day01
       3: dup
       4: invokespecial #233                // Method "<init>":()V
       7: putstatic     #211                // Field INSTANCE:Lde/bitfroest/aoc2020/Day01;
      10: return
}


package algorithms

/**
 * Sorts the array using quicksort. Elements must be greater than zero.
 */
fun IntArray.quicksort() {
    require(all { it > 0 })
    quicksort(0, size - 1)
}

/**
 * Quicksort algorithm picking the highest element as pivot,
 * so elements are only shifted to the right if they are
 */
private fun IntArray.quicksort(from: Int, to: Int) {
    if (from < to) {
        val pivot = this[to]
        var index = from

        (from..to).forEach {
            if (this[it] < pivot) swap(index++, it)
        }
        swap(index, to)

        quicksort(from, index - 1)
        quicksort(index + 1, to)
    }
}

private fun IntArray.swap(a: Int, b: Int) {
    val temp = this[a]
    this[a] = this[b]
    this[b] = temp
}

Compiled from "Quicksort.kt"
public final class algorithms.QuicksortKt {
  public static final void quicksort(int[]);
    Code:
       0: aload_0
       1: ldc           #9                  // String <this>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: astore_1
       8: iconst_0
       9: istore_2
      10: iconst_0
      11: istore_3
      12: aload_1
      13: arraylength
      14: istore        4
      16: iload_3
      17: iload         4
      19: if_icmpge     57
      22: aload_1
      23: iload_3
      24: iaload
      25: istore        5
      27: iload         5
      29: istore        6
      31: iconst_0
      32: istore        7
      34: iload         6
      36: ifle          43
      39: iconst_1
      40: goto          44
      43: iconst_0
      44: ifne          51
      47: iconst_0
      48: goto          58
      51: iinc          3, 1
      54: goto          16
      57: iconst_1
      58: ifne          76
      61: ldc           #17                 // String Failed requirement.
      63: astore_2
      64: new           #19                 // class java/lang/IllegalArgumentException
      67: dup
      68: aload_2
      69: invokevirtual #23                 // Method java/lang/Object.toString:()Ljava/lang/String;
      72: invokespecial #27                 // Method java/lang/IllegalArgumentException."<init>":(Ljava/lang/String;)V
      75: athrow
      76: aload_0
      77: iconst_0
      78: aload_0
      79: arraylength
      80: iconst_1
      81: isub
      82: invokestatic  #30                 // Method quicksort:([III)V
      85: return

  private static final void quicksort(int[], int, int);
    Code:
       0: iload_1
       1: iload_2
       2: if_icmpge     125
       5: aload_0
       6: iload_2
       7: iaload
       8: istore_3
       9: iconst_0
      10: istore        4
      12: iload_1
      13: istore        4
      15: new           #41                 // class kotlin/ranges/IntRange
      18: dup
      19: iload_1
      20: iload_2
      21: invokespecial #44                 // Method kotlin/ranges/IntRange."<init>":(II)V
      24: checkcast     #46                 // class java/lang/Iterable
      27: astore        5
      29: iconst_0
      30: istore        6
      32: aload         5
      34: invokeinterface #50,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      39: astore        7
      41: aload         7
      43: invokeinterface #56,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      48: ifeq          99
      51: aload         7
      53: checkcast     #58                 // class kotlin/collections/IntIterator
      56: invokevirtual #62                 // Method kotlin/collections/IntIterator.nextInt:()I
      59: istore        8
      61: iload         8
      63: istore        9
      65: iconst_0
      66: istore        10
      68: aload_0
      69: iload         9
      71: iaload
      72: iload_3
      73: if_icmpge     94
      76: aload_0
      77: iload         4
      79: istore        11
      81: iload         11
      83: iconst_1
      84: iadd
      85: istore        4
      87: iload         11
      89: iload         9
      91: invokestatic  #65                 // Method swap:([III)V
      94: nop
      95: nop
      96: goto          41
      99: nop
     100: aload_0
     101: iload         4
     103: iload_2
     104: invokestatic  #65                 // Method swap:([III)V
     107: aload_0
     108: iload_1
     109: iload         4
     111: iconst_1
     112: isub
     113: invokestatic  #30                 // Method quicksort:([III)V
     116: aload_0
     117: iload         4
     119: iconst_1
     120: iadd
     121: iload_2
     122: invokestatic  #30                 // Method quicksort:([III)V
     125: return

  private static final void swap(int[], int, int);
    Code:
       0: aload_0
       1: iload_1
       2: iaload
       3: istore_3
       4: aload_0
       5: iload_1
       6: aload_0
       7: iload_2
       8: iaload
       9: iastore
      10: aload_0
      11: iload_2
      12: iload_3
      13: iastore
      14: return
}


package arrays

/**
 * Finds the minimum and maximum values. Elements can be any integer.
 *
 * @return a tuple of `(min, max)` or `null` if the array is empty.
 */
fun IntArray.findMinMaxNumbers(): Pair<Int, Int>? {
    if (isEmpty()) return null

    var min = Int.MAX_VALUE
    var max = Int.MIN_VALUE
    forEach {
        min = if (min > it) it else min
        max = if (max < it) it else max
    }
    return min to max
}

/**
 * Finds all prime numbers. Elements are greater than zero.
 *
 * @return an array of prime numbers.
 */
fun IntArray.findPrimeNumbers(): IntArray {
    require(all { it > 0 })

    var primeArray = intArrayOf()
    forEach { if (it.isPrime()) primeArray += it }
    return primeArray
}

/**
 * Almost any halfway efficient prime algorithm is acceptable here, but the steps required should not exceed the square
 * root of the number.
 */
private fun Int.isPrime(): Boolean {
    if (this == 1) return false
    (2..sqrt()).forEach { if (this % it == 0) return false }
    return true
}

/**
 * Square root rounded to the nearest lower integer.
 */
private fun Int.sqrt() = Math.sqrt(toDouble()).toInt()

/**
 * Determines the deepness of an array of arrays. A flat array (even if empty) has a deepness of `1`.
 */
fun Array<*>.deepness(): Int {
    return map { if (it is Array<*>) 1 + it.deepness() else 1 }.max() ?: 1
}

Compiled from "SpecialNumbers.kt"
public final class arrays.SpecialNumbersKt {
  public static final kotlin.Pair<java.lang.Integer, java.lang.Integer> findMinMaxNumbers(int[]);
    Code:
       0: aload_0
       1: ldc           #11                 // String <this>
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: arraylength
       8: ifne          15
      11: iconst_1
      12: goto          16
      15: iconst_0
      16: ifeq          21
      19: aconst_null
      20: areturn
      21: iconst_0
      22: istore_1
      23: ldc           #18                 // int 2147483647
      25: istore_1
      26: iconst_0
      27: istore_2
      28: ldc           #19                 // int -2147483648
      30: istore_2
      31: aload_0
      32: astore_3
      33: iconst_0
      34: istore        4
      36: iconst_0
      37: istore        5
      39: aload_3
      40: arraylength
      41: istore        6
      43: iload         5
      45: iload         6
      47: if_icmpge     97
      50: aload_3
      51: iload         5
      53: iaload
      54: istore        7
      56: iload         7
      58: istore        8
      60: iconst_0
      61: istore        9
      63: iload_1
      64: iload         8
      66: if_icmple     74
      69: iload         8
      71: goto          75
      74: iload_1
      75: istore_1
      76: iload_2
      77: iload         8
      79: if_icmpge     87
      82: iload         8
      84: goto          88
      87: iload_2
      88: istore_2
      89: nop
      90: nop
      91: iinc          5, 1
      94: goto          43
      97: nop
      98: iload_1
      99: invokestatic  #25                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     102: iload_2
     103: invokestatic  #25                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     106: invokestatic  #31                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     109: areturn

  public static final int[] findPrimeNumbers(int[]);
    Code:
       0: aload_0
       1: ldc           #11                 // String <this>
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: astore_1
       8: iconst_0
       9: istore_2
      10: iconst_0
      11: istore_3
      12: aload_1
      13: arraylength
      14: istore        4
      16: iload_3
      17: iload         4
      19: if_icmpge     57
      22: aload_1
      23: iload_3
      24: iaload
      25: istore        5
      27: iload         5
      29: istore        6
      31: iconst_0
      32: istore        7
      34: iload         6
      36: ifle          43
      39: iconst_1
      40: goto          44
      43: iconst_0
      44: ifne          51
      47: iconst_0
      48: goto          58
      51: iinc          3, 1
      54: goto          16
      57: iconst_1
      58: ifne          76
      61: ldc           #46                 // String Failed requirement.
      63: astore_2
      64: new           #48                 // class java/lang/IllegalArgumentException
      67: dup
      68: aload_2
      69: invokevirtual #52                 // Method java/lang/Object.toString:()Ljava/lang/String;
      72: invokespecial #56                 // Method java/lang/IllegalArgumentException."<init>":(Ljava/lang/String;)V
      75: athrow
      76: aconst_null
      77: astore_1
      78: iconst_0
      79: newarray       int
      81: astore_1
      82: aload_0
      83: astore_2
      84: iconst_0
      85: istore_3
      86: iconst_0
      87: istore        4
      89: aload_2
      90: arraylength
      91: istore        5
      93: iload         4
      95: iload         5
      97: if_icmpge     135
     100: aload_2
     101: iload         4
     103: iaload
     104: istore        6
     106: iload         6
     108: istore        7
     110: iconst_0
     111: istore        8
     113: iload         7
     115: invokestatic  #60                 // Method isPrime:(I)Z
     118: ifeq          128
     121: aload_1
     122: iload         7
     124: invokestatic  #66                 // Method kotlin/collections/ArraysKt.plus:([II)[I
     127: astore_1
     128: nop
     129: iinc          4, 1
     132: goto          93
     135: nop
     136: aload_1
     137: areturn

  private static final boolean isPrime(int);
    Code:
       0: iload_0
       1: iconst_1
       2: if_icmpne     7
       5: iconst_0
       6: ireturn
       7: new           #75                 // class kotlin/ranges/IntRange
      10: dup
      11: iconst_2
      12: iload_0
      13: invokestatic  #79                 // Method sqrt:(I)I
      16: invokespecial #82                 // Method kotlin/ranges/IntRange."<init>":(II)V
      19: checkcast     #84                 // class java/lang/Iterable
      22: astore_1
      23: iconst_0
      24: istore_2
      25: aload_1
      26: invokeinterface #88,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      31: astore_3
      32: aload_3
      33: invokeinterface #94,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      38: ifeq          70
      41: aload_3
      42: checkcast     #96                 // class kotlin/collections/IntIterator
      45: invokevirtual #100                // Method kotlin/collections/IntIterator.nextInt:()I
      48: istore        4
      50: iload         4
      52: istore        5
      54: iconst_0
      55: istore        6
      57: iload_0
      58: iload         5
      60: irem
      61: ifne          66
      64: iconst_0
      65: ireturn
      66: nop
      67: goto          32
      70: nop
      71: iconst_1
      72: ireturn

  private static final int sqrt(int);
    Code:
       0: iload_0
       1: i2d
       2: invokestatic  #108                // Method java/lang/Math.sqrt:(D)D
       5: d2i
       6: ireturn

  public static final int deepness(java.lang.Object[]);
    Code:
       0: aload_0
       1: ldc           #11                 // String <this>
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: astore_3
      12: new           #113                // class java/util/ArrayList
      15: dup
      16: aload_1
      17: arraylength
      18: invokespecial #116                // Method java/util/ArrayList."<init>":(I)V
      21: checkcast     #118                // class java/util/Collection
      24: astore        4
      26: iconst_0
      27: istore        5
      29: iconst_0
      30: istore        6
      32: aload_3
      33: arraylength
      34: istore        7
      36: iload         6
      38: iload         7
      40: if_icmpge     100
      43: aload_3
      44: iload         6
      46: aaload
      47: astore        8
      49: aload         4
      51: aload         8
      53: astore        9
      55: astore        11
      57: iconst_0
      58: istore        10
      60: aload         9
      62: instanceof    #120                // class "[Ljava/lang/Object;"
      65: ifeq          81
      68: iconst_1
      69: aload         9
      71: checkcast     #120                // class "[Ljava/lang/Object;"
      74: invokestatic  #122                // Method deepness:([Ljava/lang/Object;)I
      77: iadd
      78: goto          82
      81: iconst_1
      82: invokestatic  #25                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      85: aload         11
      87: swap
      88: invokeinterface #126,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      93: pop
      94: iinc          6, 1
      97: goto          36
     100: aload         4
     102: checkcast     #128                // class java/util/List
     105: nop
     106: checkcast     #84                 // class java/lang/Iterable
     109: invokestatic  #134                // Method kotlin/collections/CollectionsKt.maxOrThrow:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     112: checkcast     #136                // class java/lang/Number
     115: invokevirtual #139                // Method java/lang/Number.intValue:()I
     118: ireturn
}


package search

class BinarySearch {

    fun binarySearch(arr: IntArray, l: Int, r: Int, key: Int): Int {
        if (r < l) return -1

        val mid = (l + r) / 2
        if (key == arr[mid]) {
            return mid
        }

        return if (key > arr[mid]) {
            binarySearch(arr, mid + 1, r, key)
        } else {
            binarySearch(arr, l, mid - 1, key)
        }
    }

    fun pivotedBinarySearch(array: IntArray, n: Int, value: Int): Int {
        val pivot = findPivot(array, 0, n - 1)

        // If we didn't find a pivot, then
        // array is not rotated at all
        if (pivot == -1) {
            return binarySearch(array, 0, n - 1, value)
        }

        // If we found a pivot, then first
        // compare with pivot and then
        // search in two subarrays around pivot
        if (array[pivot] == value) {
            return pivot
        }
        return if (array[0] <= value) {
            binarySearch(array, 0, pivot - 1, value)
        } else {
            binarySearch(array, pivot + 1, n - 1, value)
        }
    }

    /* Function to get pivot. For array
       3, 4, 5, 6, 1, 2 it returns
       3 (index of 6) */
    fun findPivot(arr: IntArray, l: Int, r: Int): Int {
        // base cases
        if (r < l) {
            return -1
        }
        if (r == l) {
            return l
        }

        /* low + (high - low)/2; */
        val mid = (l + r) / 2
        if (mid < r && arr[mid] > arr[mid + 1]) {
            return mid
        }
        if (mid > l && arr[mid] < arr[mid - 1]) {
            return mid - 1
        }
        return if (arr[l] >= arr[mid]) {
            findPivot(arr, l, mid - 1)
        } else {
            findPivot(arr, mid + 1, r)
        }
    }
}

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

  public final int binarySearch(int[], int, int, int);
    Code:
       0: aload_1
       1: ldc           #15                 // String arr
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_3
       7: iload_2
       8: if_icmpge     13
      11: iconst_m1
      12: ireturn
      13: iload_2
      14: iload_3
      15: iadd
      16: iconst_2
      17: idiv
      18: istore        5
      20: iload         4
      22: aload_1
      23: iload         5
      25: iaload
      26: if_icmpne     32
      29: iload         5
      31: ireturn
      32: iload         4
      34: aload_1
      35: iload         5
      37: iaload
      38: if_icmple     56
      41: aload_0
      42: aload_1
      43: iload         5
      45: iconst_1
      46: iadd
      47: iload_3
      48: iload         4
      50: invokevirtual #23                 // Method binarySearch:([IIII)I
      53: goto          68
      56: aload_0
      57: aload_1
      58: iload_2
      59: iload         5
      61: iconst_1
      62: isub
      63: iload         4
      65: invokevirtual #23                 // Method binarySearch:([IIII)I
      68: ireturn

  public final int pivotedBinarySearch(int[], int, int);
    Code:
       0: aload_1
       1: ldc           #33                 // String array
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: iconst_0
       9: iload_2
      10: iconst_1
      11: isub
      12: invokevirtual #36                 // Method findPivot:([III)I
      15: istore        4
      17: iload         4
      19: iconst_m1
      20: if_icmpne     34
      23: aload_0
      24: aload_1
      25: iconst_0
      26: iload_2
      27: iconst_1
      28: isub
      29: iload_3
      30: invokevirtual #23                 // Method binarySearch:([IIII)I
      33: ireturn
      34: aload_1
      35: iload         4
      37: iaload
      38: iload_3
      39: if_icmpne     45
      42: iload         4
      44: ireturn
      45: aload_1
      46: iconst_0
      47: iaload
      48: iload_3
      49: if_icmpgt     66
      52: aload_0
      53: aload_1
      54: iconst_0
      55: iload         4
      57: iconst_1
      58: isub
      59: iload_3
      60: invokevirtual #23                 // Method binarySearch:([IIII)I
      63: goto          79
      66: aload_0
      67: aload_1
      68: iload         4
      70: iconst_1
      71: iadd
      72: iload_2
      73: iconst_1
      74: isub
      75: iload_3
      76: invokevirtual #23                 // Method binarySearch:([IIII)I
      79: ireturn

  public final int findPivot(int[], int, int);
    Code:
       0: aload_1
       1: ldc           #15                 // String arr
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_3
       7: iload_2
       8: if_icmpge     13
      11: iconst_m1
      12: ireturn
      13: iload_3
      14: iload_2
      15: if_icmpne     20
      18: iload_2
      19: ireturn
      20: iload_2
      21: iload_3
      22: iadd
      23: iconst_2
      24: idiv
      25: istore        4
      27: iload         4
      29: iload_3
      30: if_icmpge     49
      33: aload_1
      34: iload         4
      36: iaload
      37: aload_1
      38: iload         4
      40: iconst_1
      41: iadd
      42: iaload
      43: if_icmple     49
      46: iload         4
      48: ireturn
      49: iload         4
      51: iload_2
      52: if_icmple     73
      55: aload_1
      56: iload         4
      58: iaload
      59: aload_1
      60: iload         4
      62: iconst_1
      63: isub
      64: iaload
      65: if_icmpge     73
      68: iload         4
      70: iconst_1
      71: isub
      72: ireturn
      73: aload_1
      74: iload_2
      75: iaload
      76: aload_1
      77: iload         4
      79: iaload
      80: if_icmplt     96
      83: aload_0
      84: aload_1
      85: iload_2
      86: iload         4
      88: iconst_1
      89: isub
      90: invokevirtual #36                 // Method findPivot:([III)I
      93: goto          106
      96: aload_0
      97: aload_1
      98: iload         4
     100: iconst_1
     101: iadd
     102: iload_3
     103: invokevirtual #36                 // Method findPivot:([III)I
     106: ireturn
}