kt_path
stringlengths
35
167
kt_source
stringlengths
626
28.9k
classes
listlengths
1
17
shauryam-exe__DS-Algo-Zone__3a24745/Kotlin/SelectionSort.kt
fun main(args: Array<String>) { //Input the array in the format num1 num2 num3 num4 etc print("Enter the elements for the Array: ") var inputArray = readLine()!!.trim().split(" ").map { it -> it.toInt() }.toIntArray() var sortedArray = selectionSort(inputArray) println(sortedArray.contentToString()...
[ { "class_path": "shauryam-exe__DS-Algo-Zone__3a24745/SelectionSortKt.class", "javap": "Compiled from \"SelectionSort.kt\"\npublic final class SelectionSortKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n ...
romangraef__PatternToFormula__e140a49/src/PatternFinder.kt
import java.lang.Math.floor import java.lang.Math.max import javax.script.ScriptEngine import javax.script.ScriptEngineManager data class Expression(val expression: String) fun main(args:Array<String>) { while (true) { println("---------------------------") println("Separate numbers by comma.") ...
[ { "class_path": "romangraef__PatternToFormula__e140a49/PatternFinderKt.class", "javap": "Compiled from \"PatternFinder.kt\"\npublic final class PatternFinderKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n ...
MeilCli__StalinSort__b245390/Kotlin/src/main/kotlin/StalinSort.kt
fun main(args: Array<String>) { println("Hello Stalin!") writeStalinSort(intArrayOf(4)) writeStalinSort(intArrayOf(6, 2, 5, 7, 3, 8, 8, 4)) writeStalinSort(intArrayOf(5, 3, 7, 8, 9, 5, 3, 5, 7)) /** * Hello Stalin! * Input: 4 * StalinBy: 4 * StalinByDescending: 4 * Input: 6,...
[ { "class_path": "MeilCli__StalinSort__b245390/StalinSortKt.class", "javap": "Compiled from \"StalinSort.kt\"\npublic final class StalinSortKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invokesta...
mepants__Advent-Of-Code-2022__3b42381/Day2_02/src/main/kotlin/Main.kt
import java.io.File enum class Move(val value: Int) { ROCK(1) { override fun scoreAgainst(opponentMove: Move): Int { return when (opponentMove) { ROCK -> 3 PAPER -> 0 SCISSORS -> 6 } } override fun losesAgainst() = PAP...
[ { "class_path": "mepants__Advent-Of-Code-2022__3b42381/MainKt.class", "javap": "Compiled from \"Main.kt\"\npublic final class MainKt {\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 ...
dirask__codelibrary__75f5296/kotlin/MaxFlowDinic.kt
// https://en.wikipedia.org/wiki/Dinic%27s_algorithm in O(V^2 * E) object MaxFlowDinic { data class Edge(val t: Int, val rev: Int, val cap: Int, var f: Int = 0) fun addEdge(graph: Array<ArrayList<Edge>>, s: Int, t: Int, cap: Int) { graph[s].add(Edge(t, graph[t].size, cap)) graph[t].add(Edge(s,...
[ { "class_path": "dirask__codelibrary__75f5296/MaxFlowDinic$Edge.class", "javap": "Compiled from \"MaxFlowDinic.kt\"\npublic final class MaxFlowDinic$Edge {\n private final int t;\n\n private final int rev;\n\n private final int cap;\n\n private int f;\n\n public MaxFlowDinic$Edge(int, int, int, int);\n...
dirask__codelibrary__75f5296/kotlin/Determinant.kt
// https://en.wikipedia.org/wiki/Determinant fun det(matrix: Array<DoubleArray>): Double { val EPS = 1e-10 val a = matrix.map { it.copyOf() }.toTypedArray() val n = a.size var res = 1.0 for (i in 0 until n) { val p = (i until n).maxBy { Math.abs(a[it][i]) }!! if (Math.abs(a[p][i]) < ...
[ { "class_path": "dirask__codelibrary__75f5296/DeterminantKt.class", "javap": "Compiled from \"Determinant.kt\"\npublic final class DeterminantKt {\n public static final double det(double[][]);\n Code:\n 0: aload_0\n 1: ldc #9 // String matrix\n 3: invokestati...
akkinoc__atcoder-workspace__e650a9c/atcoder.jp/abc264/abc264_c/Main.kt
fun main() { val (h1, w1) = readLine()!!.split(" ").map { it.toInt() } val a = List(h1) { readLine()!!.split(" ") } val (h2, w2) = readLine()!!.split(" ").map { it.toInt() } val b = List(h2) { readLine()!!.split(" ") } for (r in (0 until h1).combinations(h1 - h2)) { val w = a.filterIndexed {...
[ { "class_path": "akkinoc__atcoder-workspace__e650a9c/MainKt$combinations$1.class", "javap": "Compiled from \"Main.kt\"\nfinal class MainKt$combinations$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super java.util....
buczebar__advent-of-code__cdb6fe3/src/Day02.kt
fun main() { fun gameResult(yourMove: HandShape, opponentMove: HandShape) = when (yourMove) { opponentMove.greater() -> GameResult.WIN opponentMove.lower() -> GameResult.LOSS else -> GameResult.DRAW } fun part1(input: List<Pair<HandShape, HandShape>>): Int { ...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/Day02Kt$main$testInputPart2$2.class", "javap": "Compiled from \"Day02.kt\"\nfinal class Day02Kt$main$testInputPart2$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, GameResult> {\n public stati...
buczebar__advent-of-code__cdb6fe3/src/Utils.kt
import java.io.File import java.lang.IllegalArgumentException import kotlin.math.abs /** * Reads lines from the given input txt file. */ fun readInput(name: String) = File("src", "$name.txt") .readLines() /** * Reads input separated by empty line */ fun readGroupedInput(name: String) = File("src", "$name.txt"...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/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...
buczebar__advent-of-code__cdb6fe3/src/Day14.kt
import java.lang.Integer.max import java.lang.Integer.min private typealias Path = List<Position> private typealias MutableMatrix<T> = MutableList<MutableList<T>> private val Pair<Int, Int>.depth: Int get() = second private fun List<Path>.getMaxValue(selector: (Position) -> Int) = flatten().maxOf { selector(...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/Day14Kt.class", "javap": "Compiled from \"Day14.kt\"\npublic final class Day14Kt {\n private static final int getDepth(kotlin.Pair<java.lang.Integer, java.lang.Integer>);\n Code:\n 0: aload_0\n 1: invokevirtual #13 // Method ...
buczebar__advent-of-code__cdb6fe3/src/Day04.kt
typealias SectionRange = Pair<Int, Int> fun main() { infix fun SectionRange.contains(range: SectionRange): Boolean { return first <= range.first && this.second >= range.second } infix fun SectionRange.overlap(range: SectionRange): Boolean { return first <= range.second && range.first <= se...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/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 #12 // Method main$p...
buczebar__advent-of-code__cdb6fe3/src/Day07.kt
private const val TOTAL_DISK_SPACE = 70000000L private const val SPACE_NEEDED_FOR_UPDATE = 30000000L fun main() { fun part1(fileTree: TreeNode): Long { return fileTree.getAllSubdirectories().filter { it.totalSize <= 100_000 }.sumOf { it.totalSize } } fun part2(fileTree: TreeNode): Long { va...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/Day07Kt$main$part2$$inlined$sortedBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class Day07Kt$main$part2$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public Day07Kt$main$part2$$inlined$sortedBy$1();\n Code:\n ...
buczebar__advent-of-code__cdb6fe3/src/Day05.kt
typealias Stack = List<Char> fun main() { fun solve(input: Pair<MutableList<Stack>, List<StackMove>>, inputModifier: (List<Char>) -> List<Char>): String { val (stacks, moves) = input moves.forEach { move -> stacks[move.to] = stacks[move.from].take(move.amount).let { inputModifier.invok...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/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 #12 // Method parseI...
buczebar__advent-of-code__cdb6fe3/src/Day15.kt
import kotlin.math.abs private fun parseInput(name: String) = readInput(name).map { line -> line.split(":").map { it.getAllInts().pair() } }.map { (sensorXY, beaconXY) -> Sensor(sensorXY, beaconXY) } fun main() { fun Position.tuningFrequency() = 4000000L * x + y fun coverageRangesForY(y: Int,...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/Day15Kt.class", "javap": "Compiled from \"Day15.kt\"\npublic final class Day15Kt {\n private static final java.util.List<Sensor> parseInput(java.lang.String);\n Code:\n 0: aload_0\n 1: invokestatic #12 // Method UtilsKt.read...
buczebar__advent-of-code__cdb6fe3/src/Day06.kt
fun main() { fun solve(input: String, distLength: Int) = input.indexOf(input.windowed(distLength).first { it.toList().allDistinct()}) + distLength fun part1(input: String) = solve(input, 4) fun part2(input: String) = solve(input, 14) val testInput = readInput("Day06_test") val testResults ...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/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 UtilsK...
buczebar__advent-of-code__cdb6fe3/src/Day16.kt
fun main() { lateinit var flowRates: Map<String, Int> lateinit var connections: Map<String, List<String>> lateinit var workingValves: List<String> lateinit var distances: Map<Pair<String, String>, Int> fun getDistanceToValve( current: String, destination: String, visited: Li...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/Day16Kt.class", "javap": "Compiled from \"Day16.kt\"\npublic final class Day16Kt {\n public static final void main();\n Code:\n 0: new #8 // class kotlin/jvm/internal/Ref$ObjectRef\n 3: dup\n 4: invokespecial...
buczebar__advent-of-code__cdb6fe3/src/Day13.kt
fun main() { fun parseArray(arrayText: String): List<Any> { fun nodeToList(node: Node): List<Any> { return node.children.map { child -> if (child is Leaf) { child.value ?: emptyList<Any>() } else { nodeToList(child) ...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/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: astore_0\n 3: aload_0\n 4: invokestati...
buczebar__advent-of-code__cdb6fe3/src/Day03.kt
fun main() { fun Char.getPriority() = (('a'..'z') + ('A'..'Z')).indexOf(this) + 1 fun part1(input: List<String>) = input.map { sack -> sack.chunked(sack.length / 2).map { comp -> comp.toList() } } .map { (comp1, comp2) -> (comp1 intersect comp2.toSet()).single() } .sumOf...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/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 UtilsK...
buczebar__advent-of-code__cdb6fe3/src/Day12.kt
private typealias MapOfHeights = List<List<Char>> private fun Char.elevation() = when (this) { 'S' -> 0 // a 'E' -> 25 // z else -> ('a'..'z').indexOf(this) } private fun MapOfHeights.getFirstPositionOf(mark: Char): Position { forEachIndexed { index, row -> if ...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/Day12Kt.class", "javap": "Compiled from \"Day12.kt\"\npublic final class Day12Kt {\n private static final int elevation(char);\n Code:\n 0: iload_0\n 1: lookupswitch { // 2\n 69: 32\n 83: 28\n ...
buczebar__advent-of-code__cdb6fe3/src/Day10.kt
import kotlin.math.abs fun main() { fun getValuesInEachCycle(input: List<String>): List<Int> { val valuesInCycles = mutableListOf(1) var valueAfterLastCycle = valuesInCycles.first() input.forEach { instruction -> when { instruction.startsWith("noop") -> { ...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/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 UtilsK...
buczebar__advent-of-code__cdb6fe3/src/Day09.kt
import java.lang.IllegalArgumentException import kotlin.math.abs typealias Point = Pair<Int, Int> private fun Point.isTouching(point: Point) = abs(first - point.first) < 2 && abs(second - point.second) < 2 fun main() { fun parseInput(name: String) = readInput(name).map { it.splitWords() } .map { (directio...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/Day09Kt.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt {\n private static final boolean isTouching(kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>);\n Code:\n 0: aload_...
buczebar__advent-of-code__cdb6fe3/src/Day08.kt
fun main() { fun parseInput(name: String) = readInput(name).map { it.toList() }.map { row -> row.map { height -> height.digitToInt() } } fun getListOfTrees(input: List<List<Int>>): List<Tree> { val columns = input.transpose() val (width, height) = columns.size to input.size val ...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/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 #12 // Method main$p...
buczebar__advent-of-code__cdb6fe3/src/Day11.kt
import java.lang.IllegalArgumentException private fun parseMonkey(monkeyData: String): Monkey { return Monkey.build { monkeyData.lines().forEach { line -> with(line.trim()) { when { startsWith("Monkey") -> { id = getAllInts().first() ...
[ { "class_path": "buczebar__advent-of-code__cdb6fe3/Day11Kt.class", "javap": "Compiled from \"Day11.kt\"\npublic final class Day11Kt {\n private static final Monkey parseMonkey(java.lang.String);\n Code:\n 0: getstatic #12 // Field Monkey.Companion:LMonkey$Companion;\n 3: ...
davidcurrie__advent-of-code-2021__dd37372/src/day24/result.kt
import java.io.File fun main() { val programs = File("src/day24/input.txt").readText().split("inp w\n").drop(1) .map { it.split("\n").dropLast(1).map { it.split(" ") } } val variables = programs.map { Variables(it[3][2].toInt(), it[4][2].toInt(), it[14][2].toInt()) } val solutions = solve(variables...
[ { "class_path": "davidcurrie__advent-of-code-2021__dd37372/ResultKt.class", "javap": "Compiled from \"result.kt\"\npublic final class ResultKt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 ...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day04.kt
import java.io.File fun main() { fun stringToPair(data: String) : IntRange { val nums = data.split("-") return IntRange(nums[0].toInt(), nums[1].toInt()) } fun processInput(pair: String): Pair<IntRange, IntRange> { val areas = pair.split(",") .map { stringToPair(it) } ...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day04Kt.class", "javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: bipush 6\n 2: anewarray #8 // class java/lang/String\n 5: ast...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day05.kt
import java.io.File fun main() { fun dataToParts(input: String): Pair<String, String> { val parts = input.split("\n\n") return parts[0] to parts[1] } fun initStacks(input: String): Map<Int, MutableList<Char>>{ val lines = input.split("\n").reversed() val stacks = lines[0].f...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day05Kt.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n public static final void main();\n Code:\n 0: bipush 9\n 2: anewarray #8 // class java/lang/String\n 5: ast...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day07.kt
import java.io.File import java.util.Dictionary fun main() { fun buildFilesystem(data: List<String>): Directory { val root = Directory("/", null) var cwd = root data.forEachIndexed { i, line -> val curr = line.split(" ") when { curr[1] == "cd" -> cwd...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day07Kt.class", "javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt {\n public static final void main();\n Code:\n 0: bipush 23\n 2: anewarray #8 // class java/lang/String\n 5: as...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day03.kt
import java.io.File fun main() { fun part1(input: List<String>): Int { return input.map { sack -> sack.bisect() } .map { parts -> parts.first.intersect(parts.second).first() } .sumOf { it.toScore() } } fun part2(input: List<String>): Int { return input.chunked(3) ...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day03Kt.class", "javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: bipush 6\n 2: anewarray #8 // class java/lang/String\n 5: ast...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day02.kt
import java.io.File fun main() { fun part1(input: List<String>): Int { return input.sumOf { getScore(it) } } fun part2(input: List<String>): Int { return input.sumOf { getScore(getGame(it)) } } val testInput = listOf( "A Y", "B X", "C Z" ) // test ...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day02Kt.class", "javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n private static final java.util.List<java.lang.String> wins;\n\n private static final java.util.List<java.lang.String> losses;\n\n private static final jav...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day12.kt
import java.io.File import kotlin.math.min fun main() { val c0 = '`' fun getNodes(input: List<String>): List<List<Node>> = input.map { row -> row.map { c -> val height = when (c) { 'S' -> 0; 'E' -> 'z' - c0; else -> c - c0 } Node(height, isStart = c == 'S', i...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day12Kt.class", "javap": "Compiled from \"Day12.kt\"\npublic final class Day12Kt {\n public static final void main();\n Code:\n 0: bipush 96\n 2: istore_0\n 3: iconst_5\n 4: anewarray #8 ...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day11.kt
import java.io.File import kotlin.collections.ArrayDeque fun main() { fun readMonkeys(input: List<String>) = input.map { data -> val lines = data.split("\n") Monkey( ArrayDeque(lines[1].split(": ")[1].split(", ").map { it -> it.toLong() }), lines[2].s...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day11Kt$main$part1$$inlined$sortedBy$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class Day11Kt$main$part1$$inlined$sortedBy$1<T> implements java.util.Comparator {\n public Day11Kt$main$part1$$inlined$sortedBy$1();\n ...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day09.kt
import java.io.File import kotlin.math.abs import kotlin.math.round import kotlin.math.roundToInt fun main() { fun part1(input: List<String>): Int { val rope = Rope() input.forEach { moveData -> val move = moveData.split(" ") repeat(move[1].toInt()) { rope.m...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day09Kt.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt {\n public static final void main();\n Code:\n 0: bipush 8\n 2: anewarray #8 // class java/lang/String\n 5: ast...
dcbertelsen__advent-of-code-2022-kotlin__9d22341/src/Day08.kt
import java.io.File fun main() { fun sightAlongAndMark(trees: List<Tree>) { var max = -1 trees.forEach { t -> if (t.height > max) { t.canSee(); max = t.height }} } fun getVisibleTrees(trees: List<Tree>): Int { var count = 0 var max = 0 for (tree in trees.subList(1, ...
[ { "class_path": "dcbertelsen__advent-of-code-2022-kotlin__9d22341/Day08Kt.class", "javap": "Compiled from \"Day08.kt\"\npublic final class Day08Kt {\n public static final void main();\n Code:\n 0: iconst_5\n 1: anewarray #8 // class java/lang/String\n 4: astore_1\n...
mrwhoknows55__advent-of-code-2022__f307e52/src/Day05.kt
import java.io.File import java.util.Stack fun main() { val inputPair = getInputPair("src/day05_input.txt") part1(inputPair) } fun part1(inputPair: Pair<List<Stack<Char>>, List<Triple<Int, Int, Int>>>) { val stacks = inputPair.first val inputs = inputPair.second inputs.forEach { for (i in ...
[ { "class_path": "mrwhoknows55__advent-of-code-2022__f307e52/Day05Kt.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n public static final void main();\n Code:\n 0: ldc #8 // String src/day05_input.txt\n 2: invokestatic #12 ...
mrwhoknows55__advent-of-code-2022__f307e52/src/Day02.kt
import java.io.File fun main() { val input = File("src/day02_input.txt").readText().split("\n") println(part1(input)) println(part2(input)) } fun part1(input: List<String>): Int { var score = 0 input.forEach { val oppMove = Move.getMoveObj(it[0]) ?: return@part1 (score) val myMove ...
[ { "class_path": "mrwhoknows55__advent-of-code-2022__f307e52/Day02Kt.class", "javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 ...
BjornvdLaan__KotlinTestApproachExamples__c6d895d/src/main/kotlin/SimplifySquareRootBigDecimal.kt
import java.math.BigInteger /** * Square root with its coefficient. * * Definitions: a square root is of form 'coefficient * sqrt(radicand)'. * In other words, the coefficient is outside the square root * and the radicand in inside the square root. * * @property coefficient number in front of the radical ('root...
[ { "class_path": "BjornvdLaan__KotlinTestApproachExamples__c6d895d/SimplifySquareRootBigDecimalKt$simplifySquareRoot$decreasingSequence$1.class", "javap": "Compiled from \"SimplifySquareRootBigDecimal.kt\"\nfinal class SimplifySquareRootBigDecimalKt$simplifySquareRoot$decreasingSequence$1 extends kotlin.coro...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem7.kt
import kotlin.math.floor import kotlin.math.sqrt import kotlin.system.measureNanoTime /** * 10001st prime * * By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. * * What is the 10001st prime number? * * https://projecteuler.net/problem=7 */ fun main() { pr...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem7Kt.class", "javap": "Compiled from \"Problem7.kt\"\npublic final class Problem7Kt {\n public static final void main();\n Code:\n 0: bipush 6\n 2: invokestatic #10 // Method findPrime1:(I)J\n 5: lstore...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem21.kt
import kotlin.math.floor import kotlin.math.sqrt /** * Amicable numbers * * Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). * If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable * numbers. * * F...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem21Kt.class", "javap": "Compiled from \"Problem21.kt\"\npublic final class Problem21Kt {\n public static final void main();\n Code:\n 0: sipush 220\n 3: invokestatic #10 // Method sumOfProperDivisors:(I)I\n ...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem10.kt
import kotlin.math.floor import kotlin.math.sqrt import kotlin.system.measureNanoTime /** * Summation of primes * * The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. * Find the sum of all the primes below two million. * * https://projecteuler.net/problem=10 */ fun main() { println(sumOfPrimes(10)) ...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem10Kt$sumOfPrimes$1.class", "javap": "Compiled from \"Problem10.kt\"\nfinal class Problem10Kt$sumOfPrimes$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.Long, java.lang.Boolean> {\n public s...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem17.kt
import kotlin.math.floor /** * Number letter counts * * If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 * letters used in total. * * If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be u...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem17Kt.class", "javap": "Compiled from \"Problem17.kt\"\npublic final class Problem17Kt {\n private static final java.lang.Integer[] proper;\n\n private static final java.lang.Integer[] tenth;\n\n public static final void main();\n Code:\n ...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem29.kt
import kotlin.math.pow /** * Distinct powers * * Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5: * * 2^2=4, 2^3=8, 2^4=16, 2^5=32 * 3^2=9, 3^3=27, 3^4=81, 3^5=243 * 4^2=16, 4^3=64, 4^4=256, 4^5=1024 * 5^2=25, 5^3=125, 5^4=625, 55^=3125 * If they are then placed in numerical order, with an...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem29Kt.class", "javap": "Compiled from \"Problem29.kt\"\npublic final class Problem29Kt {\n public static final void main();\n Code:\n 0: iconst_5\n 1: invokestatic #10 // Method distinctPowers:(I)I\n 4: istore...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem20.kt
import java.math.BigInteger /** * Factorial digit sum * * n! means n × (n − 1) × ... × 3 × 2 × 1 * * For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, * and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. * * Find the sum of the digits in the number 100! * * https://projecteul...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem20Kt.class", "javap": "Compiled from \"Problem20.kt\"\npublic final class Problem20Kt {\n public static final void main();\n Code:\n 0: bipush 10\n 2: invokestatic #10 // Method factorialDigitSum:(I)I\n ...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem30.kt
import kotlin.math.pow /** * Digit fifth powers * * Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: * * 1634 = 1^4 + 6^4 + 3^4 + 4^4 * 8208 = 8^4 + 2^4 + 0^4 + 8^4 * 9474 = 9^4 + 4^4 + 7^4 + 4^4 * * As 1 = 14 is not a sum it is not included. * * The...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem30Kt.class", "javap": "Compiled from \"Problem30.kt\"\npublic final class Problem30Kt {\n public static final void main();\n Code:\n 0: sipush 1634\n 3: iconst_4\n 4: invokestatic #10 // Method isDigit...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem14.kt
/** * Longest Collatz sequence * * The following iterative sequence is defined for the set of positive integers: * * n → n/2 (n is even) * n → 3n + 1 (n is odd) * * Using the rule above and starting with 13, we generate the following sequence: * * 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 * It can be seen t...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem14Kt.class", "javap": "Compiled from \"Problem14.kt\"\npublic final class Problem14Kt {\n private static final java.util.Map<java.lang.Integer, java.lang.Integer> cache;\n\n public static final void main();\n Code:\n 0: ldc #7...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem4.kt
/** * Largest palindrome product * * A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is * 9009 = 91 × 99. * * Find the largest palindrome made from the product of two 3-digit numbers. * * https://projecteuler.net/problem=4 */ fun main() { ...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem4Kt.class", "javap": "Compiled from \"Problem4.kt\"\npublic final class Problem4Kt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method largestPalindrome:()I\n 3: istore_0\n 4: getstat...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem32.kt
@file:Suppress("MagicNumber") /** * Pandigital products * * We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, * the 5-digit number, 15234, is 1 through 5 pandigital. * * The product 7254 is unusual, as the identity, 39 × 186 = 7254, containing m...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem32Kt.class", "javap": "Compiled from \"Problem32.kt\"\npublic final class Problem32Kt {\n public static final void main();\n Code:\n 0: bipush 39\n 2: sipush 186\n 5: sipush 7254\n 8: invokestatic ...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem5.kt
import kotlin.math.floor import kotlin.math.log10 import kotlin.math.pow import kotlin.math.sqrt /** * Smallest multiple * * 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. * * What is the smallest positive number that is evenly divisible by all of the nu...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem5Kt.class", "javap": "Compiled from \"Problem5.kt\"\npublic final class Problem5Kt {\n public static final void main();\n Code:\n 0: bipush 20\n 2: invokestatic #10 // Method smallestNumberDivisibleBy:(I)J\n...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem23.kt
/** * Non-abundant sums * * A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, * the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. * * A number n is called deficient if the sum of its prop...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem23Kt.class", "javap": "Compiled from \"Problem23.kt\"\npublic final class Problem23Kt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method nonAbundantSums:()I\n 3: istore_0\n 4: getsta...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem33.kt
@file:Suppress("MagicNumber") /** * Digit cancelling fractions * * The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may * incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s. * * We shall consider fractions like, 30/50 =...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem33Kt.class", "javap": "Compiled from \"Problem33.kt\"\npublic final class Problem33Kt {\n public static final void main();\n Code:\n 0: bipush 49\n 2: bipush 98\n 4: invokestatic #10 // Method i...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem26.kt
import java.util.Comparator /** * Reciprocal cycles * * A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to * 10 are given: * * 1/2 = 0.5 * 1/3 = 0.(3) * 1/4 = 0.25 * 1/5 = 0.2 * 1/6 = 0.1(6) * 1/7 = 0.(142857) * 1/8 = 0.125 * 1/9 = ...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem26Kt.class", "javap": "Compiled from \"Problem26.kt\"\npublic final class Problem26Kt {\n public static final void main();\n Code:\n 0: iconst_2\n 1: invokestatic #10 // Method countRepeatingDecimalsInUnitFraction:...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem19.kt
/** * You are given the following information, but you may prefer to do some research for yourself. * - 1 Jan 1900 was a Monday. * - Thirty days has September, * April, June and November. * All the rest have thirty-one, * Saving February alone, * Which has twenty-eight, rain or shine. * And on leap ye...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem19Kt.class", "javap": "Compiled from \"Problem19.kt\"\npublic final class Problem19Kt {\n private static final java.lang.Integer[] daysOfMonth;\n\n public static final void main();\n Code:\n 0: new #8 // class...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem27.kt
import kotlin.math.pow /** * Quadratic primes * * Euler discovered the remarkable quadratic formula: n^2 + n + 41 * * It turns out that the formula will produce 40 primes for the consecutive integer values 0 <= n <= 39. However, when * is n = 40, 40^2 + 40 +41 = 40(40+1) + 41 divisible by 41, and certainly when ...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem27Kt.class", "javap": "Compiled from \"Problem27.kt\"\npublic final class Problem27Kt {\n public static final void main();\n Code:\n 0: iconst_1\n 1: bipush 41\n 3: invokestatic #10 // Method numOfPrim...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem1.kt
import kotlin.system.measureNanoTime /** * Multiples of 3 or 5 * * If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these * multiples is 23. * * Find the sum of all the multiples of 3 or 5 below 1000. * * https://projecteuler.net/problem=1 */ fun main...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem1Kt.class", "javap": "Compiled from \"Problem1.kt\"\npublic final class Problem1Kt {\n public static final void main();\n Code:\n 0: sipush 999\n 3: istore_0\n 4: iconst_0\n 5: istore_3\n 6: invokestatic #...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem18.kt
/** * By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from * top to bottom is 23. * * 3 * 7 4 * 2 4 6 * 8 5 9 3 * * That is, 3 + 7 + 4 + 9 = 23. * * Find the maximum total from top to bottom of the triangle below: * * ...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem18Kt.class", "javap": "Compiled from \"Problem18.kt\"\npublic final class Problem18Kt {\n private static final java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Long> cache;\n\n private static final java.util.List<java.u...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem11.kt
/** * Largest product in a grid * * In the 20×20 grid below, four numbers along a diagonal line have been marked in red. * * 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 * 5...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem11Kt.class", "javap": "Compiled from \"Problem11.kt\"\npublic final class Problem11Kt {\n private static final java.lang.Integer[][] grid;\n\n public static final void main();\n Code:\n 0: getstatic #10 // Field grid...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem35.kt
/** * Circular primes * * The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves * prime. * * There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. * * How many circular primes are there below one million? * * ...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem35Kt.class", "javap": "Compiled from \"Problem35.kt\"\npublic final class Problem35Kt {\n public static final void main();\n Code:\n 0: sipush 197\n 3: invokestatic #10 // Method isCircularPrime:(I)Z\n ...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem25.kt
import kotlin.math.max /** * 1000-digit Fibonacci number * * The Fibonacci sequence is defined by the recurrence relation: * Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. * Hence the first 12 terms will be: * F1 = 1 * F2 = 1 * F3 = 2 * F4 = 3 * F5 = 5 * F6 = 8 * F7 = 13...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem25Kt.class", "javap": "Compiled from \"Problem25.kt\"\npublic final class Problem25Kt {\n public static final void main();\n Code:\n 0: iconst_3\n 1: invokestatic #10 // Method fibIndexOfDigitsCount:(I)I\n 4:...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem3.kt
import kotlin.math.sqrt /** * Largest prime factor * * The prime factors of 13195 are 5, 7, 13 and 29. * What is the largest prime factor of the number 600851475143 ? * * https://projecteuler.net/problem=3 */ fun main() { println(solution3(600851475143L)) } private fun solution3(n: Long): Long { var n...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem3Kt.class", "javap": "Compiled from \"Problem3.kt\"\npublic final class Problem3Kt {\n public static final void main();\n Code:\n 0: ldc2_w #7 // long 600851475143l\n 3: invokestatic #12 // ...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem12.kt
/** * Highly divisible triangular number * * The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be * 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: * * 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... * * Let us list the factors of the first seve...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem12Kt.class", "javap": "Compiled from \"Problem12.kt\"\npublic final class Problem12Kt {\n private static final int[] primes;\n\n public static final void main();\n Code:\n 0: iconst_5\n 1: invokestatic #10 // Meth...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem24.kt
/** * Lexicographic permutations * * A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, * 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The * lexicographic permutations of 0, 1 and 2 a...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem24Kt.class", "javap": "Compiled from \"Problem24.kt\"\npublic final class Problem24Kt {\n public static final void main();\n Code:\n 0: iconst_3\n 1: anewarray #8 // class java/lang/Character\n 4: astore_...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem34.kt
/** * Digit factorials * * 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145. * * Find the sum of all numbers which are equal to the sum of the factorial of their digits. * * Note: As 1! = 1 and 2! = 2 are not sums they are not included. * * https://projecteuler.net/problem=34 */ fun main() { che...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem34Kt.class", "javap": "Compiled from \"Problem34.kt\"\npublic final class Problem34Kt {\n public static final void main();\n Code:\n 0: sipush 145\n 3: invokestatic #10 // Method isDigitFactorial:(I)Z\n ...
jimmymorales__project-euler__e881cad/src/main/kotlin/Problem2.kt
import kotlin.system.measureNanoTime /** * Even Fibonacci numbers * * Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the * first 10 terms will be: * * 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... * * By considering the...
[ { "class_path": "jimmymorales__project-euler__e881cad/Problem2Kt.class", "javap": "Compiled from \"Problem2.kt\"\npublic final class Problem2Kt {\n public static final void main();\n Code:\n 0: ldc #7 // int 4000000\n 2: istore_0\n 3: iconst_0\n 4: isto...
margalis__Kotlin_Koans_mg__faf2034/Generics/Generic functions/src/Task.kt
import java.util.* public fun <T, C : MutableCollection<in T>> Collection<T>.partitionTo(col1: C, col2: C, predicate: (T)-> Boolean): Pair<C,C> { //T-n itemi tesak, C-n` Collectioni mejini //greladzevy` toCollectioni pes for( item in this){ if(predicate(item)){ col1.add(item) } ...
[ { "class_path": "margalis__Kotlin_Koans_mg__faf2034/TaskKt.class", "javap": "Compiled from \"Task.kt\"\npublic final class TaskKt {\n public static final <T, C extends java.util.Collection<? super T>> kotlin.Pair<C, C> partitionTo(java.util.Collection<? extends T>, C, C, kotlin.jvm.functions.Function1<? su...
aragos__aoc2023__7bca0a8/aoc/src/Calibration.kt
import java.io.File fun main() { println(Calibration.readCalibrationDigitsAndWords("aoc/inputs/calibration.txt").sum()) } object Calibration { fun readCalibrationDigits(): List<Int> = buildList { File("aoc/inputs/calibration.txt").forEachLine { line -> val allDigits = Regex("[1-9]").findAll(line).map { ...
[ { "class_path": "aragos__aoc2023__7bca0a8/CalibrationKt.class", "javap": "Compiled from \"Calibration.kt\"\npublic final class CalibrationKt {\n public static final void main();\n Code:\n 0: getstatic #12 // Field Calibration.INSTANCE:LCalibration;\n 3: ldc #14 ...
aragos__aoc2023__7bca0a8/aoc/src/Soil.kt
import java.io.File import java.lang.IllegalArgumentException data class Range(val sourceStart: Long, val destinationStart: Long, val rangeLength: Long) { val sources = LongRange(sourceStart, sourceStart + rangeLength - 1) override fun toString(): String { return "$sources -> ${LongRange(destinationStart, dest...
[ { "class_path": "aragos__aoc2023__7bca0a8/SoilKt.class", "javap": "Compiled from \"Soil.kt\"\npublic final class SoilKt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 // String in...
aragos__aoc2023__7bca0a8/aoc/src/Parts.kt
import java.io.File fun main() { // countPartNumbers() countGearRatios() } private data class PartNumber(val value: Int, val location: IntRange) { fun isAdjacentTo(i: Int) = i in (location.first-1)..(location.last+1) } private fun countGearRatios() { var line1: Set<PartNumber> var line2 = setOf<PartNumber...
[ { "class_path": "aragos__aoc2023__7bca0a8/PartsKt.class", "javap": "Compiled from \"Parts.kt\"\npublic final class PartsKt {\n public static final void main();\n Code:\n 0: invokestatic #9 // Method countGearRatios:()V\n 3: return\n\n private static final void countGearRat...
aragos__aoc2023__7bca0a8/aoc/src/Hands.kt
import Card.Companion.toCard import java.io.File fun main() { val lines = File("aoc/inputs/hands.txt").readLines() println(linesToWinnings(lines)) } internal fun linesToWinnings(lines: List<String>): Int { return lines .map { line -> HandWinnings( Hand(line.substring(0, 5).map { it.toCard() ...
[ { "class_path": "aragos__aoc2023__7bca0a8/HandsKt$linesToWinnings$$inlined$sortedByDescending$1.class", "javap": "Compiled from \"Comparisons.kt\"\npublic final class HandsKt$linesToWinnings$$inlined$sortedByDescending$1<T> implements java.util.Comparator {\n public HandsKt$linesToWinnings$$inlined$sortedB...
aragos__aoc2023__7bca0a8/aoc/src/ColorGame.kt
import java.io.File fun main() { // problem1() problem2() } private fun problem2() { var powerSum = 0 val colors = listOf("red", "green", "blue") File("inputs/colorGame.txt").forEachLine { line -> val split = line.split(":") val maxes = colors.associateWith { 0 }.toMutableMap() split[1].split(";"...
[ { "class_path": "aragos__aoc2023__7bca0a8/ColorGameKt.class", "javap": "Compiled from \"ColorGame.kt\"\npublic final class ColorGameKt {\n public static final void main();\n Code:\n 0: invokestatic #9 // Method problem2:()V\n 3: return\n\n private static final void problem...
aragos__aoc2023__7bca0a8/aoc/src/Scratch.kt
import java.io.File import kotlin.math.pow fun main() { println(countPoints()) println(countCards()) } private fun countCards(): Int { val cardCount = (0..211).associateWith { 1 }.toMutableMap() File("inputs/scratch.txt").readLines().mapIndexed() { ix, line -> if (line.isBlank()) return@mapIndexed v...
[ { "class_path": "aragos__aoc2023__7bca0a8/ScratchKt.class", "javap": "Compiled from \"Scratch.kt\"\npublic final class ScratchKt {\n public static final void main();\n Code:\n 0: invokestatic #10 // Method countPoints:()I\n 3: istore_0\n 4: getstatic #16 ...
shyoutarou__desafios-DIO__b312f8f/Desafios/Kotlin/Primeiros passos em Kotlin/Carrefour Android Developer/Figurinhas/figurinhas.kt
/* Ricardo e Vicente são aficionados por figurinhas. Nas horas vagas, eles arrumam um jeito de jogar um “bafo” ou algum outro jogo que envolva tais figurinhas. Ambos também têm o hábito de trocarem as figuras repetidas com seus amigos e certo dia pensaram em uma brincadeira diferente. Chamaram todos os amigos e propuse...
[ { "class_path": "shyoutarou__desafios-DIO__b312f8f/FigurinhasKt.class", "javap": "Compiled from \"figurinhas.kt\"\npublic final class FigurinhasKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String args\n 3: invo...
LaraEstudillo__coins_challenge_1__b710f68/coins.kt
import kotlin.collections.listOf var amount = 11 var result: ArrayList<CoinsAndQuantity> = ArrayList() fun main() { println(minCoins()) } fun minCoins() { val coins = listOf(1,2,5).sorted() val suma = coins.sum(); if(suma == amount) { println(suma); return; } calculation(c...
[ { "class_path": "LaraEstudillo__coins_challenge_1__b710f68/CoinsKt.class", "javap": "Compiled from \"coins.kt\"\npublic final class CoinsKt {\n private static int amount;\n\n private static java.util.ArrayList<CoinsAndQuantity> result;\n\n public static final int getAmount();\n Code:\n 0: getsta...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day04.kt
fun main() { fun part1(input: List<String>): Int = input .contains(::fullyContains) fun part2(input: List<String>): Int = input .contains(::partiallyContains) // test if implementation meets criteria from the description, like: // val testInput = readInput("Day04_test") // check(part...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day04Kt.class", "javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: return\n\n public static final int contains(java.util.List<java.lang.String>, kotlin.jvm.functions.Function...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day05.kt
import java.io.File import java.util.Stack typealias Stacks<E> = List<Stack<E>> typealias StacksOfChar = Stacks<Char> fun main() { fun part1(input: String) = findCratesOnTopOfAllStacks( input, StacksOfChar::moveOneStackAtTime ) fun part2(input: String) = findCratesOnTopOfAllStacks( ...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day05Kt.class", "javap": "Compiled from \"Day05.kt\"\npublic final class Day05Kt {\n public static final void main();\n Code:\n 0: return\n\n public static final java.lang.String findCratesOnTopOfAllStacks(java.lang.String, kotlin.jvm.fun...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day07.kt
const val TOTALDISKSPACE = 70000000 const val NEEDEDUNUSEDSPACE = 30000000 fun main() { fun part1(input: String): Int = FileSystem().run { parseInstructions(input) getListOfDirNSizes() .map { it.second } .filter { it < 100000 } .sum() } fun part2(input:...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day07Kt.class", "javap": "Compiled from \"Day07.kt\"\npublic final class Day07Kt {\n public static final int TOTALDISKSPACE;\n\n public static final int NEEDEDUNUSEDSPACE;\n\n public static final void main();\n Code:\n 0: return\n\n pub...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day06.kt
fun main() { fun part1(signal: String, n: Int = 4): Int = firstNUniqueCharacters(signal = signal, n = n) fun part2(signal: String, n: Int = 14): Int = firstNUniqueCharacters(signal = signal, n = n) // test if implementation meets criteria from the description, like: // table test of part1 // val te...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day06Kt.class", "javap": "Compiled from \"Day06.kt\"\npublic final class Day06Kt {\n public static final void main();\n Code:\n 0: return\n\n public static final int firstNUniqueCharacters(java.lang.String, int);\n Code:\n 0: alo...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day03.kt
fun main() { fun itemPriority(c: Char): Int = when { c.isLowerCase() -> c.code - 96 c.isUpperCase() -> c.code - 64 + 26 else -> 0 } fun part1(input: List<String>): Int = input.foldRight(0) { rucksack, prioritySum -> rucksack .chunked(rucksack.length / 2) ...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day03Kt.class", "javap": "Compiled from \"Day03.kt\"\npublic final class Day03Kt {\n public static final void main();\n Code:\n 0: return\n\n private static final <A> java.util.Set<A> intersection(java.util.List<? extends java.util.Set<? ...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day02.kt
/*enum class RockPaperScissorsPermutation(val result: Int) { `A X`(3 + 1), `A Y`(6 + 2), `A Z`(0 + 3), `B X`(0 + 1), `B Y`(3 + 2), `B Z`(6 + 3), `C X`(6 + 1), `C Y`(0 + 2), `C Z`(3 + 3) }*/ val RoPaScPermutations = mapOf<String, Int>( "A X" to 3 + 1, "A Y" to 6 + 2, "A Z" to 0 + 3, "B X" to 0 + 1, ...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day02Kt.class", "javap": "Compiled from \"Day02.kt\"\npublic final class Day02Kt {\n private static final java.util.Map<java.lang.String, java.lang.Integer> RoPaScPermutations;\n\n private static final java.util.Map<java.lang.String, java.lang.Int...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day10.kt
fun main() { fun part1(input: List<String>): Int { val cycleForSignalStrength = mutableListOf<Int>(20, 60, 100, 140, 180, 220) val register = Register() val clock = Clock().apply { addProcessors(register) } val signalStrength = buildList { input .forEach...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day10Kt.class", "javap": "Compiled from \"Day10.kt\"\npublic final class Day10Kt {\n public static final void main();\n Code:\n 0: return\n\n public static final void parseInstruction(Register, java.lang.String);\n Code:\n 0: alo...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day08.kt
import java.lang.StrictMath.max fun main() { fun part1(input: List<String>): Int { val treesGraph = AdjacencyList<Int>() val verticesOfTreeHeight = treesGraph.parseVertices(input) return verticesOfTreeHeight .fold(0) { acc, vertex -> if (vertex `is max in all dir...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day08Kt$WhenMappings.class", "javap": "Compiled from \"Day08.kt\"\npublic final class Day08Kt$WhenMappings {\n public static final int[] $EnumSwitchMapping$0;\n\n static {};\n Code:\n 0: invokestatic #14 // Method Graph$E...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day09.kt
import java.lang.Math.abs fun main() { fun part1(headKnotMotionsData: List<String>): Int { val tail = Knot("tail") val head = Knot("head") tail `join to follow` head headKnotMotionsData .map { it.split(" ") } .forEach { val direction = it.fir...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day09Kt.class", "javap": "Compiled from \"Day09.kt\"\npublic final class Day09Kt {\n public static final void main();\n Code:\n 0: return\n\n public static final void join to follow(Knot, Knot);\n Code:\n 0: aload_0\n 1: ld...
GreyWolf2020__aoc-2022-in-kotlin__498da88/src/Day01.kt
import java.lang.Integer.max fun main() { fun part1(input: List<String>): Int { val sumIndex = 0 val maxSumIndex = 1 val zeroCalorie = 0 return input.map { it.toIntOrNull() }.foldRight(intArrayOf(0, 0)) { calorieOrNull, acc -> calorieOrNull ?.let { ca...
[ { "class_path": "GreyWolf2020__aoc-2022-in-kotlin__498da88/Day01Kt.class", "javap": "Compiled from \"Day01.kt\"\npublic final class Day01Kt {\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 ...
holukent__aoc-2022-in-kotlin__6993a6f/src/Day04.kt
import java.io.File fun main() { fun part1(input: String): Int { val data = input.split("\r\n") var result = 0 for (d in data) { val temp = d.split(",").map { it.split("-") } val first = temp[0] val second = temp[1] if ( (firs...
[ { "class_path": "holukent__aoc-2022-in-kotlin__6993a6f/Day04Kt.class", "javap": "Compiled from \"Day04.kt\"\npublic final class Day04Kt {\n public static final void main();\n Code:\n 0: new #8 // class java/io/File\n 3: dup\n 4: ldc #10 ...
TheRenegadeCoder__sample-programs__bd5f385/archive/k/kotlin/JobSequencing.kt
fun main(args: Array<String>) { val jobs = buildJobs(args) if (jobs.isNullOrEmpty()) { println("Usage: please provide a list of profits and a list of deadlines") } else { println(maxProfit(jobs)) } } /** * Calculates the maximum profit of a list of jobs */ private fun maxProfit(jobs: ...
[ { "class_path": "TheRenegadeCoder__sample-programs__bd5f385/JobSequencingKt.class", "javap": "Compiled from \"JobSequencing.kt\"\npublic final class JobSequencingKt {\n public static final void main(java.lang.String[]);\n Code:\n 0: aload_0\n 1: ldc #9 // String ar...
TheRenegadeCoder__sample-programs__bd5f385/archive/k/kotlin/Rot13.kt
data class EncodingBounds(val lowerBound: Int, val upperBound: Int) fun encodingBoundsForCharValue(c: Char): EncodingBounds? { val lowerCaseBounds = EncodingBounds('a'.toInt(), 'z'.toInt()) val upperCaseBounds = EncodingBounds('A'.toInt(), 'Z'.toInt()) return when (c) { in 'a'..'z' -> lowerCaseBoun...
[ { "class_path": "TheRenegadeCoder__sample-programs__bd5f385/Rot13Kt.class", "javap": "Compiled from \"Rot13.kt\"\npublic final class Rot13Kt {\n public static final EncodingBounds encodingBoundsForCharValue(char);\n Code:\n 0: new #9 // class EncodingBounds\n 3: du...
Ad0lphus__AOC2021__02f219e/day15/Kotlin/day15.kt
import java.io.* import java.util.* fun print_day_15() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 15" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Chiton -c -f sm...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/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 void part_1()...
Ad0lphus__AOC2021__02f219e/day21/Kotlin/day21.kt
import java.io.* import java.util.concurrent.atomic.AtomicInteger fun print_day_21() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 21" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day21$part2$Universe.class", "javap": "Compiled from \"day21.kt\"\npublic final class Day21$part2$Universe {\n private final int p1;\n\n private final int p2;\n\n private final int s1;\n\n private final int s2;\n\n public Day21$part2$Universe(int, int, int, i...
Ad0lphus__AOC2021__02f219e/day14/Kotlin/day14.kt
import java.io.* fun print_day_14() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 14" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Extended Polymerization -c -f smal...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day14Kt.class", "javap": "Compiled from \"day14.kt\"\npublic final class Day14Kt {\n public static final void print_day_14();\n Code:\n 0: ldc #8 // String \\u001b[33m\n 2: astore_0\n 3: ldc #10 ...
Ad0lphus__AOC2021__02f219e/day04/Kotlin/day04.kt
import java.io.* fun print_day_4() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 4" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Giant Squid -c -f small") ...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day04Kt.class", "javap": "Compiled from \"day04.kt\"\npublic final class Day04Kt {\n public static final void print_day_4();\n Code:\n 0: ldc #8 // String \\u001b[33m\n 2: astore_0\n 3: ldc #10 ...
Ad0lphus__AOC2021__02f219e/day22/Kotlin/day22.kt
import java.io.* fun print_day_22() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 22" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Reactor Reboot -c -f small") v...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day22Kt.class", "javap": "Compiled from \"day22.kt\"\npublic final class Day22Kt {\n public static final void print_day_22();\n Code:\n 0: ldc #8 // String \\u001b[33m\n 2: astore_0\n 3: ldc #10 ...
Ad0lphus__AOC2021__02f219e/day17/Kotlin/day17.kt
import java.io.* fun print_day_17() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 17" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Trick Shot -c -f small") val r...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day17.class", "javap": "Compiled from \"day17.kt\"\npublic final class Day17 {\n private final Day17$BoundingBox target;\n\n public Day17();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\":()V\n ...
Ad0lphus__AOC2021__02f219e/day13/Kotlin/day13.kt
import java.io.* fun print_day_13() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 13" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Transparent Origami -c -f small") ...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day13.class", "javap": "Compiled from \"day13.kt\"\npublic final class Day13 {\n private final java.util.List<java.lang.String> lines;\n\n private final java.util.List<kotlin.Pair<java.lang.Integer, java.lang.Integer>> coords;\n\n private final java.util.List<j...
Ad0lphus__AOC2021__02f219e/day05/Kotlin/day05.kt
import java.io.* import kotlin.math.abs fun print_day_5() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 5" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Hydroth...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day05Kt.class", "javap": "Compiled from \"day05.kt\"\npublic final class Day05Kt {\n public static final void print_day_5();\n Code:\n 0: ldc #8 // String \\u001b[33m\n 2: astore_0\n 3: ldc #10 ...
Ad0lphus__AOC2021__02f219e/day11/Kotlin/day11.kt
import java.io.* fun print_day_11() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 11" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Dumbo Octopus -c -f small") va...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day11.class", "javap": "Compiled from \"day11.kt\"\npublic final class Day11 {\n private final java.util.List<java.util.List<java.lang.Integer>> octogrid;\n\n public Day11();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method ja...
Ad0lphus__AOC2021__02f219e/day12/Kotlin/day12.kt
import java.io.* fun print_day_12() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 12" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Passage Pathing -c -f small") ...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day12$Node.class", "javap": "Compiled from \"day12.kt\"\npublic final class Day12$Node {\n private final java.lang.String name;\n\n private final boolean isLarge;\n\n private java.util.List<Day12$Node> connections;\n\n public Day12$Node(java.lang.String, boole...
Ad0lphus__AOC2021__02f219e/day07/Kotlin/day07.kt
import java.io.* import kotlin.math.abs fun print_day_7() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 7" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet The Trea...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day07Kt.class", "javap": "Compiled from \"day07.kt\"\npublic final class Day07Kt {\n public static final void print_day_7();\n Code:\n 0: ldc #8 // String \\u001b[33m\n 2: astore_0\n 3: ldc #10 ...
Ad0lphus__AOC2021__02f219e/day10/Kotlin/day10.kt
import java.io.* import java.util.* fun print_day_10() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 10" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Syntax Sco...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day10.class", "javap": "Compiled from \"day10.kt\"\npublic final class Day10 {\n private final java.util.List<java.lang.String> lines;\n\n private final java.lang.Character[] opening;\n\n private final java.util.Map<java.lang.Character, java.lang.Character> bra...
Ad0lphus__AOC2021__02f219e/day03/Kotlin/day03.kt
import java.io.* fun print_day_3() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 3" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Binary Diagnostic -c -f small")...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day03Kt.class", "javap": "Compiled from \"day03.kt\"\npublic final class Day03Kt {\n public static final void print_day_3();\n Code:\n 0: ldc #8 // String \\u001b[33m\n 2: astore_0\n 3: ldc #10 ...
Ad0lphus__AOC2021__02f219e/day18/Kotlin/day18.kt
import java.io.* fun print_day_18() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 18" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Snailfish -c -f small") val re...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day18$Num.class", "javap": "Compiled from \"day18.kt\"\npublic abstract class Day18$Num {\n private Day18$Num$NumPair parent;\n\n private Day18$Num();\n Code:\n 0: aload_0\n 1: invokespecial #8 // Method java/lang/Object.\"<init>\...
Ad0lphus__AOC2021__02f219e/day09/Kotlin/day09.kt
import java.io.* fun print_day_9() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 9" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Smoke Basin -c -f small") v...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day09Kt.class", "javap": "Compiled from \"day09.kt\"\npublic final class Day09Kt {\n public static final void print_day_9();\n Code:\n 0: ldc #8 // String \\u001b[33m\n 2: astore_0\n 3: ldc #10 ...
Ad0lphus__AOC2021__02f219e/day08/Kotlin/day08.kt
import java.io.* fun print_day_8() { val yellow = "\u001B[33m" val reset = "\u001b[0m" val green = "\u001B[32m" println(yellow + "-".repeat(25) + "Advent of Code - Day 8" + "-".repeat(25) + reset) println(green) val process = Runtime.getRuntime().exec("figlet Seven Segment Search -c -f sma...
[ { "class_path": "Ad0lphus__AOC2021__02f219e/Day08Kt.class", "javap": "Compiled from \"day08.kt\"\npublic final class Day08Kt {\n public static final void print_day_8();\n Code:\n 0: ldc #8 // String \\u001b[33m\n 2: astore_0\n 3: ldc #10 ...