kt_path stringlengths 35 167 | kt_source stringlengths 626 28.9k | classes listlengths 1 17 |
|---|---|---|
iam-abbas__cs-algorithms__d04aa8f/Kotlin/merge_sort_in_kotlin.kt | fun merge(A: Array<Int>, p: Int, q: Int, r: Int) {
var left = A.copyOfRange(p, q + 1)
var right = A.copyOfRange(q + 1, r + 1)
var i = 0
var j = 0
for (k in p..r) {
if ((i <= left.size - 1) && ((j >= right.size) || (left[i] <= right[j]))) {
A[k] = left[i];
i++;
... | [
{
"class_path": "iam-abbas__cs-algorithms__d04aa8f/Merge_sort_in_kotlinKt.class",
"javap": "Compiled from \"merge_sort_in_kotlin.kt\"\npublic final class Merge_sort_in_kotlinKt {\n public static final void merge(java.lang.Integer[], int, int, int);\n Code:\n 0: aload_0\n 1: ldc #9 ... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day02.kt | class Day02 {
fun part1(input: List<String>): Int {
return input.map { it.split(" ") }
.map { (opponentCode, myCode) -> HandShape.fromOpponentCode(opponentCode) to HandShape.fromElfCode(myCode) }
.sumOf { (opponentHandShape, myHandShape) -> HandScorer.score(opponentHandShape, myHandS... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day02$HandShape.class",
"javap": "Compiled from \"Day02.kt\"\npublic final class Day02$HandShape extends java.lang.Enum<Day02$HandShape> {\n public static final Day02$HandShape$Companion Companion;\n\n private final java.lang.String opponentCode;\n... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day15.kt | import kotlin.math.abs
class Day15 {
fun part1(input: List<String>, lookupRow: Int): Int {
val sensors = mapToSensors(input)
val minRange = sensors.minOf { sensor ->
minOf(
sensor.position.x,
sensor.beacon.x,
sensor.position.x - sensor.d... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day15.class",
"javap": "Compiled from \"Day15.kt\"\npublic final class Day15 {\n public Day15();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day09.kt | import kotlin.math.abs
class Day09 {
fun part1(input: List<String>): Int {
val movement = input.map { it.split(" ") }
.flatMap { (direction, step) -> (1..step.toInt()).map { direction.toDirection() } }
return simulateMoves(movement, 2).size
}
fun part2(input: List<String>): In... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day09$WhenMappings.class",
"javap": "Compiled from \"Day09.kt\"\npublic final class Day09$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Day09$Direct... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day03.kt | class Day03 {
fun part1(input: List<String>): Int {
return input
.map { Rucksack(it) }
.flatMap { it.getCompartmentIntersection() }
.sumOf { it.toPriorityScore() }
}
fun part2(input: List<String>): Int {
return input
.chunked(3)
.... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day03$Rucksack.class",
"javap": "Compiled from \"Day03.kt\"\npublic final class Day03$Rucksack {\n private final java.lang.String content;\n\n public Day03$Rucksack(java.lang.String);\n Code:\n 0: aload_1\n 1: ldc #9 ... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day05.kt | import kotlin.collections.HashMap
class Day05 {
fun part1(input: String): String {
return getTopCrates(input, CrateMoverModel.CrateMover9000)
}
fun part2(input: String): String {
return getTopCrates(input, CrateMoverModel.CrateMover9001)
}
private fun getTopCrates(input: String, ... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day05$CraneOperator$WhenMappings.class",
"javap": "Compiled from \"Day05.kt\"\npublic final class Day05$CraneOperator$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 ... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day12.kt | import java.util.*
class Day12 {
fun part1(input: List<String>): Int {
val area = mapToArea(input)
return area.traverseFromStart()
}
fun part2(input: List<String>): Int {
return mapToArea(input).traverseFromEnd()
}
private fun mapToArea(input: List<String>): Area {
... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day12$Area.class",
"javap": "Compiled from \"Day12.kt\"\npublic final class Day12$Area {\n private final Day12$Point startingPoint;\n\n private final Day12$Point destination;\n\n private final java.util.Map<Day12$Point, java.lang.Integer> field;\n... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day13.kt | class Day13 {
fun part1(input: String): Int {
return input.split("\n\n").map { it.lines() }
.map { (packet, other) -> packet.mapToPacketData() to other.mapToPacketData() }
.mapIndexed { index, pair -> if (pair.first.compareTo(pair.second) < 1) index + 1 else 0 }
.sum()
... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day13.class",
"javap": "Compiled from \"Day13.kt\"\npublic final class Day13 {\n public Day13();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day14.kt | class Day14 {
fun part1(input: List<String>): Int {
val rocks = mapToRocks(input)
return Cave(rocks).dropSand()
}
fun part2(input: List<String>): Int {
val rocks = mapToRocks(input)
return Cave(rocks, true).dropSandWithFloor()
}
private fun mapToRocks(input: List<S... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day14$Cave.class",
"javap": "Compiled from \"Day14.kt\"\npublic final class Day14$Cave {\n private final Day14$Point sandPoint;\n\n private final java.util.Set<Day14$Point> rocksAndFloor;\n\n private final java.util.Set<Day14$Point> sand;\n\n pri... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day08.kt | class Day08 {
fun part1(input: List<String>): Int {
return TreeArea(input).getVisibleTrees()
}
fun part2(input: List<String>): Int {
return TreeArea(input).getBestScore()
}
class TreeArea(input: List<String>) {
private val trees: Array<Array<Tree>>
private val si... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day08.class",
"javap": "Compiled from \"Day08.kt\"\npublic final class Day08 {\n public Day08();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day07.kt | class Day07 {
fun part1(input: List<String>): Long {
val hashMapOf = directoriesMap(input)
return hashMapOf.values.filter { it <= 100_000 }.sum()
}
private fun directoriesMap(input: List<String>): MutableMap<String, Long> {
val hashMapOf = mutableMapOf<String, Long>()
var p... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day07$WhenMappings.class",
"javap": "Compiled from \"Day07.kt\"\npublic final class Day07$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Day07$Comman... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day11.kt | class Day11 {
fun part1(input: String): Long {
val monkeys = input.split("\n\n").map { it.toMonkey() }.toTypedArray()
val rounds = 20
val stressReducerFormula: (Long) -> Long = { it / 3 }
repeat(rounds) { round ->
monkeys.forEach {
it.handleItems(stressRe... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day11.class",
"javap": "Compiled from \"Day11.kt\"\npublic final class Day11 {\n public Day11();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day10.kt | import java.lang.StringBuilder
class Day10 {
fun part1(input: List<String>): Int {
val cyclesToCheck = (20..220 step 40).toList()
var result = 0
val instructions = listOf(1) + input.flatMap { it.toOperation() }
instructions.reduceIndexed { cycle, acc, instruction ->
if ... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day10.class",
"javap": "Compiled from \"Day10.kt\"\npublic final class Day10 {\n public Day10();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final... |
dliszewski__advent-of-code-2022__76d5eea/src/main/kotlin/Day04.kt | class Day04 {
fun part1(input: List<String>): Int {
return input
.map { it.toRanges() }
.count { (range1, range2) -> range1 includeRange range2 }
}
fun part2(input: List<String>): Int {
return input
.map { it.toRanges() }
.count { (range1, ra... | [
{
"class_path": "dliszewski__advent-of-code-2022__76d5eea/Day04.class",
"javap": "Compiled from \"Day04.kt\"\npublic final class Day04 {\n public Day04();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final... |
kipwoker__aoc2022__d8aeea8/src/Utils.kt | import java.io.File
import kotlin.math.max
import kotlin.math.min
fun readInput(name: String) = File("src", "$name.txt")
.readLines()
fun <T> assert(actual: T, expected: T) {
if (actual == expected) {
return
}
throw Exception("Actual $actual Expected $expected")
}
data class Interval(val sta... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/UtilsKt.class",
"javap": "Compiled from \"Utils.kt\"\npublic final class UtilsKt {\n public static final java.util.List<java.lang.String> readInput(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #10 // String name\n ... |
kipwoker__aoc2022__d8aeea8/src/Day14.kt | import kotlin.math.max
import kotlin.math.min
enum class CaveCell {
Air,
Rock,
Sand
}
enum class SandFallResult {
Stuck,
Fall
}
val caveSize = 1000
fun main() {
class Cave(val map: Array<Array<CaveCell>>) {
fun getBounds(): Pair<Point, Point> {
var minX = caveSize
... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day14Kt.class",
"javap": "Compiled from \"Day14.kt\"\npublic final class Day14Kt {\n private static final int caveSize;\n\n public static final int getCaveSize();\n Code:\n 0: getstatic #10 // Field caveSize:I\n 3: ireturn\n\n ... |
kipwoker__aoc2022__d8aeea8/src/Day04.kt |
fun main() {
fun parse(lines: List<String>): List<Pair<Interval, Interval>> {
return lines.map { line ->
val intervals = line
.split(',')
.map { range ->
val rangeParts = range.split('-')
Interval(rangeParts[0].toInt(), ra... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day04Kt.class",
"javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day04_test\n 2: invokestatic #14 // Method UtilsKt.readI... |
kipwoker__aoc2022__d8aeea8/src/Day18.kt |
import kotlin.time.ExperimentalTime
import kotlin.time.measureTime
class Day18 {
data class Point(val xs: Array<Int>) {
fun isBetween(minPoint: Point, maxPoint: Point): Boolean {
return xs
.zip(minPoint.xs)
.zip(maxPoint.xs)
.all { p ->
... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day18$Point.class",
"javap": "Compiled from \"Day18.kt\"\npublic final class Day18$Point {\n private final java.lang.Integer[] xs;\n\n public Day18$Point(java.lang.Integer[]);\n Code:\n 0: aload_1\n 1: ldc #9 // String x... |
kipwoker__aoc2022__d8aeea8/src/Day24.kt | import kotlin.time.ExperimentalTime
import kotlin.time.measureTime
class Day24 {
data class Valley(val blizzards: Map<Point, List<Direction>>, val maxY: Int, val maxX: Int)
data class Moment(val expedition: Point, val minutesSpent: Int)
fun parse(input: List<String>): Valley {
val blizzards = muta... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day24$WhenMappings.class",
"javap": "Compiled from \"Day24.kt\"\npublic final class Day24$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Direction.values:()[LDirec... |
kipwoker__aoc2022__d8aeea8/src/Day23.kt | import kotlin.time.ExperimentalTime
import kotlin.time.measureTime
class Day23 {
fun parse(input: List<String>): Set<Point> {
return input.flatMapIndexed { y, line ->
line.mapIndexed { x, c ->
if (c == '#') {
Point(x, y)
} else {
... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day23Kt.class",
"javap": "Compiled from \"Day23.kt\"\npublic final class Day23Kt {\n public static final void main();\n Code:\n 0: new #8 // class Day23\n 3: dup\n 4: invokespecial #11 // Method Day2... |
kipwoker__aoc2022__d8aeea8/src/Day13.kt | import java.util.Comparator
fun main() {
class TreeNode(
val value: Int?,
val parent: TreeNode?,
val str: String?,
var children: MutableList<TreeNode> = mutableListOf()
)
class TreeNodeComparator(val f: (o1: TreeNode?, o2: TreeNode?) -> Int) : Comparator<TreeNode> {
... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day13Kt$main$TreeNodeComparator.class",
"javap": "Compiled from \"Day13.kt\"\npublic final class Day13Kt$main$TreeNodeComparator implements java.util.Comparator<Day13Kt$main$TreeNode> {\n private final kotlin.jvm.functions.Function2<Day13Kt$main$TreeNode, Day13Kt... |
kipwoker__aoc2022__d8aeea8/src/Day05.kt | import java.util.Stack
class CrateStack(val crates: Stack<Char>)
class Move(val quantity: Int, val startIdx: Int, val endIdx: Int)
class State(val stacks: Array<CrateStack>, val moves: Array<Move>) {
fun applyMoves() {
for (move in moves) {
for (i in 1..move.quantity) {
val crat... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day05Kt.class",
"javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day05_test\n 2: invokestatic #14 // Method UtilsKt.readI... |
kipwoker__aoc2022__d8aeea8/src/Day15.kt | import kotlin.math.abs
fun main() {
data class Signal(val sensor: Point, val beacon: Point) {
fun getDistance(): Int {
return abs(sensor.x - beacon.x) + abs(sensor.y - beacon.y)
}
}
fun parse(input: List<String>): List<Signal> {
val regex = """Sensor at x=(-?\d+), y=(-?... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day15Kt.class",
"javap": "Compiled from \"Day15.kt\"\npublic final class Day15Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day15_test\n 2: invokestatic #14 // Method UtilsKt.readI... |
kipwoker__aoc2022__d8aeea8/src/Day21.kt | import kotlin.time.ExperimentalTime
import kotlin.time.measureTime
enum class MathOperator {
Plus,
Minus,
Multiply,
Divide
}
class Day21 {
data class Monkey(val name: String, var value: Long?, val left: String?, val right: String?, val op: MathOperator?)
fun parseOperator(value: String): Math... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day21Kt.class",
"javap": "Compiled from \"Day21.kt\"\npublic final class Day21Kt {\n public static final void main();\n Code:\n 0: new #8 // class Day21\n 3: dup\n 4: invokespecial #11 // Method Day2... |
kipwoker__aoc2022__d8aeea8/src/Day17.kt | import kotlin.math.max
class Rock(val cells: List<Point>, var shift: Point) {
fun getCoords(): List<Point> {
return cells.map { x -> x.sum(shift) }
}
fun hasCollision(points: Set<Point>, move: Point): Boolean {
val newPosition = this.getCoords()
.map { it.sum(move) }
v... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day17Kt.class",
"javap": "Compiled from \"Day17.kt\"\npublic final class Day17Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String 17\n 2: astore_0\n 3: aload_0\n 4: invokestatic #12 ... |
kipwoker__aoc2022__d8aeea8/src/Day07.kt | import java.math.BigInteger
enum class NodeType { File, Dir }
class Node(val parent: Node?, val children: MutableMap<String, Node>, val alias: String, val size: BigInteger?, val type: NodeType) {
var totalSize = BigInteger.ZERO
fun getRoot(): Node {
var currentNode = this
while (currentNode.pa... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day07Kt.class",
"javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day07_test\n 2: invokestatic #14 // Method UtilsKt.readI... |
kipwoker__aoc2022__d8aeea8/src/Day01.kt | fun main() {
fun getStructure(input: List<String>): MutableList<List<Int>> {
val result = mutableListOf<List<Int>>()
var bucket = mutableListOf<Int>()
result.add(bucket)
input.forEach { line ->
run {
if (line.isBlank()) {
bucket = muta... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day01Kt$main$part2$$inlined$sortedByDescending$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class Day01Kt$main$part2$$inlined$sortedByDescending$1<T> implements java.util.Comparator {\n public Day01Kt$main$part2$$inlined$sortedByDescending$1... |
kipwoker__aoc2022__d8aeea8/src/Day06.kt |
fun main() {
fun getDiffIndex(input: List<String>, diffCount: Int): Int {
val line = input[0].toCharArray()
for (i in 0..line.size - diffCount) {
if (line.slice(i until i + diffCount).toSet().size == diffCount) {
return i + diffCount
}
}
ret... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day06Kt.class",
"javap": "Compiled from \"Day06.kt\"\npublic final class Day06Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day06_test_1\n 2: invokestatic #14 // Method UtilsKt.rea... |
kipwoker__aoc2022__d8aeea8/src/Day03.kt |
fun main() {
fun getPriority(ch: Char): Long {
if (ch in 'A'..'Z') {
return ch - 'A' + 27L
}
return ch - 'a' + 1L
}
fun part1(input: List<String>): Long {
return input.sumOf { line ->
line
.chunkedSequence(line.length / 2)
... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day03Kt.class",
"javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: bipush 97\n 2: invokestatic #10 // Method main$getPriority:(C)J\n 5: lconst_1\n 6... |
kipwoker__aoc2022__d8aeea8/src/Day09.kt | import kotlin.math.abs
class Command(val direction: Direction, val count: Int)
fun main() {
fun parse(input: List<String>): List<Command> {
return input.map { line ->
val parts = line.split(' ')
val direction = when (parts[0]) {
"U" -> Direction.Up
"... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day09Kt$WhenMappings.class",
"javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Direction.values:()[LD... |
kipwoker__aoc2022__d8aeea8/src/Day02.kt | enum class Figure(val score: Int) {
Rock(1),
Paper(2),
Scissors(3)
}
fun main() {
fun createFigure(value: String): Figure {
return when (value) {
"A" -> Figure.Rock
"B" -> Figure.Paper
"C" -> Figure.Scissors
"X" -> Figure.Rock
"Y" -> F... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day02Kt.class",
"javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day02_test\n 2: invokestatic #14 // Method UtilsKt.readI... |
kipwoker__aoc2022__d8aeea8/src/Day12.kt | class Day12Input(
val graph: Map<Point, Int>,
val start: Point,
val end: Point
)
data class Trace(val weight: Int, val current: Point, val prev: Point?, val distance: Int)
fun main() {
fun getNeighbors(point: Point, graph: Map<Point, Int>): List<Point> {
return listOf(
Point(point.... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day12Kt.class",
"javap": "Compiled from \"Day12.kt\"\npublic final class Day12Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day12_test\n 2: invokestatic #14 // Method UtilsKt.readI... |
kipwoker__aoc2022__d8aeea8/src/Day11.kt | import kotlin.math.pow
data class Modifier(val op: Char, val value: Int)
data class Condition(val divisibleBy: Int, val ifTrue: Int, val ifFalse: Int)
data class Monkey(
val index: Int,
val queue: MutableList<Long>,
val modifier: Modifier,
val condition: Condition,
var inspectionCount: Long
)
fun ... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day11Kt$main$calculateResult$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class Day11Kt$main$calculateResult$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public Day11Kt$main$calculateResult$$inlined$sortedBy$1... |
kipwoker__aoc2022__d8aeea8/src/Day10.kt | class Operation(val cycles: Int, val add: Int)
fun main() {
fun parse(input: List<String>): List<Operation> {
return input.map { line ->
if (line == "noop") {
Operation(1, 0)
} else {
val modifier = line.split(' ')[1].toInt()
Operation... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day10Kt.class",
"javap": "Compiled from \"Day10.kt\"\npublic final class Day10Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day10_test\n 2: invokestatic #14 // Method UtilsKt.readI... |
kipwoker__aoc2022__d8aeea8/src/Day08.kt | import kotlin.math.max
class Tree(val value: Int, var visible: Boolean)
fun main() {
fun parse(input: List<String>): List<List<Tree>> {
return input.map { line ->
line.toCharArray().map {
Tree(it.digitToInt(), false)
}
}
}
fun findVisible(trees: Lis... | [
{
"class_path": "kipwoker__aoc2022__d8aeea8/Day08Kt.class",
"javap": "Compiled from \"Day08.kt\"\npublic final class Day08Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day08_test\n 2: invokestatic #14 // Method UtilsKt.readI... |
knivey__adventofcode__14a8a23/Day11/Day11part2.kt |
import java.io.File
enum class Tile(val c: String) {
FLOOR("."),
FILLED("#"),
EMPTY("L"),
UNKNOWN("?");
fun from(c: Char) : Tile {
when (c) {
'.' -> return FLOOR
'#' -> return FILLED
'L' -> return EMPTY
}
return UNKNOWN;
}
overri... | [
{
"class_path": "knivey__adventofcode__14a8a23/Day11part2Kt.class",
"javap": "Compiled from \"Day11part2.kt\"\npublic final class Day11part2Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 ... |
Javran__exercism-solutions__15891b1/kotlin/pig-latin/src/main/kotlin/PigLatin.kt | object PigLatin {
// List of char sequence that should be considered a single cluster of vowel / consonant.
// Longer elements must appear first.
private val clusters: List<Pair<String, Boolean>> = listOf(
"sch" to false, "thr" to false,
"xr" to true, "yt" to true,
"ch" to false, "qu... | [
{
"class_path": "Javran__exercism-solutions__15891b1/PigLatin.class",
"javap": "Compiled from \"PigLatin.kt\"\npublic final class PigLatin {\n public static final PigLatin INSTANCE;\n\n private static final java.util.List<kotlin.Pair<java.lang.String, java.lang.Boolean>> clusters;\n\n private PigLatin();... |
babangsund__sorting-algorithms__0f05c41/merge-sort/mergeSort.kt | fun <T:Comparable<T>> merge(a: List<T>, b: List<T>): List<T> {
if (a.isEmpty() && b.isNotEmpty()) return b
if (b.isEmpty() && a.isNotEmpty()) return a
val (ah, at) = Pair(a[0], a.drop(1))
val (bh, bt) = Pair(b[0], b.drop(1))
return when {
ah >= bh -> listOf(bh) + merge(a, bt)
else ... | [
{
"class_path": "babangsund__sorting-algorithms__0f05c41/MergeSortKt.class",
"javap": "Compiled from \"mergeSort.kt\"\npublic final class MergeSortKt {\n public static final <T extends java.lang.Comparable<? super T>> java.util.List<T> merge(java.util.List<? extends T>, java.util.List<? extends T>);\n C... |
mikhail-dvorkin__algorithms__5ad1705/numberTheory.kt | private fun largestPrimeDivisors(n: Int): IntArray {
val largestPrimeDivisors = IntArray(n + 1) { it }
for (i in 2..n) {
if (largestPrimeDivisors[i] < i) continue
var j = i * i
if (j > n) break
do {
largestPrimeDivisors[j] = i
j += i
} while (j <= n)
}
return largestPrimeDivisors
}
private fun divi... | [
{
"class_path": "mikhail-dvorkin__algorithms__5ad1705/NumberTheoryKt.class",
"javap": "Compiled from \"numberTheory.kt\"\npublic final class NumberTheoryKt {\n private static final int[] largestPrimeDivisors(int);\n Code:\n 0: iconst_0\n 1: istore_2\n 2: iload_0\n 3: iconst_1\n ... |
teodor-vasile__aoc-2022-kotlin__2fcfe95/src/main/kotlin/Day009.kt | import kotlin.math.abs
import kotlin.math.sign
class Day009 {
companion object {
private val visitedTails = mutableSetOf<Point>()
}
var initialPoint = State(Point(0, 0), Point(0, 0))
fun moveTheSnake(input: List<String>): Int {
println(input.size)
input.forEach {
m... | [
{
"class_path": "teodor-vasile__aoc-2022-kotlin__2fcfe95/Day009$Point.class",
"javap": "Compiled from \"Day009.kt\"\npublic final class Day009$Point {\n private final int x;\n\n private final int y;\n\n public Day009$Point(int, int);\n Code:\n 0: aload_0\n 1: invokespecial #9 ... |
teodor-vasile__aoc-2022-kotlin__2fcfe95/src/main/kotlin/Day11.kt |
class Day11 {
fun solvePart1(input: String): Int {
// parse the input
val monkeys = input.split("\n\n")
.map { monkey ->
Monkey(
items = getListOfItems(monkey),
operator = getOperator(monkey),
worryMultiplier ... | [
{
"class_path": "teodor-vasile__aoc-2022-kotlin__2fcfe95/Day11.class",
"javap": "Compiled from \"Day11.kt\"\npublic final class Day11 {\n public Day11();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final ... |
teodor-vasile__aoc-2022-kotlin__2fcfe95/src/main/kotlin/Day005.kt | class Day005 {
data class Instruction(val count: Int, val source: Int, val target: Int)
fun part1(lines: List<String>): String {
val numberOfContainers = lines.first { it.trim().startsWith("1") }.trim().last().digitToInt()
val containers = List(numberOfContainers) { ArrayDeque<Char>() }
... | [
{
"class_path": "teodor-vasile__aoc-2022-kotlin__2fcfe95/Day005$Instruction.class",
"javap": "Compiled from \"Day005.kt\"\npublic final class Day005$Instruction {\n private final int count;\n\n private final int source;\n\n private final int target;\n\n public Day005$Instruction(int, int, int);\n Cod... |
teodor-vasile__aoc-2022-kotlin__2fcfe95/src/main/kotlin/Day003.kt | class Day003 {
fun part1(input: List<String>): Int {
var prioritiesSum = 0
for (rucksack in input) {
val firstHalf = rucksack.subSequence(0, rucksack.length / 2)
val lastHalf = rucksack.subSequence(rucksack.length / 2, rucksack.length)
for (char in lastHalf) {
... | [
{
"class_path": "teodor-vasile__aoc-2022-kotlin__2fcfe95/Day003.class",
"javap": "Compiled from \"Day003.kt\"\npublic final class Day003 {\n public Day003();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public fi... |
teodor-vasile__aoc-2022-kotlin__2fcfe95/src/main/kotlin/Day004.kt | class Day004 {
var counter = 0
fun part1(elfPairs: List<List<String>>): Int {
for (elfPair in elfPairs) {
val firstElf = elfPair[0].split('-').map { it.toInt() }
val secondElf = elfPair[1].split('-').map { it.toInt() }
countContainingRanges(firstElf, secondElf)
... | [
{
"class_path": "teodor-vasile__aoc-2022-kotlin__2fcfe95/Day004.class",
"javap": "Compiled from \"Day004.kt\"\npublic final class Day004 {\n private int counter;\n\n public Day004();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n ... |
SwampThingTom__AoC2022__a7825f7/21-MonkeyMath/MonkeyMath.kt | // Monkey Math
// https://adventofcode.com/2022/day/21
import java.io.File
import java.util.ArrayDeque
typealias MonkeyMap = Map<String, List<String>>
typealias MutableValuesMap = MutableMap<String, Long>
fun debugPrint(msg: String, show: Boolean = false) = if (show) { println(msg) } else {}
fun readInput(): List<S... | [
{
"class_path": "SwampThingTom__AoC2022__a7825f7/MonkeyMathKt.class",
"javap": "Compiled from \"MonkeyMath.kt\"\npublic final class MonkeyMathKt {\n public static final void debugPrint(java.lang.String, boolean);\n Code:\n 0: aload_0\n 1: ldc #9 // String msg\n ... |
thomasnield__traveling_salesman_demo__f6d2098/src/main/kotlin/CitiesAndDistances.kt | import java.util.concurrent.ThreadLocalRandom
data class CityPair(val city1: Int, val city2: Int)
class City(val id: Int, val name: String, val x: Double, val y: Double) {
override fun toString() = name
fun distanceTo(other: City) =CitiesAndDistances.distances[CityPair(id, other.id)]?:0.0
}
object CitiesAndD... | [
{
"class_path": "thomasnield__traveling_salesman_demo__f6d2098/CitiesAndDistancesKt.class",
"javap": "Compiled from \"CitiesAndDistances.kt\"\npublic final class CitiesAndDistancesKt {\n public static final java.lang.String get(java.util.Map<CityPair, java.lang.String>, int, int);\n Code:\n 0: alo... |
jacobprudhomme__advent-of-code-2022__9c2b080/src/day04/Day04.kt | import java.io.File
fun main() {
fun readInput(name: String) = File("src/day04", name)
.readLines()
fun processInput(line: String): Pair<Pair<Int, Int>, Pair<Int, Int>> {
val (range1, range2, _) = line.split(",").map { range ->
range.split("-").map { it.toInt() }.let { (start, end,... | [
{
"class_path": "jacobprudhomme__advent-of-code-2022__9c2b080/Day04Kt.class",
"javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String input\n 2: invokestatic #12 // Method ... |
jacobprudhomme__advent-of-code-2022__9c2b080/src/day05/Day05.kt | import java.io.File
typealias CrateStacks = Array<ArrayDeque<Char>>
typealias CraneProcedure = List<Triple<Int, Int, Int>>
fun main() {
fun readInput(name: String) = File("src/day05", name)
.readLines()
fun processInput(input: List<String>): Pair<CrateStacks, CraneProcedure> {
val craneProced... | [
{
"class_path": "jacobprudhomme__advent-of-code-2022__9c2b080/Day05Kt$main$processInput$craneProcedure$1$2.class",
"javap": "Compiled from \"Day05.kt\"\nfinal class Day05Kt$main$processInput$craneProcedure$1$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.l... |
jacobprudhomme__advent-of-code-2022__9c2b080/src/day11/Day11.kt | import java.io.File
import java.lang.IllegalArgumentException
import java.math.BigInteger
import java.util.PriorityQueue
class Monkey(
val heldItems: MutableList<Int>,
val applyOperation: (Int) -> BigInteger,
val decide: (Int) -> Int
) {
var inspectedItems: BigInteger = BigInteger.ZERO
fun inspect... | [
{
"class_path": "jacobprudhomme__advent-of-code-2022__9c2b080/Day11Kt$main$iterateInput$1.class",
"javap": "Compiled from \"Day11.kt\"\nfinal class Day11Kt$main$iterateInput$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceSc... |
jacobprudhomme__advent-of-code-2022__9c2b080/src/day03/Day03.kt | import java.io.File
fun main() {
fun readInput(name: String) = File("src/day03", name)
.readLines()
fun getItemPriority(item: Char): Int =
if (item.isLowerCase()) {
item.code - 96
} else {
item.code - 38
}
fun part1(input: List<String>): Int {
... | [
{
"class_path": "jacobprudhomme__advent-of-code-2022__9c2b080/Day03Kt.class",
"javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String input\n 2: invokestatic #12 // Method ... |
jacobprudhomme__advent-of-code-2022__9c2b080/src/day09/Day09.kt | import java.io.File
import java.lang.IllegalArgumentException
import kotlin.math.abs
typealias Pos = Pair<Int, Int>
enum class Direction {
UP,
RIGHT,
DOWN,
LEFT,
}
fun main() {
fun readInput(name: String) = File("src/day09", name)
.readLines()
fun convertToDirection(dirStr: String): ... | [
{
"class_path": "jacobprudhomme__advent-of-code-2022__9c2b080/Day09Kt$WhenMappings.class",
"javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Dire... |
jacobprudhomme__advent-of-code-2022__9c2b080/src/day02/Day02.kt | import java.io.File
import java.lang.IllegalArgumentException
enum class Result(val score: Int) {
LOSE(0),
DRAW(3),
WIN(6),
}
enum class Move(val value: Int) {
ROCK(1),
PAPER(2),
SCISSORS(3);
fun against(other: Move): Result = when (other.value) {
((value + 1) % 3) + 1 -> Result.W... | [
{
"class_path": "jacobprudhomme__advent-of-code-2022__9c2b080/Day02Kt.class",
"javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String input\n 2: invokestatic #12 // Method ... |
jacobprudhomme__advent-of-code-2022__9c2b080/src/day08/Day08.kt | import java.io.File
class Matrix<T>(private val mtx: List<List<T>>) {
fun dimensions(): Pair<Int, Int> = Pair(mtx.size, mtx[0].size)
fun getRow(rowIdx: Int): List<T> = mtx[rowIdx]
fun getColumn(colIdx: Int): List<T> = mtx.map { row -> row[colIdx] }
fun forEachIndexed(f: (rowIndex: Int, columnIndex: ... | [
{
"class_path": "jacobprudhomme__advent-of-code-2022__9c2b080/Day08Kt.class",
"javap": "Compiled from \"Day08.kt\"\npublic final class Day08Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String input\n 2: invokestatic #12 // Method ... |
jacobprudhomme__advent-of-code-2022__9c2b080/src/day01/Day01.kt | import java.io.File
fun main() {
fun readInput(name: String) = File("src/day01", name)
.readLines()
fun part1(input: List<String>): Int {
var maxSoFar = 0
var currentSum = 0
for (line in input) {
if (line.isEmpty()) {
if (currentSum > maxSoFar) {
... | [
{
"class_path": "jacobprudhomme__advent-of-code-2022__9c2b080/Day01Kt.class",
"javap": "Compiled from \"Day01.kt\"\npublic final class Day01Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String input\n 2: invokestatic #12 // Method ... |
nothingelsematters__university__d442a3d/advanced-algorithms/kotlin/src/bO2CMax.kt | import java.io.File
import java.util.Scanner
fun scheduleO2CMax(p1: List<Long>, p2: List<Long>): Pair<Long, List<List<Long>>> {
fun fill(schedule: MutableList<Long>, times: List<Long>, indices: Sequence<Int>, init: Long = 0) =
indices.fold(init) { sum, index ->
schedule[index] = sum
... | [
{
"class_path": "nothingelsematters__university__d442a3d/BO2CMaxKt.class",
"javap": "Compiled from \"bO2CMax.kt\"\npublic final class BO2CMaxKt {\n public static final kotlin.Pair<java.lang.Long, java.util.List<java.util.List<java.lang.Long>>> scheduleO2CMax(java.util.List<java.lang.Long>, java.util.List<j... |
nothingelsematters__university__d442a3d/advanced-algorithms/kotlin/src/lPIntreeP1LMax.kt | import java.io.File
import java.util.Scanner
fun schedulePIntreeP1LMax(
deadlines: MutableList<Int>,
m: Int,
fromTo: Map<Int, Int>,
toFrom: Map<Int, List<Int>>,
): Pair<Int, List<Int>> {
val i = deadlines.indices.find { it !in fromTo }!!
val deque = ArrayDeque<Int>()
deque += i
while ... | [
{
"class_path": "nothingelsematters__university__d442a3d/LPIntreeP1LMaxKt$schedulePIntreeP1LMax$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class LPIntreeP1LMaxKt$schedulePIntreeP1LMax$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public LPIntreeP1LMaxK... |
nothingelsematters__university__d442a3d/advanced-algorithms/kotlin/src/fP1PrecFMax.kt | import java.io.File
import java.math.BigInteger
import java.util.Scanner
private fun scheduleP1PrecFMax(
times: List<Int>,
functions: List<(Int) -> BigInteger>,
prec: Map<Int, List<Int>>,
): Pair<BigInteger, List<Int>> {
val n = times.size
val children = MutableList(n) { 0 }
prec.forEach { (_, ... | [
{
"class_path": "nothingelsematters__university__d442a3d/FP1PrecFMaxKt.class",
"javap": "Compiled from \"fP1PrecFMax.kt\"\npublic final class FP1PrecFMaxKt {\n private static final kotlin.Pair<java.math.BigInteger, java.util.List<java.lang.Integer>> scheduleP1PrecFMax(java.util.List<java.lang.Integer>, jav... |
nothingelsematters__university__d442a3d/advanced-algorithms/kotlin/src/h1PrecPmtnRFMax.kt | import java.io.File
import java.util.Scanner
private fun <T> MutableList<T>.addAll(vararg ts: T) = addAll(ts)
data class Job(
val time: Long,
var release: Long,
val index: Int,
val f: (Long) -> Long,
val times: MutableList<Long> = mutableListOf(),
)
private data class Block(val start: Long, var t... | [
{
"class_path": "nothingelsematters__university__d442a3d/H1PrecPmtnRFMaxKt$schedule1PrecPmtnRFMax$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class H1PrecPmtnRFMaxKt$schedule1PrecPmtnRFMax$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public H1PrecPmtnR... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day15.kt | import kotlin.math.abs
object Day15 {
const val EXPECTED_PART1_CHECK_ANSWER = 26
const val EXPECTED_PART2_CHECK_ANSWER = 56000011L
const val PART1_CHECK_ROW = 10
const val PART1_ROW = 2_000_000
const val PART2_CHECK_MAX = 20
const val PART2_MAX = 4_000_000
const val PART2_MULTIPLY_VALUE = ... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day15.class",
"javap": "Compiled from \"Day15.kt\"\npublic final class Day15 {\n public static final Day15 INSTANCE;\n\n public static final int EXPECTED_PART1_CHECK_ANSWER;\n\n public static final long EXPECTED_PART2_CHECK_ANSWER;\n\n public static f... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day19.kt | object Day19 {
const val EXPECTED_PART1_CHECK_ANSWER = 33
const val EXPECTED_PART2_CHECK_ANSWER = 3472
val BLUEPRINT_REGEX =
Regex("Blueprint (\\d+): Each ore robot costs (\\d+) ore. Each clay robot costs (\\d+) ore. Each obsidian robot costs (\\d+) ore and (\\d+) clay. Each geode robot costs (\\d+... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day19Kt$WhenMappings.class",
"javap": "Compiled from \"Day19.kt\"\npublic final class Day19Kt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method RobotCurrency... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Utils.kt | import java.io.File
import java.math.BigInteger
import java.security.MessageDigest
/**
* Reads lines from the given input txt file.
*/
fun readInput(name: String) = File("src", "$name.txt")
.readLines()
/**
* Converts string to md5 hash.
*/
fun String.md5() = BigInteger(1, MessageDigest.getInstance("MD5").dig... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/UtilsKt.class",
"javap": "Compiled from \"Utils.kt\"\npublic final class UtilsKt {\n public static final java.util.List<java.lang.String> readInput(java.lang.String);\n Code:\n 0: aload_0\n 1: ldc #10 // String na... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day04.kt | object Day04 {
const val EXPECTED_PART1_CHECK_ANSWER = 2
const val EXPECTED_PART2_CHECK_ANSWER = 4
}
fun main() {
fun String.parseToIntRangePerElf(): Pair<IntRange, IntRange> =
this
.split(",")
.map { it.split("-") }
.map { (it[0].toInt())..(it[1].toInt()) }
... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day04Kt.class",
"javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day04_test\n 2: invokestatic #14 // Method Util... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day16.kt | import java.util.*
object Day16 {
const val EXPECTED_PART1_CHECK_ANSWER = 1651
const val EXPECTED_PART2_CHECK_ANSWER = 1707
const val START_VALVE_NAME = "AA"
const val RUNTIME_MINS_PART1 = 30
const val RUNTIME_MINS_PART2 = 26
}
data class Valve(val name: String, val flowRate: Int) {
private ... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day16Kt$main$Opener.class",
"javap": "Compiled from \"Day16.kt\"\npublic final class Day16Kt$main$Opener {\n private final Valve currentLocation;\n\n private final int minutesRemaining;\n\n public Day16Kt$main$Opener(Valve, int);\n Code:\n 0: ... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day23.kt | import Day23.draw
import Day23.proposeMoves
object Day23 {
const val EXPECTED_PART1_CHECK_ANSWER = 110
const val EXPECTED_PART2_CHECK_ANSWER = 20
sealed interface GridCell
object Empty : GridCell
object Elf : GridCell
class Grid {
private val rows = mutableListOf<List<GridCell>>()
... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day23Kt.class",
"javap": "Compiled from \"Day23.kt\"\npublic final class Day23Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day23_test\n 2: invokestatic #14 // Method Util... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day13.kt | object Day13 {
const val EXPECTED_PART1_CHECK_ANSWER = 13
const val EXPECTED_PART2_CHECK_ANSWER = 140
const val PACKET_COMBOS_NR_OF_LINES = 3
val NONE_NUMBER_CHARS = listOf('[', ']', ',')
const val DIVIDER_PACKET_ONE = 2
const val DIVIDER_PACKET_TWO = 6
val DIVIDER_PACKETS: List<List<Any>> ... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day13.class",
"javap": "Compiled from \"Day13.kt\"\npublic final class Day13 {\n public static final Day13 INSTANCE;\n\n public static final int EXPECTED_PART1_CHECK_ANSWER;\n\n public static final int EXPECTED_PART2_CHECK_ANSWER;\n\n public static fi... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day08.kt | object Day08 {
const val EXPECTED_PART1_CHECK_ANSWER = 21
const val EXPECTED_PART2_CHECK_ANSWER = 8
}
fun main() {
fun List<String>.parseTreeGrid(): List<List<Int>> =
this.map { it.toList() }.map { it.map { chr -> chr.digitToInt() } }
fun List<List<Int>>.isVisible(x: Int, y: Int): Boolean {
... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day08.class",
"javap": "Compiled from \"Day08.kt\"\npublic final class Day08 {\n public static final Day08 INSTANCE;\n\n public static final int EXPECTED_PART1_CHECK_ANSWER;\n\n public static final int EXPECTED_PART2_CHECK_ANSWER;\n\n private Day08();... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day05.kt | object Day05 {
const val dayNumber = "05"
const val EXPECTED_PART1_CHECK_ANSWER = "CMZ"
const val EXPECTED_PART2_CHECK_ANSWER = "MCD"
const val STACK_SETUP_ENTRY_WITH_SPACE_SIZE = 4
const val STACK_SETUP_ENTRY_SIZE = 3
}
fun main() {
fun List<String>.parseStackSetup(): List<MutableList<Char>... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day05Kt.class",
"javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day05_test\n 2: invokestatic #14 // Method Util... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day11.kt | object Day11 {
const val EXPECTED_PART1_CHECK_ANSWER = 10605L
const val EXPECTED_PART2_CHECK_ANSWER = 2713310158
const val PART1_RUNS = 20
const val PART2_RUNS = 10_000
const val WORRY_LEVEL_DIVISION_AMOUNT = 3
val MONKEY_LINE_ITEMS = Regex("\\s+Starting items: ([, \\d]+)")
val MONKEY_LIN... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day11.class",
"javap": "Compiled from \"Day11.kt\"\npublic final class Day11 {\n public static final Day11 INSTANCE;\n\n public static final long EXPECTED_PART1_CHECK_ANSWER;\n\n public static final long EXPECTED_PART2_CHECK_ANSWER;\n\n public static ... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day09.kt | import kotlin.math.abs
import kotlin.math.sign
object Day09 {
const val EXPECTED_PART1_CHECK_ANSWER = 13
const val EXPECTED_PART2_CHECK_ANSWER = 1
const val TAIL_SIZE_PART_2 = 9
}
enum class MovementDirection { U, D, L, R }
fun main() {
data class Location(val x: Int, val y: Int) {
fun move(... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day09Kt$main$Location.class",
"javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt$main$Location {\n private final int x;\n\n private final int y;\n\n public Day09Kt$main$Location(int, int);\n Code:\n 0: aload_0\n 1: invokesp... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day07.kt | object Day07 {
const val EXPECTED_PART1_CHECK_ANSWER = 95437
const val EXPECTED_PART2_CHECK_ANSWER = 24933642
const val DIR_SIZE_THRESHOLD = 100_000
const val FS_TOTAL_SIZE = 70_000_000
const val FS_NEEDED_FREE_SPACE = 30_000_000
}
sealed class Entry(val name: String)
class File(name: String, val... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day07Kt.class",
"javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt {\n public static final void main();\n Code:\n 0: new #8 // class kotlin/text/Regex\n 3: dup\n 4: ldc #10 ... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day10.kt | object Day10 {
const val EXPECTED_PART1_CHECK_ANSWER = 13140
const val EXPECTED_PART2_CHECK_ANSWER = 1
val CYCLE_PROBE_POINTS = listOf(20, 60, 100, 140, 180, 220)
const val CRT_LINE_WIDTH = 40
}
sealed class CpuInstruction(val cycles: Int)
class Noop : CpuInstruction(1)
class AddX(val arg: Int) : Cpu... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day10.class",
"javap": "Compiled from \"Day10.kt\"\npublic final class Day10 {\n public static final Day10 INSTANCE;\n\n public static final int EXPECTED_PART1_CHECK_ANSWER;\n\n public static final int EXPECTED_PART2_CHECK_ANSWER;\n\n private static f... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day06.kt | import kotlin.system.measureNanoTime
object Day06 {
const val EXPECTED_PART1_CHECK_ANSWER = 7
const val EXPECTED_PART2_CHECK_ANSWER = 19
const val MARKER_PACKET_LENGTH = 4
const val MARKER_MESSAGE_LENGTH = 14
}
fun main() {
fun String.findLengthUntilMarker(markerLength: Int): Int {
var p... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day06Kt.class",
"javap": "Compiled from \"Day06.kt\"\npublic final class Day06Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day06_test\n 2: invokestatic #14 // Method Util... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day12.kt | import java.util.LinkedList
object Day12 {
const val EXPECTED_PART1_CHECK_ANSWER = 31
const val EXPECTED_PART2_CHECK_ANSWER = 29
const val CHAR_START = 'S'
const val CHAR_DESTINATION = 'E'
const val CHAR_LOWEST = 'a'
}
fun main() {
fun List<String>.parseData(): Array<CharArray> =
map... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day12.class",
"javap": "Compiled from \"Day12.kt\"\npublic final class Day12 {\n public static final Day12 INSTANCE;\n\n public static final int EXPECTED_PART1_CHECK_ANSWER;\n\n public static final int EXPECTED_PART2_CHECK_ANSWER;\n\n public static fi... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day20.kt | import java.util.LinkedList
object Day20 {
const val EXPECTED_PART1_CHECK_ANSWER = 3
const val EXPECTED_PART2_CHECK_ANSWER = 1623178306L
val ANSWER_POSITIONS = setOf(1000, 2000, 3000)
const val DECRYPTION_KEY = 811589153L
}
fun main() {
fun List<String>.parse() = map(String::toLong).foldIndexed(L... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day20Kt.class",
"javap": "Compiled from \"Day20.kt\"\npublic final class Day20Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day20_test\n 2: invokestatic #14 // Method Util... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day25.kt | import kotlin.math.pow
object Day25 {
const val EXPECTED_PART1_CHECK_ANSWER = "2=-1=0"
const val EXPECTED_PART2_CHECK_ANSWER = 1
}
fun main() {
fun fivesValueForDigit(char: Char) = when (char) {
'2' -> 2
'1' -> 1
'0' -> 0
'-' -> -1
'=' -> -2
else -> error(... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day25Kt.class",
"javap": "Compiled from \"Day25.kt\"\npublic final class Day25Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day25_test\n 2: invokestatic #14 // Method Util... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day03.kt | object Day03 {
const val EXPECTED_PART1_CHECK_ANSWER = 157
const val EXPECTED_PART2_CHECK_ANSWER = 70
const val ELF_GROUP_SIZE = 3
}
fun main() {
fun Char.mapToItemValue() = if (this.isUpperCase()) (this.minus('A') + 27) else (this.minus('a') + 1)
fun part1(input: List<String>): Int {
re... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day03Kt.class",
"javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day03_test\n 2: invokestatic #14 // Method Util... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day02.kt |
const val SCORE_ROCK = 1
const val SCORE_PAPER = 2
const val SCORE_SCISSORS = 3
const val DRAW = 'Y'
const val LOSE = 'X'
const val WIN = 'Z'
const val EXPECTED_PART1_CHECK_ANSWER = 15
const val EXPECTED_PART2_CHECK_ANSWER = 12
const val POS_THEIR_CHOICE = 0
const val POS_OUR_CHOICE = 2
const val SCORE_WIN = 6
con... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day02Kt.class",
"javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n public static final int SCORE_ROCK;\n\n public static final int SCORE_PAPER;\n\n public static final int SCORE_SCISSORS;\n\n public static final char DRAW;\n\n publi... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day18.kt | object Day18 {
const val EXPECTED_PART1_CHECK_ANSWER = 64
const val EXPECTED_PART2_CHECK_ANSWER = 58
}
fun main() {
val air = mutableMapOf<Point3D, Boolean>()
fun List<String>.parsePoints() =
map { line ->
val xyz = line.split(',')
Point3D(xyz[0].toInt(), xyz[1].toInt()... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day18.class",
"javap": "Compiled from \"Day18.kt\"\npublic final class Day18 {\n public static final Day18 INSTANCE;\n\n public static final int EXPECTED_PART1_CHECK_ANSWER;\n\n public static final int EXPECTED_PART2_CHECK_ANSWER;\n\n private Day18();... |
dizney__aoc-2022-in-kotlin__f684a4e/src/Day01.kt | const val PART1_EXPECTED_HIGHEST_CALORIES = 24000
const val PART2_EXPECTED_HIGHEST_3_CALORIES_SUM = 45000
const val PART2_TOP_ELF_COUNT = 3
fun main() {
fun elfTotals(input: List<String>, idx: Int = 0, elfAmount: Int = 0, totals: List<Int> = emptyList()): List<Int> {
if (idx >= input.size) return totals +... | [
{
"class_path": "dizney__aoc-2022-in-kotlin__f684a4e/Day01Kt.class",
"javap": "Compiled from \"Day01.kt\"\npublic final class Day01Kt {\n public static final int PART1_EXPECTED_HIGHEST_CALORIES;\n\n public static final int PART2_EXPECTED_HIGHEST_3_CALORIES_SUM;\n\n public static final int PART2_TOP_ELF_C... |
Jeff-Gillot__word-clique__4b11007/src/main/kotlin/Main.kt | import java.io.File
import kotlin.system.measureTimeMillis
fun main() {
val time = measureTimeMillis {
// Read the words and keep only 5 letters words
val textWords = File(Signature::class.java.getResource("words_alpha.txt")!!.toURI())
.readLines()
.filter { it.length == 5 ... | [
{
"class_path": "Jeff-Gillot__word-clique__4b11007/MainKt$main$lambda$20$$inlined$sortedBy$1.class",
"javap": "Compiled from \"Comparisons.kt\"\npublic final class MainKt$main$lambda$20$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public MainKt$main$lambda$20$$inlined$sortedBy$1();\n Code:... |
jjrodcast__CompetitiveProblems__a91868c/leetcode/UniquePathsTwo.kt | /*
Enlace al problema:
https://leetcode.com/problems/unique-paths-ii/
La solución se encuentra dentro de la función `uniquePathsWithObstacles`, el resto del código es para
ejecutarlo de manera local.
Explanation:
Given the grid:
[0,0,0]
[0,1,0]
[0,0,0]
Initial informatio... | [
{
"class_path": "jjrodcast__CompetitiveProblems__a91868c/UniquePathsTwoKt.class",
"javap": "Compiled from \"UniquePathsTwo.kt\"\npublic final class UniquePathsTwoKt {\n public static final void main();\n Code:\n 0: new #8 // class Solution\n 3: dup\n 4: invok... |
polydisc__codelibrary__be589a7/kotlin/MaxBipartiteMatchingEV.kt | // https://en.wikipedia.org/wiki/Matching_(graph_theory)#In_unweighted_bipartite_graphs in O(V * E)
fun maxMatching(graph: Array<out List<Int>>): Int {
val n1 = graph.size
val n2 = (graph.flatMap { it }.maxOrNull() ?: -1) + 1
val matching = IntArray(n2) { -1 }
return (0 until n1).sumOf { findPath(graph,... | [
{
"class_path": "polydisc__codelibrary__be589a7/MaxBipartiteMatchingEVKt.class",
"javap": "Compiled from \"MaxBipartiteMatchingEV.kt\"\npublic final class MaxBipartiteMatchingEVKt {\n public static final int maxMatching(java.util.List<java.lang.Integer>[]);\n Code:\n 0: aload_0\n 1: ldc ... |
cznno__advent-of-code-kotlin__423e711/src/Day02.kt | import java.nio.file.Files
import java.nio.file.Path
object Day02 {
private val map1 = mapOf("X" to 1, "Y" to 2, "Z" to 3)
private val map2 = mapOf(
"A X" to 3, "A Y" to 6, "A Z" to 0,
"B X" to 0, "B Y" to 3, "B Z" to 6,
"C X" to 6, "C Y" to 0, "C Z" to 3,
)
private val list = ... | [
{
"class_path": "cznno__advent-of-code-kotlin__423e711/Day02Kt.class",
"javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String ./input/Day02.txt\n 2: iconst_0\n 3: anewarray #10 ... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Utils.kt | import java.io.File
import java.math.BigInteger
import java.security.MessageDigest
import kotlin.math.absoluteValue
import kotlin.math.sign
fun Boolean.toInt() = if (this) 1 else 0
fun IntProgression.isRange() = step.sign > 0
operator fun <T> List<List<T>>.get(ind: Pair<Int, Int>) = this[ind.first][ind.second]
oper... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/UtilsKt.class",
"javap": "Compiled from \"Utils.kt\"\npublic final class UtilsKt {\n public static final int toInt(boolean);\n Code:\n 0: iload_0\n 1: ifeq 8\n 4: iconst_1\n 5: goto 9\n 8: iconst_... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day14.kt | private data class CurrentUnit(var pile: Int = 500, var height: Int = 0) {
fun diagonalMove(piles: Map<Int, Set<Int>>): Boolean {
if (piles[pile - 1] == null || !piles[pile - 1]!!.contains(height + 1)) {
pile--
height++
return true
}
if (piles[pile + 1] ... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day14Kt.class",
"javap": "Compiled from \"Day14.kt\"\npublic final class Day14Kt {\n private static final java.util.List<java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>>> getPoints(java.util.List<java.lang.String>);\n Code:\n ... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day04.kt | private fun rangesPairList(input: List<String>) = input.map { "(\\d+)-(\\d+),(\\d+)-(\\d+)".toRegex().find(it)!!.destructured }
.map { (l1, l2, r1, r2) -> (l1.toInt() to l2.toInt()) to (r1.toInt() to r2.toInt()) }
fun main() {
fun part1(input: List<String>) = rangesPairList(input).sumOf { (first, second) -> fi... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day04Kt.class",
"javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n private static final java.util.List<kotlin.Pair<kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>>> rangesPairL... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day05.kt | import java.util.*
private fun stackPeeks(input: List<List<String>>, move: (List<Stack<Char>>, Int, Int, Int) -> Unit): String {
val (towers, instructions) = input
val stacksSize = towers.last().split("\\s+".toRegex()).last().toInt()
val stacks = List(stacksSize) { Stack<Char>() }
for (i in (0 until t... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day05Kt.class",
"javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n private static final java.lang.String stackPeeks(java.util.List<? extends java.util.List<java.lang.String>>, kotlin.jvm.functions.Function4<? super java.util.List... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day15.kt | import kotlin.math.absoluteValue
private const val TEST_LINE = 10
private const val LINE = 2_000_000
private const val TEST_SIZE = 20
private const val SIZE = 4_000_000
private val template = "Sensor at x=(-?\\d+), y=(-?\\d+): closest beacon is at x=(-?\\d+), y=(-?\\d+)".toRegex()
private fun getCoordinates(input: ... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day15Kt.class",
"javap": "Compiled from \"Day15.kt\"\npublic final class Day15Kt {\n private static final int TEST_LINE;\n\n private static final int LINE;\n\n private static final int TEST_SIZE;\n\n private static final int SIZE;\n\n private ... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day07.kt | private const val MAX_DIR_SIZE = 100_000
private const val DISK_SPACE = 70_000_000
private const val UPDATE_SIZE = 30_000_000
private data class FS(
val name: String,
val parent: FS?, // null for root dir only.
) {
val files: MutableList<Int> = mutableListOf()
val folders: MutableList<FS> = mutableList... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day07Kt.class",
"javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt {\n private static final int MAX_DIR_SIZE;\n\n private static final int DISK_SPACE;\n\n private static final int UPDATE_SIZE;\n\n public static final java.util.Lis... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day13.kt | private val DIVIDER_PACKETS = listOf("[[2]]", "[[6]]")
private sealed interface Signal : Comparable<Signal?> {
override operator fun compareTo(signal: Signal?): Int
}
private data class SingleSignal(val element: Int) : Signal {
fun toMultiSignal() = MultiSignal(listOf(this))
override fun compareTo(signal... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day13Kt.class",
"javap": "Compiled from \"Day13.kt\"\npublic final class Day13Kt {\n private static final java.util.List<java.lang.String> DIVIDER_PACKETS;\n\n private static final Signal parseSignal(java.lang.String);\n Code:\n 0: new ... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day03.kt | private fun compartments(input: List<String>) = input.map { it.trim().chunked(it.length / 2) }
private fun groups(input: List<String>) = input.windowed(3, 3)
private fun List<List<String>>.intersect() = flatMap { it.map(String::toSet).reduce(Set<Char>::intersect) }
private fun Char.toPriority() = if (isLowerCase()) th... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day03Kt.class",
"javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n private static final java.util.List<java.util.List<java.lang.String>> compartments(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: che... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day02.kt | private const val RPS_SIZE = 3
private fun String.toInt() = when (this) {
"A", "X" -> 1
"B", "Y" -> 2
"C", "Z" -> 3
else -> error("Incorrect input")
}
private fun Pair<Int, Int>.game1() = second + when {
first % RPS_SIZE + 1 == second -> 6
first == second -> 3
(first + 1) % RPS_SIZE + 1 ==... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day02Kt.class",
"javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n private static final int RPS_SIZE;\n\n private static final int toInt(java.lang.String);\n Code:\n 0: aload_0\n 1: astore_1\n 2: aload_1\n ... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day12.kt | var start = 0 to 0
var end = 0 to 0
private fun heights(input: List<String>) =
input.mapIndexed { i, line ->
line.mapIndexed { j, char ->
when (char) {
'S' -> 'a'.also { start = i to j }
'E' -> 'z'.also { end = i to j }
else -> char
} ... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day12Kt.class",
"javap": "Compiled from \"Day12.kt\"\npublic final class Day12Kt {\n private static kotlin.Pair<java.lang.Integer, java.lang.Integer> start;\n\n private static kotlin.Pair<java.lang.Integer, java.lang.Integer> end;\n\n public sta... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day11.kt | private val template = """
Monkey (\d+):
Starting items: (.*?)
Operation: new = old (.) (.+)
Test: divisible by (\d+)
If true: throw to monkey (\d+)
If false: throw to monkey (\d+)
""".trim().toRegex()
private data class MonkeyBusiness(
val items: MutableList<ULong>,
val op: (ULong, ULong) ->... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day11Kt$parseMonkeys$1$operation$2.class",
"javap": "Compiled from \"Day11.kt\"\nfinal class Day11Kt$parseMonkeys$1$operation$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function2<kotlin.ULong, kotlin.ULong, ... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day10.kt | private const val SCREEN_WIDTH = 40
private const val SCREEN_SIZE = 6 * SCREEN_WIDTH
private const val SIGNAL_STRENGTH = SCREEN_WIDTH / 2
private fun cycleSignals(input: List<String>): List<Int> {
val signals = MutableList(2 * input.size + 1) { 1 }
var cycle = 0
for (i in input.indices) {
signals[... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day10Kt.class",
"javap": "Compiled from \"Day10.kt\"\npublic final class Day10Kt {\n private static final int SCREEN_WIDTH;\n\n private static final int SCREEN_SIZE;\n\n private static final int SIGNAL_STRENGTH;\n\n private static final java.ut... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day09.kt | import kotlin.math.absoluteValue
import kotlin.math.sign
private data class Cell(var x: Int = 0, var y: Int = 0) {
fun move(other: Cell) {
x += other.x
y += other.y
}
fun isAttached(other: Cell) = (x - other.x).absoluteValue < 2 && (y - other.y).absoluteValue < 2
fun follow(other: Ce... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day09Kt.class",
"javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt {\n private static final int moveTheRope(java.util.List<java.lang.String>, java.util.List<Cell>);\n Code:\n 0: new #9 // class jav... |
ShuffleZZZ__advent-of-code-kotlin__5a3cff1/src/Day08.kt | private fun getGrid(input: List<String>) = input.map { it.map(Char::digitToInt).toTypedArray() }.toTypedArray()
private fun observeLines(grid: Array<Array<Int>>, res: Array<BooleanArray>, lineInds: IntRange, rowInds: IntProgression) {
val maxRowInd = if (rowInds.isRange()) 0 else grid.first().size - 1
for (i ... | [
{
"class_path": "ShuffleZZZ__advent-of-code-kotlin__5a3cff1/Day08Kt.class",
"javap": "Compiled from \"Day08.kt\"\npublic final class Day08Kt {\n private static final java.lang.Integer[][] getGrid(java.util.List<java.lang.String>);\n Code:\n 0: aload_0\n 1: checkcast #9 /... |
Kirchberg__BigDataPL__b6a459a/LR6/src/main/kotlin/Task2V1.kt | // Списки (стеки, очереди) I(1..n) и U(1..n) содержат результаты n измерений тока и напряжения на неизвестном
// сопротивлении R. Найти приближенное число R методом наименьших квадратов.
import kotlin.math.pow
// Create a class LeastSquaresR that takes two lists of measurements, currents, and voltages
class LeastSqua... | [
{
"class_path": "Kirchberg__BigDataPL__b6a459a/Task2V1Kt.class",
"javap": "Compiled from \"Task2V1.kt\"\npublic final class Task2V1Kt {\n public static final void task2V1();\n Code:\n 0: iconst_5\n 1: anewarray #8 // class java/lang/Double\n 4: astore_1\n 5: ... |
Kirchberg__BigDataPL__b6a459a/LR7/src/main/kotlin/Task1V3.kt | // В тексте нет слов, начинающихся одинаковыми буквами. Напечатать слова текста в таком порядке, чтобы последняя буква
// каждого слова совпадала с первой буквой последующего слова. Если все слова нельзя напечатать в таком порядке, найти
// такую цепочку, состоящую из наибольшего количества слов.
// The WordChainFinde... | [
{
"class_path": "Kirchberg__BigDataPL__b6a459a/Task1V3Kt.class",
"javap": "Compiled from \"Task1V3.kt\"\npublic final class Task1V3Kt {\n public static final void task1V3();\n Code:\n 0: ldc #8 // String java android kotlin rust\n 2: astore_0\n 3: aload_0\n ... |
austin226__codeforces-kt__4377021/contest1904/src/main/kotlin/D1.kt | // https://codeforces.com/contest/1904/problem/D1
private fun String.splitWhitespace() = split("\\s+".toRegex())
private fun readInt(): Int = readln().toInt()
private fun readInts(): List<Int> = readln().splitWhitespace().map { it.toInt() }
fun canABecomeB(n: Int, a: MutableList<Int>, b: List<Int>): Boolean {
// ... | [
{
"class_path": "austin226__codeforces-kt__4377021/D1Kt.class",
"javap": "Compiled from \"D1.kt\"\npublic final class D1Kt {\n private static final java.util.List<java.lang.String> splitWhitespace(java.lang.String);\n Code:\n 0: aload_0\n 1: checkcast #9 // class java/la... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.