kt_path
stringlengths
35
167
kt_source
stringlengths
626
28.9k
classes
listlengths
1
17
nerok__Advent-of-code-2021__7553c28/src/main/kotlin/day9.kt
import java.io.File fun main(args: Array<String>) { day9part2() } fun day9part1() { var coordinates = mutableListOf<List<Int>>() val input = File("day9input.txt").bufferedReader().readLines() input.mapIndexed { index, line -> line.split("") .filterNot { it == "" } .map ...
[ { "class_path": "nerok__Advent-of-code-2021__7553c28/Day9Kt.class", "javap": "Compiled from \"day9.kt\"\npublic final class Day9Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15 ...
lhDream__wuziqi__c83c58c/src/test/kotlin/Test.kt
import java.util.* import kotlin.math.abs // 棋盘大小 const val BOARD_SIZE = 15 // 评估函数(简化版本,根据棋局评估得分) // 五子棋中针对当前局面的评估函数 fun evaluate(board: Array<Array<Int>>, player: Int): Int { val opponent = if (player == 2) 1 else 2 var score = 0 // 检查每个位置的行、列、对角线是否存在连续的棋子 for (i in 0 until BOARD_SIZE) { fo...
[ { "class_path": "lhDream__wuziqi__c83c58c/TestKt.class", "javap": "Compiled from \"Test.kt\"\npublic final class TestKt {\n public static final int BOARD_SIZE;\n\n private static final java.lang.Integer[][] major;\n\n public static final int evaluate(java.lang.Integer[][], int);\n Code:\n 0: alo...
alexiscrack3__algorithms-kotlin__a201986/src/main/kotlin/SubArray.kt
class SubArray { fun getLengthOfLongestContiguousSubarray(array: Array<Int>): Int { var maxLength = 1 for (i in 0 until array.size - 1) { var minimum = array[i] var maximum = array[i] for (j in i + 1 until array.size) { minimum = Math.min(minimum...
[ { "class_path": "alexiscrack3__algorithms-kotlin__a201986/SubArray.class", "javap": "Compiled from \"SubArray.kt\"\npublic final class SubArray {\n public SubArray();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n ...
goetz-markgraf__battleship_2024__ebd9504/src/main/kotlin/Main.kt
import java.lang.Integer.max import java.lang.Integer.min import kotlin.math.abs enum class Function { CHECK, PLACE } enum class Player { PLAYER1, PLAYER2 } data class Position( val col: Int, val row: Int ) data class Ship( var parts: List<Position> ) typealias Field = Array<Array<Int>> data c...
[ { "class_path": "goetz-markgraf__battleship_2024__ebd9504/MainKt$WhenMappings.class", "javap": "Compiled from \"Main.kt\"\npublic final class MainKt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Function.va...
jomartigcal__kotlin-heroes__ad16779/practice-4/src/practice4e.kt
// Special Permutation // https://codeforces.com/contest/1347/problem/E private fun readLn() = readLine()!! private fun readInt() = readLn().toInt() private fun readStrings() = readLn().split(" ") private fun readInts() = readStrings().map { it.toInt() } fun main() { val lines = readInt() for (line in 1..li...
[ { "class_path": "jomartigcal__kotlin-heroes__ad16779/Practice4eKt.class", "javap": "Compiled from \"practice4e.kt\"\npublic final class Practice4eKt {\n private static final java.lang.String readLn();\n Code:\n 0: invokestatic #11 // Method kotlin/io/ConsoleKt.readLine:()Ljava/lan...
andrewrlee__adventOfCode2021__aace0fc/src/main/kotlin/Day15.kt
import java.io.File import java.nio.charset.Charset.defaultCharset import kotlin.streams.toList typealias ChitonGrid = Map<Pair<Int, Int>, Day15.Square> object Day15 { private fun toCoordinates(row: Int, line: String) = line.chars() .map(Character::getNumericValue) .toList() .mapIndexed { ...
[ { "class_path": "andrewrlee__adventOfCode2021__aace0fc/Day15.class", "javap": "Compiled from \"Day15.kt\"\npublic final class Day15 {\n public static final Day15 INSTANCE;\n\n private Day15();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":...
andrewrlee__adventOfCode2021__aace0fc/src/main/kotlin/Day14.kt
import java.io.File import java.nio.charset.StandardCharsets.UTF_8 import kotlin.collections.Map.Entry object Day14 { object Part1 { private fun toRule(s: String): Pair<List<Char>, Char> { val (pair, value) = s.split(" -> ") return pair.toCharArray().let { listOf(it[0], it[1]) } t...
[ { "class_path": "andrewrlee__adventOfCode2021__aace0fc/Day14Kt.class", "javap": "Compiled from \"Day14.kt\"\npublic final class Day14Kt {\n public static final void main();\n Code:\n 0: getstatic #12 // Field Day14$Part1.INSTANCE:LDay14$Part1;\n 3: invokevirtual #15 ...
andrewrlee__adventOfCode2021__aace0fc/src/main/kotlin/Day16.kt
import Day16.Type.EQUAL_TO import Day16.Type.G_THAN import Day16.Type.LITERAL import Day16.Type.L_THAN import Day16.Type.MAX import Day16.Type.MIN import Day16.Type.PRODUCT import Day16.Type.SUM import java.io.File import java.math.BigInteger import java.nio.charset.Charset.defaultCharset object Day16 { enum cla...
[ { "class_path": "andrewrlee__adventOfCode2021__aace0fc/Day16$Packet.class", "javap": "Compiled from \"Day16.kt\"\npublic abstract class Day16$Packet {\n private final int version;\n\n private final Day16$Type type;\n\n private Day16$Packet(int, Day16$Type);\n Code:\n 0: aload_0\n 1: invoke...
andrewrlee__adventOfCode2021__aace0fc/src/main/kotlin/Day10.kt
import Day10.Type.CLOSE import Day10.Type.OPEN import java.io.File import java.nio.charset.Charset.defaultCharset import java.util.Stack object Day10 { data class Bracket(val bracketType: BracketType, val type: Type) enum class Type { OPEN, CLOSE } enum class BracketType(val open: Char, val close: Char, ...
[ { "class_path": "andrewrlee__adventOfCode2021__aace0fc/Day10$BracketType.class", "javap": "Compiled from \"Day10.kt\"\npublic final class Day10$BracketType extends java.lang.Enum<Day10$BracketType> {\n private final char open;\n\n private final char close;\n\n private final int points;\n\n private final...
andrewrlee__adventOfCode2021__aace0fc/src/main/kotlin/Day17.kt
object Day17 { // val targetArea = 20..30 to -10..-5 val targetArea = 248..285 to -85..-56 data class Coord(val x: Int, val y: Int) { constructor(coord: Pair<Int, Int>) : this(coord.first, coord.second) } private fun Pair<IntRange, IntRange>.toCoords(): List<Coord> { val (xs, ys) =...
[ { "class_path": "andrewrlee__adventOfCode2021__aace0fc/Day17.class", "javap": "Compiled from \"Day17.kt\"\npublic final class Day17 {\n public static final Day17 INSTANCE;\n\n private static final kotlin.Pair<kotlin.ranges.IntRange, kotlin.ranges.IntRange> targetArea;\n\n private Day17();\n Code:\n ...
andrewrlee__adventOfCode2021__aace0fc/src/main/kotlin/Day11.kt
import java.io.File import java.nio.charset.Charset.defaultCharset import kotlin.streams.toList typealias OctopusGrid = Map<Pair<Int, Int>, Day11.Octopus> object Day11 { private fun toCoordinates(row: Int, line: String) = line.chars() .map(Character::getNumericValue) .toList() .mapIndexed ...
[ { "class_path": "andrewrlee__adventOfCode2021__aace0fc/Day11$Part1.class", "javap": "Compiled from \"Day11.kt\"\npublic final class Day11$Part1 {\n public static final Day11$Part1 INSTANCE;\n\n private Day11$Part1();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java...
andrewrlee__adventOfCode2021__aace0fc/src/main/kotlin/Day13.kt
import java.io.File import java.nio.charset.StandardCharsets.UTF_8 object Day13 { data class Coord(val x: Int, val y: Int) { constructor(coord: Pair<Int, Int>) : this(coord.first, coord.second) } enum class Direction { x { override fun extract(c: Coord) = c.x overr...
[ { "class_path": "andrewrlee__adventOfCode2021__aace0fc/Day13.class", "javap": "Compiled from \"Day13.kt\"\npublic final class Day13 {\n public static final Day13 INSTANCE;\n\n private Day13();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":...
andrewrlee__adventOfCode2021__aace0fc/src/main/kotlin/Day09.kt
import java.io.File import java.nio.charset.Charset.defaultCharset import kotlin.streams.toList typealias Coordinate = Pair<Int, Int> typealias Basin = Set<Coordinate> typealias ValidCells = Set<Coordinate> object Day09 { fun toCoordinates(row: Int, line: String) = line.chars() .map(Character::getNumericV...
[ { "class_path": "andrewrlee__adventOfCode2021__aace0fc/Day09.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09 {\n public static final Day09 INSTANCE;\n\n private Day09();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":...
daily-boj__RanolP__74294a4/P2529.kt
enum class InequationType { LT, // < GT, // > KT, // Nothing } data class Minmax(val min: Long, val max: Long) fun solve(previous: Int, choice: Long, seq: List<InequationType>, available: Set<Int>): Minmax { var min = 9999999999L var max = 0L if (seq.isEmpty()) { return Minmax(choice, ...
[ { "class_path": "daily-boj__RanolP__74294a4/P2529Kt$WhenMappings.class", "javap": "Compiled from \"P2529.kt\"\npublic final class P2529Kt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method InequationType.values:...
daily-boj__RanolP__74294a4/16117/solution.kt
fun main(args: Array<out String>) { val (height, width) = readLine()!!.split(" ").map { it.toInt() } val realMap = List(height * 2) { if (it % 2 == 0) { List(width * 2) { 0L } } else { readLine()!!.split(" ").flatMap { listOf(0L, it.toLong()) } } } fun ge...
[ { "class_path": "daily-boj__RanolP__74294a4/SolutionKt.class", "javap": "Compiled from \"solution.kt\"\npublic final class SolutionKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokestatic #15...
daily-boj__RanolP__74294a4/P9735.kt
import kotlin.math.* data class QuadraticEquation(val a: Long, val b: Long, val c: Long) { fun solve(): Set<Double> { val discriminant = b.toDouble() * b.toDouble() - 4.0 * a.toDouble() * c.toDouble() if (discriminant < 0) { return emptySet() } val sqrtedDiscriminant = s...
[ { "class_path": "daily-boj__RanolP__74294a4/P9735Kt.class", "javap": "Compiled from \"P9735.kt\"\npublic final class P9735Kt {\n public static final java.util.Set<java.lang.Double> syntheticDivision(long, long, long, long);\n Code:\n 0: lload 6\n 2: lconst_0\n 3: lcmp\n 4...
lmisea__lab-algos-2__948a9e5/proyecto-1/codigo/VerificadorTSP.kt
/** * Verificador de soluciones para el problema del vendedor viajero * Recibe como argumentos el archivo de instancia y el archivo de solucion * Imprime si la solucion es correcta o no y muestra algunos errores si los hay */ import java.io.BufferedReader import java.io.File import java.io.FileReader /** * Funcion: d...
[ { "class_path": "lmisea__lab-algos-2__948a9e5/VerificadorTSPKt.class", "javap": "Compiled from \"VerificadorTSP.kt\"\npublic final class VerificadorTSPKt {\n public static final double distancia2D(kotlin.Pair<java.lang.Double, java.lang.Double>, kotlin.Pair<java.lang.Double, java.lang.Double>);\n Code:\...
lmisea__lab-algos-2__948a9e5/parcial-1-Juan/AsignarCupo.kt
fun swapDual(A: Array<Int>, B: Array<Int>, i: Int, j: Int): Unit { val aux: Int = A[i] A[i] = A[j] A[j] = aux val temp: Int = B[i] B[i] = B[j] B[j] = temp } fun compararEstudiantes(A: Array<Int>, B: Array<Int>, i: Int, j: Int): Boolean{ return A[i] < A[j] || (A[i] == A[j] && B[i] <= B[j]) }...
[ { "class_path": "lmisea__lab-algos-2__948a9e5/AsignarCupoKt.class", "javap": "Compiled from \"AsignarCupo.kt\"\npublic final class AsignarCupoKt {\n public static final void swapDual(java.lang.Integer[], java.lang.Integer[], int, int);\n Code:\n 0: aload_0\n 1: ldc #9 ...
mr-kaffee__aoc-2022-kotlin__313432b/src/Day01.kt
import java.io.File fun main() { fun part1(elves: List<Int>): Int { return elves.fold(0) { mx, calories -> maxOf(mx, calories) } } fun part2(elves: List<Int>): Int { return elves.fold(mutableListOf(0, 0, 0)) { mx, calories -> if (calories > mx[0]) { mx[2] = mx[1...
[ { "class_path": "mr-kaffee__aoc-2022-kotlin__313432b/Day01Kt.class", "javap": "Compiled from \"Day01.kt\"\npublic final class Day01Kt {\n public static final void main();\n Code:\n 0: invokestatic #12 // Method java/lang/System.currentTimeMillis:()J\n 3: lstore_0\n 4: ...
ambrosil__aoc-2022__ebaacfc/src/Utils.kt
import java.io.File /** * Reads lines from the given input txt file. */ fun readInput(name: String) = File("src", "$name.txt") .readLines() fun String.allInts() = allIntsInString(this) fun allIntsInString(line: String): List<Int> { return """-?\d+""".toRegex().findAll(line) .map { it.value.toInt() }...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/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 ...
ambrosil__aoc-2022__ebaacfc/src/Day14.kt
import Type.* enum class Type { NONE, SAND, WALL } fun main() { fun parse(input: List<String>): MutableMap<Point, Type> { val terrain = mutableMapOf<Point, Type>() val walls = input.map { it.split(" -> ") .map { it.split(",") } .map { (x, y) -> Point(x.toInt(), y....
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day14Kt.class", "javap": "Compiled from \"Day14.kt\"\npublic final class Day14Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day14\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day04.kt
fun main() { fun part1(input: List<String>) = input .readRanges() .count { (first, second) -> first contains second || second contains first } fun part2(input: List<String>) = input .readRanges() .count { (first, secon...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day04Kt.class", "javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day04\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day12.kt
fun main() { class Terrain constructor(input: List<String>) { val distances: HashMap<Point, Int> = HashMap() var queue: ArrayDeque<Point> = ArrayDeque() var heightmap: List<List<Char>> = input.map { it.toList() } fun enqueue(point: Point, distance: Int) { if (distances[...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day12Kt$main$Terrain.class", "javap": "Compiled from \"Day12.kt\"\npublic final class Day12Kt$main$Terrain {\n private final java.util.HashMap<Point, java.lang.Integer> distances;\n\n private kotlin.collections.ArrayDeque<Point> queue;\n\n private java.util.Li...
ambrosil__aoc-2022__ebaacfc/src/Day16.kt
fun main() { val day16 = Day16(readInput("inputs/Day16")) println(day16.part1()) println(day16.part2()) } class Day16(input: List<String>) { private val valves = input.map(Valve::from).associateBy(Valve::name) private val usefulValves = valves.filter { it.value.rate > 0 } private val distances...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day16$State.class", "javap": "Compiled from \"Day16.kt\"\nfinal class Day16$State {\n private final java.lang.String current;\n\n private final int minutes;\n\n private final java.util.Set<Day16$Valve> opened;\n\n public Day16$State(java.lang.String, int, jav...
ambrosil__aoc-2022__ebaacfc/src/Day22.kt
fun main() { val d = Day22(readInput("inputs/Day22")) println(d.part1()) println(d.part2()) } class Day22(input: List<String>) { private val blockedPlaces: Set<Point> = parseBlockedPlaces(input) private val instructions: List<Instruction> = Instruction.ofList(input) fun part1(): Int = ...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day22Kt.class", "javap": "Compiled from \"Day22.kt\"\npublic final class Day22Kt {\n public static final void main();\n Code:\n 0: new #8 // class Day22\n 3: dup\n 4: ldc #10 // String inp...
ambrosil__aoc-2022__ebaacfc/src/Day17.kt
import java.io.File import kotlin.math.absoluteValue fun main() { val day17 = Day17(File("src/inputs/Day17.txt").readText()) println(day17.part1()) println(day17.part2()) } class Day17(input: String) { private val jets = jets(input) private val shapes = shapes() private val cave = (0..6).map ...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day17.class", "javap": "Compiled from \"Day17.kt\"\npublic final class Day17 {\n private final java.util.List<Point> jets;\n\n private final java.util.List<java.util.Set<Point>> shapes;\n\n private final java.util.Set<Point> cave;\n\n private final Point down...
ambrosil__aoc-2022__ebaacfc/src/Day23.kt
fun main() { val d = Day23(readInput("inputs/Day23")) println(d.part1()) println(d.part2()) } class Day23(input: List<String>) { private val startingPositions = parseInput(input) private val nextTurnOffsets: List<List<Point>> = createOffsets() fun part1(): Int { val locations = (0 unt...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/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: ldc #10 // String inp...
ambrosil__aoc-2022__ebaacfc/src/Day15.kt
import kotlin.math.abs import kotlin.math.sign fun main() { fun List<IntRange>.union(): List<IntRange> { val sorted = sortedBy { it.first } val init = mutableListOf(sorted.first()) return sortedBy { it.first }.fold(init) { acc, r -> val last = acc.last() if (r.fir...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day15Kt$main$union$$inlined$sortedBy$2.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class Day15Kt$main$union$$inlined$sortedBy$2<T> implements java.util.Comparator {\n public Day15Kt$main$union$$inlined$sortedBy$2();\n Code:\n 0: alo...
ambrosil__aoc-2022__ebaacfc/src/Day24.kt
fun main() { val d = Day24(readInput("inputs/Day24")) println(d.part1()) println(d.part2()) } class Day24(input: List<String>) { private val initialMapState: MapState = MapState.of(input) private val start: Point = Point(input.first().indexOfFirst { it == '.' }, 0) private val goal: Point = Po...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day24$Blizzard.class", "javap": "Compiled from \"Day24.kt\"\nfinal class Day24$Blizzard {\n private final Point location;\n\n private final Point offset;\n\n public Day24$Blizzard(Point, Point);\n Code:\n 0: aload_1\n 1: ldc #9 ...
ambrosil__aoc-2022__ebaacfc/src/Day05.kt
fun main() { data class Common(val input: List<String>) { lateinit var moves: List<String> lateinit var stacks: List<ArrayDeque<Char>> init { parse() } fun parse() { val map = input.groupBy { when { it.contains("...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day05Kt.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day05\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day21.kt
fun main() { data class Monkey(val name: String, val expr: String) fun Monkey.evaluateExpr(map: MutableMap<String, Long>): Long? { val parts = this.expr.split(" ") if (parts.size == 1) { return parts[0].toLong() } val name1 = parts.first() val name2 = parts....
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day21Kt.class", "javap": "Compiled from \"Day21.kt\"\npublic final class Day21Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day21\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day07.kt
fun main() { data class Node(val name: String, var size: Int = 0, val dir: Boolean = false, val parent: Node? = null) { fun propagateSize() { var curr = parent while (curr != null) { curr.size += size curr = curr.parent } } } ...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day07Kt$main$Common.class", "javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt$main$Common {\n private final java.util.List<java.lang.String> input;\n\n private final java.util.List<Day07Kt$main$Node> nodes;\n\n private final Day07Kt$main$Node ro...
ambrosil__aoc-2022__ebaacfc/src/Day10.kt
fun main() { data class Step(val cycle: Int, val sum: Int) fun run(input: List<String>): MutableList<Step>{ var cycle = 1 var sum = 1 val steps = mutableListOf<Step>() input.forEach { when (it) { "noop" -> steps.add(Step(cycle++, sum)) ...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day10Kt$main$Step.class", "javap": "Compiled from \"Day10.kt\"\npublic final class Day10Kt$main$Step {\n private final int cycle;\n\n private final int sum;\n\n public Day10Kt$main$Step(int, int);\n Code:\n 0: aload_0\n 1: invokespecial #9 ...
ambrosil__aoc-2022__ebaacfc/src/Day18.kt
fun main() { data class Cube(val x: Int, val y: Int, val z: Int) fun Cube.adjacents(): List<Cube> { return listOf( Cube(x+1, y, z), Cube(x-1, y, z), Cube(x, y+1, z), Cube(x, y-1, z), Cube(x, y, z+1), Cube(x, y, z-1), ) } fun parse(input: List<String>...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day18Kt$main$Cube.class", "javap": "Compiled from \"Day18.kt\"\npublic final class Day18Kt$main$Cube {\n private final int x;\n\n private final int y;\n\n private final int z;\n\n public Day18Kt$main$Cube(int, int, int);\n Code:\n 0: aload_0\n ...
ambrosil__aoc-2022__ebaacfc/src/Day11.kt
import kotlin.math.floor fun main() { data class Monkey( val items: MutableList<Long>, val operation: String, val divisor: Long, val trueMonkey: Int, val falseMonkey: Int, var inspections: Long = 0 ) fun parse(input: List<String>) = input ...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day11Kt$main$Monkey.class", "javap": "Compiled from \"Day11.kt\"\npublic final class Day11Kt$main$Monkey {\n private final java.util.List<java.lang.Long> items;\n\n private final java.lang.String operation;\n\n private final long divisor;\n\n private final in...
ambrosil__aoc-2022__ebaacfc/src/Day13.kt
private sealed class Packet : Comparable<Packet> { companion object { fun of(input: String): Packet = of(input.split("""((?<=[\[\],])|(?=[\[\],]))""".toRegex()) .filter { it.isNotBlank() } .filter { it != "," } .iterator() )...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day13Kt.class", "javap": "Compiled from \"Day13.kt\"\npublic final class Day13Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day13\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day03.kt
fun main() { fun Set<Char>.score(): Int { val c = single() return if (c.isLowerCase()) { 1 + (c - 'a') } else { 27 + (c - 'A') } } fun String.halve(): List<String> { val half = length / 2 return listOf(substring(0, half), substring(ha...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day03Kt.class", "javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day03\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day02.kt
import Sign.* import java.lang.RuntimeException enum class Sign { ROCK, PAPER, SCISSORS } data class Round(val opponent: Sign, val mine: Sign) { private fun signPoints() = when (mine) { ROCK -> 1 PAPER -> 2 SCISSORS -> 3 } private fun matchPoints() = ...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day02Kt.class", "javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day02\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day09.kt
import kotlin.math.abs import kotlin.math.sign fun main() { infix fun Point.follow(head: Point) { val dx = head.x - x val dy = head.y - y if (abs(dx) > 1 || abs(dy) > 1) { this += Point(dx.sign, dy.sign) } } fun part1(input: List<String>): Int { val he...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day09Kt.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day09\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day08.kt
fun main() { fun part1(input: List<String>): Int { val matrix = input.map { it.toList() } return matrix.count { row, col -> matrix.visible(row, col) } } fun part2(input: List<String>): Int { val matrix = input.map { it.toList() } return matrix.maxOf { row, col -> matrix.sco...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day08Kt.class", "javap": "Compiled from \"Day08.kt\"\npublic final class Day08Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day08\n 2: invokestatic #14 // Method UtilsKt.re...
ambrosil__aoc-2022__ebaacfc/src/Day01.kt
fun main() { fun part1(input: List<String>): Int { var elfNum = 0 return input.groupBy { if (it.isBlank()) elfNum++; elfNum } .map { elf -> elf.value.filterNot { calories -> calories.isBlank() } } .maxOf { it.sumOf { n -> n.toInt() } } } fun part2(inp...
[ { "class_path": "ambrosil__aoc-2022__ebaacfc/Day01Kt.class", "javap": "Compiled from \"Day01.kt\"\npublic final class Day01Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String inputs/Day01\n 2: invokestatic #14 // Method UtilsKt.re...
jkesanen__adventofcode__e4be057/2023/src/main/kotlin/Advent2306.kt
import java.io.File import kotlin.math.max class Advent2306 { private fun chargeToDistance(charge: Long, duration: Long): Long { val timeLeft = duration - charge return charge * max(0, timeLeft) } private fun getBestResults(filename: String): List<Pair<Long, Long>> { val times = mu...
[ { "class_path": "jkesanen__adventofcode__e4be057/Advent2306.class", "javap": "Compiled from \"Advent2306.kt\"\npublic final class Advent2306 {\n public Advent2306();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n p...
fufaevlad__hyperskill_test_cinema_room_manager__b81d03b/cinema_manager.kt
var ifCount = 0 var elseCount = 0 const val cheapSeatCoast = 8 const val expSeatCoast = 10 fun main() { val (rows,seats) = greeting() val cinema = mutListCreator(rows) boardFiller(cinema,rows,seats) multipleChoise(cinema,rows,seats) } fun greeting(): Pair<Int,Int>{ println("Enter the number of r...
[ { "class_path": "fufaevlad__hyperskill_test_cinema_room_manager__b81d03b/Cinema_managerKt.class", "javap": "Compiled from \"cinema_manager.kt\"\npublic final class Cinema_managerKt {\n private static int ifCount;\n\n private static int elseCount;\n\n public static final int cheapSeatCoast;\n\n public st...
ersushantsood__kotlinSamples__94aab4e/src/main/kotlin/LambdasCollections.kt
fun main() { val li = listOf<Int>(1,2,3,4) println(li.filter({i:Int -> i%2 ==0})) //Map operation println (li.map { it * 2 }) val lstNumbers = listOf<Number>(Number("one",1),Number("two",2),Number("three",3)) println("Numbers:"+lstNumbers.map { it.name }) //Find and groupBy val li...
[ { "class_path": "ersushantsood__kotlinSamples__94aab4e/LambdasCollectionsKt.class", "javap": "Compiled from \"LambdasCollections.kt\"\npublic final class LambdasCollectionsKt {\n public static final void main();\n Code:\n 0: iconst_4\n 1: anewarray #8 // class java/lang/...
Lank891__Advent-of-Code-2021__4164b70/Day 05 - Kotlin/source.kt
import java.io.File import kotlin.math.sign const val boardSize: Int = 1000; typealias XY = Pair<Int, Int>; typealias VentPath = Pair<XY, XY>; typealias Board = Array<Array<Int>> fun ventPathToString(path: VentPath): String { return "Path (${path.first.first}, ${path.first.second}) -> (${path.second.first}, ${pa...
[ { "class_path": "Lank891__Advent-of-Code-2021__4164b70/SourceKt.class", "javap": "Compiled from \"source.kt\"\npublic final class SourceKt {\n public static final int boardSize;\n\n public static final java.lang.String ventPathToString(kotlin.Pair<kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin....
Matheus-Inacioal__AtividadesKotlinQualificaResolucao__9ce1df3/AtvRevisao/Atv3.kt
fun main() { val numbers = mutableListOf<Int>() println("Digite uma série de números separados por espaços (ou '0' para sair):") while (true) { val input = readLine() if (input == "0") { break } val number = input?.toIntOrNull() if (number != null) { ...
[ { "class_path": "Matheus-Inacioal__AtividadesKotlinQualificaResolucao__9ce1df3/Atv3Kt.class", "javap": "Compiled from \"Atv3.kt\"\npublic final class Atv3Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/util/ArrayList\n 3: dup\n 4: in...
ReciHub__FunnyAlgorithms__24518dd/Rat Maze Problem/RatMaze.kt
/** * @created October 2, 2019 * Kotlin Program that solves Rat in a maze problem using backtracking. */ class RatMaze { // Size of the maze. private var n: Int = 0 // Just in case. Primitive types cannot be lateinit. private lateinit var solution: Array<IntArray> private lateinit var maze: Array<In...
[ { "class_path": "ReciHub__FunnyAlgorithms__24518dd/RatMaze.class", "javap": "Compiled from \"RatMaze.kt\"\npublic final class RatMaze {\n private int n;\n\n private int[][] solution;\n\n private int[][] maze;\n\n public RatMaze();\n Code:\n 0: aload_0\n 1: invokespecial #8 ...
ReciHub__FunnyAlgorithms__24518dd/BellmanFord/bellmanford.kt
class Edge(val source: Int, val destination: Int, val weight: Int) class Graph(val vertices: Int, val edges: List<Edge>) { fun bellmanFord(startVertex: Int) { val distance = IntArray(vertices) { Int.MAX_VALUE } distance[startVertex] = 0 for (i in 1 until vertices) { for (edge i...
[ { "class_path": "ReciHub__FunnyAlgorithms__24518dd/BellmanfordKt.class", "javap": "Compiled from \"bellmanford.kt\"\npublic final class BellmanfordKt {\n public static final void main();\n Code:\n 0: iconst_5\n 1: istore_0\n 2: bipush 8\n 4: anewarray #8 ...
emergent__ProjectEuler__d04f502/Kotlin/problem021.kt
// Problem 21 - Project Euler // http://projecteuler.net/index.php?section=problems&id=21 import kotlin.math.* fun divisors(x: Int): List<Int> { val lim = ceil(sqrt(x.toDouble())).toInt() return (1..lim) .map { n -> if (x % n == 0) listOf(n, x/n) else null } ...
[ { "class_path": "emergent__ProjectEuler__d04f502/Problem021Kt.class", "javap": "Compiled from \"problem021.kt\"\npublic final class Problem021Kt {\n public static final java.util.List<java.lang.Integer> divisors(int);\n Code:\n 0: iload_0\n 1: i2d\n 2: invokestatic #14 ...
emergent__ProjectEuler__d04f502/Kotlin/problem011.kt
// Problem 11 - Project Euler // http://projecteuler.net/index.php?section=problems&id=11 fun main(args: Array<String>) { val d = """ 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 52...
[ { "class_path": "emergent__ProjectEuler__d04f502/Problem011Kt.class", "javap": "Compiled from \"problem011.kt\"\npublic final class Problem011Kt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invoke...
alexy2008__HelloPrime__dac2f59/original/Kotlin/KtHelloPrime.kt
import kotlin.math.ceil import kotlin.math.pow fun primeByEuler(page: Int, prime: KtPrime) { val num = BooleanArray(page) for (i in 2 until page) { if (!num[i]) prime.add(i.toLong()) for (j in 0 until prime.size() ){ if (i.toLong() * prime.getitem(j) >= page) break num[(...
[ { "class_path": "alexy2008__HelloPrime__dac2f59/KtHelloPrimeKt.class", "javap": "Compiled from \"KtHelloPrime.kt\"\npublic final class KtHelloPrimeKt {\n public static final void primeByEuler(int, KtPrime);\n Code:\n 0: aload_1\n 1: ldc #9 // String prime\n 3...
gavq__kakuro-kotlin__413f26d/src/main/kotlin/main.kt
fun pad2(n: Int): String { val s = "$n" return if (s.length < 2) " $s" else s } interface ICell { fun draw(): String } interface IDown { val down: Int } interface IAcross { val across: Int } // singleton object EmptyCell : ICell { override fun toString() = "EmptyCell" override fun draw(...
[ { "class_path": "gavq__kakuro-kotlin__413f26d/MainKt$drawRow$1.class", "javap": "Compiled from \"main.kt\"\nfinal class MainKt$drawRow$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<ICell, java.lang.String> {\n public static final MainKt$drawRow$1 INSTANCE;\n\...
TonnyL__Windary__39f85cd/Kotlin/src/CombinationSumII.kt
/** * Given a collection of candidate numbers (C) and a target number (T), * find all unique combinations in C where the candidate numbers sums to T. * * Each number in C may only be used once in the combination. * * Note: * All numbers (including target) will be positive integers. * The solution set must not c...
[ { "class_path": "TonnyL__Windary__39f85cd/CombinationSumII.class", "javap": "Compiled from \"CombinationSumII.kt\"\npublic final class CombinationSumII {\n public CombinationSumII();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n ...
TonnyL__Windary__39f85cd/Kotlin/src/UniqueBinarySearchTreesII.kt
/** * Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. * * For example, * Given n = 3, your program should return all 5 unique BST's shown below. * * 1 3 3 2 1 * \ / / / \ \ * 3 2 1 1 3 2 * / /...
[ { "class_path": "TonnyL__Windary__39f85cd/UniqueBinarySearchTreesII.class", "javap": "Compiled from \"UniqueBinarySearchTreesII.kt\"\npublic final class UniqueBinarySearchTreesII {\n public UniqueBinarySearchTreesII();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method jav...
TonnyL__Windary__39f85cd/Kotlin/src/ThreeSum.kt
/** * Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? * Find all unique triplets in the array which gives the sum of zero. * * Note: The solution set must not contain duplicate triplets. * * For example, given array S = [-1, 0, 1, 2, -1, -4], * * A solution set is: * [ ...
[ { "class_path": "TonnyL__Windary__39f85cd/ThreeSum.class", "javap": "Compiled from \"ThreeSum.kt\"\npublic final class ThreeSum {\n public ThreeSum();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final jav...
TonnyL__Windary__39f85cd/Kotlin/src/SubsetsII.kt
/** * Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). * * Note: The solution set must not contain duplicate subsets. * * For example, * If nums = [1,2,2], a solution is: * * [ * [2], * [1], * [1,2,2], * [2,2], * [1,2], * [] * ] * * Accept...
[ { "class_path": "TonnyL__Windary__39f85cd/SubsetsII.class", "javap": "Compiled from \"SubsetsII.kt\"\npublic final class SubsetsII {\n public SubsetsII();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final...
TonnyL__Windary__39f85cd/Kotlin/src/ThreeSumClosest.kt
/** * Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. * Return the sum of the three integers. * You may assume that each input would have exactly one solution. * * For example, given array S = {-1 2 1 -4}, and target = 1. * * The sum that is closes...
[ { "class_path": "TonnyL__Windary__39f85cd/ThreeSumClosest.class", "javap": "Compiled from \"ThreeSumClosest.kt\"\npublic final class ThreeSumClosest {\n public ThreeSumClosest();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: ...
TonnyL__Windary__39f85cd/Kotlin/src/LetterCombinationsOfAPhoneNumber.kt
/** * Given a digit string, return all possible letter combinations that the number could represent. * * A mapping of digit to letters (just like on the telephone buttons) is given below. * * Input:Digit string "23" * Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. * Note: * Although the above a...
[ { "class_path": "TonnyL__Windary__39f85cd/LetterCombinationsOfAPhoneNumber.class", "javap": "Compiled from \"LetterCombinationsOfAPhoneNumber.kt\"\npublic final class LetterCombinationsOfAPhoneNumber {\n public LetterCombinationsOfAPhoneNumber();\n Code:\n 0: aload_0\n 1: invokespecial #8 ...
TonnyL__Windary__39f85cd/Kotlin/src/SearchInRotatedSortedArrayII.kt
import java.util.Arrays /** * Follow up for "Search in Rotated Sorted Array": * What if duplicates are allowed? * * Would this affect the run-time complexity? How and why? * * Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. * * (i.e., 0 1 2 4 5 6 7 might become 4 ...
[ { "class_path": "TonnyL__Windary__39f85cd/SearchInRotatedSortedArrayII.class", "javap": "Compiled from \"SearchInRotatedSortedArrayII.kt\"\npublic final class SearchInRotatedSortedArrayII {\n public SearchInRotatedSortedArrayII();\n Code:\n 0: aload_0\n 1: invokespecial #8 /...
TonnyL__Windary__39f85cd/Kotlin/src/Permutations.kt
/** * Given a collection of distinct numbers, return all possible permutations. * * For example, * [1,2,3] have the following permutations: * [ * [1,2,3], * [1,3,2], * [2,1,3], * [2,3,1], * [3,1,2], * [3,2,1] * ] * * Accepted. */ class Permutations { fun permute(nums: IntArray): List<List<Int>> { ...
[ { "class_path": "TonnyL__Windary__39f85cd/Permutations.class", "javap": "Compiled from \"Permutations.kt\"\npublic final class Permutations {\n public Permutations();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n ...
TonnyL__Windary__39f85cd/Kotlin/src/MinimumPathSum.kt
/** * Given a m x n grid filled with non-negative numbers, * find a path from top left to bottom right which minimizes the sum of all numbers along its path. * * Note: You can only move either down or right at any point in time. * * Example 1: * [[1,3,1], * [1,5,1], * [4,2,1]] * Given the above grid map, retu...
[ { "class_path": "TonnyL__Windary__39f85cd/MinimumPathSum.class", "javap": "Compiled from \"MinimumPathSum.kt\"\npublic final class MinimumPathSum {\n public MinimumPathSum();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: retu...
TonnyL__Windary__39f85cd/Kotlin/src/NextPermutation.kt
/** * Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. * * If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). * * The replacement must be in-place, do not allocate extra memory. ...
[ { "class_path": "TonnyL__Windary__39f85cd/NextPermutation.class", "javap": "Compiled from \"NextPermutation.kt\"\npublic final class NextPermutation {\n public NextPermutation();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: ...
TonnyL__Windary__39f85cd/Kotlin/src/UniqueBinarySearchTrees.kt
/** * Given n, how many structurally unique BST's (binary search trees) that store values 1...n? * * For example, * Given n = 3, there are a total of 5 unique BST's. * * 1 3 3 2 1 * \ / / / \ \ * 3 2 1 1 3 2 * / / \ \ * 2 ...
[ { "class_path": "TonnyL__Windary__39f85cd/UniqueBinarySearchTrees.class", "javap": "Compiled from \"UniqueBinarySearchTrees.kt\"\npublic final class UniqueBinarySearchTrees {\n public UniqueBinarySearchTrees();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/O...
TonnyL__Windary__39f85cd/Kotlin/src/Combinations.kt
/** * Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. * * For example, * If n = 4 and k = 2, a solution is: * * [ * [2,4], * [3,4], * [2,3], * [1,2], * [1,3], * [1,4], * ] */ class Combinations { // Iterative solution. // Accepted. fun combine(n: Int,...
[ { "class_path": "TonnyL__Windary__39f85cd/Combinations.class", "javap": "Compiled from \"Combinations.kt\"\npublic final class Combinations {\n public Combinations();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n ...
TonnyL__Windary__39f85cd/Kotlin/src/FourSum.kt
/** * Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? * Find all unique quadruplets in the array which gives the sum of target. * * Note: The solution set must not contain duplicate quadruplets. * * For example, given array S = [1, 0, -1, 0, -2, 2], and tar...
[ { "class_path": "TonnyL__Windary__39f85cd/FourSum.class", "javap": "Compiled from \"FourSum.kt\"\npublic final class FourSum {\n public FourSum();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public final java.ut...
TonnyL__Windary__39f85cd/Kotlin/src/WordSearch.kt
/** * Given a 2D board and a word, find if the word exists in the grid. * * The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. * The same letter cell may not be used more than once. * * For example, * Given board = * ...
[ { "class_path": "TonnyL__Windary__39f85cd/WordSearch.class", "javap": "Compiled from \"WordSearch.kt\"\npublic final class WordSearch {\n public WordSearch();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: return\n\n public f...
TonnyL__Windary__39f85cd/Kotlin/src/CombinationSum.kt
/** * Given a set of candidate numbers (C) (without duplicates) and a target number (T), * find all unique combinations in C where the candidate numbers sums to T. * * The same repeated number may be chosen from C unlimited number of times. * * Note: * All numbers (including target) will be positive integers. *...
[ { "class_path": "TonnyL__Windary__39f85cd/CombinationSum.class", "javap": "Compiled from \"CombinationSum.kt\"\npublic final class CombinationSum {\n public CombinationSum();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: retu...
TonnyL__Windary__39f85cd/Kotlin/src/PermutationsII.kt
/** * Given a collection of numbers that might contain duplicates, return all possible unique permutations. * * For example, * [1,1,2] have the following unique permutations: * [ * [1,1,2], * [1,2,1], * [2,1,1] * ] * * Accepted. */ class PermutationsII { fun permuteUnique(nums: IntArray): List<List<Int...
[ { "class_path": "TonnyL__Windary__39f85cd/PermutationsII.class", "javap": "Compiled from \"PermutationsII.kt\"\npublic final class PermutationsII {\n public PermutationsII();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: retu...
TonnyL__Windary__39f85cd/Kotlin/src/LongestPalindromicSubstring.kt
/** * Given a string s, find the longest palindromic substring in s. * You may assume that the maximum length of s is 1000. * * Example: * * Input: "babad" * * Output: "bab" * * Note: "aba" is also a valid answer. * Example: * * Input: "cbbd" * * Output: "bb" * * Accepted. */ class LongestPalindromicS...
[ { "class_path": "TonnyL__Windary__39f85cd/LongestPalindromicSubstring.class", "javap": "Compiled from \"LongestPalindromicSubstring.kt\"\npublic final class LongestPalindromicSubstring {\n public LongestPalindromicSubstring();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Me...
TonnyL__Windary__39f85cd/Kotlin/src/SearchA2DMatrix.kt
/** * Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: * * Integers in each row are sorted from left to right. * The first integer of each row is greater than the last integer of the previous row. * For example, * * Consider the following matrix...
[ { "class_path": "TonnyL__Windary__39f85cd/SearchA2DMatrix.class", "javap": "Compiled from \"SearchA2DMatrix.kt\"\npublic final class SearchA2DMatrix {\n public SearchA2DMatrix();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n 4: ...
InertExpert2911__Kotlin-Projects__9ec619b/listFunctions.kt
// GATHERING A LIST OF VALUES fun getListOfNumbers() : List<Int> { var myList = mutableListOf <Int> () for(i in 1..7){ println("Enter a number:") var Number = Integer.valueOf(readLine()) myList.add(Number) } return myList } // FINDING THE MAX VALUE fun findMax(maxList : List<Int>) : Int { var ...
[ { "class_path": "InertExpert2911__Kotlin-Projects__9ec619b/ListFunctionsKt.class", "javap": "Compiled from \"listFunctions.kt\"\npublic final class ListFunctionsKt {\n public static final java.util.List<java.lang.Integer> getListOfNumbers();\n Code:\n 0: new #10 // class ...
codinasion__codinasion__98267f3/program/program/find-the-adjoint-of-a-matrix/FindTheAdjointOfAMatrix.kt
fun main() { val matrixA = listOf( listOf(1, 2, 3), listOf(4, 5, 6), listOf(7, 8, 9) ) val matrixAdjoint = calculateAdjoint(matrixA) println("Input (A): $matrixA") println("Matrix of Adjoint (A*): $matrixAdjoint") } fun calculateAdjoint(matrix: List<List<Int>>): List<List<...
[ { "class_path": "codinasion__codinasion__98267f3/FindTheAdjointOfAMatrixKt.class", "javap": "Compiled from \"FindTheAdjointOfAMatrix.kt\"\npublic final class FindTheAdjointOfAMatrixKt {\n public static final void main();\n Code:\n 0: iconst_3\n 1: anewarray #8 // class j...
Kvest__AOC2022__6409e65/src/Utils.kt
import java.io.File import java.math.BigInteger import java.security.MessageDigest import kotlin.math.abs typealias Matrix = Array<IntArray> typealias BooleanMatrix = Array<BooleanArray> typealias Int3DMatrix = Array<Array<IntArray>> typealias Boolean3DMatrix = Array<Array<BooleanArray>> /** * Reads lines from the g...
[ { "class_path": "Kvest__AOC2022__6409e65/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 3...
Kvest__AOC2022__6409e65/src/Day14.kt
import kotlin.math.max import kotlin.math.min fun main() { val testInput = readInput("Day14_test") check(part1(testInput) == 24) check(part2(testInput) == 93) val input = readInput("Day14") println(part1(input)) println(part2(input)) } private val SAND_START_POINT = XY(500, 0) private fun pa...
[ { "class_path": "Kvest__AOC2022__6409e65/Day14Kt.class", "javap": "Compiled from \"Day14.kt\"\npublic final class Day14Kt {\n private static final XY SAND_START_POINT;\n\n public static final void main();\n Code:\n 0: ldc #8 // String Day14_test\n 2: invokestatic ...
Kvest__AOC2022__6409e65/src/Day04.kt
fun main() { val testInput = readInput("Day04_test") check(part1(testInput) == 2) check(part2(testInput) == 4) val input = readInput("Day04") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): Int { return input .map(String::parseSectionRanges) ...
[ { "class_path": "Kvest__AOC2022__6409e65/Day04Kt.class", "javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n private static final kotlin.text.Regex ROW_FORMAT;\n\n public static final void main();\n Code:\n 0: ldc #8 // String Day04_test\n 2: invo...
Kvest__AOC2022__6409e65/src/Day15.kt
import java.util.* import kotlin.math.abs import kotlin.math.max import kotlin.time.ExperimentalTime @ExperimentalTime fun main() { val testInput = readInput("Day15_test") val (testSensors, testBeacons) = parseInput(testInput) check(part1(testSensors, testBeacons, targetLine = 10) == 26) check(part2(te...
[ { "class_path": "Kvest__AOC2022__6409e65/Day15Kt$calculateLineCoverage$$inlined$sortedBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class Day15Kt$calculateLineCoverage$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public Day15Kt$calculateLineCoverage$$inlined$sortedBy$1...
Kvest__AOC2022__6409e65/src/Day22.kt
fun main() { val testInput = readInput("Day22_test") val testMap = testInput.subList(0, testInput.size - 2).toMap() val testPath = testInput.last().parsePath() check(part1(testMap, testPath) == 6032) check(part2(testMap, testMap.buildTestCubeAdjacentMap(), testPath) == 5031) val input = readInp...
[ { "class_path": "Kvest__AOC2022__6409e65/Day22Kt.class", "javap": "Compiled from \"Day22.kt\"\npublic final class Day22Kt {\n private static final int VOID;\n\n private static final int OPEN;\n\n private static final int WALL;\n\n private static final int RIGHT;\n\n private static final int DOWN;\n\n ...
Kvest__AOC2022__6409e65/src/Day23.kt
import kotlin.math.max import kotlin.math.min fun main() { val testInput = readInput("Day23_test") check(part1(testInput) == 110) check(part2(testInput) == 20) val input = readInput("Day23") println(part1(input)) println(part2(input)) } private val DIRECTIONS = listOf( //N, NE, NW lis...
[ { "class_path": "Kvest__AOC2022__6409e65/Day23Kt.class", "javap": "Compiled from \"Day23.kt\"\npublic final class Day23Kt {\n private static final java.util.List<java.util.List<int[]>> DIRECTIONS;\n\n private static final java.util.List<int[]> ALL_ADJACENT;\n\n public static final void main();\n Code:...
Kvest__AOC2022__6409e65/src/Day05.kt
import java.util.* fun main() { val testInput = readInput("Day05_test") check(part1(testInput) == "CMZ") check(part2(testInput) == "MCD") val input = readInput("Day05") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): String = solve(input) { stacks, cm...
[ { "class_path": "Kvest__AOC2022__6409e65/Day05Kt.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n private static final kotlin.text.Regex COMMAND_FORMAT;\n\n public static final void main();\n Code:\n 0: ldc #8 // String Day05_test\n 2: ...
Kvest__AOC2022__6409e65/src/Day21.kt
fun main() { val testInput = readInput("Day21_test") val testOperations = testInput.toOperations() check(part1(testOperations) == 152L) check(part2(testOperations) == 301L) val input = readInput("Day21") val operations = input.toOperations() println(part1(operations)) println(part2(oper...
[ { "class_path": "Kvest__AOC2022__6409e65/Day21Kt.class", "javap": "Compiled from \"Day21.kt\"\npublic final class Day21Kt {\n private static final java.lang.String TARGET_OPERATION;\n\n public static final void main();\n Code:\n 0: ldc #8 // String Day21_test\n 2:...
Kvest__AOC2022__6409e65/src/Day17.kt
import java.util.* fun main() { val testInput = readInput("Day17_test")[0] check(part1(testInput) == 3068) check(part2(testInput) == 1514285714288L) val input = readInput("Day17")[0] println(part1(input)) println(part2(input)) } private const val PART1_ROCKS_COUNT = 2022 private const val PAR...
[ { "class_path": "Kvest__AOC2022__6409e65/Day17Kt.class", "javap": "Compiled from \"Day17.kt\"\npublic final class Day17Kt {\n private static final int PART1_ROCKS_COUNT;\n\n private static final long PART2_ROCKS_COUNT;\n\n private static final int PATTERN_SIZE;\n\n private static final int LEFT_BORDER;\...
Kvest__AOC2022__6409e65/src/Day07.kt
import java.util.* fun main() { val testInput = readInput("Day07_test") val testRoot = buildFileSystem(testInput) val testSizeCache = mutableMapOf<Node, Long>() check(part1(testRoot, testSizeCache) == 95437L) check(part2(testRoot, testSizeCache) == 24933642L) val input = readInput("Day07") ...
[ { "class_path": "Kvest__AOC2022__6409e65/Day07Kt.class", "javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt {\n private static final long MAX;\n\n private static final long TOTAL_SPACE;\n\n private static final long TARGET_FREE_SPACE;\n\n public static final void main();\n Code:\n ...
Kvest__AOC2022__6409e65/src/Day06.kt
fun main() { val testInput = readInput("Day06_test") check(part1(testInput[0]) == 5) check(part1(testInput[1]) == 6) check(part1(testInput[2]) == 10) check(part1(testInput[3]) == 11) check(part2(testInput[0]) == 23) check(part2(testInput[1]) == 23) check(part2(testInput[2]) == 29) c...
[ { "class_path": "Kvest__AOC2022__6409e65/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 UtilsKt.readInpu...
Kvest__AOC2022__6409e65/src/Day16.kt
import java.util.* import kotlin.math.max fun main() { val testInput = readInput("Day16_test") check(part1(testInput) == 1651) check(part2(testInput) == 1707) val input = readInput("Day16") println(part1(input)) println(part2(input)) } private const val PART1_MINUTES = 30 private const val PA...
[ { "class_path": "Kvest__AOC2022__6409e65/Day16Kt.class", "javap": "Compiled from \"Day16.kt\"\npublic final class Day16Kt {\n private static final int PART1_MINUTES;\n\n private static final int PART2_MINUTES;\n\n private static final java.lang.String START_VALVE;\n\n private static final kotlin.text.Re...
Kvest__AOC2022__6409e65/src/Day20.kt
fun main() { val testInput = readInput("Day20_test") check(part1(testInput) == 3L) check(part2(testInput) == 1623178306L) val input = readInput("Day20") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): Long = solve(input, String::toLong, mixesCount = 1) pri...
[ { "class_path": "Kvest__AOC2022__6409e65/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 UtilsKt.readInpu...
Kvest__AOC2022__6409e65/src/Day25.kt
fun main() { val testInput = readInput("Day25_test") check(part1(testInput) == "2=-1=0") val input = readInput("Day25") println(part1(input)) } private fun part1(input: List<String>): String { val sum = input.sumOf(String::SNAFUToInt) return sum.toSNAFU() } private fun String.SNAFUToInt(): L...
[ { "class_path": "Kvest__AOC2022__6409e65/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 UtilsKt.readInpu...
Kvest__AOC2022__6409e65/src/Day13.kt
fun main() { val testInput = readInput("Day13_test") check(part1(testInput) == 13) check(part2(testInput) == 140) val input = readInput("Day13") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): Int { return input.windowed(size = 2, step = 3) .ma...
[ { "class_path": "Kvest__AOC2022__6409e65/Day13Kt.class", "javap": "Compiled from \"Day13.kt\"\npublic final class Day13Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day13_test\n 2: invokestatic #14 // Method UtilsKt.readInpu...
Kvest__AOC2022__6409e65/src/Day03.kt
fun main() { val testInput = readInput("Day03_test") check(part1(testInput) == 157) check(part2(testInput) == 70) val input = readInput("Day03") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): Int { return input.sumOf(::calculatePriority) } private fu...
[ { "class_path": "Kvest__AOC2022__6409e65/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 UtilsKt.readInpu...
Kvest__AOC2022__6409e65/src/Day02.kt
fun main() { val testInput = readInput("Day02_test") check(part1(testInput) == 15) check(part2(testInput) == 12) val input = readInput("Day02") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): Int { return input.sumOf(String::toScore) } private fun par...
[ { "class_path": "Kvest__AOC2022__6409e65/Day02Kt.class", "javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n private static final java.util.Map<java.lang.String, java.lang.Integer> SCORES;\n\n private static final java.util.Map<java.lang.String, java.lang.String> CORRECTIONS;\n\n public ...
Kvest__AOC2022__6409e65/src/Day12.kt
import java.util.* fun main() { val testInput = readInput("Day12_test") check(part1(testInput) == 31) check(part2(testInput) == 29) val input = readInput("Day12") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>, ): Int = solve(input, startMarkers = setOf('...
[ { "class_path": "Kvest__AOC2022__6409e65/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.readInpu...
Kvest__AOC2022__6409e65/src/Day24.kt
import java.util.* fun main() { val testInput = readInput("Day24_test") val testMap = BlizzardMap(testInput) check(part1(testMap) == 18) check(part2(testMap) == 54) val input = readInput("Day24") val map = BlizzardMap(input) println(part1(map)) println(part2(map)) } private fun part1(...
[ { "class_path": "Kvest__AOC2022__6409e65/Day24Kt.class", "javap": "Compiled from \"Day24.kt\"\npublic final class Day24Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day24_test\n 2: invokestatic #14 // Method UtilsKt.readInpu...
Kvest__AOC2022__6409e65/src/Day09.kt
import kotlin.math.abs import kotlin.math.sign fun main() { val testInput1 = readInput("Day09_test1") val testInput2 = readInput("Day09_test2") check(part1(testInput1) == 13) check(part2(testInput1) == 1) check(part2(testInput2) == 36) val input = readInput("Day09") println(part1(input)) ...
[ { "class_path": "Kvest__AOC2022__6409e65/Day09Kt.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day09_test1\n 2: invokestatic #14 // Method UtilsKt.readInp...
Kvest__AOC2022__6409e65/src/Day19.kt
import kotlin.math.max import kotlin.math.min fun main() { val testInput = readInput("Day19_test") val testBlueprints = testInput.map(Blueprint.Companion::fromString) check(part1(testBlueprints) == 33) val input = readInput("Day19") val blueprints = input.map(Blueprint.Companion::fromString) p...
[ { "class_path": "Kvest__AOC2022__6409e65/Day19Kt.class", "javap": "Compiled from \"Day19.kt\"\npublic final class Day19Kt {\n private static final kotlin.text.Regex BLUEPRINT_FORMAT;\n\n public static final void main();\n Code:\n 0: ldc #8 // String Day19_test\n 2...
Kvest__AOC2022__6409e65/src/Day18.kt
import kotlin.math.max fun main() { val testInput = readInput("Day18_test") check(part1(testInput) == 64) check(part2(testInput) == 58) val input = readInput("Day18") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): Int { val cubes = input.to3DMatrix()...
[ { "class_path": "Kvest__AOC2022__6409e65/Day18Kt.class", "javap": "Compiled from \"Day18.kt\"\npublic final class Day18Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day18_test\n 2: invokestatic #14 // Method UtilsKt.readInpu...
Kvest__AOC2022__6409e65/src/Day08.kt
fun main() { val testInput = readInput("Day08_test").toMatrix() check(part1(testInput) == 21) check(part2(testInput) == 8) val input = readInput("Day08").toMatrix() println(part1(input)) println(part2(input)) } private fun part1(input: Matrix): Int { val width = input[0].size val heigh...
[ { "class_path": "Kvest__AOC2022__6409e65/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.readInpu...
Kvest__AOC2022__6409e65/src/Day01.kt
fun main() { // test if implementation meets criteria from the description, like: val testInput = readInput("Day01_test") check(part1(testInput) == 24000) check(part2(testInput) == 45000) val input = readInput("Day01") println(part1(input)) println(part2(input)) } private fun part1(input: ...
[ { "class_path": "Kvest__AOC2022__6409e65/Day01Kt.class", "javap": "Compiled from \"Day01.kt\"\npublic final class Day01Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day01_test\n 2: invokestatic #14 // Method UtilsKt.readInpu...
Kvest__AOC2022__6409e65/src/Day11.kt
import java.util.* fun main() { val testInput = readInput("Day11_test") check(part1(testInput) == 10605L) check(part2(testInput) == 2713310158L) val input = readInput("Day11") println(part1(input)) println(part2(input)) } private fun part1(input: List<String>): Long { val monkeys = input....
[ { "class_path": "Kvest__AOC2022__6409e65/Day11Kt.class", "javap": "Compiled from \"Day11.kt\"\npublic final class Day11Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String Day11_test\n 2: invokestatic #14 // Method UtilsKt.readInpu...
getupminaaa__Algorithm__01187e2/Algorithm/src/main/kotlin/programmers/level1/personalInfoCollectionValidityPeriod.kt
import java.util.* fun main() { val solution = Solution() val terms: Array<String> = arrayOf("A 6", "B 12", "C 3") val privacies: Array<String> = arrayOf("2021.05.02 A", "2021.07.01 B", "2022.02.19 C", "2022.02.20 C") solution.solution(today = "2022.05.19", terms, privacies) } class Solution { fu...
[ { "class_path": "getupminaaa__Algorithm__01187e2/PersonalInfoCollectionValidityPeriodKt.class", "javap": "Compiled from \"personalInfoCollectionValidityPeriod.kt\"\npublic final class PersonalInfoCollectionValidityPeriodKt {\n public static final void main();\n Code:\n 0: new #8 ...
saikatsgupta__aoc-2022-in-kotlin__2c491a9/src/Day03.kt
fun main() { fun Char.getPriority(): Int { return when { isUpperCase() -> code - 'A'.code + 27 else -> code - 'a'.code + 1 } } fun part1(input: List<String>): Int { return input.sumOf { val compartment1 = it.take(it.length / 2) val co...
[ { "class_path": "saikatsgupta__aoc-2022-in-kotlin__2c491a9/Day03Kt.class", "javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: return\n\n public static void main(java.lang.String[]);\n Code:\n 0: invokestatic #9 ...
iam-abbas__cs-algorithms__d04aa8f/Kotlin/heap_sort_in_kotlin.kt
var heapSize = 0 fun left(i: Int): Int { return 2 * i } fun right(i: Int): Int { return 2 * i + 1 } fun swap(A: Array<Int>, i: Int, j: Int) { var temp = A[i] A[i] = A[j] A[j] = temp } fun max_heapify(A: Array<Int>, i: Int) { var l = left(i); var r = right(i); var largest: Int; i...
[ { "class_path": "iam-abbas__cs-algorithms__d04aa8f/Heap_sort_in_kotlinKt.class", "javap": "Compiled from \"heap_sort_in_kotlin.kt\"\npublic final class Heap_sort_in_kotlinKt {\n private static int heapSize;\n\n public static final int getHeapSize();\n Code:\n 0: getstatic #10 ...