package com.seanshubin.kotlin.tryme.domain.schulze

import kotlin.math.max
import kotlin.math.min

object Schulze {
    fun schulzeTally(candidates: List<String>, rows: List<List<Int>>): List<Pair<String, List<String>>> {
        val strongestPaths = strongestPaths(rows)
        val tallied = tally(strongestPaths, emptyList(), emptyList())
        val result = mutableListOf<Pair<String, List<String>>>()
        var place = 1
        tallied.forEach { talliedRow ->
            val candidatesAtPlace = talliedRow.map { candidates[it] }
            val placeString = placeString(place)
            result.add(Pair(placeString, candidatesAtPlace))
            place += talliedRow.size
        }
        return result
    }

    fun strongestPaths(rows: List<List<Int>>): List<List<Int>> {
        val size = rows.size
        val strongestPaths = mutableList2(size, size)
        for (i in 0 until size) {
            for (j in 0 until size) {
                strongestPaths[i][j] = rows[i][j]
            }
        }
        for (i in 0 until size) {
            for (j in 0 until size) {
                if (i != j) {
                    for (k in 0 until size) {
                        if (i != k && j != k) {
                            strongestPaths[j][k] =
                                max(strongestPaths[j][k], min(strongestPaths[j][i], strongestPaths[i][k]))
                        }
                    }
                }
            }
        }
        return strongestPaths
    }

    tailrec fun tally(rows: List<List<Int>>, soFar: List<List<Int>>, indices: List<Int>): List<List<Int>> {
        val size = rows.size
        return if (indices.size == size) soFar
        else {
            val undefeated = (0 until size).filter { i ->
                !indices.contains(i) && (0 until size).all { j ->
                    indices.contains(j) || rows[i][j] >= rows[j][i]
                }
            }
            tally(rows, soFar + listOf(undefeated), indices + undefeated)
        }
    }

    private fun mutableList2(rowCount: Int, colCount: Int): MutableList<MutableList<Int>> =
        mutableListOf(*(0 until rowCount).map {
            mutableListOf(*(0 until colCount).map {
                0
            }.toTypedArray())
        }.toTypedArray())

    private fun placeString(place: Int): String = when (place) {
        1 -> "1st"
        2 -> "2nd"
        3 -> "3rd"
        else -> "${place}th"
    }
}

Compiled from "Schulze.kt"
public final class com.seanshubin.kotlin.tryme.domain.schulze.Schulze {
  public static final com.seanshubin.kotlin.tryme.domain.schulze.Schulze INSTANCE;

  private com.seanshubin.kotlin.tryme.domain.schulze.Schulze();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.util.List<kotlin.Pair<java.lang.String, java.util.List<java.lang.String>>> schulzeTally(java.util.List<java.lang.String>, java.util.List<? extends java.util.List<java.lang.Integer>>);
    Code:
       0: aload_1
       1: ldc           #16                 // String candidates
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #24                 // String rows
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_2
      14: invokevirtual #28                 // Method strongestPaths:(Ljava/util/List;)Ljava/util/List;
      17: astore_3
      18: aload_0
      19: aload_3
      20: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      23: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      26: invokevirtual #38                 // Method tally:(Ljava/util/List;Ljava/util/List;Ljava/util/List;)Ljava/util/List;
      29: astore        4
      31: new           #40                 // class java/util/ArrayList
      34: dup
      35: invokespecial #41                 // Method java/util/ArrayList."<init>":()V
      38: checkcast     #43                 // class java/util/List
      41: astore        5
      43: iconst_0
      44: istore        6
      46: iconst_1
      47: istore        6
      49: aload         4
      51: checkcast     #45                 // class java/lang/Iterable
      54: astore        7
      56: iconst_0
      57: istore        8
      59: aload         7
      61: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      66: astore        9
      68: aload         9
      70: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      75: ifeq          255
      78: aload         9
      80: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      85: astore        10
      87: aload         10
      89: checkcast     #43                 // class java/util/List
      92: astore        11
      94: iconst_0
      95: istore        12
      97: aload         11
      99: checkcast     #45                 // class java/lang/Iterable
     102: astore        13
     104: iconst_0
     105: istore        14
     107: aload         13
     109: astore        15
     111: new           #40                 // class java/util/ArrayList
     114: dup
     115: aload         13
     117: bipush        10
     119: invokestatic  #63                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     122: invokespecial #66                 // Method java/util/ArrayList."<init>":(I)V
     125: checkcast     #68                 // class java/util/Collection
     128: astore        16
     130: iconst_0
     131: istore        17
     133: aload         15
     135: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     140: astore        18
     142: aload         18
     144: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     149: ifeq          201
     152: aload         18
     154: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     159: astore        19
     161: aload         16
     163: aload         19
     165: checkcast     #70                 // class java/lang/Number
     168: invokevirtual #74                 // Method java/lang/Number.intValue:()I
     171: istore        20
     173: astore        21
     175: iconst_0
     176: istore        22
     178: aload_1
     179: iload         20
     181: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     186: checkcast     #80                 // class java/lang/String
     189: aload         21
     191: swap
     192: invokeinterface #84,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     197: pop
     198: goto          142
     201: aload         16
     203: checkcast     #43                 // class java/util/List
     206: nop
     207: astore        23
     209: getstatic     #87                 // Field INSTANCE:Lcom/seanshubin/kotlin/tryme/domain/schulze/Schulze;
     212: iload         6
     214: invokespecial #91                 // Method placeString:(I)Ljava/lang/String;
     217: astore        13
     219: aload         5
     221: new           #93                 // class kotlin/Pair
     224: dup
     225: aload         13
     227: aload         23
     229: invokespecial #96                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     232: invokeinterface #97,  2           // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     237: pop
     238: iload         6
     240: aload         11
     242: invokeinterface #100,  1          // InterfaceMethod java/util/List.size:()I
     247: iadd
     248: istore        6
     250: nop
     251: nop
     252: goto          68
     255: nop
     256: aload         5
     258: areturn

  public final java.util.List<java.util.List<java.lang.Integer>> strongestPaths(java.util.List<? extends java.util.List<java.lang.Integer>>);
    Code:
       0: aload_1
       1: ldc           #24                 // String rows
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokeinterface #100,  1          // InterfaceMethod java/util/List.size:()I
      12: istore_2
      13: aload_0
      14: iload_2
      15: iload_2
      16: invokespecial #128                // Method mutableList2:(II)Ljava/util/List;
      19: astore_3
      20: iconst_0
      21: istore        4
      23: iload         4
      25: iload_2
      26: if_icmpge     87
      29: iconst_0
      30: istore        5
      32: iload         5
      34: iload_2
      35: if_icmpge     81
      38: aload_3
      39: iload         4
      41: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      46: checkcast     #43                 // class java/util/List
      49: iload         5
      51: aload_1
      52: iload         4
      54: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      59: checkcast     #43                 // class java/util/List
      62: iload         5
      64: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      69: invokeinterface #132,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
      74: pop
      75: iinc          5, 1
      78: goto          32
      81: iinc          4, 1
      84: goto          23
      87: iconst_0
      88: istore        4
      90: iload         4
      92: iload_2
      93: if_icmpge     254
      96: iconst_0
      97: istore        5
      99: iload         5
     101: iload_2
     102: if_icmpge     248
     105: iload         4
     107: iload         5
     109: if_icmpeq     242
     112: iconst_0
     113: istore        6
     115: iload         6
     117: iload_2
     118: if_icmpge     242
     121: iload         4
     123: iload         6
     125: if_icmpeq     236
     128: iload         5
     130: iload         6
     132: if_icmpeq     236
     135: aload_3
     136: iload         5
     138: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     143: checkcast     #43                 // class java/util/List
     146: iload         6
     148: nop
     149: aload_3
     150: iload         5
     152: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     157: checkcast     #43                 // class java/util/List
     160: iload         6
     162: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     167: checkcast     #70                 // class java/lang/Number
     170: invokevirtual #74                 // Method java/lang/Number.intValue:()I
     173: aload_3
     174: iload         5
     176: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     181: checkcast     #43                 // class java/util/List
     184: iload         4
     186: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     191: checkcast     #70                 // class java/lang/Number
     194: invokevirtual #74                 // Method java/lang/Number.intValue:()I
     197: aload_3
     198: iload         4
     200: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     205: checkcast     #43                 // class java/util/List
     208: iload         6
     210: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     215: checkcast     #70                 // class java/lang/Number
     218: invokevirtual #74                 // Method java/lang/Number.intValue:()I
     221: invokestatic  #138                // Method java/lang/Math.min:(II)I
     224: invokestatic  #141                // Method java/lang/Math.max:(II)I
     227: invokestatic  #147                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     230: invokeinterface #132,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
     235: pop
     236: iinc          6, 1
     239: goto          115
     242: iinc          5, 1
     245: goto          99
     248: iinc          4, 1
     251: goto          90
     254: aload_3
     255: areturn

  public final java.util.List<java.util.List<java.lang.Integer>> tally(java.util.List<? extends java.util.List<java.lang.Integer>>, java.util.List<? extends java.util.List<java.lang.Integer>>, java.util.List<java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #24                 // String rows
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #153                // String soFar
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #155                // String indices
      15: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: astore        4
      21: aload_1
      22: invokeinterface #100,  1          // InterfaceMethod java/util/List.size:()I
      27: istore        5
      29: aload_3
      30: invokeinterface #100,  1          // InterfaceMethod java/util/List.size:()I
      35: iload         5
      37: if_icmpne     44
      40: aload_2
      41: goto          372
      44: iconst_0
      45: iload         5
      47: invokestatic  #161                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      50: checkcast     #45                 // class java/lang/Iterable
      53: astore        7
      55: iconst_0
      56: istore        8
      58: aload         7
      60: astore        9
      62: new           #40                 // class java/util/ArrayList
      65: dup
      66: invokespecial #41                 // Method java/util/ArrayList."<init>":()V
      69: checkcast     #68                 // class java/util/Collection
      72: astore        10
      74: iconst_0
      75: istore        11
      77: aload         9
      79: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      84: astore        12
      86: aload         12
      88: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      93: ifeq          310
      96: aload         12
      98: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     103: astore        13
     105: aload         13
     107: checkcast     #70                 // class java/lang/Number
     110: invokevirtual #74                 // Method java/lang/Number.intValue:()I
     113: istore        14
     115: iconst_0
     116: istore        15
     118: aload_3
     119: iload         14
     121: invokestatic  #147                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     124: invokeinterface #164,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     129: ifne          292
     132: iconst_0
     133: iload         5
     135: invokestatic  #161                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     138: checkcast     #45                 // class java/lang/Iterable
     141: astore        16
     143: iconst_0
     144: istore        17
     146: aload         16
     148: instanceof    #68                 // class java/util/Collection
     151: ifeq          171
     154: aload         16
     156: checkcast     #68                 // class java/util/Collection
     159: invokeinterface #167,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     164: ifeq          171
     167: iconst_1
     168: goto          285
     171: aload         16
     173: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     178: astore        18
     180: aload         18
     182: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     187: ifeq          284
     190: aload         18
     192: checkcast     #169                // class kotlin/collections/IntIterator
     195: invokevirtual #172                // Method kotlin/collections/IntIterator.nextInt:()I
     198: istore        19
     200: iload         19
     202: istore        20
     204: iconst_0
     205: istore        21
     207: aload_3
     208: iload         20
     210: invokestatic  #147                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     213: invokeinterface #164,  2          // InterfaceMethod java/util/List.contains:(Ljava/lang/Object;)Z
     218: ifne          272
     221: aload_1
     222: iload         14
     224: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     229: checkcast     #43                 // class java/util/List
     232: iload         20
     234: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     239: checkcast     #70                 // class java/lang/Number
     242: invokevirtual #74                 // Method java/lang/Number.intValue:()I
     245: aload_1
     246: iload         20
     248: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     253: checkcast     #43                 // class java/util/List
     256: iload         14
     258: invokeinterface #78,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     263: checkcast     #70                 // class java/lang/Number
     266: invokevirtual #74                 // Method java/lang/Number.intValue:()I
     269: if_icmplt     276
     272: iconst_1
     273: goto          277
     276: iconst_0
     277: ifne          180
     280: iconst_0
     281: goto          285
     284: iconst_1
     285: ifeq          292
     288: iconst_1
     289: goto          293
     292: iconst_0
     293: nop
     294: ifeq          86
     297: aload         10
     299: aload         13
     301: invokeinterface #84,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     306: pop
     307: goto          86
     310: aload         10
     312: checkcast     #43                 // class java/util/List
     315: nop
     316: astore        6
     318: aload         4
     320: astore        7
     322: aload_1
     323: astore        8
     325: aload_2
     326: checkcast     #68                 // class java/util/Collection
     329: aload         6
     331: invokestatic  #176                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     334: checkcast     #45                 // class java/lang/Iterable
     337: invokestatic  #180                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
     340: astore        9
     342: aload_3
     343: checkcast     #68                 // class java/util/Collection
     346: aload         6
     348: checkcast     #45                 // class java/lang/Iterable
     351: invokestatic  #180                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
     354: astore        10
     356: aload         7
     358: astore        4
     360: aload         8
     362: astore_1
     363: aload         9
     365: astore_2
     366: aload         10
     368: astore_3
     369: goto          21
     372: areturn

  private final java.util.List<java.util.List<java.lang.Integer>> mutableList2(int, int);
    Code:
       0: iconst_0
       1: iload_1
       2: invokestatic  #161                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
       5: checkcast     #45                 // class java/lang/Iterable
       8: astore        4
      10: iconst_0
      11: istore        5
      13: aload         4
      15: astore        6
      17: new           #40                 // class java/util/ArrayList
      20: dup
      21: aload         4
      23: bipush        10
      25: invokestatic  #63                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      28: invokespecial #66                 // Method java/util/ArrayList."<init>":(I)V
      31: checkcast     #68                 // class java/util/Collection
      34: astore        7
      36: iconst_0
      37: istore        8
      39: aload         6
      41: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      46: astore        9
      48: aload         9
      50: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      55: ifeq          233
      58: aload         9
      60: checkcast     #169                // class kotlin/collections/IntIterator
      63: invokevirtual #172                // Method kotlin/collections/IntIterator.nextInt:()I
      66: istore        10
      68: aload         7
      70: iload         10
      72: istore        11
      74: astore        24
      76: iconst_0
      77: istore        12
      79: iconst_0
      80: iload_2
      81: invokestatic  #161                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      84: checkcast     #45                 // class java/lang/Iterable
      87: astore        13
      89: iconst_0
      90: istore        14
      92: aload         13
      94: astore        15
      96: new           #40                 // class java/util/ArrayList
      99: dup
     100: aload         13
     102: bipush        10
     104: invokestatic  #63                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     107: invokespecial #66                 // Method java/util/ArrayList."<init>":(I)V
     110: checkcast     #68                 // class java/util/Collection
     113: astore        16
     115: iconst_0
     116: istore        17
     118: aload         15
     120: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     125: astore        18
     127: aload         18
     129: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     134: ifeq          174
     137: aload         18
     139: checkcast     #169                // class kotlin/collections/IntIterator
     142: invokevirtual #172                // Method kotlin/collections/IntIterator.nextInt:()I
     145: istore        19
     147: aload         16
     149: iload         19
     151: istore        20
     153: astore        21
     155: iconst_0
     156: istore        22
     158: iconst_0
     159: invokestatic  #147                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     162: aload         21
     164: swap
     165: invokeinterface #84,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     170: pop
     171: goto          127
     174: aload         16
     176: checkcast     #43                 // class java/util/List
     179: nop
     180: checkcast     #68                 // class java/util/Collection
     183: astore        13
     185: nop
     186: iconst_0
     187: istore        14
     189: aload         13
     191: astore        15
     193: aload         15
     195: iconst_0
     196: anewarray     #143                // class java/lang/Integer
     199: invokeinterface #195,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     204: checkcast     #197                // class "[Ljava/lang/Integer;"
     207: astore        23
     209: aload         23
     211: aload         23
     213: arraylength
     214: invokestatic  #203                // Method java/util/Arrays.copyOf:([Ljava/lang/Object;I)[Ljava/lang/Object;
     217: invokestatic  #207                // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
     220: nop
     221: aload         24
     223: swap
     224: invokeinterface #84,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     229: pop
     230: goto          48
     233: aload         7
     235: checkcast     #43                 // class java/util/List
     238: nop
     239: checkcast     #68                 // class java/util/Collection
     242: astore        4
     244: nop
     245: iconst_0
     246: istore        5
     248: aload         4
     250: astore        6
     252: aload         6
     254: iconst_0
     255: anewarray     #43                 // class java/util/List
     258: invokeinterface #195,  2          // InterfaceMethod java/util/Collection.toArray:([Ljava/lang/Object;)[Ljava/lang/Object;
     263: checkcast     #209                // class "[Ljava/util/List;"
     266: astore_3
     267: aload_3
     268: aload_3
     269: arraylength
     270: invokestatic  #203                // Method java/util/Arrays.copyOf:([Ljava/lang/Object;I)[Ljava/lang/Object;
     273: invokestatic  #207                // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
     276: areturn

  private final java.lang.String placeString(int);
    Code:
       0: iload_1
       1: tableswitch   { // 1 to 3
                     1: 28
                     2: 33
                     3: 38
               default: 43
          }
      28: ldc           #218                // String 1st
      30: goto          62
      33: ldc           #220                // String 2nd
      35: goto          62
      38: ldc           #222                // String 3rd
      40: goto          62
      43: new           #224                // class java/lang/StringBuilder
      46: dup
      47: invokespecial #225                // Method java/lang/StringBuilder."<init>":()V
      50: iload_1
      51: invokevirtual #229                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      54: ldc           #231                // String th
      56: invokevirtual #234                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      59: invokevirtual #238                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      62: areturn

  static {};
    Code:
       0: new           #2                  // class com/seanshubin/kotlin/tryme/domain/schulze/Schulze
       3: dup
       4: invokespecial #240                // Method "<init>":()V
       7: putstatic     #87                 // Field INSTANCE:Lcom/seanshubin/kotlin/tryme/domain/schulze/Schulze;
      10: return
}


package asaad

import java.io.File

private fun IntRange.containsOneAnother(intRange: IntRange): Boolean {
    return this.intersect(intRange).size == minOf(intRange.size, this.size)
}

private fun IntRange.overlap(intRange: IntRange): Boolean {
    return this.intersect(intRange).isNotEmpty()
}

private val IntRange.size: Int
    get() {
        return this.last - this.first + 1
    }

class DayFour(filePath: String) {
    private val file = File(filePath)
    private val input = readInput(file).map { it.asRanges() }

    private fun readInput(file: File) = file.readLines()

    private fun String.asRanges(): List<IntRange> {
        return this.split(",").map { getFieldRange(it) }
    }

    private fun solve(func: IntRange.(IntRange) -> Boolean) =
        input.count { it[0].func(it[1]) }

    fun result() {
        println("\tpart 1: ${solve(IntRange::containsOneAnother)}")
        println("\tpart 2: ${solve(IntRange::overlap)}")
    }

    /**
     * @param section: field section expression : "a-b"
     */
    private fun getFieldRange(section: String): IntRange {
        val (first, second) = section.split("-")
            .map { it.toInt() }
        return first..second
    }
}

Compiled from "DayFour.kt"
final class asaad.DayFour$result$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function2<kotlin.ranges.IntRange, kotlin.ranges.IntRange, java.lang.Boolean> {
  public static final asaad.DayFour$result$1 INSTANCE;

  asaad.DayFour$result$1();
    Code:
       0: aload_0
       1: iconst_2
       2: ldc           #11                 // class asaad/DayFourKt
       4: ldc           #13                 // String containsOneAnother
       6: ldc           #15                 // String containsOneAnother(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Z
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.Boolean invoke(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_1
       1: ldc           #24                 // String p0
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #32                 // String p1
       9: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: aload_2
      14: invokestatic  #36                 // Method asaad/DayFourKt.access$containsOneAnother:(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Z
      17: invokestatic  #42                 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      20: areturn

  public java.lang.Object invoke(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #46                 // class kotlin/ranges/IntRange
       5: aload_2
       6: checkcast     #46                 // class kotlin/ranges/IntRange
       9: invokevirtual #48                 // Method invoke:(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Ljava/lang/Boolean;
      12: areturn

  static {};
    Code:
       0: new           #2                  // class asaad/DayFour$result$1
       3: dup
       4: invokespecial #53                 // Method "<init>":()V
       7: putstatic     #56                 // Field INSTANCE:Lasaad/DayFour$result$1;
      10: return
}

Compiled from "DayFour.kt"
final class asaad.DayFour$result$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function2<kotlin.ranges.IntRange, kotlin.ranges.IntRange, java.lang.Boolean> {
  public static final asaad.DayFour$result$2 INSTANCE;

  asaad.DayFour$result$2();
    Code:
       0: aload_0
       1: iconst_2
       2: ldc           #11                 // class asaad/DayFourKt
       4: ldc           #13                 // String overlap
       6: ldc           #15                 // String overlap(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Z
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.Boolean invoke(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_1
       1: ldc           #24                 // String p0
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #32                 // String p1
       9: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: aload_2
      14: invokestatic  #36                 // Method asaad/DayFourKt.access$overlap:(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Z
      17: invokestatic  #42                 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      20: areturn

  public java.lang.Object invoke(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #46                 // class kotlin/ranges/IntRange
       5: aload_2
       6: checkcast     #46                 // class kotlin/ranges/IntRange
       9: invokevirtual #48                 // Method invoke:(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Ljava/lang/Boolean;
      12: areturn

  static {};
    Code:
       0: new           #2                  // class asaad/DayFour$result$2
       3: dup
       4: invokespecial #53                 // Method "<init>":()V
       7: putstatic     #56                 // Field INSTANCE:Lasaad/DayFour$result$2;
      10: return
}

Compiled from "DayFour.kt"
public final class asaad.DayFourKt {
  private static final boolean containsOneAnother(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: checkcast     #8                  // class java/lang/Iterable
       4: aload_1
       5: checkcast     #8                  // class java/lang/Iterable
       8: invokestatic  #14                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      11: invokeinterface #20,  1           // InterfaceMethod java/util/Set.size:()I
      16: aload_1
      17: invokestatic  #24                 // Method getSize:(Lkotlin/ranges/IntRange;)I
      20: aload_0
      21: invokestatic  #24                 // Method getSize:(Lkotlin/ranges/IntRange;)I
      24: invokestatic  #30                 // Method java/lang/Math.min:(II)I
      27: if_icmpne     34
      30: iconst_1
      31: goto          35
      34: iconst_0
      35: ireturn

  private static final boolean overlap(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: checkcast     #8                  // class java/lang/Iterable
       4: aload_1
       5: checkcast     #8                  // class java/lang/Iterable
       8: invokestatic  #14                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      11: checkcast     #36                 // class java/util/Collection
      14: invokeinterface #40,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
      19: ifne          26
      22: iconst_1
      23: goto          27
      26: iconst_0
      27: ireturn

  private static final int getSize(kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: invokevirtual #46                 // Method kotlin/ranges/IntRange.getLast:()I
       4: aload_0
       5: invokevirtual #49                 // Method kotlin/ranges/IntRange.getFirst:()I
       8: isub
       9: iconst_1
      10: iadd
      11: ireturn

  public static final boolean access$containsOneAnother(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #53                 // Method containsOneAnother:(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Z
       5: ireturn

  public static final boolean access$overlap(kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #57                 // Method overlap:(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)Z
       5: ireturn
}

Compiled from "DayFour.kt"
public final class asaad.DayFour {
  private final java.io.File file;

  private final java.util.List<java.util.List<kotlin.ranges.IntRange>> input;

  public asaad.DayFour(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #9                  // String filePath
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: new           #20                 // class java/io/File
      14: dup
      15: aload_1
      16: invokespecial #22                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      19: putfield      #26                 // Field file:Ljava/io/File;
      22: aload_0
      23: aload_0
      24: aload_0
      25: getfield      #26                 // Field file:Ljava/io/File;
      28: invokespecial #30                 // Method readInput:(Ljava/io/File;)Ljava/util/List;
      31: checkcast     #32                 // class java/lang/Iterable
      34: astore_2
      35: astore        11
      37: iconst_0
      38: istore_3
      39: aload_2
      40: astore        4
      42: new           #34                 // class java/util/ArrayList
      45: dup
      46: aload_2
      47: bipush        10
      49: invokestatic  #40                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      52: invokespecial #43                 // Method java/util/ArrayList."<init>":(I)V
      55: checkcast     #45                 // class java/util/Collection
      58: astore        5
      60: iconst_0
      61: istore        6
      63: aload         4
      65: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      70: astore        7
      72: aload         7
      74: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      79: ifeq          123
      82: aload         7
      84: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      89: astore        8
      91: aload         5
      93: aload         8
      95: checkcast     #61                 // class java/lang/String
      98: astore        9
     100: astore        12
     102: iconst_0
     103: istore        10
     105: aload_0
     106: aload         9
     108: invokespecial #65                 // Method asRanges:(Ljava/lang/String;)Ljava/util/List;
     111: aload         12
     113: swap
     114: invokeinterface #69,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     119: pop
     120: goto          72
     123: aload         5
     125: checkcast     #71                 // class java/util/List
     128: nop
     129: aload         11
     131: swap
     132: putfield      #75                 // Field input:Ljava/util/List;
     135: return

  private final java.util.List<java.lang.String> readInput(java.io.File);
    Code:
       0: aload_1
       1: aconst_null
       2: iconst_1
       3: aconst_null
       4: invokestatic  #97                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
       7: areturn

  private final java.util.List<kotlin.ranges.IntRange> asRanges(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #100                // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #61                 // class java/lang/String
       8: astore_2
       9: aload_2
      10: iconst_0
      11: ldc           #102                // String ,
      13: aastore
      14: aload_2
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #108                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #32                 // class java/lang/Iterable
      26: astore_2
      27: iconst_0
      28: istore_3
      29: aload_2
      30: astore        4
      32: new           #34                 // class java/util/ArrayList
      35: dup
      36: aload_2
      37: bipush        10
      39: invokestatic  #40                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      42: invokespecial #43                 // Method java/util/ArrayList."<init>":(I)V
      45: checkcast     #45                 // class java/util/Collection
      48: astore        5
      50: iconst_0
      51: istore        6
      53: aload         4
      55: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      60: astore        7
      62: aload         7
      64: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      69: ifeq          113
      72: aload         7
      74: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      79: astore        8
      81: aload         5
      83: aload         8
      85: checkcast     #61                 // class java/lang/String
      88: astore        9
      90: astore        11
      92: iconst_0
      93: istore        10
      95: aload_0
      96: aload         9
      98: invokespecial #112                // Method getFieldRange:(Ljava/lang/String;)Lkotlin/ranges/IntRange;
     101: aload         11
     103: swap
     104: invokeinterface #69,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     109: pop
     110: goto          62
     113: aload         5
     115: checkcast     #71                 // class java/util/List
     118: nop
     119: areturn

  private final int solve(kotlin.jvm.functions.Function2<? super kotlin.ranges.IntRange, ? super kotlin.ranges.IntRange, java.lang.Boolean>);
    Code:
       0: aload_0
       1: getfield      #75                 // Field input:Ljava/util/List;
       4: checkcast     #32                 // class java/lang/Iterable
       7: astore_2
       8: iconst_0
       9: istore_3
      10: aload_2
      11: instanceof    #45                 // class java/util/Collection
      14: ifeq          33
      17: aload_2
      18: checkcast     #45                 // class java/util/Collection
      21: invokeinterface #120,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      26: ifeq          33
      29: iconst_0
      30: goto          120
      33: iconst_0
      34: istore        4
      36: aload_2
      37: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        5
      44: aload         5
      46: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          118
      54: aload         5
      56: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        6
      63: aload         6
      65: checkcast     #71                 // class java/util/List
      68: astore        7
      70: iconst_0
      71: istore        8
      73: aload_1
      74: aload         7
      76: iconst_0
      77: invokeinterface #124,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      82: aload         7
      84: iconst_1
      85: invokeinterface #124,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      90: invokeinterface #130,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      95: checkcast     #132                // class java/lang/Boolean
      98: invokevirtual #135                // Method java/lang/Boolean.booleanValue:()Z
     101: ifeq          44
     104: iinc          4, 1
     107: iload         4
     109: ifge          44
     112: invokestatic  #138                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     115: goto          44
     118: iload         4
     120: ireturn

  public final void result();
    Code:
       0: new           #148                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #149                // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #151                // String \tpart 1:
       9: invokevirtual #155                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getstatic     #161                // Field asaad/DayFour$result$1.INSTANCE:Lasaad/DayFour$result$1;
      16: checkcast     #126                // class kotlin/jvm/functions/Function2
      19: invokespecial #163                // Method solve:(Lkotlin/jvm/functions/Function2;)I
      22: invokevirtual #166                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      25: invokevirtual #170                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      28: getstatic     #176                // Field java/lang/System.out:Ljava/io/PrintStream;
      31: swap
      32: invokevirtual #182                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      35: new           #148                // class java/lang/StringBuilder
      38: dup
      39: invokespecial #149                // Method java/lang/StringBuilder."<init>":()V
      42: ldc           #184                // String \tpart 2:
      44: invokevirtual #155                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      47: aload_0
      48: getstatic     #189                // Field asaad/DayFour$result$2.INSTANCE:Lasaad/DayFour$result$2;
      51: checkcast     #126                // class kotlin/jvm/functions/Function2
      54: invokespecial #163                // Method solve:(Lkotlin/jvm/functions/Function2;)I
      57: invokevirtual #166                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      60: invokevirtual #170                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      63: getstatic     #176                // Field java/lang/System.out:Ljava/io/PrintStream;
      66: swap
      67: invokevirtual #182                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      70: return

  private final kotlin.ranges.IntRange getFieldRange(java.lang.String);
    Code:
       0: aload_1
       1: checkcast     #100                // class java/lang/CharSequence
       4: iconst_1
       5: anewarray     #61                 // class java/lang/String
       8: astore_3
       9: aload_3
      10: iconst_0
      11: ldc           #191                // String -
      13: aastore
      14: aload_3
      15: iconst_0
      16: iconst_0
      17: bipush        6
      19: aconst_null
      20: invokestatic  #108                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      23: checkcast     #32                 // class java/lang/Iterable
      26: astore_3
      27: nop
      28: iconst_0
      29: istore        4
      31: aload_3
      32: astore        5
      34: new           #34                 // class java/util/ArrayList
      37: dup
      38: aload_3
      39: bipush        10
      41: invokestatic  #40                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      44: invokespecial #43                 // Method java/util/ArrayList."<init>":(I)V
      47: checkcast     #45                 // class java/util/Collection
      50: astore        6
      52: iconst_0
      53: istore        7
      55: aload         5
      57: invokeinterface #49,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      62: astore        8
      64: aload         8
      66: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      71: ifeq          118
      74: aload         8
      76: invokeinterface #59,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      81: astore        9
      83: aload         6
      85: aload         9
      87: checkcast     #61                 // class java/lang/String
      90: astore        10
      92: astore        12
      94: iconst_0
      95: istore        11
      97: aload         10
      99: invokestatic  #197                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     102: nop
     103: invokestatic  #201                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     106: aload         12
     108: swap
     109: invokeinterface #69,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     114: pop
     115: goto          64
     118: aload         6
     120: checkcast     #71                 // class java/util/List
     123: nop
     124: astore_2
     125: aload_2
     126: iconst_0
     127: invokeinterface #124,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     132: checkcast     #203                // class java/lang/Number
     135: invokevirtual #207                // Method java/lang/Number.intValue:()I
     138: istore_3
     139: aload_2
     140: iconst_1
     141: invokeinterface #124,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     146: checkcast     #203                // class java/lang/Number
     149: invokevirtual #207                // Method java/lang/Number.intValue:()I
     152: istore        4
     154: new           #209                // class kotlin/ranges/IntRange
     157: dup
     158: iload_3
     159: iload         4
     161: invokespecial #212                // Method kotlin/ranges/IntRange."<init>":(II)V
     164: areturn
}


package asaad

import java.io.File

class DayThree(filePath: String) {
    private val file = File(filePath)
    private val input = readInput(file)

    private fun readInput(file: File) = file.readLines()

    private fun Char.toPriority(): Int = when {
        this.isLowerCase() -> this - 'a' + 1
        this.isUpperCase() -> this - 'A' + 27
        else -> throw Exception("char $this has no priority")
    }

    private fun solve1() =
        input.fold(0) { acc, s -> acc + RuckSack(s).repeatedItem().toPriority() }

    private fun solve2() =
        input.chunked(3){ chunk ->
            chunk.map { it.toSet() }
                .reduce { acc, chars -> acc.intersect(chars) }
                .firstOrNull()
        }.fold(0) { acc, s -> acc + s?.toPriority()!! }

    fun result() {
        println("\tpart 1: ${solve1()}")
        println("\tpart 2: ${solve2()}")
    }

    private class RuckSack(ruckSack: String) {

        private val compartments: List<Set<Char>>

        init {
            val ruckSize = ruckSack.length
            compartments = listOf(
                ruckSack.substring(0 until ruckSize / 2).toHashSet(),
                ruckSack.substring(ruckSize / 2 until ruckSize).toHashSet()
            )
        }

        fun repeatedItem(): Char {
            val intersection = compartments[0].intersect(compartments[1].toSet())
            if (intersection.size > 1)
                throw Exception("there is more than one repeated element in the compartments")

            return intersection.first()
        }

    }
}

Compiled from "DayThree.kt"
public final class asaad.DayThree {
  private final java.io.File file;

  private final java.util.List<java.lang.String> input;

  public asaad.DayThree(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #9                  // String filePath
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: new           #20                 // class java/io/File
      14: dup
      15: aload_1
      16: invokespecial #22                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      19: putfield      #26                 // Field file:Ljava/io/File;
      22: aload_0
      23: aload_0
      24: aload_0
      25: getfield      #26                 // Field file:Ljava/io/File;
      28: invokespecial #30                 // Method readInput:(Ljava/io/File;)Ljava/util/List;
      31: putfield      #34                 // Field input:Ljava/util/List;
      34: return

  private final java.util.List<java.lang.String> readInput(java.io.File);
    Code:
       0: aload_1
       1: aconst_null
       2: iconst_1
       3: aconst_null
       4: invokestatic  #44                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
       7: areturn

  private final int toPriority(char);
    Code:
       0: nop
       1: iload_1
       2: invokestatic  #52                 // Method java/lang/Character.isLowerCase:(C)Z
       5: ifeq          17
       8: iload_1
       9: bipush        97
      11: isub
      12: iconst_1
      13: iadd
      14: goto          66
      17: iload_1
      18: invokestatic  #55                 // Method java/lang/Character.isUpperCase:(C)Z
      21: ifeq          34
      24: iload_1
      25: bipush        65
      27: isub
      28: bipush        27
      30: iadd
      31: goto          66
      34: new           #57                 // class java/lang/Exception
      37: dup
      38: new           #59                 // class java/lang/StringBuilder
      41: dup
      42: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
      45: ldc           #62                 // String char
      47: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      50: iload_1
      51: invokevirtual #69                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      54: ldc           #71                 // String  has no priority
      56: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      59: invokevirtual #75                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      62: invokespecial #76                 // Method java/lang/Exception."<init>":(Ljava/lang/String;)V
      65: athrow
      66: ireturn

  private final int solve1();
    Code:
       0: aload_0
       1: getfield      #34                 // Field input:Ljava/util/List;
       4: checkcast     #82                 // class java/lang/Iterable
       7: astore_1
       8: iconst_0
       9: istore_2
      10: iconst_0
      11: istore_3
      12: iload_2
      13: istore        4
      15: aload_1
      16: invokeinterface #86,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      21: astore        5
      23: aload         5
      25: invokeinterface #92,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      30: ifeq          80
      33: aload         5
      35: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      40: astore        6
      42: iload         4
      44: aload         6
      46: checkcast     #98                 // class java/lang/String
      49: astore        7
      51: istore        8
      53: iconst_0
      54: istore        9
      56: iload         8
      58: aload_0
      59: new           #100                // class asaad/DayThree$RuckSack
      62: dup
      63: aload         7
      65: invokespecial #101                // Method asaad/DayThree$RuckSack."<init>":(Ljava/lang/String;)V
      68: invokevirtual #105                // Method asaad/DayThree$RuckSack.repeatedItem:()C
      71: invokespecial #107                // Method toPriority:(C)I
      74: iadd
      75: istore        4
      77: goto          23
      80: iload         4
      82: ireturn

  private final int solve2();
    Code:
       0: aload_0
       1: getfield      #34                 // Field input:Ljava/util/List;
       4: checkcast     #82                 // class java/lang/Iterable
       7: iconst_3
       8: invokedynamic #138,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      13: invokestatic  #144                // Method kotlin/collections/CollectionsKt.chunked:(Ljava/lang/Iterable;ILkotlin/jvm/functions/Function1;)Ljava/util/List;
      16: checkcast     #82                 // class java/lang/Iterable
      19: astore_1
      20: iconst_0
      21: istore_2
      22: iconst_0
      23: istore_3
      24: iload_2
      25: istore        4
      27: aload_1
      28: invokeinterface #86,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      33: astore        5
      35: aload         5
      37: invokeinterface #92,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      42: ifeq          105
      45: aload         5
      47: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      52: astore        6
      54: iload         4
      56: aload         6
      58: checkcast     #48                 // class java/lang/Character
      61: astore        7
      63: istore        8
      65: iconst_0
      66: istore        9
      68: iload         8
      70: aload         7
      72: dup
      73: ifnull        90
      76: aload_0
      77: swap
      78: invokevirtual #147                // Method java/lang/Character.charValue:()C
      81: invokespecial #107                // Method toPriority:(C)I
      84: invokestatic  #153                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      87: goto          92
      90: pop
      91: aconst_null
      92: dup
      93: invokestatic  #157                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      96: invokevirtual #160                // Method java/lang/Integer.intValue:()I
      99: iadd
     100: istore        4
     102: goto          35
     105: iload         4
     107: ireturn

  public final void result();
    Code:
       0: new           #59                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #165                // String \tpart 1:
       9: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: invokespecial #167                // Method solve1:()I
      16: invokevirtual #170                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: invokevirtual #75                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      22: getstatic     #176                // Field java/lang/System.out:Ljava/io/PrintStream;
      25: swap
      26: invokevirtual #181                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      29: new           #59                 // class java/lang/StringBuilder
      32: dup
      33: invokespecial #60                 // Method java/lang/StringBuilder."<init>":()V
      36: ldc           #183                // String \tpart 2:
      38: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      41: aload_0
      42: invokespecial #185                // Method solve2:()I
      45: invokevirtual #170                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      48: invokevirtual #75                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: getstatic     #176                // Field java/lang/System.out:Ljava/io/PrintStream;
      54: swap
      55: invokevirtual #181                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      58: return

  private static final java.lang.Character solve2$lambda$3(java.util.List);
    Code:
       0: aload_0
       1: ldc           #187                // String chunk
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #82                 // class java/lang/Iterable
      10: astore_1
      11: iconst_0
      12: istore_2
      13: aload_1
      14: astore_3
      15: new           #189                // class java/util/ArrayList
      18: dup
      19: aload_1
      20: bipush        10
      22: invokestatic  #193                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      25: invokespecial #196                // Method java/util/ArrayList."<init>":(I)V
      28: checkcast     #198                // class java/util/Collection
      31: astore        4
      33: iconst_0
      34: istore        5
      36: aload_3
      37: invokeinterface #86,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        6
      44: aload         6
      46: invokeinterface #92,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          97
      54: aload         6
      56: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        7
      63: aload         4
      65: aload         7
      67: checkcast     #98                 // class java/lang/String
      70: astore        8
      72: astore        10
      74: iconst_0
      75: istore        9
      77: aload         8
      79: checkcast     #200                // class java/lang/CharSequence
      82: invokestatic  #206                // Method kotlin/text/StringsKt.toSet:(Ljava/lang/CharSequence;)Ljava/util/Set;
      85: aload         10
      87: swap
      88: invokeinterface #210,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      93: pop
      94: goto          44
      97: aload         4
      99: checkcast     #212                // class java/util/List
     102: nop
     103: checkcast     #82                 // class java/lang/Iterable
     106: astore_1
     107: nop
     108: iconst_0
     109: istore_2
     110: aload_1
     111: invokeinterface #86,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     116: astore_3
     117: aload_3
     118: invokeinterface #92,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     123: ifne          136
     126: new           #214                // class java/lang/UnsupportedOperationException
     129: dup
     130: ldc           #216                // String Empty collection can\'t be reduced.
     132: invokespecial #217                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     135: athrow
     136: aload_3
     137: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     142: astore        4
     144: aload_3
     145: invokeinterface #92,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     150: ifeq          192
     153: aload         4
     155: aload_3
     156: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     161: checkcast     #219                // class java/util/Set
     164: astore        5
     166: checkcast     #219                // class java/util/Set
     169: astore        6
     171: iconst_0
     172: istore        7
     174: aload         6
     176: checkcast     #82                 // class java/lang/Iterable
     179: aload         5
     181: checkcast     #82                 // class java/lang/Iterable
     184: invokestatic  #223                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
     187: astore        4
     189: goto          144
     192: aload         4
     194: checkcast     #82                 // class java/lang/Iterable
     197: invokestatic  #227                // Method kotlin/collections/CollectionsKt.firstOrNull:(Ljava/lang/Iterable;)Ljava/lang/Object;
     200: checkcast     #48                 // class java/lang/Character
     203: areturn
}

Compiled from "DayThree.kt"
final class asaad.DayThree$RuckSack {
  private final java.util.List<java.util.Set<java.lang.Character>> compartments;

  public asaad.DayThree$RuckSack(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #9                  // String ruckSack
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: nop
      11: aload_1
      12: invokevirtual #24                 // Method java/lang/String.length:()I
      15: istore_2
      16: aload_0
      17: iconst_2
      18: anewarray     #26                 // class java/util/HashSet
      21: astore_3
      22: aload_3
      23: iconst_0
      24: aload_1
      25: iconst_0
      26: iload_2
      27: iconst_2
      28: idiv
      29: invokestatic  #32                 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      32: invokestatic  #38                 // Method kotlin/text/StringsKt.substring:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;
      35: checkcast     #40                 // class java/lang/CharSequence
      38: invokestatic  #44                 // Method kotlin/text/StringsKt.toHashSet:(Ljava/lang/CharSequence;)Ljava/util/HashSet;
      41: aastore
      42: aload_3
      43: iconst_1
      44: aload_1
      45: iload_2
      46: iconst_2
      47: idiv
      48: iload_2
      49: invokestatic  #32                 // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      52: invokestatic  #38                 // Method kotlin/text/StringsKt.substring:(Ljava/lang/String;Lkotlin/ranges/IntRange;)Ljava/lang/String;
      55: checkcast     #40                 // class java/lang/CharSequence
      58: invokestatic  #44                 // Method kotlin/text/StringsKt.toHashSet:(Ljava/lang/CharSequence;)Ljava/util/HashSet;
      61: aastore
      62: aload_3
      63: invokestatic  #50                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      66: putfield      #54                 // Field compartments:Ljava/util/List;
      69: nop
      70: return

  public final char repeatedItem();
    Code:
       0: aload_0
       1: getfield      #54                 // Field compartments:Ljava/util/List;
       4: iconst_0
       5: invokeinterface #67,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      10: checkcast     #69                 // class java/lang/Iterable
      13: aload_0
      14: getfield      #54                 // Field compartments:Ljava/util/List;
      17: iconst_1
      18: invokeinterface #67,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      23: checkcast     #69                 // class java/lang/Iterable
      26: invokestatic  #73                 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
      29: checkcast     #69                 // class java/lang/Iterable
      32: invokestatic  #77                 // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      35: astore_1
      36: aload_1
      37: invokeinterface #82,  1           // InterfaceMethod java/util/Set.size:()I
      42: iconst_1
      43: if_icmple     56
      46: new           #84                 // class java/lang/Exception
      49: dup
      50: ldc           #86                 // String there is more than one repeated element in the compartments
      52: invokespecial #88                 // Method java/lang/Exception."<init>":(Ljava/lang/String;)V
      55: athrow
      56: aload_1
      57: checkcast     #69                 // class java/lang/Iterable
      60: invokestatic  #92                 // Method kotlin/collections/CollectionsKt.first:(Ljava/lang/Iterable;)Ljava/lang/Object;
      63: checkcast     #94                 // class java/lang/Character
      66: invokevirtual #97                 // Method java/lang/Character.charValue:()C
      69: ireturn
}