package aoc03

import java.nio.file.Paths

val valueMap = calculateValueMap();

fun calculateValueMap(): Map<Char, Int> {
    val tmpMap = mutableMapOf<Char, Int>()
    var c = 'a';
    while (c <= 'z') {
        tmpMap[c] = c.code - 96;
        c++
    }

    c = 'A'
    while (c <= 'Z') {
        tmpMap[c] = c.code - 38;
        c++
    }
    return tmpMap;
}

fun main() {
    val lines = Paths.get("src/main/resources/aoc_03.txt").toFile().useLines { it.toList() }

    println(solution1(lines))
    println(solution2(lines))
}

fun solution1(lines: List<String>): Int {
    return lines.map {
        Pair(it.substring(0, it.length / 2), it.substring(it.length / 2))
    }.map { pair ->
        pair.first.toCharArray().first {
            pair.second.contains(it)
        }
    }.sumOf {
        valueMap[it]!!
    }
}

fun solution2(lines: List<String>): Int {
    return lines
        .windowed(3, 3)
        .map { group ->
            val charMap = mutableMapOf<Char, Int>()
            group.forEach { line ->
                line.toCharArray()
                    .distinct()
                    .forEach {
                        charMap.computeIfPresent(it) { _, v -> v + 1 }
                        charMap.putIfAbsent(it, 1)
                    }
            }
            charMap.maxBy { it.value }.key
        }.sumOf {
            valueMap[it]!!
        }
}

Compiled from "Solution03.kt"
public final class aoc03.Solution03Kt {
  private static final java.util.Map<java.lang.Character, java.lang.Integer> valueMap;

  public static final java.util.Map<java.lang.Character, java.lang.Integer> getValueMap();
    Code:
       0: getstatic     #12                 // Field valueMap:Ljava/util/Map;
       3: areturn

  public static final java.util.Map<java.lang.Character, java.lang.Integer> calculateValueMap();
    Code:
       0: new           #15                 // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #19                 // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #21                 // class java/util/Map
      10: astore_0
      11: bipush        97
      13: istore_1
      14: iload_1
      15: bipush        122
      17: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      20: ifgt          53
      23: iload_1
      24: invokestatic  #33                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      27: astore_3
      28: aload_0
      29: aload_3
      30: iload_1
      31: bipush        96
      33: isub
      34: invokestatic  #38                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      37: invokeinterface #42,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      42: pop
      43: iload_1
      44: istore_2
      45: iload_2
      46: iconst_1
      47: iadd
      48: i2c
      49: istore_1
      50: goto          14
      53: bipush        65
      55: istore_1
      56: iload_1
      57: bipush        90
      59: invokestatic  #27                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      62: ifgt          95
      65: iload_1
      66: invokestatic  #33                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      69: astore_3
      70: aload_0
      71: aload_3
      72: iload_1
      73: bipush        38
      75: isub
      76: invokestatic  #38                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      79: invokeinterface #42,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      84: pop
      85: iload_1
      86: istore_2
      87: iload_2
      88: iconst_1
      89: iadd
      90: i2c
      91: istore_1
      92: goto          56
      95: aload_0
      96: areturn

  public static final void main();
    Code:
       0: ldc           #50                 // String src/main/resources/aoc_03.txt
       2: iconst_0
       3: anewarray     #52                 // class java/lang/String
       6: invokestatic  #58                 // Method java/nio/file/Paths.get:(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
       9: invokeinterface #64,  1           // InterfaceMethod java/nio/file/Path.toFile:()Ljava/io/File;
      14: dup
      15: ldc           #66                 // String toFile(...)
      17: invokestatic  #70                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      20: astore_1
      21: getstatic     #76                 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;
      24: astore_2
      25: iconst_0
      26: istore_3
      27: aload_1
      28: astore        4
      30: sipush        8192
      33: istore        5
      35: aload         4
      37: astore        6
      39: new           #78                 // class java/io/InputStreamReader
      42: dup
      43: new           #80                 // class java/io/FileInputStream
      46: dup
      47: aload         6
      49: invokespecial #83                 // Method java/io/FileInputStream."<init>":(Ljava/io/File;)V
      52: checkcast     #85                 // class java/io/InputStream
      55: aload_2
      56: invokespecial #88                 // Method java/io/InputStreamReader."<init>":(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
      59: checkcast     #90                 // class java/io/Reader
      62: astore        6
      64: aload         6
      66: instanceof    #92                 // class java/io/BufferedReader
      69: ifeq          80
      72: aload         6
      74: checkcast     #92                 // class java/io/BufferedReader
      77: goto          91
      80: new           #92                 // class java/io/BufferedReader
      83: dup
      84: aload         6
      86: iload         5
      88: invokespecial #95                 // Method java/io/BufferedReader."<init>":(Ljava/io/Reader;I)V
      91: checkcast     #97                 // class java/io/Closeable
      94: astore        4
      96: aconst_null
      97: astore        5
      99: nop
     100: aload         4
     102: checkcast     #92                 // class java/io/BufferedReader
     105: astore        6
     107: iconst_0
     108: istore        7
     110: aload         6
     112: invokestatic  #103                // Method kotlin/io/TextStreamsKt.lineSequence:(Ljava/io/BufferedReader;)Lkotlin/sequences/Sequence;
     115: astore        8
     117: iconst_0
     118: istore        9
     120: aload         8
     122: invokestatic  #109                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     125: astore        6
     127: aload         4
     129: aload         5
     131: invokestatic  #115                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     134: aload         6
     136: goto          160
     139: astore        7
     141: aload         7
     143: astore        5
     145: aload         7
     147: athrow
     148: astore        7
     150: aload         4
     152: aload         5
     154: invokestatic  #115                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     157: aload         7
     159: athrow
     160: nop
     161: astore_0
     162: aload_0
     163: invokestatic  #119                // Method solution1:(Ljava/util/List;)I
     166: istore_1
     167: getstatic     #125                // Field java/lang/System.out:Ljava/io/PrintStream;
     170: iload_1
     171: invokevirtual #131                // Method java/io/PrintStream.println:(I)V
     174: aload_0
     175: invokestatic  #134                // Method solution2:(Ljava/util/List;)I
     178: istore_1
     179: getstatic     #125                // Field java/lang/System.out:Ljava/io/PrintStream;
     182: iload_1
     183: invokevirtual #131                // Method java/io/PrintStream.println:(I)V
     186: return
    Exception table:
       from    to  target type
          99   127   139   Class java/lang/Throwable
          99   127   148   any
         139   148   148   any
         148   150   148   any

  public static final int solution1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #157                // String lines
       3: invokestatic  #160                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #162                // class java/lang/Iterable
      10: astore_1
      11: iconst_0
      12: istore_2
      13: aload_1
      14: astore_3
      15: new           #164                // class java/util/ArrayList
      18: dup
      19: aload_1
      20: bipush        10
      22: invokestatic  #170                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      25: invokespecial #172                // Method java/util/ArrayList."<init>":(I)V
      28: checkcast     #174                // class java/util/Collection
      31: astore        4
      33: iconst_0
      34: istore        5
      36: aload_3
      37: invokeinterface #178,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        6
      44: aload         6
      46: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          133
      54: aload         6
      56: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        7
      63: aload         4
      65: aload         7
      67: checkcast     #52                 // class java/lang/String
      70: astore        8
      72: astore        17
      74: iconst_0
      75: istore        9
      77: new           #190                // class kotlin/Pair
      80: dup
      81: aload         8
      83: iconst_0
      84: aload         8
      86: invokevirtual #194                // Method java/lang/String.length:()I
      89: iconst_2
      90: idiv
      91: invokevirtual #198                // Method java/lang/String.substring:(II)Ljava/lang/String;
      94: dup
      95: ldc           #200                // String substring(...)
      97: invokestatic  #70                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     100: aload         8
     102: aload         8
     104: invokevirtual #194                // Method java/lang/String.length:()I
     107: iconst_2
     108: idiv
     109: invokevirtual #203                // Method java/lang/String.substring:(I)Ljava/lang/String;
     112: dup
     113: ldc           #200                // String substring(...)
     115: invokestatic  #70                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     118: invokespecial #206                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     121: aload         17
     123: swap
     124: invokeinterface #210,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     129: pop
     130: goto          44
     133: aload         4
     135: checkcast     #153                // class java/util/List
     138: nop
     139: checkcast     #162                // class java/lang/Iterable
     142: astore_1
     143: nop
     144: iconst_0
     145: istore_2
     146: aload_1
     147: astore_3
     148: new           #164                // class java/util/ArrayList
     151: dup
     152: aload_1
     153: bipush        10
     155: invokestatic  #170                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     158: invokespecial #172                // Method java/util/ArrayList."<init>":(I)V
     161: checkcast     #174                // class java/util/Collection
     164: astore        4
     166: iconst_0
     167: istore        5
     169: aload_3
     170: invokeinterface #178,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     175: astore        6
     177: aload         6
     179: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     184: ifeq          318
     187: aload         6
     189: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     194: astore        7
     196: aload         4
     198: aload         7
     200: checkcast     #190                // class kotlin/Pair
     203: astore        8
     205: astore        17
     207: iconst_0
     208: istore        9
     210: aload         8
     212: invokevirtual #213                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     215: checkcast     #52                 // class java/lang/String
     218: invokevirtual #217                // Method java/lang/String.toCharArray:()[C
     221: dup
     222: ldc           #219                // String toCharArray(...)
     224: invokestatic  #70                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     227: astore        10
     229: nop
     230: iconst_0
     231: istore        11
     233: iconst_0
     234: istore        12
     236: aload         10
     238: arraylength
     239: istore        13
     241: iload         12
     243: iload         13
     245: if_icmpge     292
     248: aload         10
     250: iload         12
     252: caload
     253: istore        14
     255: iload         14
     257: istore        15
     259: iconst_0
     260: istore        16
     262: aload         8
     264: invokevirtual #222                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     267: checkcast     #224                // class java/lang/CharSequence
     270: iload         15
     272: iconst_0
     273: iconst_2
     274: aconst_null
     275: invokestatic  #230                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
     278: ifeq          286
     281: iload         14
     283: goto          302
     286: iinc          12, 1
     289: goto          241
     292: new           #232                // class java/util/NoSuchElementException
     295: dup
     296: ldc           #234                // String Array contains no element matching the predicate.
     298: invokespecial #237                // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
     301: athrow
     302: nop
     303: invokestatic  #33                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     306: aload         17
     308: swap
     309: invokeinterface #210,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     314: pop
     315: goto          177
     318: aload         4
     320: checkcast     #153                // class java/util/List
     323: nop
     324: checkcast     #162                // class java/lang/Iterable
     327: astore_1
     328: iconst_0
     329: istore_2
     330: aload_1
     331: invokeinterface #178,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     336: astore_3
     337: aload_3
     338: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     343: ifeq          404
     346: aload_3
     347: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     352: astore        4
     354: iload_2
     355: aload         4
     357: checkcast     #29                 // class java/lang/Character
     360: invokevirtual #241                // Method java/lang/Character.charValue:()C
     363: istore        5
     365: istore        17
     367: iconst_0
     368: istore        6
     370: getstatic     #12                 // Field valueMap:Ljava/util/Map;
     373: iload         5
     375: invokestatic  #33                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     378: invokeinterface #244,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     383: dup
     384: invokestatic  #248                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     387: checkcast     #250                // class java/lang/Number
     390: invokevirtual #253                // Method java/lang/Number.intValue:()I
     393: istore        18
     395: iload         17
     397: iload         18
     399: iadd
     400: istore_2
     401: goto          337
     404: iload_2
     405: ireturn

  public static final int solution2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #157                // String lines
       3: invokestatic  #160                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #162                // class java/lang/Iterable
      10: iconst_3
      11: iconst_3
      12: iconst_0
      13: iconst_4
      14: aconst_null
      15: invokestatic  #278                // Method kotlin/collections/CollectionsKt.windowed$default:(Ljava/lang/Iterable;IIZILjava/lang/Object;)Ljava/util/List;
      18: checkcast     #162                // class java/lang/Iterable
      21: astore_1
      22: nop
      23: iconst_0
      24: istore_2
      25: aload_1
      26: astore_3
      27: new           #164                // class java/util/ArrayList
      30: dup
      31: aload_1
      32: bipush        10
      34: invokestatic  #170                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      37: invokespecial #172                // Method java/util/ArrayList."<init>":(I)V
      40: checkcast     #174                // class java/util/Collection
      43: astore        4
      45: iconst_0
      46: istore        5
      48: aload_3
      49: invokeinterface #178,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      54: astore        6
      56: aload         6
      58: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          443
      66: aload         6
      68: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: astore        7
      75: aload         4
      77: aload         7
      79: checkcast     #153                // class java/util/List
      82: astore        8
      84: astore        23
      86: iconst_0
      87: istore        9
      89: new           #15                 // class java/util/LinkedHashMap
      92: dup
      93: invokespecial #19                 // Method java/util/LinkedHashMap."<init>":()V
      96: checkcast     #21                 // class java/util/Map
      99: astore        10
     101: aload         8
     103: checkcast     #162                // class java/lang/Iterable
     106: astore        11
     108: iconst_0
     109: istore        12
     111: aload         11
     113: invokeinterface #178,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     118: astore        13
     120: aload         13
     122: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     127: ifeq          264
     130: aload         13
     132: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     137: astore        14
     139: aload         14
     141: checkcast     #52                 // class java/lang/String
     144: astore        15
     146: iconst_0
     147: istore        16
     149: aload         15
     151: invokevirtual #217                // Method java/lang/String.toCharArray:()[C
     154: dup
     155: ldc           #219                // String toCharArray(...)
     157: invokestatic  #70                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     160: invokestatic  #284                // Method kotlin/collections/ArraysKt.distinct:([C)Ljava/util/List;
     163: checkcast     #162                // class java/lang/Iterable
     166: astore        17
     168: nop
     169: iconst_0
     170: istore        18
     172: aload         17
     174: invokeinterface #178,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     179: astore        19
     181: aload         19
     183: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     188: ifeq          258
     191: aload         19
     193: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     198: astore        20
     200: aload         20
     202: checkcast     #29                 // class java/lang/Character
     205: invokevirtual #241                // Method java/lang/Character.charValue:()C
     208: istore        21
     210: iconst_0
     211: istore        22
     213: aload         10
     215: iload         21
     217: invokestatic  #33                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     220: invokedynamic #302,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;
     225: invokedynamic #313,  0            // InvokeDynamic #1:apply:(Lkotlin/jvm/functions/Function2;)Ljava/util/function/BiFunction;
     230: invokeinterface #317,  3          // InterfaceMethod java/util/Map.computeIfPresent:(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
     235: pop
     236: aload         10
     238: iload         21
     240: invokestatic  #33                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     243: iconst_1
     244: invokestatic  #38                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     247: invokeinterface #320,  3          // InterfaceMethod java/util/Map.putIfAbsent:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     252: pop
     253: nop
     254: nop
     255: goto          181
     258: nop
     259: nop
     260: nop
     261: goto          120
     264: nop
     265: aload         10
     267: invokeinterface #324,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     272: checkcast     #162                // class java/lang/Iterable
     275: astore        12
     277: aload         12
     279: invokeinterface #178,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     284: astore        13
     286: aload         13
     288: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     293: ifne          304
     296: new           #232                // class java/util/NoSuchElementException
     299: dup
     300: invokespecial #325                // Method java/util/NoSuchElementException."<init>":()V
     303: athrow
     304: aload         13
     306: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     311: astore        14
     313: aload         13
     315: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     320: ifne          328
     323: aload         14
     325: goto          414
     328: aload         14
     330: checkcast     #327                // class java/util/Map$Entry
     333: astore        15
     335: iconst_0
     336: istore        16
     338: aload         15
     340: invokeinterface #330,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     345: checkcast     #250                // class java/lang/Number
     348: invokevirtual #253                // Method java/lang/Number.intValue:()I
     351: istore        15
     353: aload         13
     355: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     360: astore        16
     362: aload         16
     364: checkcast     #327                // class java/util/Map$Entry
     367: astore        17
     369: iconst_0
     370: istore        18
     372: aload         17
     374: invokeinterface #330,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     379: checkcast     #250                // class java/lang/Number
     382: invokevirtual #253                // Method java/lang/Number.intValue:()I
     385: istore        17
     387: iload         15
     389: iload         17
     391: if_icmpge     402
     394: aload         16
     396: astore        14
     398: iload         17
     400: istore        15
     402: aload         13
     404: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     409: ifne          353
     412: aload         14
     414: checkcast     #327                // class java/util/Map$Entry
     417: invokeinterface #333,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     422: checkcast     #29                 // class java/lang/Character
     425: invokevirtual #241                // Method java/lang/Character.charValue:()C
     428: invokestatic  #33                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     431: aload         23
     433: swap
     434: invokeinterface #210,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     439: pop
     440: goto          56
     443: aload         4
     445: checkcast     #153                // class java/util/List
     448: nop
     449: checkcast     #162                // class java/lang/Iterable
     452: astore_1
     453: iconst_0
     454: istore_2
     455: aload_1
     456: invokeinterface #178,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     461: astore_3
     462: aload_3
     463: invokeinterface #184,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     468: ifeq          529
     471: aload_3
     472: invokeinterface #188,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     477: astore        4
     479: iload_2
     480: aload         4
     482: checkcast     #29                 // class java/lang/Character
     485: invokevirtual #241                // Method java/lang/Character.charValue:()C
     488: istore        5
     490: istore        23
     492: iconst_0
     493: istore        6
     495: getstatic     #12                 // Field valueMap:Ljava/util/Map;
     498: iload         5
     500: invokestatic  #33                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     503: invokeinterface #244,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     508: dup
     509: invokestatic  #248                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     512: checkcast     #250                // class java/lang/Number
     515: invokevirtual #253                // Method java/lang/Number.intValue:()I
     518: istore        24
     520: iload         23
     522: iload         24
     524: iadd
     525: istore_2
     526: goto          462
     529: iload_2
     530: ireturn

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

  private static final java.lang.Integer solution2$lambda$10$lambda$8$lambda$7$lambda$5(java.lang.Character, java.lang.Integer);
    Code:
       0: aload_0
       1: ldc_w         #351                // String <unused var>
       4: invokestatic  #160                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #353                // String v
      11: invokestatic  #160                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_1
      15: invokevirtual #354                // Method java/lang/Integer.intValue:()I
      18: iconst_1
      19: iadd
      20: invokestatic  #38                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      23: areturn

  private static final java.lang.Integer solution2$lambda$10$lambda$8$lambda$7$lambda$6(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #359,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #35                 // class java/lang/Integer
      11: areturn

  static {};
    Code:
       0: invokestatic  #366                // Method calculateValueMap:()Ljava/util/Map;
       3: putstatic     #12                 // Field valueMap:Ljava/util/Map;
       6: return
}


package aoc05

import java.nio.file.Paths

/*

    [D]
[N] [C]
[Z] [M] [P]
 1   2   3

            [J] [Z] [G]
            [Z] [T] [S] [P] [R]
[R]         [Q] [V] [B] [G] [J]
[W] [W]     [N] [L] [V] [W] [C]
[F] [Q]     [T] [G] [C] [T] [T] [W]
[H] [D] [W] [W] [H] [T] [R] [M] [B]
[T] [G] [T] [R] [B] [P] [B] [G] [G]
[S] [S] [B] [D] [F] [L] [Z] [N] [L]
 1   2   3   4   5   6   7   8   9
 */

fun createStorage(): Map<Int, ArrayDeque<String>> {
    val storage = mutableMapOf<Int, ArrayDeque<String>>()
    storage[1] = ArrayDeque(listOf("S", "T","H","F","W","R"))
    storage[2] = ArrayDeque(listOf("S", "G", "D","Q","W"))
    storage[3] = ArrayDeque(listOf("B","T","W"))
    storage[4] = ArrayDeque(listOf("D","R","W","T","N","Q","Z","J"))
    storage[5] = ArrayDeque(listOf("F","B","H","G","L","V","T","Z"))
    storage[6] = ArrayDeque(listOf("L","P","T","C","V","B","S","G"))
    storage[7] = ArrayDeque(listOf("Z","B","R","T","W","G","P"))
    storage[8] = ArrayDeque(listOf("N","G","M","T","C","J","R"))
    storage[9] = ArrayDeque(listOf("L","G","B","W"))
    return storage
}

fun main() {
    val lines = Paths.get("src/main/resources/aoc_05.txt").toFile().useLines { it.toList() }

    val operations = lines.map { it.split(" ") }
        .map { tokens ->
            tokens.map { token -> token.toIntOrNull() }.mapNotNull { it }
        }
        .map {
            Triple(it[0], it[1], it[2])
        }

    println(solution1(createStorage(), operations))
    println(solution2(createStorage(), operations))
}

fun solution1(storage: Map<Int, ArrayDeque<String>>, operations: List<Triple<Int, Int, Int>>): String {
    operations.forEach {
        for (i in 0 until it.first) storage[it.third]!!.addLast(storage[it.second]!!.removeLast())
    }

    return storage.map {it.value.removeLast() }.joinToString(separator = "")
}

fun solution2(storage: Map<Int, ArrayDeque<String>>, operations: List<Triple<Int, Int, Int>>): String {
    operations.forEach { movement ->
        val tmpDeque = ArrayDeque<String>();

        for (i in 0 until movement.first) {
            tmpDeque.addFirst(storage[movement.second]!!.removeLast());
        }

        tmpDeque.forEach {
            storage[movement.third]!!.addLast(it)
        }
    }

    return storage.map {it.value.removeLast() }.joinToString(separator = "")
}

Compiled from "Solution05.kt"
public final class aoc05.Solution05Kt {
  public static final java.util.Map<java.lang.Integer, kotlin.collections.ArrayDeque<java.lang.String>> createStorage();
    Code:
       0: new           #10                 // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #14                 // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #16                 // class java/util/Map
      10: astore_0
      11: aload_0
      12: astore_1
      13: iconst_1
      14: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      17: astore_2
      18: new           #24                 // class kotlin/collections/ArrayDeque
      21: dup
      22: bipush        6
      24: anewarray     #26                 // class java/lang/String
      27: astore_3
      28: aload_3
      29: iconst_0
      30: ldc           #28                 // String S
      32: aastore
      33: aload_3
      34: iconst_1
      35: ldc           #30                 // String T
      37: aastore
      38: aload_3
      39: iconst_2
      40: ldc           #32                 // String H
      42: aastore
      43: aload_3
      44: iconst_3
      45: ldc           #34                 // String F
      47: aastore
      48: aload_3
      49: iconst_4
      50: ldc           #36                 // String W
      52: aastore
      53: aload_3
      54: iconst_5
      55: ldc           #38                 // String R
      57: aastore
      58: aload_3
      59: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
      62: checkcast     #46                 // class java/util/Collection
      65: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
      68: astore_3
      69: aload_1
      70: aload_2
      71: aload_3
      72: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      77: pop
      78: aload_0
      79: astore_1
      80: iconst_2
      81: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      84: astore_2
      85: new           #24                 // class kotlin/collections/ArrayDeque
      88: dup
      89: iconst_5
      90: anewarray     #26                 // class java/lang/String
      93: astore_3
      94: aload_3
      95: iconst_0
      96: ldc           #28                 // String S
      98: aastore
      99: aload_3
     100: iconst_1
     101: ldc           #55                 // String G
     103: aastore
     104: aload_3
     105: iconst_2
     106: ldc           #57                 // String D
     108: aastore
     109: aload_3
     110: iconst_3
     111: ldc           #59                 // String Q
     113: aastore
     114: aload_3
     115: iconst_4
     116: ldc           #36                 // String W
     118: aastore
     119: aload_3
     120: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     123: checkcast     #46                 // class java/util/Collection
     126: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     129: astore_3
     130: aload_1
     131: aload_2
     132: aload_3
     133: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     138: pop
     139: aload_0
     140: astore_1
     141: iconst_3
     142: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     145: astore_2
     146: new           #24                 // class kotlin/collections/ArrayDeque
     149: dup
     150: iconst_3
     151: anewarray     #26                 // class java/lang/String
     154: astore_3
     155: aload_3
     156: iconst_0
     157: ldc           #61                 // String B
     159: aastore
     160: aload_3
     161: iconst_1
     162: ldc           #30                 // String T
     164: aastore
     165: aload_3
     166: iconst_2
     167: ldc           #36                 // String W
     169: aastore
     170: aload_3
     171: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     174: checkcast     #46                 // class java/util/Collection
     177: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     180: astore_3
     181: aload_1
     182: aload_2
     183: aload_3
     184: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     189: pop
     190: aload_0
     191: astore_1
     192: iconst_4
     193: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     196: astore_2
     197: new           #24                 // class kotlin/collections/ArrayDeque
     200: dup
     201: bipush        8
     203: anewarray     #26                 // class java/lang/String
     206: astore_3
     207: aload_3
     208: iconst_0
     209: ldc           #57                 // String D
     211: aastore
     212: aload_3
     213: iconst_1
     214: ldc           #38                 // String R
     216: aastore
     217: aload_3
     218: iconst_2
     219: ldc           #36                 // String W
     221: aastore
     222: aload_3
     223: iconst_3
     224: ldc           #30                 // String T
     226: aastore
     227: aload_3
     228: iconst_4
     229: ldc           #63                 // String N
     231: aastore
     232: aload_3
     233: iconst_5
     234: ldc           #59                 // String Q
     236: aastore
     237: aload_3
     238: bipush        6
     240: ldc           #65                 // String Z
     242: aastore
     243: aload_3
     244: bipush        7
     246: ldc           #67                 // String J
     248: aastore
     249: aload_3
     250: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     253: checkcast     #46                 // class java/util/Collection
     256: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     259: astore_3
     260: aload_1
     261: aload_2
     262: aload_3
     263: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     268: pop
     269: aload_0
     270: astore_1
     271: iconst_5
     272: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     275: astore_2
     276: new           #24                 // class kotlin/collections/ArrayDeque
     279: dup
     280: bipush        8
     282: anewarray     #26                 // class java/lang/String
     285: astore_3
     286: aload_3
     287: iconst_0
     288: ldc           #34                 // String F
     290: aastore
     291: aload_3
     292: iconst_1
     293: ldc           #61                 // String B
     295: aastore
     296: aload_3
     297: iconst_2
     298: ldc           #32                 // String H
     300: aastore
     301: aload_3
     302: iconst_3
     303: ldc           #55                 // String G
     305: aastore
     306: aload_3
     307: iconst_4
     308: ldc           #69                 // String L
     310: aastore
     311: aload_3
     312: iconst_5
     313: ldc           #71                 // String V
     315: aastore
     316: aload_3
     317: bipush        6
     319: ldc           #30                 // String T
     321: aastore
     322: aload_3
     323: bipush        7
     325: ldc           #65                 // String Z
     327: aastore
     328: aload_3
     329: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     332: checkcast     #46                 // class java/util/Collection
     335: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     338: astore_3
     339: aload_1
     340: aload_2
     341: aload_3
     342: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     347: pop
     348: aload_0
     349: astore_1
     350: bipush        6
     352: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     355: astore_2
     356: new           #24                 // class kotlin/collections/ArrayDeque
     359: dup
     360: bipush        8
     362: anewarray     #26                 // class java/lang/String
     365: astore_3
     366: aload_3
     367: iconst_0
     368: ldc           #69                 // String L
     370: aastore
     371: aload_3
     372: iconst_1
     373: ldc           #73                 // String P
     375: aastore
     376: aload_3
     377: iconst_2
     378: ldc           #30                 // String T
     380: aastore
     381: aload_3
     382: iconst_3
     383: ldc           #75                 // String C
     385: aastore
     386: aload_3
     387: iconst_4
     388: ldc           #71                 // String V
     390: aastore
     391: aload_3
     392: iconst_5
     393: ldc           #61                 // String B
     395: aastore
     396: aload_3
     397: bipush        6
     399: ldc           #28                 // String S
     401: aastore
     402: aload_3
     403: bipush        7
     405: ldc           #55                 // String G
     407: aastore
     408: aload_3
     409: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     412: checkcast     #46                 // class java/util/Collection
     415: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     418: astore_3
     419: aload_1
     420: aload_2
     421: aload_3
     422: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     427: pop
     428: aload_0
     429: astore_1
     430: bipush        7
     432: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     435: astore_2
     436: new           #24                 // class kotlin/collections/ArrayDeque
     439: dup
     440: bipush        7
     442: anewarray     #26                 // class java/lang/String
     445: astore_3
     446: aload_3
     447: iconst_0
     448: ldc           #65                 // String Z
     450: aastore
     451: aload_3
     452: iconst_1
     453: ldc           #61                 // String B
     455: aastore
     456: aload_3
     457: iconst_2
     458: ldc           #38                 // String R
     460: aastore
     461: aload_3
     462: iconst_3
     463: ldc           #30                 // String T
     465: aastore
     466: aload_3
     467: iconst_4
     468: ldc           #36                 // String W
     470: aastore
     471: aload_3
     472: iconst_5
     473: ldc           #55                 // String G
     475: aastore
     476: aload_3
     477: bipush        6
     479: ldc           #73                 // String P
     481: aastore
     482: aload_3
     483: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     486: checkcast     #46                 // class java/util/Collection
     489: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     492: astore_3
     493: aload_1
     494: aload_2
     495: aload_3
     496: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     501: pop
     502: aload_0
     503: astore_1
     504: bipush        8
     506: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     509: astore_2
     510: new           #24                 // class kotlin/collections/ArrayDeque
     513: dup
     514: bipush        7
     516: anewarray     #26                 // class java/lang/String
     519: astore_3
     520: aload_3
     521: iconst_0
     522: ldc           #63                 // String N
     524: aastore
     525: aload_3
     526: iconst_1
     527: ldc           #55                 // String G
     529: aastore
     530: aload_3
     531: iconst_2
     532: ldc           #77                 // String M
     534: aastore
     535: aload_3
     536: iconst_3
     537: ldc           #30                 // String T
     539: aastore
     540: aload_3
     541: iconst_4
     542: ldc           #75                 // String C
     544: aastore
     545: aload_3
     546: iconst_5
     547: ldc           #67                 // String J
     549: aastore
     550: aload_3
     551: bipush        6
     553: ldc           #38                 // String R
     555: aastore
     556: aload_3
     557: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     560: checkcast     #46                 // class java/util/Collection
     563: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     566: astore_3
     567: aload_1
     568: aload_2
     569: aload_3
     570: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     575: pop
     576: aload_0
     577: astore_1
     578: bipush        9
     580: invokestatic  #22                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     583: astore_2
     584: new           #24                 // class kotlin/collections/ArrayDeque
     587: dup
     588: iconst_4
     589: anewarray     #26                 // class java/lang/String
     592: astore_3
     593: aload_3
     594: iconst_0
     595: ldc           #69                 // String L
     597: aastore
     598: aload_3
     599: iconst_1
     600: ldc           #55                 // String G
     602: aastore
     603: aload_3
     604: iconst_2
     605: ldc           #61                 // String B
     607: aastore
     608: aload_3
     609: iconst_3
     610: ldc           #36                 // String W
     612: aastore
     613: aload_3
     614: invokestatic  #44                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     617: checkcast     #46                 // class java/util/Collection
     620: invokespecial #49                 // Method kotlin/collections/ArrayDeque."<init>":(Ljava/util/Collection;)V
     623: astore_3
     624: aload_1
     625: aload_2
     626: aload_3
     627: invokeinterface #53,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     632: pop
     633: aload_0
     634: areturn

  public static final void main();
    Code:
       0: ldc           #84                 // String src/main/resources/aoc_05.txt
       2: iconst_0
       3: anewarray     #26                 // class java/lang/String
       6: invokestatic  #90                 // Method java/nio/file/Paths.get:(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
       9: invokeinterface #96,  1           // InterfaceMethod java/nio/file/Path.toFile:()Ljava/io/File;
      14: dup
      15: ldc           #98                 // String toFile(...)
      17: invokestatic  #104                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      20: astore_1
      21: getstatic     #110                // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;
      24: astore_2
      25: iconst_0
      26: istore_3
      27: aload_1
      28: astore        4
      30: sipush        8192
      33: istore        5
      35: aload         4
      37: astore        6
      39: new           #112                // class java/io/InputStreamReader
      42: dup
      43: new           #114                // class java/io/FileInputStream
      46: dup
      47: aload         6
      49: invokespecial #117                // Method java/io/FileInputStream."<init>":(Ljava/io/File;)V
      52: checkcast     #119                // class java/io/InputStream
      55: aload_2
      56: invokespecial #122                // Method java/io/InputStreamReader."<init>":(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
      59: checkcast     #124                // class java/io/Reader
      62: astore        6
      64: aload         6
      66: instanceof    #126                // class java/io/BufferedReader
      69: ifeq          80
      72: aload         6
      74: checkcast     #126                // class java/io/BufferedReader
      77: goto          91
      80: new           #126                // class java/io/BufferedReader
      83: dup
      84: aload         6
      86: iload         5
      88: invokespecial #129                // Method java/io/BufferedReader."<init>":(Ljava/io/Reader;I)V
      91: checkcast     #131                // class java/io/Closeable
      94: astore        4
      96: aconst_null
      97: astore        5
      99: nop
     100: aload         4
     102: checkcast     #126                // class java/io/BufferedReader
     105: astore        6
     107: iconst_0
     108: istore        7
     110: aload         6
     112: invokestatic  #137                // Method kotlin/io/TextStreamsKt.lineSequence:(Ljava/io/BufferedReader;)Lkotlin/sequences/Sequence;
     115: astore        8
     117: iconst_0
     118: istore        9
     120: aload         8
     122: invokestatic  #143                // Method kotlin/sequences/SequencesKt.toList:(Lkotlin/sequences/Sequence;)Ljava/util/List;
     125: astore        6
     127: aload         4
     129: aload         5
     131: invokestatic  #149                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     134: aload         6
     136: goto          160
     139: astore        7
     141: aload         7
     143: astore        5
     145: aload         7
     147: athrow
     148: astore        7
     150: aload         4
     152: aload         5
     154: invokestatic  #149                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     157: aload         7
     159: athrow
     160: nop
     161: astore_0
     162: aload_0
     163: checkcast     #151                // class java/lang/Iterable
     166: astore_2
     167: iconst_0
     168: istore_3
     169: aload_2
     170: astore        4
     172: new           #153                // class java/util/ArrayList
     175: dup
     176: aload_2
     177: bipush        10
     179: invokestatic  #157                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     182: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
     185: checkcast     #46                 // class java/util/Collection
     188: astore        5
     190: iconst_0
     191: istore        6
     193: aload         4
     195: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     200: astore        7
     202: aload         7
     204: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     209: ifeq          274
     212: aload         7
     214: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     219: astore        8
     221: aload         5
     223: aload         8
     225: checkcast     #26                 // class java/lang/String
     228: astore        9
     230: astore        27
     232: iconst_0
     233: istore        10
     235: aload         9
     237: checkcast     #176                // class java/lang/CharSequence
     240: iconst_1
     241: anewarray     #26                 // class java/lang/String
     244: astore        11
     246: aload         11
     248: iconst_0
     249: ldc           #178                // String
     251: aastore
     252: aload         11
     254: iconst_0
     255: iconst_0
     256: bipush        6
     258: aconst_null
     259: invokestatic  #184                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     262: aload         27
     264: swap
     265: invokeinterface #188,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     270: pop
     271: goto          202
     274: aload         5
     276: checkcast     #190                // class java/util/List
     279: nop
     280: checkcast     #151                // class java/lang/Iterable
     283: astore_2
     284: nop
     285: iconst_0
     286: istore_3
     287: aload_2
     288: astore        4
     290: new           #153                // class java/util/ArrayList
     293: dup
     294: aload_2
     295: bipush        10
     297: invokestatic  #157                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     300: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
     303: checkcast     #46                 // class java/util/Collection
     306: astore        5
     308: iconst_0
     309: istore        6
     311: aload         4
     313: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     318: astore        7
     320: aload         7
     322: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     327: ifeq          583
     330: aload         7
     332: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     337: astore        8
     339: aload         5
     341: aload         8
     343: checkcast     #190                // class java/util/List
     346: astore        9
     348: astore        27
     350: iconst_0
     351: istore        10
     353: aload         9
     355: checkcast     #151                // class java/lang/Iterable
     358: astore        11
     360: iconst_0
     361: istore        12
     363: aload         11
     365: astore        13
     367: new           #153                // class java/util/ArrayList
     370: dup
     371: aload         11
     373: bipush        10
     375: invokestatic  #157                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     378: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
     381: checkcast     #46                 // class java/util/Collection
     384: astore        14
     386: iconst_0
     387: istore        15
     389: aload         13
     391: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     396: astore        16
     398: aload         16
     400: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     405: ifeq          448
     408: aload         16
     410: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     415: astore        17
     417: aload         14
     419: aload         17
     421: checkcast     #26                 // class java/lang/String
     424: astore        18
     426: astore        19
     428: iconst_0
     429: istore        20
     431: aload         18
     433: invokestatic  #194                // Method kotlin/text/StringsKt.toIntOrNull:(Ljava/lang/String;)Ljava/lang/Integer;
     436: aload         19
     438: swap
     439: invokeinterface #188,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     444: pop
     445: goto          398
     448: aload         14
     450: checkcast     #190                // class java/util/List
     453: nop
     454: checkcast     #151                // class java/lang/Iterable
     457: astore        11
     459: nop
     460: iconst_0
     461: istore        12
     463: aload         11
     465: astore        13
     467: new           #153                // class java/util/ArrayList
     470: dup
     471: invokespecial #195                // Method java/util/ArrayList."<init>":()V
     474: checkcast     #46                 // class java/util/Collection
     477: astore        14
     479: iconst_0
     480: istore        15
     482: aload         13
     484: astore        16
     486: iconst_0
     487: istore        17
     489: aload         16
     491: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     496: astore        18
     498: aload         18
     500: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     505: ifeq          563
     508: aload         18
     510: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     515: astore        20
     517: aload         20
     519: astore        21
     521: iconst_0
     522: istore        22
     524: aload         21
     526: checkcast     #18                 // class java/lang/Integer
     529: astore        23
     531: iconst_0
     532: istore        24
     534: aload         23
     536: dup
     537: ifnull        558
     540: astore        25
     542: iconst_0
     543: istore        26
     545: aload         14
     547: aload         25
     549: invokeinterface #188,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     554: pop
     555: goto          559
     558: pop
     559: nop
     560: goto          498
     563: nop
     564: aload         14
     566: checkcast     #190                // class java/util/List
     569: nop
     570: nop
     571: aload         27
     573: swap
     574: invokeinterface #188,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     579: pop
     580: goto          320
     583: aload         5
     585: checkcast     #190                // class java/util/List
     588: nop
     589: checkcast     #151                // class java/lang/Iterable
     592: astore_2
     593: nop
     594: iconst_0
     595: istore_3
     596: aload_2
     597: astore        4
     599: new           #153                // class java/util/ArrayList
     602: dup
     603: aload_2
     604: bipush        10
     606: invokestatic  #157                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     609: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
     612: checkcast     #46                 // class java/util/Collection
     615: astore        5
     617: iconst_0
     618: istore        6
     620: aload         4
     622: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     627: astore        7
     629: aload         7
     631: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     636: ifeq          705
     639: aload         7
     641: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     646: astore        8
     648: aload         5
     650: aload         8
     652: checkcast     #190                // class java/util/List
     655: astore        9
     657: astore        27
     659: iconst_0
     660: istore        10
     662: new           #197                // class kotlin/Triple
     665: dup
     666: aload         9
     668: iconst_0
     669: invokeinterface #200,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     674: aload         9
     676: iconst_1
     677: invokeinterface #200,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     682: aload         9
     684: iconst_2
     685: invokeinterface #200,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     690: invokespecial #203                // Method kotlin/Triple."<init>":(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
     693: aload         27
     695: swap
     696: invokeinterface #188,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     701: pop
     702: goto          629
     705: aload         5
     707: checkcast     #190                // class java/util/List
     710: nop
     711: astore_1
     712: invokestatic  #205                // Method createStorage:()Ljava/util/Map;
     715: aload_1
     716: invokestatic  #209                // Method solution1:(Ljava/util/Map;Ljava/util/List;)Ljava/lang/String;
     719: getstatic     #215                // Field java/lang/System.out:Ljava/io/PrintStream;
     722: swap
     723: invokevirtual #221                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     726: invokestatic  #205                // Method createStorage:()Ljava/util/Map;
     729: aload_1
     730: invokestatic  #224                // Method solution2:(Ljava/util/Map;Ljava/util/List;)Ljava/lang/String;
     733: getstatic     #215                // Field java/lang/System.out:Ljava/io/PrintStream;
     736: swap
     737: invokevirtual #221                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     740: return
    Exception table:
       from    to  target type
          99   127   139   Class java/lang/Throwable
          99   127   148   any
         139   148   148   any
         148   150   148   any

  public static final java.lang.String solution1(java.util.Map<java.lang.Integer, kotlin.collections.ArrayDeque<java.lang.String>>, java.util.List<kotlin.Triple<java.lang.Integer, java.lang.Integer, java.lang.Integer>>);
    Code:
       0: aload_0
       1: ldc_w         #275                // String storage
       4: invokestatic  #278                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #279                // String operations
      11: invokestatic  #278                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_1
      15: checkcast     #151                // class java/lang/Iterable
      18: astore_2
      19: iconst_0
      20: istore_3
      21: aload_2
      22: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      27: astore        4
      29: aload         4
      31: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          134
      39: aload         4
      41: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: astore        5
      48: aload         5
      50: checkcast     #197                // class kotlin/Triple
      53: astore        6
      55: iconst_0
      56: istore        7
      58: iconst_0
      59: istore        8
      61: aload         6
      63: invokevirtual #282                // Method kotlin/Triple.getFirst:()Ljava/lang/Object;
      66: checkcast     #284                // class java/lang/Number
      69: invokevirtual #288                // Method java/lang/Number.intValue:()I
      72: istore        9
      74: iload         8
      76: iload         9
      78: if_icmpge     129
      81: aload_0
      82: aload         6
      84: invokevirtual #291                // Method kotlin/Triple.getThird:()Ljava/lang/Object;
      87: invokeinterface #294,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      92: dup
      93: invokestatic  #297                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      96: checkcast     #24                 // class kotlin/collections/ArrayDeque
      99: aload_0
     100: aload         6
     102: invokevirtual #300                // Method kotlin/Triple.getSecond:()Ljava/lang/Object;
     105: invokeinterface #294,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     110: dup
     111: invokestatic  #297                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     114: checkcast     #24                 // class kotlin/collections/ArrayDeque
     117: invokevirtual #303                // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
     120: invokevirtual #306                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     123: iinc          8, 1
     126: goto          74
     129: nop
     130: nop
     131: goto          29
     134: nop
     135: aload_0
     136: astore_2
     137: iconst_0
     138: istore_3
     139: aload_2
     140: astore        4
     142: new           #153                // class java/util/ArrayList
     145: dup
     146: aload_2
     147: invokeinterface #309,  1          // InterfaceMethod java/util/Map.size:()I
     152: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
     155: checkcast     #46                 // class java/util/Collection
     158: astore        5
     160: iconst_0
     161: istore        6
     163: aload         4
     165: invokeinterface #313,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     170: invokeinterface #316,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     175: astore        7
     177: aload         7
     179: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     184: ifeq          238
     187: aload         7
     189: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     194: checkcast     #318                // class java/util/Map$Entry
     197: astore        8
     199: aload         5
     201: aload         8
     203: astore        9
     205: astore        11
     207: iconst_0
     208: istore        10
     210: aload         9
     212: invokeinterface #321,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     217: checkcast     #24                 // class kotlin/collections/ArrayDeque
     220: invokevirtual #303                // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
     223: checkcast     #26                 // class java/lang/String
     226: aload         11
     228: swap
     229: invokeinterface #188,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     234: pop
     235: goto          177
     238: aload         5
     240: checkcast     #190                // class java/util/List
     243: nop
     244: checkcast     #151                // class java/lang/Iterable
     247: ldc_w         #323                // String
     250: checkcast     #176                // class java/lang/CharSequence
     253: aconst_null
     254: aconst_null
     255: iconst_0
     256: aconst_null
     257: aconst_null
     258: bipush        62
     260: aconst_null
     261: invokestatic  #327                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     264: areturn

  public static final java.lang.String solution2(java.util.Map<java.lang.Integer, kotlin.collections.ArrayDeque<java.lang.String>>, java.util.List<kotlin.Triple<java.lang.Integer, java.lang.Integer, java.lang.Integer>>);
    Code:
       0: aload_0
       1: ldc_w         #275                // String storage
       4: invokestatic  #278                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #279                // String operations
      11: invokestatic  #278                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_1
      15: checkcast     #151                // class java/lang/Iterable
      18: astore_2
      19: iconst_0
      20: istore_3
      21: aload_2
      22: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      27: astore        4
      29: aload         4
      31: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          204
      39: aload         4
      41: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: astore        5
      48: aload         5
      50: checkcast     #197                // class kotlin/Triple
      53: astore        6
      55: iconst_0
      56: istore        7
      58: new           #24                 // class kotlin/collections/ArrayDeque
      61: dup
      62: invokespecial #335                // Method kotlin/collections/ArrayDeque."<init>":()V
      65: astore        8
      67: iconst_0
      68: istore        9
      70: aload         6
      72: invokevirtual #282                // Method kotlin/Triple.getFirst:()Ljava/lang/Object;
      75: checkcast     #284                // class java/lang/Number
      78: invokevirtual #288                // Method java/lang/Number.intValue:()I
      81: istore        10
      83: iload         9
      85: iload         10
      87: if_icmpge     122
      90: aload         8
      92: aload_0
      93: aload         6
      95: invokevirtual #300                // Method kotlin/Triple.getSecond:()Ljava/lang/Object;
      98: invokeinterface #294,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     103: dup
     104: invokestatic  #297                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     107: checkcast     #24                 // class kotlin/collections/ArrayDeque
     110: invokevirtual #303                // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
     113: invokevirtual #338                // Method kotlin/collections/ArrayDeque.addFirst:(Ljava/lang/Object;)V
     116: iinc          9, 1
     119: goto          83
     122: aload         8
     124: checkcast     #151                // class java/lang/Iterable
     127: astore        9
     129: iconst_0
     130: istore        10
     132: aload         9
     134: invokeinterface #164,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     139: astore        11
     141: aload         11
     143: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     148: ifeq          198
     151: aload         11
     153: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     158: astore        12
     160: aload         12
     162: checkcast     #26                 // class java/lang/String
     165: astore        13
     167: iconst_0
     168: istore        14
     170: aload_0
     171: aload         6
     173: invokevirtual #291                // Method kotlin/Triple.getThird:()Ljava/lang/Object;
     176: invokeinterface #294,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     181: dup
     182: invokestatic  #297                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     185: checkcast     #24                 // class kotlin/collections/ArrayDeque
     188: aload         13
     190: invokevirtual #306                // Method kotlin/collections/ArrayDeque.addLast:(Ljava/lang/Object;)V
     193: nop
     194: nop
     195: goto          141
     198: nop
     199: nop
     200: nop
     201: goto          29
     204: nop
     205: aload_0
     206: astore_2
     207: iconst_0
     208: istore_3
     209: aload_2
     210: astore        4
     212: new           #153                // class java/util/ArrayList
     215: dup
     216: aload_2
     217: invokeinterface #309,  1          // InterfaceMethod java/util/Map.size:()I
     222: invokespecial #160                // Method java/util/ArrayList."<init>":(I)V
     225: checkcast     #46                 // class java/util/Collection
     228: astore        5
     230: iconst_0
     231: istore        6
     233: aload         4
     235: invokeinterface #313,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     240: invokeinterface #316,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     245: astore        7
     247: aload         7
     249: invokeinterface #170,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     254: ifeq          308
     257: aload         7
     259: invokeinterface #174,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     264: checkcast     #318                // class java/util/Map$Entry
     267: astore        8
     269: aload         5
     271: aload         8
     273: astore        9
     275: astore        15
     277: iconst_0
     278: istore        10
     280: aload         9
     282: invokeinterface #321,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     287: checkcast     #24                 // class kotlin/collections/ArrayDeque
     290: invokevirtual #303                // Method kotlin/collections/ArrayDeque.removeLast:()Ljava/lang/Object;
     293: checkcast     #26                 // class java/lang/String
     296: aload         15
     298: swap
     299: invokeinterface #188,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     304: pop
     305: goto          247
     308: aload         5
     310: checkcast     #190                // class java/util/List
     313: nop
     314: checkcast     #151                // class java/lang/Iterable
     317: ldc_w         #323                // String
     320: checkcast     #176                // class java/lang/CharSequence
     323: aconst_null
     324: aconst_null
     325: iconst_0
     326: aconst_null
     327: aconst_null
     328: bipush        62
     330: aconst_null
     331: invokestatic  #327                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     334: areturn

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