import kotlin.math.abs
import kotlin.math.sign

class Day009 {

    companion object {
        private val visitedTails = mutableSetOf<Point>()
    }

    var initialPoint = State(Point(0, 0), Point(0, 0))
    fun moveTheSnake(input: List<String>): Int {
        println(input.size)
        input.forEach {
            makeMove(initialPoint, it[2].digitToInt(), it[0].toPoint())
        }
        println(visitedTails)
        return visitedTails.size
    }

    data class State(
        val head: Point,
        val tail: Point
    )

    data class Point(
        val x: Int,
        val y: Int
    ) {
        infix operator fun plus(that: Point) =
            Point(this.x + that.x, this.y + that.y)

        fun moveTowards(other: Point): Point =
            Point(
                (other.x - x).sign + x,
                (other.y - y).sign + y
            )
    }

    private fun makeMove(initialState: State, numberOfTimes: Int, direction: Point): State {
        var head = initialState.head
        var tail = initialState.tail
        repeat(numberOfTimes) {
//            println("Step " + (it + 1) + " head $head and tail $tail")
            head += direction
            tail = moveTailAbs(tail, head)
            initialPoint = State(head, tail)
//            println("after move $initialPoint")
        }
        return State(head, tail)
    }

    private fun moveTailAbs(tailInitial: Point, headAfter: Point): Point {
        val result =
            if (abs(headAfter.x - abs(tailInitial.x)) <= 1 && abs(headAfter.y - abs(tailInitial.y)) <= 1) {
//        if ((headAfter.x - tailInitial.x).absoluteValue <= 1 && (headAfter.y - tailInitial.y).absoluteValue <= 1) {
                tailInitial
            } else {
            /*Point(
                    (headAfter.x - tailInitial.x).sign + tailInitial.x,
                    (headAfter.y - tailInitial.y).sign + tailInitial.y
                )*/
                tailInitial.moveTowards(headAfter)
            }

        visitedTails.add(result)
        return result
    }

    private fun Char.toPoint(): Point {
        return when (this) {
            'R' -> Point(1, 0)
            'L' -> Point(-1, 0)
            'U' -> Point(0, 1)
            'D' -> Point(0, -1)
            else -> {
                error("Value not valid")
            }
        }
    }
}

Compiled from "Day009.kt"
public final class Day009$Point {
  private final int x;

  private final int y;

  public Day009$Point(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 x:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field y:I
      14: return

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

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

  public final Day009$Point plus(Day009$Point);
    Code:
       0: aload_1
       1: ldc           #26                 // String that
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class Day009$Point
       9: dup
      10: aload_0
      11: getfield      #13                 // Field x:I
      14: aload_1
      15: getfield      #13                 // Field x:I
      18: iadd
      19: aload_0
      20: getfield      #16                 // Field y:I
      23: aload_1
      24: getfield      #16                 // Field y:I
      27: iadd
      28: invokespecial #34                 // Method "<init>":(II)V
      31: areturn

  public final Day009$Point moveTowards(Day009$Point);
    Code:
       0: aload_1
       1: ldc           #37                 // String other
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class Day009$Point
       9: dup
      10: aload_1
      11: getfield      #13                 // Field x:I
      14: aload_0
      15: getfield      #13                 // Field x:I
      18: isub
      19: invokestatic  #43                 // Method kotlin/math/MathKt.getSign:(I)I
      22: aload_0
      23: getfield      #13                 // Field x:I
      26: iadd
      27: aload_1
      28: getfield      #16                 // Field y:I
      31: aload_0
      32: getfield      #16                 // Field y:I
      35: isub
      36: invokestatic  #43                 // Method kotlin/math/MathKt.getSign:(I)I
      39: aload_0
      40: getfield      #16                 // Field y:I
      43: iadd
      44: invokespecial #34                 // Method "<init>":(II)V
      47: areturn

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

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

  public final Day009$Point copy(int, int);
    Code:
       0: new           #2                  // class Day009$Point
       3: dup
       4: iload_1
       5: iload_2
       6: invokespecial #34                 // Method "<init>":(II)V
       9: areturn

  public static Day009$Point copy$default(Day009$Point, int, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #13                 // Field x:I
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #16                 // Field y:I
      21: istore_2
      22: aload_0
      23: iload_1
      24: iload_2
      25: invokevirtual #51                 // Method copy:(II)LDay009$Point;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #55                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #56                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #58                 // String Point(x=
       9: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field x:I
      16: invokevirtual #65                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #67                 // String , y=
      21: invokevirtual #62                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field y:I
      28: invokevirtual #65                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #70                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #72                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:I
       4: invokestatic  #77                 // 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 y:I
      16: invokestatic  #77                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

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

Compiled from "Day009.kt"
public final class Day009 {
  public static final Day009$Companion Companion;

  private Day009$State initialPoint;

  private static final java.util.Set<Day009$Point> visitedTails;

  public Day009();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: new           #10                 // class Day009$State
       8: dup
       9: new           #12                 // class Day009$Point
      12: dup
      13: iconst_0
      14: iconst_0
      15: invokespecial #15                 // Method Day009$Point."<init>":(II)V
      18: new           #12                 // class Day009$Point
      21: dup
      22: iconst_0
      23: iconst_0
      24: invokespecial #15                 // Method Day009$Point."<init>":(II)V
      27: invokespecial #18                 // Method Day009$State."<init>":(LDay009$Point;LDay009$Point;)V
      30: putfield      #22                 // Field initialPoint:LDay009$State;
      33: return

  public final Day009$State getInitialPoint();
    Code:
       0: aload_0
       1: getfield      #22                 // Field initialPoint:LDay009$State;
       4: areturn

  public final void setInitialPoint(Day009$State);
    Code:
       0: aload_1
       1: ldc           #31                 // String <set-?>
       3: invokestatic  #37                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: putfield      #22                 // Field initialPoint:LDay009$State;
      11: return

  public final int moveTheSnake(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #42                 // String input
       3: invokestatic  #37                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokeinterface #48,  1           // InterfaceMethod java/util/List.size:()I
      12: istore_2
      13: getstatic     #54                 // Field java/lang/System.out:Ljava/io/PrintStream;
      16: iload_2
      17: invokevirtual #60                 // Method java/io/PrintStream.println:(I)V
      20: aload_1
      21: checkcast     #62                 // class java/lang/Iterable
      24: astore_2
      25: iconst_0
      26: istore_3
      27: aload_2
      28: invokeinterface #66,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      33: astore        4
      35: aload         4
      37: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      42: ifeq          97
      45: aload         4
      47: invokeinterface #76,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      52: astore        5
      54: aload         5
      56: checkcast     #78                 // class java/lang/String
      59: astore        6
      61: iconst_0
      62: istore        7
      64: aload_0
      65: aload_0
      66: getfield      #22                 // Field initialPoint:LDay009$State;
      69: aload         6
      71: iconst_2
      72: invokevirtual #82                 // Method java/lang/String.charAt:(I)C
      75: invokestatic  #88                 // Method kotlin/text/CharsKt.digitToInt:(C)I
      78: aload_0
      79: aload         6
      81: iconst_0
      82: invokevirtual #82                 // Method java/lang/String.charAt:(I)C
      85: invokespecial #92                 // Method toPoint:(C)LDay009$Point;
      88: invokespecial #96                 // Method makeMove:(LDay009$State;ILDay009$Point;)LDay009$State;
      91: pop
      92: nop
      93: nop
      94: goto          35
      97: nop
      98: getstatic     #100                // Field visitedTails:Ljava/util/Set;
     101: getstatic     #54                 // Field java/lang/System.out:Ljava/io/PrintStream;
     104: swap
     105: invokevirtual #103                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     108: getstatic     #100                // Field visitedTails:Ljava/util/Set;
     111: invokeinterface #106,  1          // InterfaceMethod java/util/Set.size:()I
     116: ireturn

  private final Day009$State makeMove(Day009$State, int, Day009$Point);
    Code:
       0: aconst_null
       1: astore        4
       3: aload_1
       4: invokevirtual #120                // Method Day009$State.getHead:()LDay009$Point;
       7: astore        4
       9: aconst_null
      10: astore        5
      12: aload_1
      13: invokevirtual #123                // Method Day009$State.getTail:()LDay009$Point;
      16: astore        5
      18: iconst_0
      19: istore        6
      21: iload         6
      23: iload_2
      24: if_icmpge     74
      27: iload         6
      29: istore        7
      31: iconst_0
      32: istore        8
      34: aload         4
      36: aload_3
      37: invokevirtual #127                // Method Day009$Point.plus:(LDay009$Point;)LDay009$Point;
      40: astore        4
      42: aload_0
      43: aload         5
      45: aload         4
      47: invokespecial #131                // Method moveTailAbs:(LDay009$Point;LDay009$Point;)LDay009$Point;
      50: astore        5
      52: aload_0
      53: new           #10                 // class Day009$State
      56: dup
      57: aload         4
      59: aload         5
      61: invokespecial #18                 // Method Day009$State."<init>":(LDay009$Point;LDay009$Point;)V
      64: putfield      #22                 // Field initialPoint:LDay009$State;
      67: nop
      68: iinc          6, 1
      71: goto          21
      74: new           #10                 // class Day009$State
      77: dup
      78: aload         4
      80: aload         5
      82: invokespecial #18                 // Method Day009$State."<init>":(LDay009$Point;LDay009$Point;)V
      85: areturn

  private final Day009$Point moveTailAbs(Day009$Point, Day009$Point);
    Code:
       0: aload_2
       1: invokevirtual #141                // Method Day009$Point.getX:()I
       4: aload_1
       5: invokevirtual #141                // Method Day009$Point.getX:()I
       8: invokestatic  #147                // Method java/lang/Math.abs:(I)I
      11: isub
      12: invokestatic  #147                // Method java/lang/Math.abs:(I)I
      15: iconst_1
      16: if_icmpgt     42
      19: aload_2
      20: invokevirtual #150                // Method Day009$Point.getY:()I
      23: aload_1
      24: invokevirtual #150                // Method Day009$Point.getY:()I
      27: invokestatic  #147                // Method java/lang/Math.abs:(I)I
      30: isub
      31: invokestatic  #147                // Method java/lang/Math.abs:(I)I
      34: iconst_1
      35: if_icmpgt     42
      38: aload_1
      39: goto          47
      42: aload_1
      43: aload_2
      44: invokevirtual #153                // Method Day009$Point.moveTowards:(LDay009$Point;)LDay009$Point;
      47: astore_3
      48: getstatic     #100                // Field visitedTails:Ljava/util/Set;
      51: aload_3
      52: invokeinterface #157,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
      57: pop
      58: aload_3
      59: areturn

  private final Day009$Point toPoint(char);
    Code:
       0: iload_1
       1: lookupswitch  { // 4
                    68: 80
                    76: 56
                    82: 44
                    85: 68
               default: 92
          }
      44: new           #12                 // class Day009$Point
      47: dup
      48: iconst_1
      49: iconst_0
      50: invokespecial #15                 // Method Day009$Point."<init>":(II)V
      53: goto          105
      56: new           #12                 // class Day009$Point
      59: dup
      60: iconst_m1
      61: iconst_0
      62: invokespecial #15                 // Method Day009$Point."<init>":(II)V
      65: goto          105
      68: new           #12                 // class Day009$Point
      71: dup
      72: iconst_0
      73: iconst_1
      74: invokespecial #15                 // Method Day009$Point."<init>":(II)V
      77: goto          105
      80: new           #12                 // class Day009$Point
      83: dup
      84: iconst_0
      85: iconst_m1
      86: invokespecial #15                 // Method Day009$Point."<init>":(II)V
      89: goto          105
      92: new           #162                // class java/lang/IllegalStateException
      95: dup
      96: ldc           #164                // String Value not valid
      98: invokevirtual #168                // Method java/lang/Object.toString:()Ljava/lang/String;
     101: invokespecial #171                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     104: athrow
     105: areturn

  static {};
    Code:
       0: new           #176                // class Day009$Companion
       3: dup
       4: aconst_null
       5: invokespecial #179                // Method Day009$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #183                // Field Companion:LDay009$Companion;
      11: new           #185                // class java/util/LinkedHashSet
      14: dup
      15: invokespecial #186                // Method java/util/LinkedHashSet."<init>":()V
      18: checkcast     #105                // class java/util/Set
      21: putstatic     #100                // Field visitedTails:Ljava/util/Set;
      24: return
}

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

  public Day009$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #12                 // Method "<init>":()V
       4: return
}

Compiled from "Day009.kt"
public final class Day009$State {
  private final Day009$Point head;

  private final Day009$Point tail;

  public Day009$State(Day009$Point, Day009$Point);
    Code:
       0: aload_1
       1: ldc           #9                  // String head
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String tail
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #20                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_1
      18: putfield      #23                 // Field head:LDay009$Point;
      21: aload_0
      22: aload_2
      23: putfield      #25                 // Field tail:LDay009$Point;
      26: return

  public final Day009$Point getHead();
    Code:
       0: aload_0
       1: getfield      #23                 // Field head:LDay009$Point;
       4: areturn

  public final Day009$Point getTail();
    Code:
       0: aload_0
       1: getfield      #25                 // Field tail:LDay009$Point;
       4: areturn

  public final Day009$Point component1();
    Code:
       0: aload_0
       1: getfield      #23                 // Field head:LDay009$Point;
       4: areturn

  public final Day009$Point component2();
    Code:
       0: aload_0
       1: getfield      #25                 // Field tail:LDay009$Point;
       4: areturn

  public final Day009$State copy(Day009$Point, Day009$Point);
    Code:
       0: aload_1
       1: ldc           #9                  // String head
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String tail
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #2                  // class Day009$State
      15: dup
      16: aload_1
      17: aload_2
      18: invokespecial #36                 // Method "<init>":(LDay009$Point;LDay009$Point;)V
      21: areturn

  public static Day009$State copy$default(Day009$State, Day009$Point, Day009$Point, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #23                 // Field head:LDay009$Point;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #25                 // Field tail:LDay009$Point;
      21: astore_2
      22: aload_0
      23: aload_1
      24: aload_2
      25: invokevirtual #40                 // Method copy:(LDay009$Point;LDay009$Point;)LDay009$State;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #44                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #45                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #47                 // String State(head=
       9: invokevirtual #51                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #23                 // Field head:LDay009$Point;
      16: invokevirtual #54                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #56                 // String , tail=
      21: invokevirtual #51                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #25                 // Field tail:LDay009$Point;
      28: invokevirtual #54                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #59                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #61                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #23                 // Field head:LDay009$Point;
       4: invokevirtual #67                 // Method Day009$Point.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #25                 // Field tail:LDay009$Point;
      16: invokevirtual #67                 // Method Day009$Point.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Day009$State
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day009$State
      20: astore_2
      21: aload_0
      22: getfield      #23                 // Field head:LDay009$Point;
      25: aload_2
      26: getfield      #23                 // Field head:LDay009$Point;
      29: invokestatic  #76                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #25                 // Field tail:LDay009$Point;
      41: aload_2
      42: getfield      #25                 // Field tail:LDay009$Point;
      45: invokestatic  #76                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: iconst_1
      54: ireturn
}


class Day11 {

    fun solvePart1(input: String): Int {

        // parse the input
        val monkeys = input.split("\n\n")
            .map { monkey ->
                Monkey(
                    items = getListOfItems(monkey),
                    operator = getOperator(monkey),
                    worryMultiplier = getWorryMultiplier(monkey),
                    divisibleBy = getDivisibleBy(monkey),
                    actionIsTrue = getActionIsTrue(monkey),
                    actionIsFalse = getActionIsFalse(monkey),
                    operationsPerformed = 0
                )
            }

        repeat(20) {doOperations(monkeys)}

        monkeys.forEach { println(it) }

        println()

        return monkeys.sortedByDescending { monkey -> monkey.operationsPerformed }
            .take(2)
            .map { it.operationsPerformed }
            .fold(1) { acc, value -> acc * value }
    }

    private fun doOperations(monkeys: List<Monkey>) {
        monkeys.forEach {monkey ->
            if (monkey.items.isNotEmpty()) {
                convertWorryMultiplier(monkey)
                calculateWorryLevel(monkey)
                monkeyGetsBored(monkey)
                throwToMonkey(monkey, monkeys)
            }
        }
    }

    data class Monkey(
        var items: ArrayDeque<Int>,
        val operator: String,
        val worryMultiplier: String,
        val divisibleBy: Int,
        val actionIsTrue: Int,
        val actionIsFalse: Int,
        var operationsPerformed: Int
    )

    private fun throwToMonkey(monkey: Monkey, monkeys: List<Monkey>) {

        repeat(monkey.items.count()) {
            if (monkeyGetsBored(monkey) % monkey.divisibleBy == 0) {
                monkeys[monkey.actionIsTrue].items.addLast(monkeyGetsBored(monkey))
                monkey.items.removeFirst()
                monkey.operationsPerformed++
            } else {
                monkeys[monkey.actionIsFalse].items.addLast(monkeyGetsBored(monkey))
                monkey.items.removeFirst()
                monkey.operationsPerformed++
            }
        }
    }

    private fun monkeyGetsBored(monkey: Monkey): Int {
        return calculateWorryLevel(monkey) / 3
    }

    private fun convertWorryMultiplier(monkey: Monkey): Int {
        return if (monkey.worryMultiplier == "old") monkey.items.first() else monkey.worryMultiplier.toInt()
    }

    private fun calculateWorryLevel(monkey: Monkey): Int {
        return when (monkey.operator) {
            "*" -> monkey.items.first() * convertWorryMultiplier(monkey)
            "/" -> monkey.items.first() / convertWorryMultiplier(monkey)
            "+" -> monkey.items.first() + convertWorryMultiplier(monkey)
            "-" -> monkey.items.first() - convertWorryMultiplier(monkey)
            else -> error("invalid operation")
        }
    }

    private fun getListOfItems(monkey: String): ArrayDeque<Int> {
        val worryMultiplier =
            monkey.lines()
                .find { it.trim().startsWith("Starting") }
                .let {
                    it!!.substring(18, it.length)
                        .split(",")
                        .map { it.trim().toInt() }
                }

        return ArrayDeque(worryMultiplier)
    }

    private fun getWorryMultiplier(monkey: String): String {
        val worryMultiplier = monkey.lines()
            .find { it.trim().startsWith("Operation") }
            .let {
                it!!.substring(25, it.length)
            }
        return worryMultiplier
    }

    private fun getOperator(monkey: String): String {
        val worryMultiplier =
            monkey.lines()
                .find { it.trim().startsWith("Operation") }
                .let {
                    it!!.substring(23, 24)
                }
        return worryMultiplier
    }

    private fun getDivisibleBy(lines: String): Int {
        val regex = """Test: divisible by (\d+)""".toRegex()
        val divisibleBy = regex.find(lines)
        val (value) = divisibleBy!!.destructured

        return value.toInt()
    }

    private fun getActionIsTrue(lines: String): Int {
        val regex = """If true: throw to monkey (\d+)""".toRegex()
        val divisibleBy = regex.find(lines)
        val (value) = divisibleBy!!.destructured
        return value.toInt()
    }

    private fun getActionIsFalse(lines: String): Int {
        val regex = """If false: throw to monkey (\d+)""".toRegex()
        val divisibleBy = regex.find(lines)
        val (value) = divisibleBy!!.destructured
        return value.toInt()
    }
}

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

  public final int solvePart1(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #23                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #25                 // class java/lang/String
      14: astore_3
      15: aload_3
      16: iconst_0
      17: ldc           #27                 // String \n\n
      19: aastore
      20: aload_3
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #33                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: checkcast     #35                 // class java/lang/Iterable
      32: astore_3
      33: nop
      34: iconst_0
      35: istore        4
      37: aload_3
      38: astore        5
      40: new           #37                 // class java/util/ArrayList
      43: dup
      44: aload_3
      45: bipush        10
      47: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      50: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
      53: checkcast     #48                 // class java/util/Collection
      56: astore        6
      58: iconst_0
      59: istore        7
      61: aload         5
      63: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      68: astore        8
      70: aload         8
      72: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      77: ifeq          160
      80: aload         8
      82: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      87: astore        9
      89: aload         6
      91: aload         9
      93: checkcast     #25                 // class java/lang/String
      96: astore        10
      98: astore        12
     100: iconst_0
     101: istore        11
     103: new           #64                 // class Day11$Monkey
     106: dup
     107: aload_0
     108: aload         10
     110: invokespecial #68                 // Method getListOfItems:(Ljava/lang/String;)Lkotlin/collections/ArrayDeque;
     113: aload_0
     114: aload         10
     116: invokespecial #72                 // Method getOperator:(Ljava/lang/String;)Ljava/lang/String;
     119: aload_0
     120: aload         10
     122: invokespecial #75                 // Method getWorryMultiplier:(Ljava/lang/String;)Ljava/lang/String;
     125: aload_0
     126: aload         10
     128: invokespecial #78                 // Method getDivisibleBy:(Ljava/lang/String;)I
     131: aload_0
     132: aload         10
     134: invokespecial #81                 // Method getActionIsTrue:(Ljava/lang/String;)I
     137: aload_0
     138: aload         10
     140: invokespecial #84                 // Method getActionIsFalse:(Ljava/lang/String;)I
     143: iconst_0
     144: invokespecial #87                 // Method Day11$Monkey."<init>":(Lkotlin/collections/ArrayDeque;Ljava/lang/String;Ljava/lang/String;IIII)V
     147: nop
     148: aload         12
     150: swap
     151: invokeinterface #91,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     156: pop
     157: goto          70
     160: aload         6
     162: checkcast     #93                 // class java/util/List
     165: nop
     166: astore_2
     167: bipush        20
     169: istore_3
     170: iconst_0
     171: istore        4
     173: iload         4
     175: iload_3
     176: if_icmpge     197
     179: iload         4
     181: istore        5
     183: iconst_0
     184: istore        6
     186: aload_0
     187: aload_2
     188: invokespecial #97                 // Method doOperations:(Ljava/util/List;)V
     191: iinc          4, 1
     194: goto          173
     197: aload_2
     198: checkcast     #35                 // class java/lang/Iterable
     201: astore_3
     202: iconst_0
     203: istore        4
     205: aload_3
     206: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     211: astore        5
     213: aload         5
     215: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     220: ifeq          255
     223: aload         5
     225: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     230: astore        6
     232: aload         6
     234: checkcast     #64                 // class Day11$Monkey
     237: astore        7
     239: iconst_0
     240: istore        8
     242: getstatic     #103                // Field java/lang/System.out:Ljava/io/PrintStream;
     245: aload         7
     247: invokevirtual #109                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     250: nop
     251: nop
     252: goto          213
     255: nop
     256: getstatic     #103                // Field java/lang/System.out:Ljava/io/PrintStream;
     259: invokevirtual #111                // Method java/io/PrintStream.println:()V
     262: aload_2
     263: checkcast     #35                 // class java/lang/Iterable
     266: astore_3
     267: iconst_0
     268: istore        4
     270: aload_3
     271: new           #113                // class Day11$solvePart1$$inlined$sortedByDescending$1
     274: dup
     275: invokespecial #114                // Method Day11$solvePart1$$inlined$sortedByDescending$1."<init>":()V
     278: checkcast     #116                // class java/util/Comparator
     281: invokestatic  #120                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
     284: checkcast     #35                 // class java/lang/Iterable
     287: iconst_2
     288: invokestatic  #124                // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;
     291: checkcast     #35                 // class java/lang/Iterable
     294: astore_3
     295: nop
     296: iconst_0
     297: istore        4
     299: aload_3
     300: astore        5
     302: new           #37                 // class java/util/ArrayList
     305: dup
     306: aload_3
     307: bipush        10
     309: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     312: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     315: checkcast     #48                 // class java/util/Collection
     318: astore        6
     320: iconst_0
     321: istore        7
     323: aload         5
     325: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     330: astore        8
     332: aload         8
     334: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     339: ifeq          385
     342: aload         8
     344: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     349: astore        9
     351: aload         6
     353: aload         9
     355: checkcast     #64                 // class Day11$Monkey
     358: astore        10
     360: astore        12
     362: iconst_0
     363: istore        11
     365: aload         10
     367: invokevirtual #128                // Method Day11$Monkey.getOperationsPerformed:()I
     370: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     373: aload         12
     375: swap
     376: invokeinterface #91,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     381: pop
     382: goto          332
     385: aload         6
     387: checkcast     #93                 // class java/util/List
     390: nop
     391: checkcast     #35                 // class java/lang/Iterable
     394: astore_3
     395: iconst_1
     396: istore        4
     398: iconst_0
     399: istore        5
     401: iload         4
     403: istore        6
     405: aload_3
     406: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     411: astore        7
     413: aload         7
     415: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     420: ifeq          459
     423: aload         7
     425: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     430: astore        8
     432: iload         6
     434: aload         8
     436: checkcast     #136                // class java/lang/Number
     439: invokevirtual #139                // Method java/lang/Number.intValue:()I
     442: istore        9
     444: istore        10
     446: iconst_0
     447: istore        11
     449: iload         10
     451: iload         9
     453: imul
     454: istore        6
     456: goto          413
     459: iload         6
     461: ireturn

  private final void doOperations(java.util.List<Day11$Monkey>);
    Code:
       0: aload_1
       1: checkcast     #35                 // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: aload_2
       8: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      13: astore        4
      15: aload         4
      17: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      22: ifeq          101
      25: aload         4
      27: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      32: astore        5
      34: aload         5
      36: checkcast     #64                 // class Day11$Monkey
      39: astore        6
      41: iconst_0
      42: istore        7
      44: aload         6
      46: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
      49: checkcast     #48                 // class java/util/Collection
      52: invokeinterface #179,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      57: ifne          64
      60: iconst_1
      61: goto          65
      64: iconst_0
      65: ifeq          96
      68: aload_0
      69: aload         6
      71: invokespecial #183                // Method convertWorryMultiplier:(LDay11$Monkey;)I
      74: pop
      75: aload_0
      76: aload         6
      78: invokespecial #186                // Method calculateWorryLevel:(LDay11$Monkey;)I
      81: pop
      82: aload_0
      83: aload         6
      85: invokespecial #189                // Method monkeyGetsBored:(LDay11$Monkey;)I
      88: pop
      89: aload_0
      90: aload         6
      92: aload_1
      93: invokespecial #193                // Method throwToMonkey:(LDay11$Monkey;Ljava/util/List;)V
      96: nop
      97: nop
      98: goto          15
     101: nop
     102: return

  private final void throwToMonkey(Day11$Monkey, java.util.List<Day11$Monkey>);
    Code:
       0: aload_1
       1: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
       4: checkcast     #48                 // class java/util/Collection
       7: invokeinterface #198,  1          // InterfaceMethod java/util/Collection.size:()I
      12: istore_3
      13: iconst_0
      14: istore        4
      16: iload         4
      18: iload_3
      19: if_icmpge     150
      22: iload         4
      24: istore        5
      26: iconst_0
      27: istore        6
      29: aload_0
      30: aload_1
      31: invokespecial #189                // Method monkeyGetsBored:(LDay11$Monkey;)I
      34: aload_1
      35: invokevirtual #200                // Method Day11$Monkey.getDivisibleBy:()I
      38: irem
      39: ifne          94
      42: aload_2
      43: aload_1
      44: invokevirtual #202                // Method Day11$Monkey.getActionIsTrue:()I
      47: invokeinterface #206,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      52: checkcast     #64                 // class Day11$Monkey
      55: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
      58: aload_0
      59: aload_1
      60: invokespecial #189                // Method monkeyGetsBored:(LDay11$Monkey;)I
      63: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      66: invokevirtual #211                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
      69: aload_1
      70: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
      73: invokevirtual #214                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
      76: pop
      77: aload_1
      78: invokevirtual #128                // Method Day11$Monkey.getOperationsPerformed:()I
      81: istore        7
      83: aload_1
      84: iload         7
      86: iconst_1
      87: iadd
      88: invokevirtual #217                // Method Day11$Monkey.setOperationsPerformed:(I)V
      91: goto          143
      94: aload_2
      95: aload_1
      96: invokevirtual #219                // Method Day11$Monkey.getActionIsFalse:()I
      99: invokeinterface #206,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     104: checkcast     #64                 // class Day11$Monkey
     107: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
     110: aload_0
     111: aload_1
     112: invokespecial #189                // Method monkeyGetsBored:(LDay11$Monkey;)I
     115: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     118: invokevirtual #211                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     121: aload_1
     122: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
     125: invokevirtual #214                // Method kotlin/collections/ArrayDeque.removeFirst:()Ljava/lang/Object;
     128: pop
     129: aload_1
     130: invokevirtual #128                // Method Day11$Monkey.getOperationsPerformed:()I
     133: istore        7
     135: aload_1
     136: iload         7
     138: iconst_1
     139: iadd
     140: invokevirtual #217                // Method Day11$Monkey.setOperationsPerformed:(I)V
     143: nop
     144: iinc          4, 1
     147: goto          16
     150: return

  private final int monkeyGetsBored(Day11$Monkey);
    Code:
       0: aload_0
       1: aload_1
       2: invokespecial #186                // Method calculateWorryLevel:(LDay11$Monkey;)I
       5: iconst_3
       6: idiv
       7: ireturn

  private final int convertWorryMultiplier(Day11$Monkey);
    Code:
       0: aload_1
       1: invokevirtual #223                // Method Day11$Monkey.getWorryMultiplier:()Ljava/lang/String;
       4: ldc           #225                // String old
       6: invokestatic  #229                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
       9: ifeq          28
      12: aload_1
      13: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
      16: invokevirtual #232                // Method kotlin/collections/ArrayDeque.first:()Ljava/lang/Object;
      19: checkcast     #136                // class java/lang/Number
      22: invokevirtual #139                // Method java/lang/Number.intValue:()I
      25: goto          35
      28: aload_1
      29: invokevirtual #223                // Method Day11$Monkey.getWorryMultiplier:()Ljava/lang/String;
      32: invokestatic  #235                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      35: ireturn

  private final int calculateWorryLevel(Day11$Monkey);
    Code:
       0: aload_1
       1: invokevirtual #237                // Method Day11$Monkey.getOperator:()Ljava/lang/String;
       4: astore_2
       5: aload_2
       6: invokevirtual #240                // Method java/lang/String.hashCode:()I
       9: tableswitch   { // 42 to 47
                    42: 48
                    43: 60
                    44: 184
                    45: 72
                    46: 184
                    47: 84
               default: 184
          }
      48: aload_2
      49: ldc           #242                // String *
      51: invokevirtual #245                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      54: ifne          96
      57: goto          184
      60: aload_2
      61: ldc           #247                // String +
      63: invokevirtual #245                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      66: ifne          140
      69: goto          184
      72: aload_2
      73: ldc           #249                // String -
      75: invokevirtual #245                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      78: ifne          162
      81: goto          184
      84: aload_2
      85: ldc           #251                // String /
      87: invokevirtual #245                // Method java/lang/String.equals:(Ljava/lang/Object;)Z
      90: ifne          118
      93: goto          184
      96: aload_1
      97: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
     100: invokevirtual #232                // Method kotlin/collections/ArrayDeque.first:()Ljava/lang/Object;
     103: checkcast     #136                // class java/lang/Number
     106: invokevirtual #139                // Method java/lang/Number.intValue:()I
     109: aload_0
     110: aload_1
     111: invokespecial #183                // Method convertWorryMultiplier:(LDay11$Monkey;)I
     114: imul
     115: goto          197
     118: aload_1
     119: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
     122: invokevirtual #232                // Method kotlin/collections/ArrayDeque.first:()Ljava/lang/Object;
     125: checkcast     #136                // class java/lang/Number
     128: invokevirtual #139                // Method java/lang/Number.intValue:()I
     131: aload_0
     132: aload_1
     133: invokespecial #183                // Method convertWorryMultiplier:(LDay11$Monkey;)I
     136: idiv
     137: goto          197
     140: aload_1
     141: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
     144: invokevirtual #232                // Method kotlin/collections/ArrayDeque.first:()Ljava/lang/Object;
     147: checkcast     #136                // class java/lang/Number
     150: invokevirtual #139                // Method java/lang/Number.intValue:()I
     153: aload_0
     154: aload_1
     155: invokespecial #183                // Method convertWorryMultiplier:(LDay11$Monkey;)I
     158: iadd
     159: goto          197
     162: aload_1
     163: invokevirtual #176                // Method Day11$Monkey.getItems:()Lkotlin/collections/ArrayDeque;
     166: invokevirtual #232                // Method kotlin/collections/ArrayDeque.first:()Ljava/lang/Object;
     169: checkcast     #136                // class java/lang/Number
     172: invokevirtual #139                // Method java/lang/Number.intValue:()I
     175: aload_0
     176: aload_1
     177: invokespecial #183                // Method convertWorryMultiplier:(LDay11$Monkey;)I
     180: isub
     181: goto          197
     184: new           #253                // class java/lang/IllegalStateException
     187: dup
     188: ldc           #255                // String invalid operation
     190: invokevirtual #258                // Method java/lang/Object.toString:()Ljava/lang/String;
     193: invokespecial #261                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     196: athrow
     197: ireturn

  private final kotlin.collections.ArrayDeque<java.lang.Integer> getListOfItems(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/CharSequence
       4: invokestatic  #266                // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
       7: checkcast     #35                 // class java/lang/Iterable
      10: astore_3
      11: aload_3
      12: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      17: astore        4
      19: aload         4
      21: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      26: ifeq          76
      29: aload         4
      31: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      36: astore        5
      38: aload         5
      40: checkcast     #25                 // class java/lang/String
      43: astore        6
      45: iconst_0
      46: istore        7
      48: aload         6
      50: checkcast     #23                 // class java/lang/CharSequence
      53: invokestatic  #270                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      56: invokevirtual #258                // Method java/lang/Object.toString:()Ljava/lang/String;
      59: ldc_w         #272                // String Starting
      62: iconst_0
      63: iconst_2
      64: aconst_null
      65: invokestatic  #276                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      68: ifeq          19
      71: aload         5
      73: goto          77
      76: aconst_null
      77: checkcast     #25                 // class java/lang/String
      80: astore_3
      81: iconst_0
      82: istore        4
      84: aload_3
      85: dup
      86: invokestatic  #279                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      89: bipush        18
      91: aload_3
      92: invokevirtual #282                // Method java/lang/String.length:()I
      95: invokevirtual #286                // Method java/lang/String.substring:(II)Ljava/lang/String;
      98: dup
      99: ldc_w         #288                // String substring(...)
     102: invokestatic  #291                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     105: checkcast     #23                 // class java/lang/CharSequence
     108: iconst_1
     109: anewarray     #25                 // class java/lang/String
     112: astore        5
     114: aload         5
     116: iconst_0
     117: ldc_w         #293                // String ,
     120: aastore
     121: aload         5
     123: iconst_0
     124: iconst_0
     125: bipush        6
     127: aconst_null
     128: invokestatic  #33                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     131: checkcast     #35                 // class java/lang/Iterable
     134: astore        5
     136: nop
     137: iconst_0
     138: istore        6
     140: aload         5
     142: astore        7
     144: new           #37                 // class java/util/ArrayList
     147: dup
     148: aload         5
     150: bipush        10
     152: invokestatic  #43                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     155: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     158: checkcast     #48                 // class java/util/Collection
     161: astore        8
     163: iconst_0
     164: istore        9
     166: aload         7
     168: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     173: astore        10
     175: aload         10
     177: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     182: ifeq          239
     185: aload         10
     187: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     192: astore        11
     194: aload         8
     196: aload         11
     198: checkcast     #25                 // class java/lang/String
     201: astore        12
     203: astore        13
     205: iconst_0
     206: istore        14
     208: nop
     209: aload         12
     211: checkcast     #23                 // class java/lang/CharSequence
     214: invokestatic  #270                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     217: invokevirtual #258                // Method java/lang/Object.toString:()Ljava/lang/String;
     220: invokestatic  #235                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     223: nop
     224: invokestatic  #134                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     227: aload         13
     229: swap
     230: invokeinterface #91,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     235: pop
     236: goto          175
     239: aload         8
     241: checkcast     #93                 // class java/util/List
     244: nop
     245: nop
     246: nop
     247: astore_2
     248: new           #208                // class kotlin/collections/ArrayDeque
     251: dup
     252: aload_2
     253: checkcast     #48                 // class java/util/Collection
     256: invokespecial #296                // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     259: areturn

  private final java.lang.String getWorryMultiplier(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/CharSequence
       4: invokestatic  #266                // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
       7: checkcast     #35                 // class java/lang/Iterable
      10: astore_3
      11: aload_3
      12: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      17: astore        4
      19: aload         4
      21: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      26: ifeq          76
      29: aload         4
      31: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      36: astore        5
      38: aload         5
      40: checkcast     #25                 // class java/lang/String
      43: astore        6
      45: iconst_0
      46: istore        7
      48: aload         6
      50: checkcast     #23                 // class java/lang/CharSequence
      53: invokestatic  #270                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      56: invokevirtual #258                // Method java/lang/Object.toString:()Ljava/lang/String;
      59: ldc_w         #302                // String Operation
      62: iconst_0
      63: iconst_2
      64: aconst_null
      65: invokestatic  #276                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      68: ifeq          19
      71: aload         5
      73: goto          77
      76: aconst_null
      77: checkcast     #25                 // class java/lang/String
      80: astore_3
      81: iconst_0
      82: istore        4
      84: aload_3
      85: dup
      86: invokestatic  #279                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      89: bipush        25
      91: aload_3
      92: invokevirtual #282                // Method java/lang/String.length:()I
      95: invokevirtual #286                // Method java/lang/String.substring:(II)Ljava/lang/String;
      98: dup
      99: ldc_w         #288                // String substring(...)
     102: invokestatic  #291                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     105: nop
     106: nop
     107: astore_2
     108: aload_2
     109: areturn

  private final java.lang.String getOperator(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/lang/CharSequence
       4: invokestatic  #266                // Method kotlin/text/StringsKt.lines:(Ljava/lang/CharSequence;)Ljava/util/List;
       7: checkcast     #35                 // class java/lang/Iterable
      10: astore_3
      11: aload_3
      12: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      17: astore        4
      19: aload         4
      21: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      26: ifeq          76
      29: aload         4
      31: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      36: astore        5
      38: aload         5
      40: checkcast     #25                 // class java/lang/String
      43: astore        6
      45: iconst_0
      46: istore        7
      48: aload         6
      50: checkcast     #23                 // class java/lang/CharSequence
      53: invokestatic  #270                // Method kotlin/text/StringsKt.trim:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
      56: invokevirtual #258                // Method java/lang/Object.toString:()Ljava/lang/String;
      59: ldc_w         #302                // String Operation
      62: iconst_0
      63: iconst_2
      64: aconst_null
      65: invokestatic  #276                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
      68: ifeq          19
      71: aload         5
      73: goto          77
      76: aconst_null
      77: checkcast     #25                 // class java/lang/String
      80: astore_3
      81: iconst_0
      82: istore        4
      84: aload_3
      85: dup
      86: invokestatic  #279                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      89: bipush        23
      91: bipush        24
      93: invokevirtual #286                // Method java/lang/String.substring:(II)Ljava/lang/String;
      96: dup
      97: ldc_w         #288                // String substring(...)
     100: invokestatic  #291                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     103: nop
     104: nop
     105: astore_2
     106: aload_2
     107: areturn

  private final int getDivisibleBy(java.lang.String);
    Code:
       0: new           #308                // class kotlin/text/Regex
       3: dup
       4: ldc_w         #310                // String Test: divisible by (\\d+)
       7: invokespecial #311                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      10: astore_2
      11: aload_2
      12: aload_1
      13: checkcast     #23                 // class java/lang/CharSequence
      16: iconst_0
      17: iconst_2
      18: aconst_null
      19: invokestatic  #315                // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;
      22: astore_3
      23: aload_3
      24: dup
      25: invokestatic  #279                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      28: invokeinterface #321,  1          // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
      33: invokevirtual #327                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      36: invokeinterface #331,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      41: iconst_1
      42: invokeinterface #206,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      47: checkcast     #25                 // class java/lang/String
      50: astore        4
      52: aload         4
      54: invokestatic  #235                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      57: ireturn

  private final int getActionIsTrue(java.lang.String);
    Code:
       0: new           #308                // class kotlin/text/Regex
       3: dup
       4: ldc_w         #337                // String If true: throw to monkey (\\d+)
       7: invokespecial #311                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      10: astore_2
      11: aload_2
      12: aload_1
      13: checkcast     #23                 // class java/lang/CharSequence
      16: iconst_0
      17: iconst_2
      18: aconst_null
      19: invokestatic  #315                // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;
      22: astore_3
      23: aload_3
      24: dup
      25: invokestatic  #279                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      28: invokeinterface #321,  1          // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
      33: invokevirtual #327                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      36: invokeinterface #331,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      41: iconst_1
      42: invokeinterface #206,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      47: checkcast     #25                 // class java/lang/String
      50: astore        4
      52: aload         4
      54: invokestatic  #235                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      57: ireturn

  private final int getActionIsFalse(java.lang.String);
    Code:
       0: new           #308                // class kotlin/text/Regex
       3: dup
       4: ldc_w         #339                // String If false: throw to monkey (\\d+)
       7: invokespecial #311                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
      10: astore_2
      11: aload_2
      12: aload_1
      13: checkcast     #23                 // class java/lang/CharSequence
      16: iconst_0
      17: iconst_2
      18: aconst_null
      19: invokestatic  #315                // Method kotlin/text/Regex.find$default:(Lkotlin/text/Regex;Ljava/lang/CharSequence;IILjava/lang/Object;)Lkotlin/text/MatchResult;
      22: astore_3
      23: aload_3
      24: dup
      25: invokestatic  #279                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      28: invokeinterface #321,  1          // InterfaceMethod kotlin/text/MatchResult.getDestructured:()Lkotlin/text/MatchResult$Destructured;
      33: invokevirtual #327                // Method kotlin/text/MatchResult$Destructured.getMatch:()Lkotlin/text/MatchResult;
      36: invokeinterface #331,  1          // InterfaceMethod kotlin/text/MatchResult.getGroupValues:()Ljava/util/List;
      41: iconst_1
      42: invokeinterface #206,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      47: checkcast     #25                 // class java/lang/String
      50: astore        4
      52: aload         4
      54: invokestatic  #235                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      57: ireturn
}

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

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

Compiled from "Day11.kt"
public final class Day11$Monkey {
  private kotlin.collections.ArrayDeque<java.lang.Integer> items;

  private final java.lang.String operator;

  private final java.lang.String worryMultiplier;

  private final int divisibleBy;

  private final int actionIsTrue;

  private final int actionIsFalse;

  private int operationsPerformed;

  public Day11$Monkey(kotlin.collections.ArrayDeque<java.lang.Integer>, java.lang.String, java.lang.String, int, int, int, int);
    Code:
       0: aload_1
       1: ldc           #10                 // String items
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String operator
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #20                 // String worryMultiplier
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: invokespecial #23                 // Method java/lang/Object."<init>":()V
      22: aload_0
      23: aload_1
      24: putfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
      27: aload_0
      28: aload_2
      29: putfield      #29                 // Field operator:Ljava/lang/String;
      32: aload_0
      33: aload_3
      34: putfield      #31                 // Field worryMultiplier:Ljava/lang/String;
      37: aload_0
      38: iload         4
      40: putfield      #35                 // Field divisibleBy:I
      43: aload_0
      44: iload         5
      46: putfield      #38                 // Field actionIsTrue:I
      49: aload_0
      50: iload         6
      52: putfield      #41                 // Field actionIsFalse:I
      55: aload_0
      56: iload         7
      58: putfield      #44                 // Field operationsPerformed:I
      61: return

  public final kotlin.collections.ArrayDeque<java.lang.Integer> getItems();
    Code:
       0: aload_0
       1: getfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
       4: areturn

  public final void setItems(kotlin.collections.ArrayDeque<java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #54                 // String <set-?>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: putfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
      11: return

  public final java.lang.String getOperator();
    Code:
       0: aload_0
       1: getfield      #29                 // Field operator:Ljava/lang/String;
       4: areturn

  public final java.lang.String getWorryMultiplier();
    Code:
       0: aload_0
       1: getfield      #31                 // Field worryMultiplier:Ljava/lang/String;
       4: areturn

  public final int getDivisibleBy();
    Code:
       0: aload_0
       1: getfield      #35                 // Field divisibleBy:I
       4: ireturn

  public final int getActionIsTrue();
    Code:
       0: aload_0
       1: getfield      #38                 // Field actionIsTrue:I
       4: ireturn

  public final int getActionIsFalse();
    Code:
       0: aload_0
       1: getfield      #41                 // Field actionIsFalse:I
       4: ireturn

  public final int getOperationsPerformed();
    Code:
       0: aload_0
       1: getfield      #44                 // Field operationsPerformed:I
       4: ireturn

  public final void setOperationsPerformed(int);
    Code:
       0: aload_0
       1: iload_1
       2: putfield      #44                 // Field operationsPerformed:I
       5: return

  public final kotlin.collections.ArrayDeque<java.lang.Integer> component1();
    Code:
       0: aload_0
       1: getfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
       4: areturn

  public final java.lang.String component2();
    Code:
       0: aload_0
       1: getfield      #29                 // Field operator:Ljava/lang/String;
       4: areturn

  public final java.lang.String component3();
    Code:
       0: aload_0
       1: getfield      #31                 // Field worryMultiplier:Ljava/lang/String;
       4: areturn

  public final int component4();
    Code:
       0: aload_0
       1: getfield      #35                 // Field divisibleBy:I
       4: ireturn

  public final int component5();
    Code:
       0: aload_0
       1: getfield      #38                 // Field actionIsTrue:I
       4: ireturn

  public final int component6();
    Code:
       0: aload_0
       1: getfield      #41                 // Field actionIsFalse:I
       4: ireturn

  public final int component7();
    Code:
       0: aload_0
       1: getfield      #44                 // Field operationsPerformed:I
       4: ireturn

  public final Day11$Monkey copy(kotlin.collections.ArrayDeque<java.lang.Integer>, java.lang.String, java.lang.String, int, int, int, int);
    Code:
       0: aload_1
       1: ldc           #10                 // String items
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #18                 // String operator
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #20                 // String worryMultiplier
      15: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: new           #2                  // class Day11$Monkey
      21: dup
      22: aload_1
      23: aload_2
      24: aload_3
      25: iload         4
      27: iload         5
      29: iload         6
      31: iload         7
      33: invokespecial #76                 // Method "<init>":(Lkotlin/collections/ArrayDeque;Ljava/lang/String;Ljava/lang/String;IIII)V
      36: areturn

  public static Day11$Monkey copy$default(Day11$Monkey, kotlin.collections.ArrayDeque, java.lang.String, java.lang.String, int, int, int, int, int, java.lang.Object);
    Code:
       0: iload         8
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
      11: astore_1
      12: iload         8
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #29                 // Field operator:Ljava/lang/String;
      23: astore_2
      24: iload         8
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #31                 // Field worryMultiplier:Ljava/lang/String;
      35: astore_3
      36: iload         8
      38: bipush        8
      40: iand
      41: ifeq          50
      44: aload_0
      45: getfield      #35                 // Field divisibleBy:I
      48: istore        4
      50: iload         8
      52: bipush        16
      54: iand
      55: ifeq          64
      58: aload_0
      59: getfield      #38                 // Field actionIsTrue:I
      62: istore        5
      64: iload         8
      66: bipush        32
      68: iand
      69: ifeq          78
      72: aload_0
      73: getfield      #41                 // Field actionIsFalse:I
      76: istore        6
      78: iload         8
      80: bipush        64
      82: iand
      83: ifeq          92
      86: aload_0
      87: getfield      #44                 // Field operationsPerformed:I
      90: istore        7
      92: aload_0
      93: aload_1
      94: aload_2
      95: aload_3
      96: iload         4
      98: iload         5
     100: iload         6
     102: iload         7
     104: invokevirtual #80                 // Method copy:(Lkotlin/collections/ArrayDeque;Ljava/lang/String;Ljava/lang/String;IIII)LDay11$Monkey;
     107: areturn

  public java.lang.String toString();
    Code:
       0: new           #83                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #84                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #86                 // String Monkey(items=
       9: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
      16: invokevirtual #93                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #95                 // String , operator=
      21: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #29                 // Field operator:Ljava/lang/String;
      28: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      31: ldc           #97                 // String , worryMultiplier=
      33: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #31                 // Field worryMultiplier:Ljava/lang/String;
      40: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      43: ldc           #99                 // String , divisibleBy=
      45: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      48: aload_0
      49: getfield      #35                 // Field divisibleBy:I
      52: invokevirtual #102                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      55: ldc           #104                // String , actionIsTrue=
      57: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      60: aload_0
      61: getfield      #38                 // Field actionIsTrue:I
      64: invokevirtual #102                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      67: ldc           #106                // String , actionIsFalse=
      69: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      72: aload_0
      73: getfield      #41                 // Field actionIsFalse:I
      76: invokevirtual #102                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      79: ldc           #108                // String , operationsPerformed=
      81: invokevirtual #90                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      84: aload_0
      85: getfield      #44                 // Field operationsPerformed:I
      88: invokevirtual #102                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      91: bipush        41
      93: invokevirtual #111                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      96: invokevirtual #113                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      99: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
       4: invokevirtual #118                // Method kotlin/collections/ArrayDeque.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #29                 // Field operator:Ljava/lang/String;
      16: invokevirtual #121                // Method java/lang/String.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #31                 // Field worryMultiplier:Ljava/lang/String;
      29: invokevirtual #121                // Method java/lang/String.hashCode:()I
      32: iadd
      33: istore_1
      34: iload_1
      35: bipush        31
      37: imul
      38: aload_0
      39: getfield      #35                 // Field divisibleBy:I
      42: invokestatic  #126                // Method java/lang/Integer.hashCode:(I)I
      45: iadd
      46: istore_1
      47: iload_1
      48: bipush        31
      50: imul
      51: aload_0
      52: getfield      #38                 // Field actionIsTrue:I
      55: invokestatic  #126                // Method java/lang/Integer.hashCode:(I)I
      58: iadd
      59: istore_1
      60: iload_1
      61: bipush        31
      63: imul
      64: aload_0
      65: getfield      #41                 // Field actionIsFalse:I
      68: invokestatic  #126                // Method java/lang/Integer.hashCode:(I)I
      71: iadd
      72: istore_1
      73: iload_1
      74: bipush        31
      76: imul
      77: aload_0
      78: getfield      #44                 // Field operationsPerformed:I
      81: invokestatic  #126                // Method java/lang/Integer.hashCode:(I)I
      84: iadd
      85: istore_1
      86: iload_1
      87: 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 Day11$Monkey
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day11$Monkey
      20: astore_2
      21: aload_0
      22: getfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
      25: aload_2
      26: getfield      #26                 // Field items:Lkotlin/collections/ArrayDeque;
      29: invokestatic  #134                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #29                 // Field operator:Ljava/lang/String;
      41: aload_2
      42: getfield      #29                 // Field operator:Ljava/lang/String;
      45: invokestatic  #134                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: aload_0
      54: getfield      #31                 // Field worryMultiplier:Ljava/lang/String;
      57: aload_2
      58: getfield      #31                 // Field worryMultiplier:Ljava/lang/String;
      61: invokestatic  #134                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      64: ifne          69
      67: iconst_0
      68: ireturn
      69: aload_0
      70: getfield      #35                 // Field divisibleBy:I
      73: aload_2
      74: getfield      #35                 // Field divisibleBy:I
      77: if_icmpeq     82
      80: iconst_0
      81: ireturn
      82: aload_0
      83: getfield      #38                 // Field actionIsTrue:I
      86: aload_2
      87: getfield      #38                 // Field actionIsTrue:I
      90: if_icmpeq     95
      93: iconst_0
      94: ireturn
      95: aload_0
      96: getfield      #41                 // Field actionIsFalse:I
      99: aload_2
     100: getfield      #41                 // Field actionIsFalse:I
     103: if_icmpeq     108
     106: iconst_0
     107: ireturn
     108: aload_0
     109: getfield      #44                 // Field operationsPerformed:I
     112: aload_2
     113: getfield      #44                 // Field operationsPerformed:I
     116: if_icmpeq     121
     119: iconst_0
     120: ireturn
     121: iconst_1
     122: ireturn
}