package fijb.leetcode.algorithms

// https://leetcode.com/problems/longest-palindromic-substring/
object A5LongestPalindromicSubstring {
    fun longestPalindrome(s: String): String {
        var max = Pair(0, 0)
        for (i in s.indices) max = maxPairOf(max, maxPairOf(getOddPair(s, i), getEvenPair(s, i)))
        return s.substring(max.first, max.second)
    }

    // "aba" for example
    private fun getOddPair(s: String, point: Int): Pair<Int, Int> {
        var i = 0
        while (point - i - 1 >= 0 && point + i + 1 <= s.length - 1 && s[point - i - 1] == s[point + i + 1]) i ++
        return Pair(maxOf(0, point - i), minOf(s.length, point + i) + 1)
    }

    // "abba" for example
    private fun getEvenPair(s: String, point: Int): Pair<Int, Int> {
        var i = 0
        if (point + 1 > s.length - 1 || s[point] != s[point + 1]) return Pair(0, 0)
        while (point - i - 1 >= 0 && point + i + 2 <= s.length - 1 && s[point - i - 1] == s[point + i + 2]) i ++
        return Pair(maxOf(0, point - i), minOf(s.length, point + i + 1) + 1)
    }

    private fun maxPairOf(p1: Pair<Int, Int>, p2: Pair<Int, Int>) =
        if (p1.second - p1.first >= p2.second - p2.first) p1 else p2
}

Compiled from "A5LongestPalindromicSubstring.kt"
public final class fijb.leetcode.algorithms.A5LongestPalindromicSubstring {
  public static final fijb.leetcode.algorithms.A5LongestPalindromicSubstring INSTANCE;

  private fijb.leetcode.algorithms.A5LongestPalindromicSubstring();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.lang.String longestPalindrome(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String s
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #23                 // class kotlin/Pair
       9: dup
      10: iconst_0
      11: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      14: iconst_0
      15: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      18: invokespecial #32                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      21: astore_2
      22: iconst_0
      23: istore_3
      24: aload_1
      25: checkcast     #34                 // class java/lang/CharSequence
      28: invokeinterface #38,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      33: istore        4
      35: iload_3
      36: iload         4
      38: if_icmpge     69
      41: aload_0
      42: aload_2
      43: aload_0
      44: aload_0
      45: aload_1
      46: iload_3
      47: invokespecial #42                 // Method getOddPair:(Ljava/lang/String;I)Lkotlin/Pair;
      50: aload_0
      51: aload_1
      52: iload_3
      53: invokespecial #45                 // Method getEvenPair:(Ljava/lang/String;I)Lkotlin/Pair;
      56: invokespecial #49                 // Method maxPairOf:(Lkotlin/Pair;Lkotlin/Pair;)Lkotlin/Pair;
      59: invokespecial #49                 // Method maxPairOf:(Lkotlin/Pair;Lkotlin/Pair;)Lkotlin/Pair;
      62: astore_2
      63: iinc          3, 1
      66: goto          35
      69: aload_1
      70: aload_2
      71: invokevirtual #53                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      74: checkcast     #55                 // class java/lang/Number
      77: invokevirtual #58                 // Method java/lang/Number.intValue:()I
      80: aload_2
      81: invokevirtual #61                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      84: checkcast     #55                 // class java/lang/Number
      87: invokevirtual #58                 // Method java/lang/Number.intValue:()I
      90: invokevirtual #67                 // Method java/lang/String.substring:(II)Ljava/lang/String;
      93: dup
      94: ldc           #69                 // String substring(...)
      96: invokestatic  #72                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      99: areturn

  private final kotlin.Pair<java.lang.Integer, java.lang.Integer> getOddPair(java.lang.String, int);
    Code:
       0: iconst_0
       1: istore_3
       2: iload_2
       3: iload_3
       4: isub
       5: iconst_1
       6: isub
       7: iflt          51
      10: iload_2
      11: iload_3
      12: iadd
      13: iconst_1
      14: iadd
      15: aload_1
      16: invokevirtual #79                 // Method java/lang/String.length:()I
      19: iconst_1
      20: isub
      21: if_icmpgt     51
      24: aload_1
      25: iload_2
      26: iload_3
      27: isub
      28: iconst_1
      29: isub
      30: invokevirtual #83                 // Method java/lang/String.charAt:(I)C
      33: aload_1
      34: iload_2
      35: iload_3
      36: iadd
      37: iconst_1
      38: iadd
      39: invokevirtual #83                 // Method java/lang/String.charAt:(I)C
      42: if_icmpne     51
      45: iinc          3, 1
      48: goto          2
      51: new           #23                 // class kotlin/Pair
      54: dup
      55: iconst_0
      56: iload_2
      57: iload_3
      58: isub
      59: invokestatic  #88                 // Method java/lang/Math.max:(II)I
      62: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      65: aload_1
      66: invokevirtual #79                 // Method java/lang/String.length:()I
      69: iload_2
      70: iload_3
      71: iadd
      72: invokestatic  #91                 // Method java/lang/Math.min:(II)I
      75: iconst_1
      76: iadd
      77: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: invokespecial #32                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      83: areturn

  private final kotlin.Pair<java.lang.Integer, java.lang.Integer> getEvenPair(java.lang.String, int);
    Code:
       0: iconst_0
       1: istore_3
       2: iload_2
       3: iconst_1
       4: iadd
       5: aload_1
       6: invokevirtual #79                 // Method java/lang/String.length:()I
       9: iconst_1
      10: isub
      11: if_icmpgt     29
      14: aload_1
      15: iload_2
      16: invokevirtual #83                 // Method java/lang/String.charAt:(I)C
      19: aload_1
      20: iload_2
      21: iconst_1
      22: iadd
      23: invokevirtual #83                 // Method java/lang/String.charAt:(I)C
      26: if_icmpeq     45
      29: new           #23                 // class kotlin/Pair
      32: dup
      33: iconst_0
      34: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      37: iconst_0
      38: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      41: invokespecial #32                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      44: areturn
      45: iload_2
      46: iload_3
      47: isub
      48: iconst_1
      49: isub
      50: iflt          94
      53: iload_2
      54: iload_3
      55: iadd
      56: iconst_2
      57: iadd
      58: aload_1
      59: invokevirtual #79                 // Method java/lang/String.length:()I
      62: iconst_1
      63: isub
      64: if_icmpgt     94
      67: aload_1
      68: iload_2
      69: iload_3
      70: isub
      71: iconst_1
      72: isub
      73: invokevirtual #83                 // Method java/lang/String.charAt:(I)C
      76: aload_1
      77: iload_2
      78: iload_3
      79: iadd
      80: iconst_2
      81: iadd
      82: invokevirtual #83                 // Method java/lang/String.charAt:(I)C
      85: if_icmpne     94
      88: iinc          3, 1
      91: goto          45
      94: new           #23                 // class kotlin/Pair
      97: dup
      98: iconst_0
      99: iload_2
     100: iload_3
     101: isub
     102: invokestatic  #88                 // Method java/lang/Math.max:(II)I
     105: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     108: aload_1
     109: invokevirtual #79                 // Method java/lang/String.length:()I
     112: iload_2
     113: iload_3
     114: iadd
     115: iconst_1
     116: iadd
     117: invokestatic  #91                 // Method java/lang/Math.min:(II)I
     120: iconst_1
     121: iadd
     122: invokestatic  #29                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     125: invokespecial #32                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     128: areturn

  private final kotlin.Pair<java.lang.Integer, java.lang.Integer> maxPairOf(kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_1
       1: invokevirtual #61                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
       4: checkcast     #55                 // class java/lang/Number
       7: invokevirtual #58                 // Method java/lang/Number.intValue:()I
      10: aload_1
      11: invokevirtual #53                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      14: checkcast     #55                 // class java/lang/Number
      17: invokevirtual #58                 // Method java/lang/Number.intValue:()I
      20: isub
      21: aload_2
      22: invokevirtual #61                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      25: checkcast     #55                 // class java/lang/Number
      28: invokevirtual #58                 // Method java/lang/Number.intValue:()I
      31: aload_2
      32: invokevirtual #53                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      35: checkcast     #55                 // class java/lang/Number
      38: invokevirtual #58                 // Method java/lang/Number.intValue:()I
      41: isub
      42: if_icmplt     49
      45: aload_1
      46: goto          50
      49: aload_2
      50: areturn

  static {};
    Code:
       0: new           #2                  // class fijb/leetcode/algorithms/A5LongestPalindromicSubstring
       3: dup
       4: invokespecial #97                 // Method "<init>":()V
       7: putstatic     #100                // Field INSTANCE:Lfijb/leetcode/algorithms/A5LongestPalindromicSubstring;
      10: return
}


package fijb.leetcode.algorithms

//https://leetcode.com/problems/add-two-numbers/
object A2AddTwoNumbers {
    fun addTwoNumbers(l1: ListNode?, l2: ListNode?): ListNode? {
        var result : ListNode? = null
        var it: ListNode? = null
        var it1 = l1
        var it2 = l2

        var dev = 0
        while (it1 != null) {
            var sum =
                if (it2 == null) it1.`val` + dev
                else it1.`val` + it2.`val` + dev
            dev = sum / 10
            sum %= 10
            if (result == null) {
                result = ListNode(sum)
                it = result
            }
            else {
                it?.next = ListNode(sum)
                it = it?.next
            }
            it1 = it1.next
            it2 = it2?.next
        }
        while (it2 != null) {
            var sum = it2.`val` + dev
            dev = sum / 10
            sum %= 10
            it?.next = ListNode(sum)
            it = it?.next
            it2 = it2.next
        }
        if (dev != 0) it?.next = ListNode(dev)

        return result
    }

    class ListNode(var `val`: Int) {
        var next: ListNode? = null

        override fun toString(): String {
            val result = StringBuilder()
            var it : ListNode? = this

            while (it != null) {
                result.append("${it.`val`} ")
                it = it.next
            }
            return "[" + result.toString().trim().replace(" ", ",") + "]"
        }

        override fun equals(other: Any?): Boolean {
            var it1: ListNode? = this
            var it2: ListNode? = other as ListNode

            while (it1 != null) {
                if (it1.`val` != it2?.`val`) return false
                it1 = it1.next
                it2 = it2.next
            }
            if (it2 != null) return false
            return true
        }

        override fun hashCode(): Int {
            var result = `val`
            result = 31 * result + (next?.hashCode() ?: 0)
            return result
        }
    }
}

Compiled from "A2AddTwoNumbers.kt"
public final class fijb.leetcode.algorithms.A2AddTwoNumbers$ListNode {
  private int val;

  private fijb.leetcode.algorithms.A2AddTwoNumbers$ListNode next;

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

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

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

  public final fijb.leetcode.algorithms.A2AddTwoNumbers$ListNode getNext();
    Code:
       0: aload_0
       1: getfield      #25                 // Field next:Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
       4: areturn

  public final void setNext(fijb.leetcode.algorithms.A2AddTwoNumbers$ListNode);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #25                 // Field next:Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
       5: return

  public java.lang.String toString();
    Code:
       0: new           #32                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #33                 // Method java/lang/StringBuilder."<init>":()V
       7: astore_1
       8: aload_0
       9: astore_2
      10: aload_2
      11: ifnull        49
      14: aload_1
      15: new           #32                 // class java/lang/StringBuilder
      18: dup
      19: invokespecial #33                 // Method java/lang/StringBuilder."<init>":()V
      22: aload_2
      23: getfield      #13                 // Field val:I
      26: invokevirtual #37                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      29: bipush        32
      31: invokevirtual #40                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      34: invokevirtual #42                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      37: invokevirtual #45                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      40: pop
      41: aload_2
      42: getfield      #25                 // Field next:Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
      45: astore_2
      46: goto          10
      49: new           #32                 // class java/lang/StringBuilder
      52: dup
      53: invokespecial #33                 // Method java/lang/StringBuilder."<init>":()V
      56: bipush        91
      58: invokevirtual #40                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      61: aload_1
      62: invokevirtual #42                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      65: dup
      66: ldc           #47                 // String toString(...)
      68: invokestatic  #53                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      71: checkcast     #55                 // class java/lang/CharSequence
      74: invokestatic  #61                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      77: invokevirtual #62                 // Method java/lang/Object.toString:()Ljava/lang/String;
      80: ldc           #64                 // String
      82: ldc           #66                 // String ,
      84: iconst_0
      85: iconst_4
      86: aconst_null
      87: invokestatic  #70                 // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
      90: invokevirtual #45                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      93: bipush        93
      95: invokevirtual #40                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      98: invokevirtual #42                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     101: areturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: astore_2
       2: aload_1
       3: ldc           #77                 // String null cannot be cast to non-null type fijb.leetcode.algorithms.A2AddTwoNumbers.ListNode
       5: invokestatic  #80                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
       8: aload_1
       9: checkcast     #2                  // class fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode
      12: astore_3
      13: aload_2
      14: ifnull        64
      17: aload_3
      18: astore        4
      20: aload         4
      22: ifnull        45
      25: aload_2
      26: getfield      #13                 // Field val:I
      29: aload         4
      31: getfield      #13                 // Field val:I
      34: if_icmpne     41
      37: iconst_1
      38: goto          46
      41: iconst_0
      42: goto          46
      45: iconst_0
      46: ifne          51
      49: iconst_0
      50: ireturn
      51: aload_2
      52: getfield      #25                 // Field next:Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
      55: astore_2
      56: aload_3
      57: getfield      #25                 // Field next:Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
      60: astore_3
      61: goto          13
      64: aload_3
      65: ifnull        70
      68: iconst_0
      69: ireturn
      70: iconst_1
      71: ireturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field val:I
       4: istore_1
       5: bipush        31
       7: iload_1
       8: imul
       9: aload_0
      10: getfield      #25                 // Field next:Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
      13: dup
      14: ifnull        23
      17: invokevirtual #87                 // Method hashCode:()I
      20: goto          25
      23: pop
      24: iconst_0
      25: iadd
      26: istore_1
      27: iload_1
      28: ireturn
}

Compiled from "A2AddTwoNumbers.kt"
public final class fijb.leetcode.algorithms.A2AddTwoNumbers {
  public static final fijb.leetcode.algorithms.A2AddTwoNumbers INSTANCE;

  private fijb.leetcode.algorithms.A2AddTwoNumbers();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final fijb.leetcode.algorithms.A2AddTwoNumbers$ListNode addTwoNumbers(fijb.leetcode.algorithms.A2AddTwoNumbers$ListNode, fijb.leetcode.algorithms.A2AddTwoNumbers$ListNode);
    Code:
       0: aconst_null
       1: astore_3
       2: aconst_null
       3: astore        4
       5: aload_1
       6: astore        5
       8: aload_2
       9: astore        6
      11: iconst_0
      12: istore        7
      14: aload         5
      16: ifnull        149
      19: aload         6
      21: ifnonnull     35
      24: aload         5
      26: invokevirtual #19                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getVal:()I
      29: iload         7
      31: iadd
      32: goto          49
      35: aload         5
      37: invokevirtual #19                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getVal:()I
      40: aload         6
      42: invokevirtual #19                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getVal:()I
      45: iadd
      46: iload         7
      48: iadd
      49: istore        8
      51: iload         8
      53: bipush        10
      55: idiv
      56: istore        7
      58: iload         8
      60: bipush        10
      62: irem
      63: istore        8
      65: aload_3
      66: ifnonnull     85
      69: new           #15                 // class fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode
      72: dup
      73: iload         8
      75: invokespecial #22                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode."<init>":(I)V
      78: astore_3
      79: aload_3
      80: astore        4
      82: goto          123
      85: aload         4
      87: dup
      88: ifnull        106
      91: new           #15                 // class fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode
      94: dup
      95: iload         8
      97: invokespecial #22                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode."<init>":(I)V
     100: invokevirtual #26                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.setNext:(Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;)V
     103: goto          107
     106: pop
     107: aload         4
     109: dup
     110: ifnull        119
     113: invokevirtual #30                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getNext:()Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
     116: goto          121
     119: pop
     120: aconst_null
     121: astore        4
     123: aload         5
     125: invokevirtual #30                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getNext:()Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
     128: astore        5
     130: aload         6
     132: dup
     133: ifnull        142
     136: invokevirtual #30                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getNext:()Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
     139: goto          144
     142: pop
     143: aconst_null
     144: astore        6
     146: goto          14
     149: aload         6
     151: ifnull        226
     154: aload         6
     156: invokevirtual #19                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getVal:()I
     159: iload         7
     161: iadd
     162: istore        8
     164: iload         8
     166: bipush        10
     168: idiv
     169: istore        7
     171: iload         8
     173: bipush        10
     175: irem
     176: istore        8
     178: aload         4
     180: dup
     181: ifnull        199
     184: new           #15                 // class fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode
     187: dup
     188: iload         8
     190: invokespecial #22                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode."<init>":(I)V
     193: invokevirtual #26                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.setNext:(Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;)V
     196: goto          200
     199: pop
     200: aload         4
     202: dup
     203: ifnull        212
     206: invokevirtual #30                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getNext:()Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
     209: goto          214
     212: pop
     213: aconst_null
     214: astore        4
     216: aload         6
     218: invokevirtual #30                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.getNext:()Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;
     221: astore        6
     223: goto          149
     226: iload         7
     228: ifeq          253
     231: aload         4
     233: dup
     234: ifnull        252
     237: new           #15                 // class fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode
     240: dup
     241: iload         7
     243: invokespecial #22                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode."<init>":(I)V
     246: invokevirtual #26                 // Method fijb/leetcode/algorithms/A2AddTwoNumbers$ListNode.setNext:(Lfijb/leetcode/algorithms/A2AddTwoNumbers$ListNode;)V
     249: goto          253
     252: pop
     253: aload_3
     254: areturn

  static {};
    Code:
       0: new           #2                  // class fijb/leetcode/algorithms/A2AddTwoNumbers
       3: dup
       4: invokespecial #42                 // Method "<init>":()V
       7: putstatic     #45                 // Field INSTANCE:Lfijb/leetcode/algorithms/A2AddTwoNumbers;
      10: return
}


package fijb.leetcode.algorithms

//https://leetcode.com/problems/median-of-two-sorted-arrays/
object A4MedianOfTwoSortedArrays {
    fun findMedianSortedArrays(nums1: IntArray, nums2: IntArray): Double {
        val nums = arrayListOf<Int>()
        var i1 = 0
        var i2 = 0

        val s = (nums1.size + nums2.size)
        while (i1 < nums1.size && i2 < nums2.size) {
            if (i1 + i2 > s) break
            if (nums1[i1] < nums2[i2]) nums.add( nums1[i1 ++] )
            else nums.add( nums2[i2 ++] )
        }

        val h = s / 2
        val h1 = minOf(nums1.size, h + 1)
        val h2 = minOf(nums2.size, h + 1)

        while (i1 < h1) nums.add( nums1[i1 ++] )
        while (i2 < h2) nums.add( nums2[i2 ++] )

        return if (s % 2 == 0) 0.5 * (nums[h - 1] + nums[h]) else nums[h].toDouble()
    }
}

Compiled from "A4MedianOfTwoSortedArrays.kt"
public final class fijb.leetcode.algorithms.A4MedianOfTwoSortedArrays {
  public static final fijb.leetcode.algorithms.A4MedianOfTwoSortedArrays INSTANCE;

  private fijb.leetcode.algorithms.A4MedianOfTwoSortedArrays();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final double findMedianSortedArrays(int[], int[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String nums1
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #23                 // String nums2
       9: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #25                 // class java/util/ArrayList
      15: dup
      16: invokespecial #26                 // Method java/util/ArrayList."<init>":()V
      19: astore_3
      20: iconst_0
      21: istore        4
      23: iconst_0
      24: istore        5
      26: aload_1
      27: arraylength
      28: aload_2
      29: arraylength
      30: iadd
      31: istore        6
      33: iload         4
      35: aload_1
      36: arraylength
      37: if_icmpge     103
      40: iload         5
      42: aload_2
      43: arraylength
      44: if_icmpge     103
      47: iload         4
      49: iload         5
      51: iadd
      52: iload         6
      54: if_icmpgt     103
      57: aload_1
      58: iload         4
      60: iaload
      61: aload_2
      62: iload         5
      64: iaload
      65: if_icmpge     85
      68: aload_3
      69: aload_1
      70: iload         4
      72: iinc          4, 1
      75: iaload
      76: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      79: invokevirtual #36                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      82: goto          99
      85: aload_3
      86: aload_2
      87: iload         5
      89: iinc          5, 1
      92: iaload
      93: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      96: invokevirtual #36                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      99: pop
     100: goto          33
     103: iload         6
     105: iconst_2
     106: idiv
     107: istore        7
     109: aload_1
     110: arraylength
     111: iload         7
     113: iconst_1
     114: iadd
     115: invokestatic  #42                 // Method java/lang/Math.min:(II)I
     118: istore        8
     120: aload_2
     121: arraylength
     122: iload         7
     124: iconst_1
     125: iadd
     126: invokestatic  #42                 // Method java/lang/Math.min:(II)I
     129: istore        9
     131: iload         4
     133: iload         8
     135: if_icmpge     156
     138: aload_3
     139: aload_1
     140: iload         4
     142: iinc          4, 1
     145: iaload
     146: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     149: invokevirtual #36                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     152: pop
     153: goto          131
     156: iload         5
     158: iload         9
     160: if_icmpge     181
     163: aload_3
     164: aload_2
     165: iload         5
     167: iinc          5, 1
     170: iaload
     171: invokestatic  #32                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     174: invokevirtual #36                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     177: pop
     178: goto          156
     181: iload         6
     183: iconst_2
     184: irem
     185: ifne          229
     188: ldc2_w        #43                 // double 0.5d
     191: aload_3
     192: iload         7
     194: iconst_1
     195: isub
     196: invokevirtual #48                 // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
     199: checkcast     #50                 // class java/lang/Number
     202: invokevirtual #54                 // Method java/lang/Number.intValue:()I
     205: aload_3
     206: iload         7
     208: invokevirtual #48                 // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
     211: dup
     212: ldc           #56                 // String get(...)
     214: invokestatic  #59                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     217: checkcast     #50                 // class java/lang/Number
     220: invokevirtual #54                 // Method java/lang/Number.intValue:()I
     223: iadd
     224: i2d
     225: dmul
     226: goto          242
     229: aload_3
     230: iload         7
     232: invokevirtual #48                 // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
     235: checkcast     #50                 // class java/lang/Number
     238: invokevirtual #54                 // Method java/lang/Number.intValue:()I
     241: i2d
     242: dreturn

  static {};
    Code:
       0: new           #2                  // class fijb/leetcode/algorithms/A4MedianOfTwoSortedArrays
       3: dup
       4: invokespecial #72                 // Method "<init>":()V
       7: putstatic     #75                 // Field INSTANCE:Lfijb/leetcode/algorithms/A4MedianOfTwoSortedArrays;
      10: return
}


package solutions.CHK

object CheckoutSolution {
    val prices = hashMapOf(
    "A" to 50,
    "B" to 30,
    "C" to 20,
    "D" to 15,
    "E" to 40,
    "F" to 10,
    "G" to 20,
    "H" to 10,
    "I" to 35,
    "J" to 60,
    "K" to 80,
    "L" to 90,
    "M" to 15,
    "N" to 40,
    "O" to 10,
    "P" to 50,
    "Q" to 30,
    "R" to 50,
    "S" to 30,
    "T" to 20,
    "U" to 40,
    "V" to 50,
    "W" to 20,
    "X" to 90,
    "Z" to 50,
    "Y" to 10
    )

    const val PRICE_A = 50
    const val PRICE_B = 30
    const val PRICE_C = 20
    const val PRICE_D = 15
    const val PRICE_E = 40
    const val PRICE_F = 10

    const val A_OFFER3 = 130
    const val A_OFFER5 = 200
    const val B_OFFER2 = 45

    fun checkout(skus: String): Int {
        if (skus.any { !listOf('A', 'B', 'C', 'D', 'E', 'F').contains(it) }) {
            return -1
        }

        // calculating As
        val offerA5 = calculateOffer(
            PRICE_A,
            skus.count { it == 'A' } * PRICE_A,
            5,
            A_OFFER5
        )
        val offerA3 = calculateOffer(
            PRICE_A,
            offerA5.second,
            3,
            A_OFFER3
        )
        val totalA = offerA5.first + offerA3.first + offerA3.second

        // calculating Es
        val offerE = calculateOffer(
            PRICE_E,
            skus.count { it == 'E' } * PRICE_E,
            2,
            1
        )
        val adjustedBCount = skus.count { it == 'B' } - offerE.first

        // calculating Bs
        val newB = calculateOffer(
            PRICE_B,
            adjustedBCount * PRICE_B,
            2,
            B_OFFER2
        )
        val totalB = newB.first + newB.second

        // calculating Fs
        val offerF = calculateOffer(
            PRICE_F,
            skus.count { it == 'F' } * PRICE_F,
            3,
            1
        )
        val totalF = (skus.count { it == 'F' } * PRICE_F) - (offerF.first * PRICE_F)

        return totalA +
                (if (totalB <= 0) 0 else totalB) +
                (skus.count { it == 'C' } * PRICE_C) +
                (skus.count { it == 'D' } * PRICE_D) +
                (skus.count { it == 'E' } * PRICE_E) +
                totalF
    }

    private fun calculateOffer(
        price: Int,
        total: Int,
        multiplier: Int,
        offer: Int
    ) : Pair<Int, Int> {
        val leftover = total % (price * multiplier)
        val reduced = ((total - leftover) / (price * multiplier)) * offer
        return Pair(reduced, leftover)
    }
}

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

  private static final java.util.HashMap<java.lang.String, java.lang.Integer> prices;

  public static final int PRICE_A;

  public static final int PRICE_B;

  public static final int PRICE_C;

  public static final int PRICE_D;

  public static final int PRICE_E;

  public static final int PRICE_F;

  public static final int A_OFFER3;

  public static final int A_OFFER5;

  public static final int B_OFFER2;

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

  public final java.util.HashMap<java.lang.String, java.lang.Integer> getPrices();
    Code:
       0: getstatic     #18                 // Field prices:Ljava/util/HashMap;
       3: areturn

  public final int checkout(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #22                 // String skus
       3: invokestatic  #28                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #30                 // class java/lang/CharSequence
      10: astore_2
      11: iconst_0
      12: istore_3
      13: iconst_0
      14: istore        4
      16: iload         4
      18: aload_2
      19: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      24: if_icmpge     141
      27: aload_2
      28: iload         4
      30: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      35: istore        5
      37: iload         5
      39: istore        6
      41: iconst_0
      42: istore        7
      44: bipush        6
      46: anewarray     #40                 // class java/lang/Character
      49: astore        8
      51: aload         8
      53: iconst_0
      54: bipush        65
      56: invokestatic  #44                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      59: aastore
      60: aload         8
      62: iconst_1
      63: bipush        66
      65: invokestatic  #44                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      68: aastore
      69: aload         8
      71: iconst_2
      72: bipush        67
      74: invokestatic  #44                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      77: aastore
      78: aload         8
      80: iconst_3
      81: bipush        68
      83: invokestatic  #44                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      86: aastore
      87: aload         8
      89: iconst_4
      90: bipush        69
      92: invokestatic  #44                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      95: aastore
      96: aload         8
      98: iconst_5
      99: bipush        70
     101: invokestatic  #44                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     104: aastore
     105: aload         8
     107: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     110: iload         6
     112: invokestatic  #44                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     115: invokeinterface #56,  2           // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     120: ifne          127
     123: iconst_1
     124: goto          128
     127: iconst_0
     128: ifeq          135
     131: iconst_1
     132: goto          142
     135: iinc          4, 1
     138: goto          16
     141: iconst_0
     142: ifeq          147
     145: iconst_m1
     146: ireturn
     147: aload_0
     148: bipush        50
     150: aload_1
     151: checkcast     #30                 // class java/lang/CharSequence
     154: astore_3
     155: istore        19
     157: astore        18
     159: iconst_0
     160: istore        4
     162: iconst_0
     163: istore        5
     165: iconst_0
     166: istore        6
     168: iload         6
     170: aload_3
     171: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     176: if_icmpge     220
     179: aload_3
     180: iload         6
     182: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     187: istore        7
     189: iload         7
     191: istore        8
     193: iconst_0
     194: istore        9
     196: iload         8
     198: bipush        65
     200: if_icmpne     207
     203: iconst_1
     204: goto          208
     207: iconst_0
     208: ifeq          214
     211: iinc          5, 1
     214: iinc          6, 1
     217: goto          168
     220: iload         5
     222: istore        20
     224: aload         18
     226: iload         19
     228: iload         20
     230: bipush        50
     232: imul
     233: iconst_5
     234: sipush        200
     237: invokespecial #60                 // Method calculateOffer:(IIII)Lkotlin/Pair;
     240: astore_2
     241: aload_0
     242: bipush        50
     244: aload_2
     245: invokevirtual #66                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     248: checkcast     #68                 // class java/lang/Number
     251: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     254: iconst_3
     255: sipush        130
     258: invokespecial #60                 // Method calculateOffer:(IIII)Lkotlin/Pair;
     261: astore_3
     262: aload_2
     263: invokevirtual #74                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     266: checkcast     #68                 // class java/lang/Number
     269: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     272: aload_3
     273: invokevirtual #74                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     276: checkcast     #68                 // class java/lang/Number
     279: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     282: iadd
     283: aload_3
     284: invokevirtual #66                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     287: checkcast     #68                 // class java/lang/Number
     290: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     293: iadd
     294: istore        4
     296: aload_0
     297: bipush        40
     299: aload_1
     300: checkcast     #30                 // class java/lang/CharSequence
     303: astore        6
     305: istore        19
     307: astore        18
     309: iconst_0
     310: istore        7
     312: iconst_0
     313: istore        8
     315: iconst_0
     316: istore        9
     318: iload         9
     320: aload         6
     322: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     327: if_icmpge     372
     330: aload         6
     332: iload         9
     334: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     339: istore        10
     341: iload         10
     343: istore        11
     345: iconst_0
     346: istore        12
     348: iload         11
     350: bipush        69
     352: if_icmpne     359
     355: iconst_1
     356: goto          360
     359: iconst_0
     360: ifeq          366
     363: iinc          8, 1
     366: iinc          9, 1
     369: goto          318
     372: iload         8
     374: istore        20
     376: aload         18
     378: iload         19
     380: iload         20
     382: bipush        40
     384: imul
     385: iconst_2
     386: iconst_1
     387: invokespecial #60                 // Method calculateOffer:(IIII)Lkotlin/Pair;
     390: astore        5
     392: aload_1
     393: checkcast     #30                 // class java/lang/CharSequence
     396: astore        7
     398: iconst_0
     399: istore        8
     401: iconst_0
     402: istore        9
     404: iconst_0
     405: istore        10
     407: iload         10
     409: aload         7
     411: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     416: if_icmpge     461
     419: aload         7
     421: iload         10
     423: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     428: istore        11
     430: iload         11
     432: istore        12
     434: iconst_0
     435: istore        13
     437: iload         12
     439: bipush        66
     441: if_icmpne     448
     444: iconst_1
     445: goto          449
     448: iconst_0
     449: ifeq          455
     452: iinc          9, 1
     455: iinc          10, 1
     458: goto          407
     461: iload         9
     463: aload         5
     465: invokevirtual #74                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     468: checkcast     #68                 // class java/lang/Number
     471: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     474: isub
     475: istore        6
     477: aload_0
     478: bipush        30
     480: iload         6
     482: bipush        30
     484: imul
     485: iconst_2
     486: bipush        45
     488: invokespecial #60                 // Method calculateOffer:(IIII)Lkotlin/Pair;
     491: astore        7
     493: aload         7
     495: invokevirtual #74                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     498: checkcast     #68                 // class java/lang/Number
     501: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     504: aload         7
     506: invokevirtual #66                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     509: checkcast     #68                 // class java/lang/Number
     512: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     515: iadd
     516: istore        8
     518: aload_0
     519: bipush        10
     521: aload_1
     522: checkcast     #30                 // class java/lang/CharSequence
     525: astore        10
     527: istore        19
     529: astore        18
     531: iconst_0
     532: istore        11
     534: iconst_0
     535: istore        12
     537: iconst_0
     538: istore        13
     540: iload         13
     542: aload         10
     544: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     549: if_icmpge     594
     552: aload         10
     554: iload         13
     556: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     561: istore        14
     563: iload         14
     565: istore        15
     567: iconst_0
     568: istore        16
     570: iload         15
     572: bipush        70
     574: if_icmpne     581
     577: iconst_1
     578: goto          582
     581: iconst_0
     582: ifeq          588
     585: iinc          12, 1
     588: iinc          13, 1
     591: goto          540
     594: iload         12
     596: istore        20
     598: aload         18
     600: iload         19
     602: iload         20
     604: bipush        10
     606: imul
     607: iconst_3
     608: iconst_1
     609: invokespecial #60                 // Method calculateOffer:(IIII)Lkotlin/Pair;
     612: astore        9
     614: aload_1
     615: checkcast     #30                 // class java/lang/CharSequence
     618: astore        11
     620: iconst_0
     621: istore        12
     623: iconst_0
     624: istore        13
     626: iconst_0
     627: istore        14
     629: iload         14
     631: aload         11
     633: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     638: if_icmpge     683
     641: aload         11
     643: iload         14
     645: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     650: istore        15
     652: iload         15
     654: istore        16
     656: iconst_0
     657: istore        17
     659: iload         16
     661: bipush        70
     663: if_icmpne     670
     666: iconst_1
     667: goto          671
     670: iconst_0
     671: ifeq          677
     674: iinc          13, 1
     677: iinc          14, 1
     680: goto          629
     683: iload         13
     685: bipush        10
     687: imul
     688: aload         9
     690: invokevirtual #74                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     693: checkcast     #68                 // class java/lang/Number
     696: invokevirtual #71                 // Method java/lang/Number.intValue:()I
     699: bipush        10
     701: imul
     702: isub
     703: istore        10
     705: iload         4
     707: iload         8
     709: ifgt          716
     712: iconst_0
     713: goto          718
     716: iload         8
     718: iadd
     719: aload_1
     720: checkcast     #30                 // class java/lang/CharSequence
     723: astore        11
     725: istore        18
     727: iconst_0
     728: istore        12
     730: iconst_0
     731: istore        13
     733: iconst_0
     734: istore        14
     736: iload         14
     738: aload         11
     740: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     745: if_icmpge     790
     748: aload         11
     750: iload         14
     752: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     757: istore        15
     759: iload         15
     761: istore        16
     763: iconst_0
     764: istore        17
     766: iload         16
     768: bipush        67
     770: if_icmpne     777
     773: iconst_1
     774: goto          778
     777: iconst_0
     778: ifeq          784
     781: iinc          13, 1
     784: iinc          14, 1
     787: goto          736
     790: iload         13
     792: istore        19
     794: iload         18
     796: iload         19
     798: bipush        20
     800: imul
     801: iadd
     802: aload_1
     803: checkcast     #30                 // class java/lang/CharSequence
     806: astore        11
     808: istore        18
     810: iconst_0
     811: istore        12
     813: iconst_0
     814: istore        13
     816: iconst_0
     817: istore        14
     819: iload         14
     821: aload         11
     823: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     828: if_icmpge     873
     831: aload         11
     833: iload         14
     835: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     840: istore        15
     842: iload         15
     844: istore        16
     846: iconst_0
     847: istore        17
     849: iload         16
     851: bipush        68
     853: if_icmpne     860
     856: iconst_1
     857: goto          861
     860: iconst_0
     861: ifeq          867
     864: iinc          13, 1
     867: iinc          14, 1
     870: goto          819
     873: iload         13
     875: istore        19
     877: iload         18
     879: iload         19
     881: bipush        15
     883: imul
     884: iadd
     885: aload_1
     886: checkcast     #30                 // class java/lang/CharSequence
     889: astore        11
     891: istore        18
     893: iconst_0
     894: istore        12
     896: iconst_0
     897: istore        13
     899: iconst_0
     900: istore        14
     902: iload         14
     904: aload         11
     906: invokeinterface #34,  1           // InterfaceMethod java/lang/CharSequence.length:()I
     911: if_icmpge     956
     914: aload         11
     916: iload         14
     918: invokeinterface #38,  2           // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     923: istore        15
     925: iload         15
     927: istore        16
     929: iconst_0
     930: istore        17
     932: iload         16
     934: bipush        69
     936: if_icmpne     943
     939: iconst_1
     940: goto          944
     943: iconst_0
     944: ifeq          950
     947: iinc          13, 1
     950: iinc          14, 1
     953: goto          902
     956: iload         13
     958: istore        19
     960: iload         18
     962: iload         19
     964: bipush        40
     966: imul
     967: iadd
     968: iload         10
     970: iadd
     971: ireturn

  private final kotlin.Pair<java.lang.Integer, java.lang.Integer> calculateOffer(int, int, int, int);
    Code:
       0: iload_2
       1: iload_1
       2: iload_3
       3: imul
       4: irem
       5: istore        5
       7: iload_2
       8: iload         5
      10: isub
      11: iload_1
      12: iload_3
      13: imul
      14: idiv
      15: iload         4
      17: imul
      18: istore        6
      20: new           #62                 // class kotlin/Pair
      23: dup
      24: iload         6
      26: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      29: iload         5
      31: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      34: invokespecial #117                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      37: areturn

  static {};
    Code:
       0: new           #2                  // class solutions/CHK/CheckoutSolution
       3: dup
       4: invokespecial #125                // Method "<init>":()V
       7: putstatic     #128                // Field INSTANCE:Lsolutions/CHK/CheckoutSolution;
      10: bipush        26
      12: anewarray     #62                 // class kotlin/Pair
      15: astore_0
      16: aload_0
      17: iconst_0
      18: ldc           #130                // String A
      20: bipush        50
      22: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      28: aastore
      29: aload_0
      30: iconst_1
      31: ldc           #138                // String B
      33: bipush        30
      35: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      38: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      41: aastore
      42: aload_0
      43: iconst_2
      44: ldc           #139                // String C
      46: bipush        20
      48: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      51: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      54: aastore
      55: aload_0
      56: iconst_3
      57: ldc           #141                // String D
      59: bipush        15
      61: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      64: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      67: aastore
      68: aload_0
      69: iconst_4
      70: ldc           #143                // String E
      72: bipush        40
      74: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      77: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      80: aastore
      81: aload_0
      82: iconst_5
      83: ldc           #145                // String F
      85: bipush        10
      87: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      90: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      93: aastore
      94: aload_0
      95: bipush        6
      97: ldc           #147                // String G
      99: bipush        20
     101: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     104: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     107: aastore
     108: aload_0
     109: bipush        7
     111: ldc           #149                // String H
     113: bipush        10
     115: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     118: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     121: aastore
     122: aload_0
     123: bipush        8
     125: ldc           #150                // String I
     127: bipush        35
     129: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     132: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     135: aastore
     136: aload_0
     137: bipush        9
     139: ldc           #152                // String J
     141: bipush        60
     143: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     146: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     149: aastore
     150: aload_0
     151: bipush        10
     153: ldc           #154                // String K
     155: bipush        80
     157: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     160: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     163: aastore
     164: aload_0
     165: bipush        11
     167: ldc           #156                // String L
     169: bipush        90
     171: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     174: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     177: aastore
     178: aload_0
     179: bipush        12
     181: ldc           #158                // String M
     183: bipush        15
     185: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     188: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     191: aastore
     192: aload_0
     193: bipush        13
     195: ldc           #160                // String N
     197: bipush        40
     199: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     202: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     205: aastore
     206: aload_0
     207: bipush        14
     209: ldc           #162                // String O
     211: bipush        10
     213: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     216: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     219: aastore
     220: aload_0
     221: bipush        15
     223: ldc           #164                // String P
     225: bipush        50
     227: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     230: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     233: aastore
     234: aload_0
     235: bipush        16
     237: ldc           #166                // String Q
     239: bipush        30
     241: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     244: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     247: aastore
     248: aload_0
     249: bipush        17
     251: ldc           #168                // String R
     253: bipush        50
     255: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     258: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     261: aastore
     262: aload_0
     263: bipush        18
     265: ldc           #170                // String S
     267: bipush        30
     269: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     272: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     275: aastore
     276: aload_0
     277: bipush        19
     279: ldc           #172                // String T
     281: bipush        20
     283: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     286: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     289: aastore
     290: aload_0
     291: bipush        20
     293: ldc           #174                // String U
     295: bipush        40
     297: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     300: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     303: aastore
     304: aload_0
     305: bipush        21
     307: ldc           #176                // String V
     309: bipush        50
     311: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     314: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     317: aastore
     318: aload_0
     319: bipush        22
     321: ldc           #178                // String W
     323: bipush        20
     325: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     328: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     331: aastore
     332: aload_0
     333: bipush        23
     335: ldc           #180                // String X
     337: bipush        90
     339: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     342: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     345: aastore
     346: aload_0
     347: bipush        24
     349: ldc           #182                // String Z
     351: bipush        50
     353: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     356: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     359: aastore
     360: aload_0
     361: bipush        25
     363: ldc           #184                // String Y
     365: bipush        10
     367: invokestatic  #114                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     370: invokestatic  #136                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     373: aastore
     374: aload_0
     375: invokestatic  #190                // Method kotlin/collections/MapsKt.hashMapOf:([Lkotlin/Pair;)Ljava/util/HashMap;
     378: putstatic     #18                 // Field prices:Ljava/util/HashMap;
     381: return
}


package iii_conventions

data class RepeatedTimeInterval(val interval: TimeInterval, val repeat : Int = 1)

enum class TimeInterval {
    DAY(),
    WEEK(),
    YEAR();

    operator fun times(i: Int): RepeatedTimeInterval {
        return RepeatedTimeInterval(this, i)
    }
}

data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int) {
    operator fun compareTo(date2: MyDate): Int {
        return when {
            this.year != date2.year -> this.year.compareTo(date2.year)
            this.month != date2.month -> this.month.compareTo(date2.month)
            else -> this.dayOfMonth.compareTo(date2.dayOfMonth)
        }
    }

    fun nextDay(days : Int = 1) : MyDate {

        var d = this.dayOfMonth
        var m = this.month
        var y = this.year
        val daysOfMonth = when (m) {
            1, 3, 5, 7, 8, 10, 12 -> 31
            2 -> if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) 29 else 28
            else -> 30
        }

        var remainder = 0
        when {
            days <= daysOfMonth - this.dayOfMonth -> d += days
            days <= daysOfMonth - this.dayOfMonth + 28 -> {
                d += days - daysOfMonth
                m += 1
            }
            else -> {
                remainder = days - 28 - (daysOfMonth - this.dayOfMonth)
                d = 28
                m += 1
            }
        }
        if (m > 12) {
            m = 1
            y += 1
        }
        val result = MyDate(y, m, d)
        if (remainder > 0) {
            return result.nextDay(remainder)
        }
        return result
    }
}

operator fun MyDate.rangeTo(other: MyDate): DateRange = DateRange(this, other)

class DateRange(val start: MyDate, val endInclusive: MyDate) {
    operator fun contains(d: MyDate) = start <= d && d <= endInclusive
    operator fun iterator(): Iterator<MyDate> {
        return object : Iterator<MyDate> {
            var currentDate = start.copy()
            override fun hasNext(): Boolean {
                return currentDate <= endInclusive
            }

            override fun next(): MyDate {
                val retDate = currentDate
                currentDate = currentDate.nextDay()
                return retDate
            }
        }
    }
}

Compiled from "MyDate.kt"
public final class iii_conventions.MyDate {
  private final int year;

  private final int month;

  private final int dayOfMonth;

  public iii_conventions.MyDate(int, int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field year:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field month:I
      14: aload_0
      15: iload_3
      16: putfield      #19                 // Field dayOfMonth:I
      19: return

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

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

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

  public final int compareTo(iii_conventions.MyDate);
    Code:
       0: aload_1
       1: ldc           #30                 // String date2
       3: invokestatic  #36                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: nop
       7: aload_0
       8: getfield      #13                 // Field year:I
      11: aload_1
      12: getfield      #13                 // Field year:I
      15: if_icmpeq     32
      18: aload_0
      19: getfield      #13                 // Field year:I
      22: aload_1
      23: getfield      #13                 // Field year:I
      26: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      29: goto          68
      32: aload_0
      33: getfield      #16                 // Field month:I
      36: aload_1
      37: getfield      #16                 // Field month:I
      40: if_icmpeq     57
      43: aload_0
      44: getfield      #16                 // Field month:I
      47: aload_1
      48: getfield      #16                 // Field month:I
      51: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      54: goto          68
      57: aload_0
      58: getfield      #19                 // Field dayOfMonth:I
      61: aload_1
      62: getfield      #19                 // Field dayOfMonth:I
      65: invokestatic  #40                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      68: ireturn

  public final iii_conventions.MyDate nextDay(int);
    Code:
       0: aload_0
       1: getfield      #19                 // Field dayOfMonth:I
       4: istore_2
       5: aload_0
       6: getfield      #16                 // Field month:I
       9: istore_3
      10: aload_0
      11: getfield      #13                 // Field year:I
      14: istore        4
      16: iload_3
      17: tableswitch   { // 1 to 12
                     1: 80
                     2: 85
                     3: 80
                     4: 125
                     5: 80
                     6: 125
                     7: 80
                     8: 80
                     9: 125
                    10: 80
                    11: 125
                    12: 80
               default: 125
          }
      80: bipush        31
      82: goto          127
      85: aload_0
      86: getfield      #13                 // Field year:I
      89: sipush        400
      92: irem
      93: ifeq          115
      96: aload_0
      97: getfield      #13                 // Field year:I
     100: iconst_4
     101: irem
     102: ifne          120
     105: aload_0
     106: getfield      #13                 // Field year:I
     109: bipush        100
     111: irem
     112: ifeq          120
     115: bipush        29
     117: goto          127
     120: bipush        28
     122: goto          127
     125: bipush        30
     127: istore        5
     129: iconst_0
     130: istore        6
     132: nop
     133: iload_1
     134: iload         5
     136: aload_0
     137: getfield      #19                 // Field dayOfMonth:I
     140: isub
     141: if_icmpgt     151
     144: iload_2
     145: iload_1
     146: iadd
     147: istore_2
     148: goto          198
     151: iload_1
     152: iload         5
     154: aload_0
     155: getfield      #19                 // Field dayOfMonth:I
     158: isub
     159: bipush        28
     161: iadd
     162: if_icmpgt     178
     165: iload_2
     166: iload_1
     167: iload         5
     169: isub
     170: iadd
     171: istore_2
     172: iinc          3, 1
     175: goto          198
     178: iload_1
     179: bipush        28
     181: isub
     182: iload         5
     184: aload_0
     185: getfield      #19                 // Field dayOfMonth:I
     188: isub
     189: isub
     190: istore        6
     192: bipush        28
     194: istore_2
     195: iinc          3, 1
     198: iload_3
     199: bipush        12
     201: if_icmple     209
     204: iconst_1
     205: istore_3
     206: iinc          4, 1
     209: new           #2                  // class iii_conventions/MyDate
     212: dup
     213: iload         4
     215: iload_3
     216: iload_2
     217: invokespecial #44                 // Method "<init>":(III)V
     220: astore        7
     222: iload         6
     224: ifle          235
     227: aload         7
     229: iload         6
     231: invokevirtual #46                 // Method nextDay:(I)Liii_conventions/MyDate;
     234: areturn
     235: aload         7
     237: areturn

  public static iii_conventions.MyDate nextDay$default(iii_conventions.MyDate, int, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          8
       6: iconst_1
       7: istore_1
       8: aload_0
       9: iload_1
      10: invokevirtual #46                 // Method nextDay:(I)Liii_conventions/MyDate;
      13: areturn

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

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

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

  public final iii_conventions.MyDate copy(int, int, int);
    Code:
       0: new           #2                  // class iii_conventions/MyDate
       3: dup
       4: iload_1
       5: iload_2
       6: iload_3
       7: invokespecial #44                 // Method "<init>":(III)V
      10: areturn

  public static iii_conventions.MyDate copy$default(iii_conventions.MyDate, int, int, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #13                 // Field year:I
      11: istore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #16                 // Field month:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #19                 // Field dayOfMonth:I
      35: istore_3
      36: aload_0
      37: iload_1
      38: iload_2
      39: iload_3
      40: invokevirtual #64                 // Method copy:(III)Liii_conventions/MyDate;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #68                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #69                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #71                 // String MyDate(year=
       9: invokevirtual #75                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field year:I
      16: invokevirtual #78                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #80                 // String , month=
      21: invokevirtual #75                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field month:I
      28: invokevirtual #78                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #82                 // String , dayOfMonth=
      33: invokevirtual #75                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #19                 // Field dayOfMonth:I
      40: invokevirtual #78                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #85                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #87                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field year:I
       4: invokestatic  #93                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field month:I
      16: invokestatic  #93                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #19                 // Field dayOfMonth:I
      29: invokestatic  #93                 // Method java/lang/Integer.hashCode:(I)I
      32: iadd
      33: istore_1
      34: iload_1
      35: 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 iii_conventions/MyDate
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class iii_conventions/MyDate
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field year:I
      25: aload_2
      26: getfield      #13                 // Field year:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field month:I
      38: aload_2
      39: getfield      #16                 // Field month:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: aload_0
      48: getfield      #19                 // Field dayOfMonth:I
      51: aload_2
      52: getfield      #19                 // Field dayOfMonth:I
      55: if_icmpeq     60
      58: iconst_0
      59: ireturn
      60: iconst_1
      61: ireturn
}

Compiled from "MyDate.kt"
public final class iii_conventions.MyDateKt {
  public static final iii_conventions.DateRange rangeTo(iii_conventions.MyDate, iii_conventions.MyDate);
    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_1
       7: ldc           #17                 // String other
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #19                 // class iii_conventions/DateRange
      15: dup
      16: aload_0
      17: aload_1
      18: invokespecial #23                 // Method iii_conventions/DateRange."<init>":(Liii_conventions/MyDate;Liii_conventions/MyDate;)V
      21: areturn
}


package day01

import java.io.File

fun main() {
    val depths = parseInput()
    val part1 = countIncreases(depths)
    val slidingWindows = getSlidingWindows(depths)
    val part2 = countIncreases(slidingWindows)

    println(part1)
    println(part2)
}

fun parseInput(): List<Int> {
    return File("../../input/01.txt")
        .readLines()
        .map { it.toInt() }
}

fun countIncreases(measurements: List<Int>): Int {
    return (measurements.dropLast(1) zip measurements.drop(1))
        .count { it.first < it.second }
}

fun getSlidingWindows(depths: List<Int>): List<Int> {
    return zipSum(
        zipSum(
            depths.dropLast(2),
            depths.dropLast(1).drop(1)
        ),
        depths.drop(2)
    )
}

fun zipSum(first: List<Int>, second: List<Int>): List<Int> {
    return (first zip second).map{ it.first + it.second }
}

Compiled from "sonarSweep.kt"
public final class day01.SonarSweepKt {
  public static final void main();
    Code:
       0: invokestatic  #10                 // Method parseInput:()Ljava/util/List;
       3: astore_0
       4: aload_0
       5: invokestatic  #14                 // Method countIncreases:(Ljava/util/List;)I
       8: istore_1
       9: aload_0
      10: invokestatic  #18                 // Method getSlidingWindows:(Ljava/util/List;)Ljava/util/List;
      13: astore_2
      14: aload_2
      15: invokestatic  #14                 // Method countIncreases:(Ljava/util/List;)I
      18: istore_3
      19: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      22: iload_1
      23: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      26: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      29: iload_3
      30: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      33: return

  public static final java.util.List<java.lang.Integer> parseInput();
    Code:
       0: new           #40                 // class java/io/File
       3: dup
       4: ldc           #42                 // String ../../input/01.txt
       6: invokespecial #46                 // Method java/io/File."<init>":(Ljava/lang/String;)V
       9: aconst_null
      10: iconst_1
      11: aconst_null
      12: invokestatic  #52                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      15: checkcast     #54                 // class java/lang/Iterable
      18: astore_0
      19: nop
      20: iconst_0
      21: istore_1
      22: aload_0
      23: astore_2
      24: new           #56                 // class java/util/ArrayList
      27: dup
      28: aload_0
      29: bipush        10
      31: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      34: invokespecial #64                 // Method java/util/ArrayList."<init>":(I)V
      37: checkcast     #66                 // class java/util/Collection
      40: astore_3
      41: iconst_0
      42: istore        4
      44: aload_2
      45: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        5
      52: aload         5
      54: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          105
      62: aload         5
      64: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      69: astore        6
      71: aload_3
      72: aload         6
      74: checkcast     #82                 // class java/lang/String
      77: astore        7
      79: astore        9
      81: iconst_0
      82: istore        8
      84: aload         7
      86: invokestatic  #88                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      89: nop
      90: invokestatic  #92                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      93: aload         9
      95: swap
      96: invokeinterface #96,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     101: pop
     102: goto          52
     105: aload_3
     106: checkcast     #98                 // class java/util/List
     109: nop
     110: areturn

  public static final int countIncreases(java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc           #113                // String measurements
       3: invokestatic  #119                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iconst_1
       8: invokestatic  #123                // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;
      11: checkcast     #54                 // class java/lang/Iterable
      14: aload_0
      15: checkcast     #54                 // class java/lang/Iterable
      18: iconst_1
      19: invokestatic  #127                // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      22: checkcast     #54                 // class java/lang/Iterable
      25: invokestatic  #131                // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
      28: checkcast     #54                 // class java/lang/Iterable
      31: astore_1
      32: nop
      33: iconst_0
      34: istore_2
      35: aload_1
      36: instanceof    #66                 // class java/util/Collection
      39: ifeq          58
      42: aload_1
      43: checkcast     #66                 // class java/util/Collection
      46: invokeinterface #134,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      51: ifeq          58
      54: iconst_0
      55: goto          144
      58: iconst_0
      59: istore_3
      60: aload_1
      61: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      66: astore        4
      68: aload         4
      70: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      75: ifeq          143
      78: aload         4
      80: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      85: astore        5
      87: aload         5
      89: checkcast     #136                // class kotlin/Pair
      92: astore        6
      94: iconst_0
      95: istore        7
      97: aload         6
      99: invokevirtual #139                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     102: checkcast     #141                // class java/lang/Number
     105: invokevirtual #145                // Method java/lang/Number.intValue:()I
     108: aload         6
     110: invokevirtual #148                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     113: checkcast     #141                // class java/lang/Number
     116: invokevirtual #145                // Method java/lang/Number.intValue:()I
     119: if_icmpge     126
     122: iconst_1
     123: goto          127
     126: iconst_0
     127: ifeq          68
     130: iinc          3, 1
     133: iload_3
     134: ifge          68
     137: invokestatic  #151                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     140: goto          68
     143: iload_3
     144: ireturn

  public static final java.util.List<java.lang.Integer> getSlidingWindows(java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc           #159                // String depths
       3: invokestatic  #119                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: iconst_2
       8: invokestatic  #123                // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;
      11: aload_0
      12: iconst_1
      13: invokestatic  #123                // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;
      16: checkcast     #54                 // class java/lang/Iterable
      19: iconst_1
      20: invokestatic  #127                // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      23: invokestatic  #163                // Method zipSum:(Ljava/util/List;Ljava/util/List;)Ljava/util/List;
      26: aload_0
      27: checkcast     #54                 // class java/lang/Iterable
      30: iconst_2
      31: invokestatic  #127                // Method kotlin/collections/CollectionsKt.drop:(Ljava/lang/Iterable;I)Ljava/util/List;
      34: invokestatic  #163                // Method zipSum:(Ljava/util/List;Ljava/util/List;)Ljava/util/List;
      37: areturn

  public static final java.util.List<java.lang.Integer> zipSum(java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc           #166                // String first
       3: invokestatic  #119                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #168                // String second
       9: invokestatic  #119                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: checkcast     #54                 // class java/lang/Iterable
      16: aload_1
      17: checkcast     #54                 // class java/lang/Iterable
      20: invokestatic  #131                // Method kotlin/collections/CollectionsKt.zip:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/List;
      23: checkcast     #54                 // class java/lang/Iterable
      26: astore_2
      27: iconst_0
      28: istore_3
      29: aload_2
      30: astore        4
      32: new           #56                 // class java/util/ArrayList
      35: dup
      36: aload_2
      37: bipush        10
      39: invokestatic  #62                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      42: invokespecial #64                 // Method java/util/ArrayList."<init>":(I)V
      45: checkcast     #66                 // class java/util/Collection
      48: astore        5
      50: iconst_0
      51: istore        6
      53: aload         4
      55: invokeinterface #70,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      60: astore        7
      62: aload         7
      64: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      69: ifeq          133
      72: aload         7
      74: invokeinterface #80,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      79: astore        8
      81: aload         5
      83: aload         8
      85: checkcast     #136                // class kotlin/Pair
      88: astore        9
      90: astore        11
      92: iconst_0
      93: istore        10
      95: aload         9
      97: invokevirtual #139                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     100: checkcast     #141                // class java/lang/Number
     103: invokevirtual #145                // Method java/lang/Number.intValue:()I
     106: aload         9
     108: invokevirtual #148                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     111: checkcast     #141                // class java/lang/Number
     114: invokevirtual #145                // Method java/lang/Number.intValue:()I
     117: iadd
     118: invokestatic  #92                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     121: aload         11
     123: swap
     124: invokeinterface #96,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     129: pop
     130: goto          62
     133: aload         5
     135: checkcast     #98                 // class java/util/List
     138: nop
     139: areturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #172                // Method main:()V
       3: return
}