{"similarity_score": 0.9278200943054045, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.Comparator\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\nimport kotlin.random.Random\nimport kotlin.system.measureTimeMillis\n\n/**\n * 23.02.2020\n * Main\n *\n * @author Havlong\n * @version v1.0\n */\nclass LineReader(tempReader: Reader) {\n private val reader = BufferedReader(tempReader)\n fun hasNext() = peek() != -1\n private fun peek(): Int {\n reader.mark(1)\n return reader.read().also { reader.reset() }\n }\n\n fun skipSpaces() {\n while (Character.isWhitespace(peek()))\n reader.read()\n }\n\n fun readLine(): String = reader.readLine()\n fun longList() = readLine().split(' ').map(String::toLong)\n fun intList() = readLine().split(' ').map(String::toInt)\n}\n\ntypealias ML = MutableList\ntypealias MI = MutableList\ntypealias LL = List\ntypealias LLL = List\ntypealias PLL = Pair\ntypealias PPLL = Pair\n\nconst val M7 = 1000000007L\nconst val M9 = 1000000009L\nconst val MFFT = 998244353L\nconst val INF = 2000000000000000000L\n\nfun lowerBound(from: Long, to: Long, comparison: (Long) -> Long): Long {\n var left = from\n var right = to + 1\n while (left < right) {\n val mid = (left + right) / 2\n val result = comparison(mid)\n if (result >= 0) {\n right = mid\n } else {\n left = mid + 1\n }\n }\n return left\n}\n\nfun upperBound(from: Long, to: Long, comparison: (Long) -> Long): Long {\n var left = from\n var right = to + 1\n while (left < right) {\n val mid = (left + right) / 2\n val result = comparison(mid)\n if (result > 0) {\n right = mid\n } else {\n left = mid + 1\n }\n }\n return left\n}\n\nfun > List.upperBound(key: T, from: Int = 0, to: Int = size - 1): Int {\n return upperBound(from.toLong(), to.toLong()) { this[it.toInt()].compareTo(key).toLong() }.toInt()\n}\n\nfun > List.lowerBound(key: T, from: Int = 0, to: Int = size - 1): Int {\n return lowerBound(from.toLong(), to.toLong()) { this[it.toInt()].compareTo(key).toLong() }.toInt()\n}\n\nfun > Array.upperBound(key: T, from: Int = 0, to: Int = size - 1): Int {\n return upperBound(from.toLong(), to.toLong()) { this[it.toInt()].compareTo(key).toLong() }.toInt()\n}\n\nfun > Array.lowerBound(key: T, from: Int = 0, to: Int = size - 1): Int {\n return lowerBound(from.toLong(), to.toLong()) { this[it.toInt()].compareTo(key).toLong() }.toInt()\n}\n\noperator fun , B : Comparable> Pair.compareTo(other: Pair): Int {\n return first.compareTo(other.first).let { if (it == 0) second.compareTo(other.second) else it }\n}\n\nfun binPow(number: Long, power: Long, mod: Long): Long {\n var result = 1L\n var a = number % mod\n var n = power\n while (n > 0) {\n if (n % 2 != 0L)\n result = (result * a) % mod\n a = (a * a) % mod\n n /= 2\n }\n return result\n}\n\ntailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)\n\nfun lcm(a: Long, b: Long) = a * b / gcd(a, b)\n\nfun main(args: Array) {\n if (args.isNotEmpty() && args[0] == \"local\") {\n val reader = LineReader(FileReader(\"input.txt\"))\n PrintWriter(File(\"output.txt\")).use {\n while (reader.hasNext()) {\n it.println(\"\\n${measureTimeMillis {\n solve(reader, it)\n }} ms\\n\")\n reader.skipSpaces()\n }\n }\n } else {\n val reader = LineReader(InputStreamReader(System.`in`))\n PrintWriter(System.out).use { solve(reader, it) }\n }\n}\n\nfun solve(reader: LineReader, writer: PrintWriter) {\n val (year, month, day) = reader.readLine().split(':').map(String::toInt)\n val (year2, month2, day2) = reader.readLine().split(':').map(String::toInt)\n val start = Calendar.getInstance().apply { set(year + 400, month, day) }\n val end = Calendar.getInstance().apply { set(year2 + 400, month2, day2) }\n val result = abs(end.timeInMillis - start.timeInMillis + 1) / 1000\n writer.println(result / 3600 / 24)\n}\n", "lang": "Kotlin", "bug_code_uid": "58562ac063a14f842361cb5ef62dc6c6", "src_uid": "bdf99d78dc291758fa09ec133fff1e9c", "apr_id": "e91d1300669e0a08f7170f98b5c624b7", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9835662724619874, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "//TINY_OUNCE911666\n// You are not prepared!\n@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\n\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C127 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val n = readInt()\n println(25)\n}\n/* stuff you should look for\n\t* int overflow, array bounds\n\t* special cases (n=1?)\n\t* do smthn instead of nothing and stay organized\n\t* WRITE STUFF DOWN\n*/", "lang": "Kotlin", "bug_code_uid": "b6571b268bc03c627874baa8316d258f", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "apr_id": "1e6c3132f4a51bf5907a3b0337225498", "difficulty": 800, "tags": ["number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9831649831649831, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n println(\"25\")\n}\n", "lang": "Kotlin", "bug_code_uid": "b01fe0eb469752075dcb17c2f1e8df7f", "src_uid": "dcaff75492eafaf61d598779d6202c9d", "apr_id": "5ee6e5aa549838d2c1d6f379826dd591", "difficulty": 800, "tags": ["number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7024128686327078, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n\tval input = readLine()!!.toInt()\n\tprintln(getVariants(input))\n}\n\nfun getVariants(numberOfEmployee: Int): Int {\n\tvar numOfVariants = 0\n\n\tif (numberOfEmployee < 2) return 0\n\n\tif (numberOfEmployee % 3 != 0 && numberOfEmployee % 2 != 0) return 1\n\n\tfor (i in 0 until numberOfEmployee) {\n\t\tif ((numberOfEmployee - i) % i == 0) {\n\t\t\tnumOfVariats += 1\n\t\t}\n\t}\n\n\treturn numOfVariants\n}", "lang": "Kotlin", "bug_code_uid": "b35915bc6b1979f582610c9cde16a80b", "src_uid": "89f6c1659e5addbf909eddedb785d894", "apr_id": "4ddf4b9a0313273c78b94fc0bd8ba0f9", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7014725568942436, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n\tval input = readLine()!!.toInt()\n\tprintln(getVariants(input))\n}\n\nfun getVariants(numberOfEmployee: Int): Int {\n\tvar numOfVariants = 0\n\n\tif (numberOfEmployee < 2) return 0\n\n\tif (numberOfEmployee % 3 != 0 && numberOfEmployee % 2 != 0) return 1\n\n\tfor (i in 0 until numberOfEmployee) {\n\t\tif ((numberOfEmployee - i) % i == 0) {\n\t\t\tnumOfVariants += 1\n\t\t}\n\t}\n\n\treturn numOfVariants\n}", "lang": "Kotlin", "bug_code_uid": "a8a7c1b2d656075ebc4f0c531b2ea5e9", "src_uid": "89f6c1659e5addbf909eddedb785d894", "apr_id": "4ddf4b9a0313273c78b94fc0bd8ba0f9", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.706199460916442, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n\tval input = readLine()!!.toInt()\n\tprintln(getVariants(input))\n}\n\nfun getVariants(numberOfEmployee: Int): Int {\n\tvar numOfVariants = 0\n\n\tif (numberOfEmployee < 2) return 0\n\n\tif (numberOfEmployee % 3 != 0 && numberOfEmployee % 2 != 0) return 1\n\n\tfor (i in 1..numberOfEmployee) {\n\t\tif ((numberOfEmployee - i) % i == 0) {\n\t\t\tnumOfVariants += 1\n\t\t}\n\t}\n\n\treturn numOfVariants\n}", "lang": "Kotlin", "bug_code_uid": "0c2ec5018342eb56221ad81a8be1aee3", "src_uid": "89f6c1659e5addbf909eddedb785d894", "apr_id": "4ddf4b9a0313273c78b94fc0bd8ba0f9", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9322709163346613, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val n = scan.nextInt()\n var res = 1\n for (i in 2 until n/2) {\n if (n%i == 0){\n res++\n if (n/i != i) res++\n }\n\n }\n print(res)\n}", "lang": "Kotlin", "bug_code_uid": "63c943b8898ddf147ab7f3c991c00089", "src_uid": "89f6c1659e5addbf909eddedb785d894", "apr_id": "7e66b5ac75c117273f56106dbe14094b", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.993006993006993, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n\tval n = readLine()!!.toInt()\n\tvar temp = 0\n\tfor(i in 1..n-1){\n\tif((n - 1) % i == 0) temp++\n\t}\n\tprintln(temp)\n}", "lang": "Kotlin", "bug_code_uid": "854be7ffb29a46c3d84359837205c7b7", "src_uid": "89f6c1659e5addbf909eddedb785d894", "apr_id": "3e5539663f38aac4bd56e552944bf4f5", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9262877442273535, "equal_cnt": 18, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 16, "fix_ops_cnt": 17, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val gameList = takeInput()\n var result = true\n var prevWinner = gameList[0]\n var prevLooser = 3 - gameList[0]\n var prevWatcher = 3\n for(i in 1 until gameList.size) {\n val currentWinner = gameList.get(i)\n var currentLooser: Int;\n if(currentWinner == prevWinner) {\n currentLooser = prevWatcher;\n } else {\n currentLooser = prevWinner;\n }\n var currentWatcher = prevLooser;\n if(currentWinner==prevLooser) {\n result = false\n break\n }\n prevWinner = currentWinner;\n prevLooser = currentLooser;\n prevWatcher = currentWatcher;\n }\n if(result) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}\n\nfun takeInput(): IntArray {\n val scanner = Scanner(System.`in`);\n val numOfGames = scanner.nextInt();\n val gameList = IntArray(numOfGames);\n for(i in 0 until numOfGames) {\n gameList[i] = scanner.nextInt()\n }\n return gameList\n}\n\n", "lang": "Kotlin", "bug_code_uid": "6ce1cb50833d871f0ee99327468e5f2a", "src_uid": "6c7ab07abdf157c24be92f49fd1d8d87", "apr_id": "868b5c973585f73bff599e70903a1627", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6929824561403509, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val fly = readInts()\n val otherFly = readInts()\n print(if (fly.withIndex().count { it.value == otherFly[it.index] } >= 2) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "3b80eeb6fa583594fb3930bb2310b6d0", "src_uid": "91c9dbbceb467d5fd420e92c2919ecb6", "apr_id": "d5faffe110f9184a702362e0d78d5a91", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9961538461538462, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val n = br.readLine().toInt()\n val digits = listOf(8, 4, 2, 6)\n println(if (n == 0) 8 else digits[(n - 1) % 4])\n}", "lang": "Kotlin", "bug_code_uid": "e9ea912445510e220a31985ee9887ac9", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "2cdfd9821586a4c0ed8ebb16217572b4", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9620758483033932, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val n = br.readLine().toInt()\n val digits = listOf(8, 4, 2, 6)\n println(digits[(n - 1) % 4])\n}", "lang": "Kotlin", "bug_code_uid": "155c14c0ce50e742565c07d213d5da1e", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "2cdfd9821586a4c0ed8ebb16217572b4", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8671328671328671, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val i = readLine()!!.toInt()\n when(i%4) {\n 1 -> println(8)\n 2 -> println(4)\n 3 -> println(2)\n 0 -> println(6)\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "bc469443b55fe76c3a55a1d98dd5b436", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "189d2846cd5594d8f33cfc6f769ec235", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9045226130653267, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n var n = inp.nextInt() % 4\n if (n == 0) n = 4\n print(pow(8, n) % 10)\n}\n\nprivate fun pow(a: Int, b: Int): Int {\n var p = 1\n for (i in 1..b)\n p *= a\n return p\n}", "lang": "Kotlin", "bug_code_uid": "c772fb58e6239856f74b5a0793dd4d53", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "4913c160c27afe7478569fc801b175d6", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.971928545388261, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun DataReader.solve(out: PrintWriter) {\n val n = nextInt() % 4\n\n out.println((1..n).map { 8 }.fold(1, Int::times) % 10)\n}\n\nfun Boolean.toYesNo() = if (this) \"YES\" else \"NO\"\n\nclass DataReader(private val reader: BufferedReader) {\n var st : StringTokenizer? = null\n companion object {\n fun createFromFile(name: String) = DataReader(BufferedReader(FileReader(name)))\n }\n\n fun next() : String? {\n while (st == null || !st!!.hasMoreTokens()) {\n val s = reader.readLine() ?: return null\n st = StringTokenizer(s)\n }\n\n return st?.nextToken()\n }\n\n fun nextToken() = next()!!\n\n fun nextInt() = nextToken().toInt()\n fun nextLong() = nextToken().toLong()\n fun readIntArray(n: Int) : IntArray {\n val result = IntArray(n)\n result.indices.forEach { i -> result[i] = nextInt() }\n return result\n }\n\n fun nextLine() = reader.readLine()\n}\n\nfun main(args: Array) {\n val r: Reader\n val out: PrintWriter\n if (System.getProperty(\"ONLINE_JUDGE\") == null) {\n r = FileReader(\"input.txt\")\n out = PrintWriter(\"output.txt\")\n } else {\n r = InputStreamReader(System.`in`)\n out = PrintWriter(System.out)\n }\n\n DataReader(BufferedReader(r)).solve(out)\n out.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "1a65933032ccd3671d4355e698fb74a4", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "f033dbe4df9d29d344ff242bf2f54e2a", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9048927982407916, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n var (n,k) = readLine()!!.split(\" \").map{it.toInt()}\n val a = readLine()!!\n val t = Array(n+1, {IntArray(26)})\n for (j in 0..25) t[0][j] = -1\n for (i in 0..n-1) {\n for (j in 0..25) t[i+1][j] = t[i][j]\n t[i+1][a[i]-'a'] = i\n }\n val dp = Array(n, {LongArray(n+1, {0})})\n for (i in 0..n-1) {\n dp[i][1] = 1\n for (j in 2..n) {\n for (c in 0..25) if (t[i][c]>=0) {\n dp[i][j] += dp[ t[i][c] ][j-1]\n if (dp[i][j] > 1000000000000L)\n dp[i][j] = 1000000000000L\n }\n }\n }\n var ans = 0L\n for (j in n downTo 1) for (c in 0..25) if (t[n][c]>=0) {\n if (k==0) break\n val cnt = minOf(dp[ t[n][c] ][j], k.toLong())\n ans += cnt * (n-j)\n k -= cnt.toInt()\n }\n if (k==0) println(ans)\n else if (k==1) println(ans+n)\n else println(\"-1\")\n}\n", "lang": "Kotlin", "bug_code_uid": "baadd4509860f6a78b28e443e3905571", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "apr_id": "68918291f36a6dd555e9cc92dc64d295", "difficulty": 1900, "tags": ["dp", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9965738120065545, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.ArrayList\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val inputReader = InputReader(inputStream)\n val out = PrintWriter(outputStream)\n\n val n = inputReader.nextInt()\n val k = inputReader.nextInt()\n val str = inputReader.next()\n\n val letters = BooleanArray(26)\n val list = ArrayList(n)\n for (i in 0 until str.length) {\n val char = str[i]\n val node = Node(char, i, n)\n if (letters[char - 'a']) {\n node.isSame = true\n } else {\n letters[char - 'a'] = true\n }\n list.add(node)\n }\n for (i in 0 until list.size) {\n val ai = list[i]\n for (j in i + 1 until list.size) {\n val aj = list[j]\n ai.addNext(aj.char - 'a', aj)\n }\n }\n\n for (node in list) {\n find(node)\n }\n\n val totalCountArray = IntArray(n)\n for (i in 0 until n) {\n for (node in list) {\n if (!node.isSame) {\n totalCountArray[i] += node.countArray[i]\n }\n }\n }\n\n var totalCost = 0\n var selectCount = 0\n for (i in n - 1 downTo 0) {\n if (selectCount + totalCountArray[i] < k) {\n totalCost += (n - 1 - i) * totalCountArray[i]\n selectCount += totalCountArray[i]\n } else {\n val over = (selectCount + totalCountArray[i]) - k\n totalCost += (n - 1 - i) * (totalCountArray[i] - over)\n selectCount += (totalCountArray[i] - over)\n break\n }\n }\n\n if (selectCount < k) {\n if (selectCount == k - 1) {\n println(totalCost + n)\n } else {\n println(-1)\n }\n } else {\n println(totalCost)\n }\n}\n\nprivate fun find(node: Node) {\n if (node.hasCul) {\n return\n }\n\n node.countArray[0]++\n for (next in node.nextList) {\n find(next)\n for (i in 0 until next.countArray.size) {\n if (next.countArray[i] > 0) {\n node.countArray[i + 1] += next.countArray[i]\n }\n }\n }\n\n node.hasCul = true\n}\n\nclass Node(var char: Char, var index: Int, n: Int) {\n private val nextArray: Array = arrayOfNulls(26)\n var hasCul = false\n var isSame = false\n var nextCount = 0\n val nextList = ArrayList()\n\n val countArray = IntArray(n)\n\n override fun toString(): String {\n return \"$char\"\n }\n\n fun addNext(index: Int, node: Node) {\n if (nextArray[index] == null) {\n nextCount++\n nextArray[index] = node\n nextList.add(node)\n }\n }\n}\n\nclass InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream))\n private var tokenizer = StringTokenizer(\"\")\n\n /** get next word */\n @Throws(IOException::class)\n operator fun next(): String {\n while (!tokenizer.hasMoreTokens()) {\n //TODO add check for eof if necessary\n tokenizer = StringTokenizer(\n reader.readLine()\n )\n }\n return tokenizer.nextToken()\n }\n\n fun nextLong() = next().toLong()\n fun nextInt() = next().toInt()\n fun nextDouble() = next().toDouble()\n fun nextFloat() = next().toFloat()\n}", "lang": "Kotlin", "bug_code_uid": "9c8f26fcb573a0d8e73c1c48068101b6", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "apr_id": "9f64c5d2a5952718a6758ff6b5d4f463", "difficulty": 1900, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5751115518096183, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\n\nfun main() {\n val input = readLine()!!.toInt()\n\n println(maxProduct(input))\n}\n\nfun maxProduct(input: Int): Long {\n val inputDigits = splitDigits(input)\n val limit = (listOf(inputDigits[0] - 1) + Collections.nCopies(inputDigits.size - 1, 9)).joinToString(\"\").toInt()\n\n var max: Long = 0\n for (i in input downTo limit) {\n val digits = splitDigits(i)\n val prod = product(digits)\n if (prod > max) max = prod\n }\n return max\n}\n\n\nfun product(digits: List): Long {\n return digits\n .map(Int::toLong)\n .reduce(Long::times)\n}\n\nfun splitDigits(input: Int): List {\n var number = input\n val digits: MutableList = ArrayList()\n while(number != 0) {\n digits.add(number % 10)\n number /= 10\n }\n return digits.reversed()\n}", "lang": "Kotlin", "bug_code_uid": "778f748c32bddff274336f8bee903293", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "apr_id": "3469613ae4b32638ff85f5a62b17a023", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6048543689320388, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*\n\nfun main() {\n val input = readLine()!!.toInt()\n\n println(maxProduct(input))\n}\n\nfun maxProduct(input: Int): Long {\n if (input < 10) return input.toLong()\n\n val inputDigits = splitDigits(input)\n val limit = (listOf(inputDigits[0] - 1) + Collections.nCopies(inputDigits.size - 1, 9)).joinToString(\"\").toInt()\n\n var max: Long = 0\n for (i in input downTo limit) {\n val digits = splitDigits(i)\n val prod = product(digits)\n if (prod > max) max = prod\n }\n return max\n}\n\n\nfun product(digits: List): Long {\n return digits\n .map(Int::toLong)\n .reduce(Long::times)\n}\n\nfun splitDigits(input: Int): List {\n var number = input\n val digits: MutableList = ArrayList()\n while(number != 0) {\n digits.add(number % 10)\n number /= 10\n }\n return digits.reversed()\n}", "lang": "Kotlin", "bug_code_uid": "a552cb9ff706fdf081a02b047674e45b", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "apr_id": "3469613ae4b32638ff85f5a62b17a023", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9910903691132796, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n val input = readLine()!!.toInt()\n\n println(maxProduct(input))\n}\n\nfun maxProduct(input: Int): Long {\n if (input < 10) return input.toLong()\n\n val inputDigits = splitDigits(input)\n\n var max: Long = 0\n val nines = generateNines(inputDigits)\n for (digits in nines) {\n val prod = product(digits)\n if (prod > max) {\n max = prod\n }\n }\n return max\n}\n\nfun generateNines(digits: List): List> {\n val nines: MutableList> = ArrayList(digits.size)\n\n for (i in 0 until digits.size) {\n val tail = Collections.nCopies(i, 9)\n val head = splitDigits(digits.subList(0, digits.size - i).joinToString(\"\").toInt() - 1)\n nines.add(head + tail)\n }\n\n return nines\n}\n\nfun product(digits: List): Long {\n return digits\n .map(Int::toLong)\n .reduce(Long::times)\n}\n\nfun splitDigits(input: Int): List {\n var number = input\n val digits: MutableList = ArrayList()\n while(number != 0) {\n digits.add(number % 10)\n number /= 10\n }\n return digits.reversed()\n}", "lang": "Kotlin", "bug_code_uid": "b9776a51d19be7f7892c9d79c0634563", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "apr_id": "3469613ae4b32638ff85f5a62b17a023", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9495327102803738, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(){\n var n = readLine()!!.toInt()\n val results = IntArray(10){0}\n var i=9\n while (n>0){\n results[i]=n%10\n i--\n n/=10\n }\n i=0\n while (results[i]==0) i++\n var ti=i\n var proizv1=1\n for (k in i..9) proizv1*=results[k]\n var tp=1\n while (ti<10) {\n var proizv2 = tp * (results[ti]-1) * Math.pow(9.0, (9 - ti).toDouble()).toInt()\n if (proizv2 > proizv1) proizv1 = proizv2\n tp*=results[ti]\n ti++\n }\n println(proizv1)\n}", "lang": "Kotlin", "bug_code_uid": "c13afe6cc1725b1847ff0a1ec7fd0362", "src_uid": "38690bd32e7d0b314f701f138ce19dfb", "apr_id": "575e01976b5ceb4551c68a1e1739dffe", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9725158562367865, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.lang.Math.*\nimport java.util.*\n\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n val pw = PrintWriter(System.out)\n val n = sc.nextInt()\n val k = sc.nextInt()\n val a = arrayListOf()\n for (i in 1..k)\n if (n % i == 0)\n a.add(i)\n var min = Int.MAX_VALUE\n for (i in a) {\n val need = n / i\n val x = need * k + i\n min = min(x, min)\n }\n pw.println(min)\n pw.close()\n}\n\nclass FastScanner(s: InputStream) {\n val br = BufferedReader(InputStreamReader(s))\n var st = StringTokenizer(\"\")\n fun next(): String {\n if (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n}", "lang": "Kotlin", "bug_code_uid": "648b53584e83351f74a91adeee13917f", "src_uid": "ed0ebc1e484fcaea875355b5b7944c57", "apr_id": "e4b64b7fc8379bf14e9c3faa6495d22d", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8032345013477089, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val s1 = r.readLine()!!.split(\" \").map { it.toInt() }.sum()\n val s2 = r.readLine()!!.split(\" \").map { it.toInt() }.sum()\n val v = r.readLine()!!.toInt()\n val ans = s1/5 + s2/10 +if (s1%5!=0) 1 else 0 +if (s2%10!=0) 1 else 0\n println(if (ans<=v) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "55087de07e7aa647fb4584b366ade42a", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "apr_id": "4d226a77a59e195114e45cfbff34e96a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9562251279135873, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "// https://codeforces.com/problemset/problem/448/A\n\n\nfun main(args: Array) {\n val medals = readInts()\n val cups = readInts()\n var totalShelves = readInt()\n\n val totalMedals = medals.sum()\n val totalCups = cups.sum()\n\n var totalCupsShelves = (totalCups / 10)\n if(totalCupsShelves % 10 != 0){\n totalCupsShelves += 1\n }\n var totalMedalsShelves = (totalMedals / 5)\n if(totalMedalsShelves % 5 != 0){\n totalMedalsShelves += 1\n }\n\n if(totalCupsShelves + totalMedalsShelves > totalShelves){\n print(\"NO\")\n }else{\n print(\"YES\")\n }\n\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings(del: String = \" \") = readLn().split(del) // list of strings\nprivate fun readInts(del: String = \" \") = readStrings(del).map { it.toInt() } // list of ints", "lang": "Kotlin", "bug_code_uid": "f3f54f2ad2ce65820973947fa14aec9f", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e", "apr_id": "7bded3c1dad8dca49bae8b76515fd31a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9864351600651112, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n fun readLong() = readLine()!!.toLong()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n val aes = readInts().sorted()\n var total = aes.sum()\n if(total % 2 == 1) {\n print(\"NO\")\n return\n }\n var goal = total / 2\n var options = setOf(true, false)\n for(option1 in options)\n for(option2 in options)\n for (option3 in options)\n for(option4 in options) {\n var sol = 0\n if(option1) sol += aes[0]\n if(option2) sol += aes[1]\n if(option3) sol += aes[2]\n if(option4) sol += aes[3]\n if(sol == goal) {\n print(\"YES\")\n return\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "cfd86402e818be4024822b657976e050", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "e7e34b254186125444123b78a0175aab", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.34822104466313397, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "fun main() {\n val n = readLine()!!\n val nInt = n.toInt()\n// val occsEach = (n.length + 1) / 2\n// if (n.length % 2 == 1) {\n// val sb = StringBuilder()\n// repeat(occsEach) { sb.append('4') }\n// repeat(occsEach) { sb.append('7') }\n// return print(sb.toString())\n// }\n// val big = n.map { it >= '7' }.reduce { a, b -> a and b } // all digits 7 or bigger\n// if (big) {\n// val sb = StringBuilder()\n// repeat(occsEach + 1) { sb.append('4') }\n// repeat(occsEach + 1) { sb.append('7') }\n// return print(sb.toString())\n// }\n//\n fun recursion(sb: StringBuilder, fours: Int, sevens: Int): String? {\n if (fours == 0 && sevens == 0) {\n if (sb.toString().toInt() >= nInt) return sb.toString()\n else return null\n } else {\n if (fours > 0) {\n sb.append('4')\n val option1 = recursion(sb, fours - 1, sevens)\n if (option1 != null) return option1\n sb.deleteCharAt(sb.lastIndex)\n }\n if (sevens > 0) {\n sb.append('7')\n val option2 = recursion(sb, fours, sevens - 1)\n if (option2 != null) return option2\n sb.deleteCharAt(sb.lastIndex)\n return null\n }\n return null\n }\n }\n\n for (length in n.length .. n.length + 2) {\n if (length % 2 == 1) continue\n val sb = StringBuilder()\n val sol = recursion(sb, length / 2, length / 2)\n if (sol != null) return print(sol)\n }\n}", "lang": "Kotlin", "bug_code_uid": "3a2ca7f82b92f06940544285874834d3", "src_uid": "77b5f83cdadf4b0743618a46b646a849", "apr_id": "dabfef2880d81a6b26fb8677f508d127", "difficulty": 1300, "tags": ["brute force", "bitmasks", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7055555555555556, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "import kotlin.math.pow\n\nfun main() {\n val n = readLine()!!.toInt()\n var ans = 0\n for (i in 1..n) {\n ans += (-1.0).pow(i.toDouble()).toInt() * i\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "c8d89b9330d5a8d1a333423dbf943476", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "0b4261f097dd84e57bdaf04c479e034a", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.981081081081081, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val (s, n) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n when{\n n%2==1&&m>=n/2+1 -> println(m-1)\n n%2==1 -> println(m+1)\n n%2==0&&m>n/2 -> println(m-1)\n else -> println(m+1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "7d31cefb33428622b450d8537a35fcd7", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "apr_id": "7649d8c692671a29732e0a37e1aeb7a5", "difficulty": 1300, "tags": ["games", "greedy", "math", "implementation", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7062068965517241, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.*\n//https://codeforces.com/problemset/problem/570/B\nfun main(args: Array) = with(Scanner(System.`in`)){\n val n = nextLong()\n val m = nextLong()\n val lM = m - 1\n val rM = n - m \n \n if(lM >= rM) {\n println(m - 1)\n } else {\n println(m + 1)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "18c3976afbd550ac5fff64f37f921378", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "apr_id": "1dd37407314873e2bbf04fab79c20277", "difficulty": 1300, "tags": ["games", "greedy", "math", "implementation", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8881118881118881, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val (n, m) = readLine()!!.split(\" \").map(String::toInt)\n if (m <= n / 2.0) print(m + 1) else print(m - 1)\n}", "lang": "Kotlin", "bug_code_uid": "b2078f982540df787e0204f70486339b", "src_uid": "f6a80c0f474cae1e201032e1df10e9f7", "apr_id": "e6391138bd69212af74cc53da2dca262", "difficulty": 1300, "tags": ["games", "greedy", "math", "implementation", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9887539361223572, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport kotlin.concurrent.thread\nimport java.io.IOException\nimport java.io.BufferedReader\nimport java.io.InputStream\nimport kotlin.*\nimport java.*\nimport java.io.OutputStream\nimport java.io.PrintWriter\nimport java.lang.ArithmeticException\nimport java.lang.Exception\nimport java.math.BigInteger\nimport java.security.cert.TrustAnchor\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.system.exitProcess\n\nfun main() {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = InputReader(inputStream)\n val out = PrintWriter(outputStream)\n\n val n = `in`.nextLong()+2\n var t = `in`.nextLong()\n\n if (t and t - 1 > 0) {\n out.println(0)\n } else {\n var kol = 1\n var ans=0L\n if (t==1L)\n --ans\n while (t % 2 == 0L) {\n ++kol\n t /= 2\n }\n\n fun C(b:Int,m:Int):Long {\n if (m>b)\n return 0\n var x = BigInteger.ONE\n for (i in 1..b)\n x=x.multiply(BigInteger(i.toString()))\n for (i in 1..m)\n x=x.divide(BigInteger(i.toString()))\n for (i in 1..b-m)\n x=x.divide(BigInteger(i.toString()))\n return x.toLong()\n }\n\n for (i in 60 downTo 0)\n {\n if ((1L shl i).and(n)>0) {\n ans += C(i, kol)\n --kol\n }\n }\n\n out.println(ans)\n }\n\n\n\n out.close()\n\n}\n\n\ninternal class InputReader(stream: InputStream) {\n var reader: BufferedReader\n var tokenizer: StringTokenizer? = null\n\n init {\n reader = BufferedReader(InputStreamReader(stream), 32768)\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return next().toLong()\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "fd7b07970f87e1f1e50981026da00206", "src_uid": "727d5b601694e5e0f0cf3a9ca25323fc", "apr_id": "37643da085f40cd398089cd6e0c339cc", "difficulty": 2000, "tags": ["dp", "math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9889001009081736, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.collections.*\nimport kotlin.io.*\nimport kotlin.math.*\nimport kotlin.Array\n\nclass Main{\n\n fun solve(inp : InputReader) {\n val s = inp.readln().toLowerCase()\n val t = inp.readln().toLowerCase()\n var signs = 0\n for(i in 0 until s.length){\n if(s[i] != t[i]){\n signs = if(s[i] < t[i])-1 else 1\n }\n }\n print(signs)\n }\n\n class InputReader{\n public fun readln() = readLine()!!\n public fun readlnInt() = readln().toInt()\n public fun readlnLong() = readln().toLong()\n public fun readlnDouble() = readln().toDouble()\n\n public fun readlnStrings() = readln().split(\" \")\n public fun readlnInts() = readlnStrings().map{it.toInt()}\n public fun readlnLongs() = readlnStrings().map{it.toLong()}\n public fun readlnDoubles() = readlnStrings().map{it.toDouble()}\n }\n}\n\nfun main(args : Array ){\n Main().solve(Main.InputReader())\n}", "lang": "Kotlin", "bug_code_uid": "fcd6040811fde83336762786af0fb04b", "src_uid": "ffeae332696a901813677bd1033cf01e", "apr_id": "928db6ae766ca4e7133f9086fa030d3a", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.42462845010615713, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.regex.Pattern\n\nfun main(args: Array) {\n\n var sum1 =0\n var sum2 =0\n for (i in 0..1)\n {\n var text = readLine()!!.toLowerCase()\n var charArray = text.toCharArray()\n for (ix in 0..(charArray.size-1))\n {\n if (i ==0)\n {\n sum1 += charArray[ix].toInt()\n }\n else\n {\n sum2 +=charArray[ix].toInt()\n }\n }\n\n }\n\n if (sum1 Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i + offset)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun pair(a: A, b: B) = RPair(a, b)\ndata class RPair(val _1: A, val _2: B)\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "77459823a5419b9f835daa32a0704a60", "src_uid": "cd351d1190a92d094b2d929bf1e5c44f", "apr_id": "fddbed66778400037ead3fbec8a44635", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9740458015267176, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() = readLine()!!.let { word ->\n for (i in word.indices) {\n for (j in (i + 1)..word.length) {\n if (\"${word.substring(0, i)}${if (j < word.length) word.substring(j, word.length) else \"\"}\".apply(::println) == \"CODEFORCES\")\n return@let \"YES\"\n }\n }\n return@let \"NO\"\n}.run(::println)\n", "lang": "Kotlin", "bug_code_uid": "101486951884799dd8338f849f2f05d3", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "apr_id": "6f75195812275301023b3e09084ed7f7", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.3159922928709056, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n var n = 0\n var s = \"CODEFORCES\"\n readLine()!!.forEach { n += if (n < s.length && it == s[n]) 1 else 0 }\n println(when(n) {\n s.length -> \"YES\"\n else -> \"NO\"\n })\n}", "lang": "Kotlin", "bug_code_uid": "db14f006804115e681c7c05abd1f0755", "src_uid": "bda4b15827c94b526643dfefc4bc36e7", "apr_id": "bfd1388de3b1c5e70193a7992072697a", "difficulty": 1400, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9846051978149313, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\n\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.max\nimport kotlin.math.pow\n\n@JvmField\n val INPUT = System.`in`!!\n @JvmField\n val OUTPUT = System.out!!\n\n @JvmField\n val reader = INPUT.bufferedReader()\n\n fun readLine(): String? = reader.readLine()\n fun readLn() = reader.readLine()!!\n @JvmField\n var tokenizer: StringTokenizer = StringTokenizer(\"\")\n\n fun read(): String {\n while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(reader.readLine() ?: return \"\", \" \")\n return tokenizer.nextToken()\n }\n\n fun readInt() = read().toInt()\n fun readDouble() = read().toDouble()\n fun readLong() = read().toLong()\n fun readIntArray(n: Int) = IntArray(n) { read().toInt() }\n fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\n fun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n @JvmField\n val rw = PrintWriter(OUTPUT, false)\n\n inline fun output(block: PrintWriter.() -> Unit) {\n rw.apply(block).flush()\n }\n\n fun printLArray(a: LongArray) { a.forEach { x -> rw.print(x); rw.print(\" \") };rw.println() }\n fun printIArray(a: IntArray) { a.forEach { x -> rw.print(x);rw.print(\" \") };rw.println() }\n\n private var is_prime: BooleanArray? = null\n private var prime: ArrayList? = null\n fun sieve(n: Int) {\n is_prime = BooleanArray(n + 10)\n prime = ArrayList()\n for (i in 2..n) is_prime!![i] = true\n for (i in 2..n) {\n if (is_prime!![i]) prime!!.add(i)\n var j = 0\n while (j < prime!!.size && i * prime!![j] < n) {\n is_prime!![i * prime!![j]] = false\n if (i % prime!![j] == 0) break\n ++j\n }\n }\n }\n\n fun mergeSort(a: IntArray) {\n val n = a.size\n if (n < 2) return\n val mid = n / 2; val left = IntArray(mid); val right = IntArray(n - mid)\n for (i in 0 until mid) left[i] = a[i]\n for (i in mid until n) right[i - mid] = a[i]\n mergeSort(left);mergeSort(right);merge(left, right, a)\n }\n\n fun merge(left: IntArray, right: IntArray, a: IntArray) {\n val nLeft = left.size; val nRight = right.size\n var i = 0; var j = 0; var k = 0\n while (i < nLeft && j < nRight) {\n if (left[i] <= right[j]) {\n a[k] = left[i];k++;i++\n } else {\n a[k] = right[j]; k++;j++\n }\n }\n while (i < nLeft) {a[k] = left[i]; i++; k++}\n while (j < nRight){a[k] = right[j]; j++; k++}\n }\n\n fun gcd(a: Long, b: Long): Long {\n if (b == 0L) return a\n return gcd(b, a % b)\n }\n\n fun smallest(a: IntArray): Int {\n var min = a[0]\n for (i in 1 until a.size) {\n if (a[i] < min) min = a[i]\n }\n return min\n }\nfun main(){\n\n val n = readInt()\n val dp = IntArray(n)\n dp[0] = 1\n for (i in 1 until n) dp[i] = dp[i-1] + 2.0.pow(i+1).toInt() \n rw.println(dp[n-1])\n rw.close()\n}\n\n", "lang": "Kotlin", "bug_code_uid": "b9cfc57c9e51b20840efd2206461c3da", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "fa4e1afcd4db290e4f91e5fe7d402da0", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7577319587628866, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n\n val n = readLine()!!.toInt()\n\n val a_n_1 = 1\n val a_n = 1\n for (i in 2..n) {\n\n a_n = (a_n_1 + Math.pow(2.0, i.toDouble())).toInt()\n a_n_1 = a_n\n }\n \n println(a_n)\n}", "lang": "Kotlin", "bug_code_uid": "761c6151c4a123c604da1f5e90abff4f", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "31c5d3335442bca42e75e61a5add2c72", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7728459530026109, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n\n val n = readLine()!!.toInt()\n\n var a_n_1 = 1\n var a_n = 1\n for (i in 2..n) {\n a_n = (a_n_1 + Math.pow(2.0, i.toDouble())).toInt()\n a_n_1 = a_n\n }\n\n println(a_n)\n}", "lang": "Kotlin", "bug_code_uid": "1af0e80c8fc7734b54b59dba4296d6b8", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "31c5d3335442bca42e75e61a5add2c72", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7990762124711316, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val n = readLine()?.toInt()\n println(calcRhomb(n!!))\n}\n\nfun calcRhomb(n: Int): Int {\n if (n == 1)\n return 1\n if (n == 2)\n return 5\n\n return Math.pow(2.toDouble(), n.toDouble()).toInt() + calcRhomb(n - 1)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "5228a4e40be27de396d14c1e6e28d9c9", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "ec95c4f0279ac9a95cbccc251dcd5ac8", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9757281553398058, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport kotlin.math.pow\n\nfun main() {\n val reader = Scanner(System.`in`)\n val nThOrderRhomb = reader.nextFloat()\n println(nThOrderRhomb.pow(2) + (nThOrderRhomb - 1).pow(2))\n}", "lang": "Kotlin", "bug_code_uid": "fe115ac73fecff06f5a6d7619ba58f4a", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "f3c38dee8687bb1a5903ab07689c7fca", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4394686907020873, "equal_cnt": 24, "replace_cnt": 18, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 23, "bug_source_code": "import java.io.PrintWriter\nimport java.util.ArrayDeque\nimport java.util.StringTokenizer\n\nfun main() {\n output {\n val (n, m, a, b) = readInts(4)\n val (g0, x, y, z) = readLongs(4)\n val H = generateSequence(g0) { (it * x + y) % z }.chunked(m).take(n).toList()\n\n val rc = H.map { it.windowedMins(b).toList() }\n\n val ans = H[0].indices.fold(0L) { acc: Long, i: Int ->\n acc + H.virtualMap { it[i] }.windowedMins(a).sum()\n }\n\n println(ans)\n }\n}\n\nfun > List.windowedMins(len: Int): Sequence = sequence {\n var l = len\n val deq = ArrayDeque()\n for(i in indices) {\n val n = get(i)\n while(deq.isNotEmpty() && deq.last > n) deq.removeLast()\n deq.addLast(n)\n if(i >= len && get(i-len) == deq.first) deq.removeFirst()\n if(i+1 >= len) yield(deq.first)\n }\n}\n\nfun List.virtualMap(func: (T) -> R): List = VirtualMapList(this, func)\n\nclass VirtualMapList(val delegate: List, val mapFunc: (T) -> R): AbstractList() {\n override val size: Int\n get() = delegate.size\n\n override fun get(index: Int): R = mapFunc(delegate[index])\n}\n\n/** IO code start */\n@JvmField val _reader = System.`in`.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(System.out, false)\ninline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }\nfun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks", "lang": "Kotlin", "bug_code_uid": "2c973723adaf959142e7d63f6dd0f016", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "apr_id": "4a0c8d471f73890b06acaf63ed4f67da", "difficulty": 2100, "tags": ["data structures", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7689415303628502, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.io.PrintWriter\nimport java.util.ArrayDeque\nimport java.util.Deque\nimport java.util.StringTokenizer\n\nfun main() {\n val n = read().toInt()\n val m = read().toInt()\n val a = read().toInt()\n val b = read().toInt()\n var h = read().toInt()\n val x = read().toInt()\n val y = read().toInt()\n val z = read().toInt()\n\n val cWindows = Array(m-b+1) { Window(a) }\n var ans = 0L\n\n for(i in 0 until n) {\n val rWindow = Window(b)\n val tg = i+1-a >= 0\n for(j in 0 until m) {\n rWindow.add(h)\n val l = j+1-b\n if(l >= 0) {\n val cw = cWindows[l]\n cw.add(rWindow.min)\n if(tg) ans += cw.min\n }\n h = (h.toLong() * x + y).rem(z).toInt()\n }\n }\n\n println(ans)\n}\n\nclass Window(@JvmField val len: Int) {\n @JvmField val eleQ = ArrayDeque(len)\n @JvmField val minQ = ArrayDeque(len)\n\n inline fun add(item: Int) {\n if(eleQ.size == len && eleQ.pollFirst() == minQ.first) minQ.pollFirst()\n eleQ.addLast(item)\n while(minQ.isNotEmpty() && minQ.last > item) minQ.pollLast()\n minQ.addLast(item)\n }\n\n inline val min: Int get() = minQ.first\n}\n\n/** IO code start */\n@JvmField val _reader = System.`in`.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(System.out, false)\ninline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }\nfun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks", "lang": "Kotlin", "bug_code_uid": "43cb3beda6c73daa2aef7b89b22b9b3b", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "apr_id": "4a0c8d471f73890b06acaf63ed4f67da", "difficulty": 2100, "tags": ["data structures", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3438395415472779, "equal_cnt": 24, "replace_cnt": 18, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main() {\n val jin = Scanner(System.`in`)\n val n = jin.nextInt()\n val m = jin.nextInt()\n val a = jin.nextInt()\n val b = jin.nextInt()\n var g = jin.nextLong()\n val x = jin.nextLong()\n val y = jin.nextLong()\n val z = jin.nextLong()\n var before = Array(n) { LongArray(m) {\n val res = g\n g = ((g * x) + y) % z\n res\n }}\n /*for (i in 0 until n) {\n for (j in 0 until m) {\n println(\"array[\" + i + \"][\" + j + \"] = \" + before[i][j])\n }\n }*/\n var after = Array(n) { LongArray(m) }\n var alpha = 1\n while ((2 * alpha) <= a) {\n for (i in 0 until n) {\n for (j in 0 until m) {\n after[i][j] = min(before[i][j], before[(i + alpha) % n][j])\n }\n }\n val temp = before\n before = after\n after = temp\n alpha *= 2\n }\n var beta = 1\n while ((2 * beta) <= b) {\n for (i in 0 until n) {\n for (j in 0 until m) {\n after[i][j] = min(before[i][j], before[i][(j + beta) % m])\n }\n }\n val temp = before\n before = after\n after = temp\n beta *= 2\n }\n //println(\"a = \" + a + \", b = \" + b + \", alpha = \" + alpha + \", beta = \" + beta)\n var answer: Long = 0\n for (i in 0..n - a) {\n for (j in 0..m - b) {\n val delta = min(\n min(before[i][j], before[i][j + b - beta]),\n min(before[i + a - alpha][j], before[i + a - alpha][j + b - beta])\n )\n //println(\"delta[\" + i + \"][\" + j + \"] = \" + delta)\n answer += delta\n }\n }\n println(answer)\n}", "lang": "Kotlin", "bug_code_uid": "02d5978a5517c4431bb773ee0e07923a", "src_uid": "4618fbffb2b9d321a6d22c11590a4773", "apr_id": "5501d67186d0438a41dcfbcd3b5f453b", "difficulty": 2100, "tags": ["data structures", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7413127413127413, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "//package codeforces.com.tasks.task118A\n\nfun main(args: Array) {\n val vowels = setOf('a', 'o', 'y', 'e', 'u', 'i')\n val input = readLine()!!\n val letters = Array(input.length) { \"\" }\n var index = 0\n input.map {\n if (vowels.contains(it.toLowerCase()))\n index++\n else letters[index] = \".${it.toLowerCase()}\"; index++\n }\n println(letters.joinToString(\"\"))\n}", "lang": "Kotlin", "bug_code_uid": "f82b5c645728ae04db1e7d1b569e5d44", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "9a44acfe78fbd9de203d49e21a72ffc6", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7902097902097902, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n var s = 0\n var n = readLine()!!.toInt()\n s += n / 5 + 1\n println(s)\n}", "lang": "Kotlin", "bug_code_uid": "5fecac125676e3f0715eeeabc9bf7356", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "e7796f81246da5f744764d461b9e65c0", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.918918918918919, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (copies, originals) = readInts()\n when {\n originals == 0 -> print(\"No\")\n originals > copies + 1 -> print(\"No\")\n (copies - originals - 1) % 2 == 0 -> print(\"Yes\")\n else -> print(\"No\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "e8123c6880048eead29d05161e379ae9", "src_uid": "1527171297a0b9c5adf356a549f313b9", "apr_id": "15f0cdb679d45ad03a993c52a9a6f7cb", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8579795021961932, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(){\n var (n,a) = readLine()!!.split(' ')\n var a1 = a.toLong()\n var n1 = n.toLong()\n var otv_o:Long=a1-1;\n //println(n1-otv_o)\n if((n1-otv_o)%2L==0L && n1-otv_o>=0 && a1>=1){\n println(\"YES\")\n return\n }else{\n println(\"NO\")\n return\n }\n}", "lang": "Kotlin", "bug_code_uid": "56a7f618956480bb44afaecd42c18bd8", "src_uid": "1527171297a0b9c5adf356a549f313b9", "apr_id": "5f8a2219529830935273ff31af259119", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9849374521317334, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.*\nfun main() {\n val fs = CodeForces.FastReader()\n var x = fs.nextInt()\n var y = fs.nextInt()\n if(x==0 && y==1) println(\"Yes\")\n else if(x==0 || y==0) println(\"No\")\n else if(x-y+1 >= 0 && (x-y-1)%2==0) println(\"Yes\")\n else println(\"No\")\n}\n\nclass CodeForces {\n internal class FastReader {\n private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private var st: StringTokenizer? = null\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreElements()) {\n try {\n st = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n }\n return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLine(): String {\n var str = \"\"\n try {\n str = br.readLine()\n } catch (e: IOException) {\n e.printStackTrace()\n }\n return str\n }\n\n fun readIntArray(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = nextInt()\n return a\n }\n\n fun readLongArray(n: Int): LongArray {\n val a = LongArray(n)\n for (i in 0 until n) a[i] = nextLong()\n return a\n }\n\n fun readDoubleArray(n: Int): DoubleArray {\n val a = DoubleArray(n)\n for (i in 0 until n) a[i] = nextDouble()\n return a\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "c66e1979ab2cdafff50e6421e2c0e1b9", "src_uid": "1527171297a0b9c5adf356a549f313b9", "apr_id": "84a9eb8cf3b92a509b58866ffb30a8b2", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7235323632714501, "equal_cnt": 37, "replace_cnt": 28, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 36, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //var (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n val str = r.readLine()\n val len = str.length\n var nexti = 0\n var ans = true\n while (ans&&nexti when{\n nexti==len-1 -> nexti++\n nexti==len-2 && str[nexti+1]=='4' -> nexti +=2\n nexti==len-2 && str[nexti+1]!='4' -> ans = false\n nexti==len-3 &&str[nexti+1]=='4'&&str[nexti+2]=='4' -> nexti += 3\n nexti==len-3 &&(str[nexti+1]!='4'||str[nexti+2]!='4') -> false\n str[nexti+1]=='4'&&str[nexti+2]=='4' -> nexti += 3\n str[nexti+1]=='4' -> nexti +=2\n }\n else -> ans = false\n }\n }\n println(if (ans) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "f1bb8f3eff2d6c427244ebfdb6c076a2", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "apr_id": "eb7420c2396bbf1fa89c11037c85a0ef", "difficulty": 900, "tags": ["brute force", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7614410905550146, "equal_cnt": 35, "replace_cnt": 25, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 34, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //var (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n val str = r.readLine()\n val len = str.length\n var nexti = 0\n var ans = true\n while (ans&&nexti when{\n nexti==len-1 -> nexti++\n nexti==len-2 && str[nexti+1]=='4' -> nexti +=2\n nexti==len-2 && str[nexti+1]!='4' -> ans = false\n nexti==len-3 &&str[nexti+1]=='4'&&str[nexti+2]=='4' -> nexti += 3\n nexti==len-3 &&(str[nexti+1]!='4'||str[nexti+2]!='4') -> ans=false\n str[nexti+1]=='4'&&str[nexti+2]=='4' -> nexti += 3\n str[nexti+1]=='4' -> nexti +=2\n else -> nexti++\n }\n else -> ans = false\n }\n }\n println(if (ans) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "ee37d17188079fbf0aee9dfb78a12caa", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "apr_id": "eb7420c2396bbf1fa89c11037c85a0ef", "difficulty": 900, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9761904761904762, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n\n var text = readLine()!!\n\n text= text.replace(\"144\",\"\")\n text =text.replace(\"14\",\"\")\n text =text.replace(\"1\",\"\")\n\n if (text.isEmpty())\n {\n print(\"YES\")\n }\n else\n print(\"NO\")\n\n}", "lang": "Kotlin", "bug_code_uid": "6ae6fd9c9a3bcdca355e5bd23c03e4fe", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "apr_id": "6f75f6311e9ff37aa49536280491eebf", "difficulty": 900, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9789029535864979, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main() {\n var n = readLine()!!.split(\"1\")\n println(n)\n var ans = true\n if (!n[0].equals(\"\")) {\n ans = false\n } else {\n for (i in n) {\n if (!i.equals(\"\") && !i.equals(\"4\") && !i.equals(\"44\")) {\n ans = false\n }\n }\n }\n if (ans) println(\"YES\") else println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "0c9994c34d3c7898db8eccc1d094de66", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "apr_id": "565435a6f1f95b456a4ab052b43a33be", "difficulty": 900, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.11205673758865248, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main () {\n val n = readLine()!!\n\n if (n.length == 1) {\n if (\"1\" == n) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n } else if (n.length == 2) {\n if (\"14\" == n) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n } else {\n var result = \"YES\"\n\n var i = n.length - 1\n while (i > 2) {\n if (n[i] == '4') {\n if (n[i - 1] == '1') {\n i -= 2\n } else if (n[i - 1] == '4' && n[i - 2] == '1') {\n i -= 3\n } else {\n result = \"NO\"\n break\n }\n } else if (n[i] == '1') {\n i -= 1\n } else {\n result = \"NO\"\n break\n }\n }\n\n println(result)\n }\n}", "lang": "Kotlin", "bug_code_uid": "5e1c81bf087d429ce6c3eb26ae410cd3", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "apr_id": "3d90b340c751498f5e3e10175616bf24", "difficulty": 900, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9978308026030369, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.system.*\n\nfun main() {\n val digits = readLine()!!.map(Character::getNumericValue)\n var i = 0\n while(i < digits.size) {\n if(digits[i] == 1) {\n if(i + 2 < digits.size && digits[i + 1] == 4 && digits[i + 2] == 4) i += 3\n else if(i + 1 < digits.size && digits[i + 1] == 4) i+=2\n else i++\n }\n else {\n println(\"NO\")\n exitProcess(1)\n }\n }\n println(\"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "dfcee23d1b708c5f9f9ac8495baf519e", "src_uid": "3153cfddae27fbd817caaf2cb7a6a4b5", "apr_id": "1bb5b7988ce65a11000075255567975e", "difficulty": 900, "tags": ["brute force", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9262545454545454, "equal_cnt": 17, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n val solver = Solver(System.`in`, System.out)\n solver.solve()\n solver.clear()\n}\n\nclass Solver(input: InputStream, output: OutputStream) {\n\n companion object {\n private const val MAX_N = (1e6 + 10).toInt()\n private const val INF = (1e9 + 7).toInt()\n private const val MOD = (1e9 + 7).toInt()\n private const val INF_F = 1e-6\n }\n\n private val reader = Reader(input)\n private val writer = Writer(output)\n\n fun solve() {\n val n = reader.nextInt()\n val a = reader.nextArrayInt(n)\n var ans = 0\n for (i in 0 until n - 1) {\n when {\n a[i] == 1 && a[i + 1] == 2 || a[i] == 2 && a[i + 1] == 1 -> ans += 3\n a[i] == 1 && a[i + 1] == 3 || a[i] == 3 && a[i + 1] == 1 -> ans += 4\n a[i] == 2 && a[i + 1] == 3 || a[i] == 3 && a[i + 1] == 2 -> {\n writer.println(\"Infinite\")\n return\n }\n }\n }\n writer.println(\"Finite\")\n writer.println(ans)\n }\n\n fun clear() {\n writer.close()\n }\n\n private fun IntArray.gcd(): Int {\n var g = first()\n forEach { g = gcd(g, it) }\n return g\n }\n\n private fun LongArray.gcd(): Long {\n var g = first()\n forEach { g = gcd(g, it) }\n return g\n }\n\n private fun gcd(a: Int, b: Int): Int {\n return if (b == 0) a else gcd(b, a % b)\n }\n\n private fun gcd(a: Long, b: Long): Long {\n return if (b == 0L) a else gcd(b, a % b)\n }\n}\n\nclass Reader(input: InputStream) {\n private val reader = BufferedReader(InputStreamReader(BufferedInputStream(input)), 32768)\n private var tokenizer: StringTokenizer? = null\n\n fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt() = next().toInt()\n\n fun nextLong() = next().toLong()\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n}\n\nclass Writer(output: OutputStream) {\n private val writer = PrintWriter(BufferedOutputStream(output))\n\n fun println() {\n writer.println()\n }\n\n fun println(t: T) {\n writer.println(t)\n }\n\n fun print(t: T) {\n writer.print(t)\n }\n\n fun printIntArray(array: IntArray) {\n array.forEach { writer.print(\"$it \") }\n writer.println()\n }\n\n fun printLongArray(array: LongArray) {\n array.forEach { writer.print(\"$it \") }\n writer.println()\n }\n\n fun printCharArray(array: CharArray) {\n array.forEach { writer.print(\"$it\") }\n writer.println()\n }\n\n fun close() {\n writer.close()\n }\n}", "lang": "Kotlin", "bug_code_uid": "f58c0f020d31dab1d12e21d7ee42c4c8", "src_uid": "6c8f028f655cc77b05ed89a668273702", "apr_id": "d56bb2098b051fff9fe991fb3fd28223", "difficulty": 1400, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9858823529411764, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val n = readInt()\n val a = readInts()\n\n val ans = run {\n var cnt = 0\n for ((s0, s1) in a.zipWithNext()) {\n if(s0 == s1) return@run null\n\n when(s0) {\n 1 -> {\n when(s1) {\n 2 -> cnt += 3\n 3 -> cnt += 4\n }\n }\n 2 -> {\n when(s1) {\n 1 -> cnt += 3\n 3 -> return@run null\n }\n }\n 3 -> {\n when(s1) {\n 1 -> cnt += 4\n 2 -> return@run null\n }\n }\n }\n }\n cnt\n }\n\n output {\n if(ans == null) println(\"Infinite\") else {\n println(\"Finite\")\n println(ans)\n }\n }\n\n}\n\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println() { sb.append('\\n') }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit)\n { Output().apply(block).nowPrint() }\n", "lang": "Kotlin", "bug_code_uid": "c4de6cc525643b0ab636f782a59234aa", "src_uid": "6c8f028f655cc77b05ed89a668273702", "apr_id": "9f4ea78dbcf444acad7e0f66de47e7a9", "difficulty": 1400, "tags": ["geometry"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9836355594869527, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import Starter.ni\nimport Starter.nia\nimport java.util.*\n\nfun main() {\n var n = ni();\n var a = nia(n)\n var points = 0L\n for(i in 1 until n){\n if(a[i] == 1){\n if(a[i-1] == 2) points += 3\n if(a[i-1] == 3) points += 4\n }\n if(a[i] == 2){\n if(a[i-1] == 1) points += 3\n if(a[i-1] == 3){\n println(\"Infinite\")\n return\n }\n }\n if(a[i] == 3){\n if(a[i-1] == 1) points += 4\n if(a[i-1] == 2){\n println(\"Infinite\")\n return\n }\n }\n }\n for(i in 2 until n){\n if(a[i] == 2 && a[i-1] == 1 && a[i-2] == 3) points--\n }\n println(\"Finite\")\n println(points)\n}\n\nvar input = Scanner(System.`in`)\n\nfun ni() = input.nextInt()\n\nfun nia(n: Int) = Array(n) { ni() }\n\nfun nim(n: Int, m: Int) = Array(n) { nia(m) }\n\nfun nl() = input.nextLong()\n\nfun nla(n: Int) = Array(n) { nl() }\n\nfun nlm(n: Int, m: Int) = Array(n) { nla(m) }\n\nfun ns() = input.next()\n\nfun nsa(n: Int) = Array(n) { ns() }\n\nfun println(arr: Array<*>) = println(arr.fold(\"\") { r, n -> \"$r$n \" })", "lang": "Kotlin", "bug_code_uid": "3a7369c99f680421db5e5cbd985e9843", "src_uid": "6c8f028f655cc77b05ed89a668273702", "apr_id": "8c977ee7828895ff2af8f4744efdda33", "difficulty": 1400, "tags": ["geometry"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7736549165120594, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nfun main(args: Array) {\n\n var num = readInt()\n\n if (num % 4 == 1) {\n println(\"0 A\")\n } else {\n if (num % 4 == 0 || num % 4 == 3) {\n println(\"1 A\")\n } else if (num % 4 == 2) {\n println(\"1 B\")\n }\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "ddd9882975c07d8e9e9f766cc15b5079", "src_uid": "488e809bd0c55531b0b47f577996627e", "apr_id": "6d21b735c8080173d4b83217ddbf18c3", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.977491961414791, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!.toInt()\n //val v = r.readLine()!!.split(\" \").map { it.toLong() }\n when(n%4){\n 0 -> println(\"2 B\")\n 1 -> println(\"0 A\")\n 2 -> println(\"2 A\")\n 3 -> println(\"1 A\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "4ae0d6cb46c91b7b5d3cff7b0d642d2e", "src_uid": "488e809bd0c55531b0b47f577996627e", "apr_id": "0cb55ca6e284961a1a034d9cbb643b43", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7397260273972602, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val ost = n % 4\n\n if (ost == 1) println(\"0 A\")\n if (ost == 0) println(\"2 B\")\n if (ost == 2) println(\"1 B\")\n if (ost == 3) println(\"2 A\")\n}", "lang": "Kotlin", "bug_code_uid": "a6eb0fd18a08fb1ad4fdd034fb1822c0", "src_uid": "488e809bd0c55531b0b47f577996627e", "apr_id": "9f63f639fde567e201ccf8983991b20a", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9308176100628931, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 11, "bug_source_code": "import java.*\nimport java.awt.geom.*\nimport java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\n/*\n\t\t\t br = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\t pw = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n\t\t\t br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n */\n\n private var br: BufferedReader? = null\n private var st: StringTokenizer? = null\n private var pw: PrintWriter? = null\n\n @Throws(IOException::class)\n fun main(args: Array) {\n br = BufferedReader(InputStreamReader(System.`in`))\n pw = PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n //int qq = 1;\n val qq = Integer.MAX_VALUE\n //int qq = readInt();\n for (casenum in 1..qq) {\n val s = readToken()\n var ret = -1\n for (mask in 1 until (1 shl s.length)) {\n var del = 0\n var curr = 0\n for (i in 0 until s.length) {\n if (mask and (1 shl i) != 0) {\n curr *= 10\n curr += s[i] - '0'\n } else {\n del++\n }\n }\n val cand = Math.sqrt(curr.toDouble()).toInt()\n if (cand * cand == curr) {\n if (ret == -1 || del < ret) ret = del\n }\n }\n pw!!.println(ret)\n }\n exitImmediately()\n }\n\n private fun exitImmediately() {\n pw!!.close()\n System.exit(0)\n }\n\n @Throws(IOException::class)\n private fun readLong(): Long {\n return java.lang.Long.parseLong(readToken())\n }\n\n @Throws(IOException::class)\n private fun readDouble(): Double {\n return java.lang.Double.parseDouble(readToken())\n }\n\n @Throws(IOException::class)\n private fun readInt(): Int {\n return Integer.parseInt(readToken())\n }\n\n @Throws(IOException::class)\n private fun readLine(): String? {\n val s = br!!.readLine()\n if (s == null) {\n exitImmediately()\n }\n st = null\n return s\n }\n\n @Throws(IOException::class)\n private fun readToken(): String {\n while (st == null || !st!!.hasMoreTokens()) {\n st = StringTokenizer(readLine()!!.trim { it <= ' ' })\n }\n return st!!.nextToken()\n }\n", "lang": "Kotlin", "bug_code_uid": "8aec0ba9407f0ed69845abe705de1cc3", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "262226dea950c91d8e3aa78ec9c0192c", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9733014177867796, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.*\nimport java.awt.geom.*\nimport java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\n/*\n\t\t\t br = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\t pw = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n\t\t\t br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n */\n\n private var br: BufferedReader? = null\n private var st: StringTokenizer? = null\n private var pw: PrintWriter? = null\n\n @Throws(IOException::class)\n fun main(args: Array) {\n br = BufferedReader(InputStreamReader(System.`in`))\n pw = PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n //int qq = 1;\n val qq = Integer.MAX_VALUE\n //int qq = readInt();\n\n /*\nreminders: arrays of objects are problematic, prefer ArrayList instead\n\t\t */\n for (casenum in 1..qq) {\n val s = readToken()\n var ret = -1\n for (mask in 1 until (1 shl s.length)) {\n var del = 0\n var curr = 0\n var can = true\n for (i in 0 until s.length) {\n if (mask and (1 shl i) != 0) {\n if (curr == 0 && s[i] == '0') {\n can = false\n }\n curr *= 10\n curr += s[i] - '0'\n } else {\n del++\n }\n }\n val cand = Math.sqrt(curr.toDouble()).toInt()\n if (can && cand * cand == curr) {\n if (ret == -1 || del < ret) ret = del\n }\n }\n pw!!.println(ret)\n }\n exitImmediately()\n }\n\n private fun exitImmediately() {\n pw!!.close()\n System.exit(0)\n }\n\n @Throws(IOException::class)\n private fun readLong(): Long {\n return java.lang.Long.parseLong(readToken())\n }\n\n @Throws(IOException::class)\n private fun readDouble(): Double {\n return java.lang.Double.parseDouble(readToken())\n }\n\n @Throws(IOException::class)\n private fun readInt(): Int {\n return Integer.parseInt(readToken())\n }\n\n @Throws(IOException::class)\n private fun readLine(): String? {\n val s = br!!.readLine()\n if (s == null) {\n exitImmediately()\n }\n st = null\n return s\n }\n\n @Throws(IOException::class)\n private fun readToken(): String {\n while (st == null || !st!!.hasMoreTokens()) {\n }\n return st!!.nextToken()\n }\n}", "lang": "Kotlin", "bug_code_uid": "1ba6a5b900981ab5855e6e64acf16b9c", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "262226dea950c91d8e3aa78ec9c0192c", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9734806629834254, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.*\nimport java.awt.geom.*\nimport java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\n/*\n\t\t\t br = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\t pw = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n\t\t\t br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n */\n\n private var br: BufferedReader? = null\n private var st: StringTokenizer? = null\n private var pw: PrintWriter? = null\n\n @Throws(IOException::class)\n fun main(args: Array) {\n br = BufferedReader(InputStreamReader(System.`in`))\n pw = PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n //int qq = 1;\n val qq = Integer.MAX_VALUE\n //int qq = readInt();\n\n /*\nreminders: arrays of objects are problematic, prefer ArrayList instead\n\t\t */\n for (casenum in 1..qq) {\n val s = readToken()\n var ret = -1\n for (mask in 1 until (1 shl s.length)) {\n var del = 0\n var curr = 0\n var can = true\n for (i in 0 until s.length) {\n if (mask and (1 shl i) != 0) {\n if (curr == 0 && s[i] == '0') {\n can = false\n }\n curr *= 10\n curr += s[i] - '0'\n } else {\n del++\n }\n }\n val cand = Math.sqrt(curr.toDouble()).toInt()\n if (can && cand * cand == curr) {\n if (ret == -1 || del < ret) ret = del\n }\n }\n pw!!.println(ret)\n }\n exitImmediately()\n }\n\n private fun exitImmediately() {\n pw!!.close()\n System.exit(0)\n }\n\n @Throws(IOException::class)\n private fun readLong(): Long {\n return java.lang.Long.parseLong(readToken())\n }\n\n @Throws(IOException::class)\n private fun readDouble(): Double {\n return java.lang.Double.parseDouble(readToken())\n }\n\n @Throws(IOException::class)\n private fun readInt(): Int {\n return Integer.parseInt(readToken())\n }\n\n @Throws(IOException::class)\n private fun readLine(): String? {\n val s = br!!.readLine()\n if (s == null) {\n exitImmediately()\n }\n st = null\n return s\n }\n\n @Throws(IOException::class)\n private fun readToken(): String {\n while (st == null || !st!!.hasMoreTokens()) {\n }\n return st!!.nextToken()\n }\n", "lang": "Kotlin", "bug_code_uid": "39dda7bf76f27e72fb5585f2ac3f2e40", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "262226dea950c91d8e3aa78ec9c0192c", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.1086382497170879, "equal_cnt": 38, "replace_cnt": 21, "delete_cnt": 12, "insert_cnt": 6, "fix_ops_cnt": 39, "bug_source_code": " import java.io.BufferedReader;\n import java.io.IOException;\n import java.io.InputStream;\n import java.io.InputStreamReader;\n import java.io.PrintWriter;\n\n\n import java.util.*;\n\n\n public class Main {\n\n\n\n\n\n\n\n\n public static void main (String[]args) throws IOException {\n Scanner in = new Scanner(System.in);\n\n\n try (PrintWriter or = new PrintWriter(System.out)) {\n\n char[]a=in.next().toCharArray();\n\n int ans=0;\n boolean state=false;\n for (int i = 1; i < 1<0)temp.append(a[j]);\n }\n if (temp.length()>0)\n {\n for (int j = 0; j < temp.length(); j++) {\n if (temp.charAt(j)=='0'){\n temp.deleteCharAt(0);\n j=-1;\n }\n }\n if (temp.length()>0){\n int s=Integer.parseInt(temp.toString());\n int sqr=(int)Math.sqrt(s);\n if (sqr*sqr==s){\n ans=Math.max(ans,temp.length());\n state=true;\n }\n }\n\n }\n }\n or.println(state?a.length-ans:-1);\n\n\n\n\n\n\n\n\n\n }\n\n }\n\n\n\n\n\n\n\n\n static long gcd(long a, long b)\n {\n if (b == 0)\n return a;\n return gcd(b, a % b);\n }\n\n\n\n\n\n\n\n static class Scanner {\n\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream s) {\n br = new BufferedReader(new InputStreamReader(s));\n }\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public String nextLine() throws IOException {\n return br.readLine();\n }\n\n public double nextDouble() throws IOException {\n String x = next();\n StringBuilder sb = new StringBuilder(\"0\");\n double res = 0, f = 1;\n boolean dec = false, neg = false;\n int start = 0;\n if (x.charAt(0) == '-') {\n neg = true;\n start++;\n }\n for (int i = start; i < x.length(); i++) {\n if (x.charAt(i) == '.') {\n res = Long.parseLong(sb.toString());\n sb = new StringBuilder(\"0\");\n dec = true;\n } else {\n sb.append(x.charAt(i));\n if (dec) {\n f *= 10;\n }\n }\n }\n res += Long.parseLong(sb.toString()) / f;\n return res * (neg ? -1 : 1);\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n }\n }\n\n class Pair implements Comparable {\n int first, second;\n\n public Pair(int first, int second) {\n this.first = first;\n this.second = second;\n }\n\n\n @Override\n public int compareTo(Pair o) {\n if (first!=o.first)return first-o.first;\n return second-o.second;\n }\n }\n\n class Tempo {\n\n int first,second,third;\n\n public Tempo(int first, int second, int third) {\n this.first = first;\n this.second = second;\n this.third = third;\n }\n }", "lang": "Kotlin", "bug_code_uid": "f31c0aa32f89c90993ffb17ae12e3729", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "05703b5ffbf9cc0b27ccc04815c8dfc0", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9772382397572079, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main() {\n\n var a : String? = readLine();\n\n var ans: Int=0;\n var state: Boolean=false;\n for ( i in 1..1.shl(a?.length!!)) {\n\n var temp: StringBuilder = StringBuilder()\n\n for (j in a.indices)\n {\n if ((i.and((1.shl(j)))) > 0) temp.append(a[j])\n }\n\n if (temp.length > 0) {\n for ( j in a.indices) {\n if (temp[0] == '0') {\n temp.deleteCharAt(0)\n } else break;\n }\n if (temp.length > 0) {\n var s :Int= Integer.parseInt (temp.toString());\n var sqr:Int = Math.sqrt (1.0*s).toInt()\n if ((sqr * sqr).equals(s)) {\n ans = Math.max(ans, temp.length)\n state = true;\n }\n }\n\n }\n }\n println(if (state)a.length-ans else -1)\n }\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "78b0fde1248b45a1845e7cdd576e8094", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "05703b5ffbf9cc0b27ccc04815c8dfc0", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.1553398058252427, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun oddEven() {\n val nk: List = readLine()?.split(' ')!!\n val ns = 1..(nk.get(0).toInt())\n println((ns.filter { x -> x % 2 == 1 } + ns.filter { x -> x % 2 == 0 })[nk.get(1).toInt() - 1])\n}\n\nfun main(args: Array) {\n oddEven()\n}", "lang": "Kotlin", "bug_code_uid": "9db5b7579cff8f698ab3c3e022489266", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "917a28606cd656770353947de07c4d2a", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9858356940509915, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main()\n{\n val(nb_elements, k) = readLine()!!.split(\" \").map{ it.toInt() }\n val mids = (nb_elements + 1) / 2\n println( if(k > mids) 2 * (k - mids) else 2 * k - 1)\n}", "lang": "Kotlin", "bug_code_uid": "dc853de5cd3d6020c99fd0567a5abbba", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "4d59e2920daec67bfbb17bde0473ccf1", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9855907780979827, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n\tval (n, k) = readLine()!!.split(\" \").map(String::toInt)\n\tval odds = (n / 2) + (n % 2)\n\tif (k <= odds) println(1 + 2*(k - 1))\n\telse println(0 + 2*(k - odds))\n}\n", "lang": "Kotlin", "bug_code_uid": "36e155647d6d64fe1df88e66a5f9f157", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "a377e0b4546c8dc36816dc36b8e7335f", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.23271889400921658, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n // 8:02\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n var res: Int\n if (n % 2 == 0) {\n res = if (k <= n / 2) {\n 2 * k - 1\n }\n else {\n 2 * (k - n / 2)\n }\n }\n else {\n res = if (k <= (n + 1) / 2) {\n 2 * k - 1\n }\n else {\n 2 * (k - (n + 1) / 2)\n }\n }\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "ce9064bc36bed3fe2b1923f25fbe0d68", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "87d61c32362195e323fbfeb0aeaa67f1", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9988571428571429, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n // 8:02\n val (n, k) = readLine()!!.split(' ').map(String::toLong)\n var res: Long\n if (n % 2 == 0) {\n res = if (k <= n / 2) {\n 2L * k - 1L\n }\n else {\n 2L * (k - n / 2)\n }\n }\n else {\n res = if (k <= (n + 1) / 2) {\n 2L * k - 1\n }\n else {\n 2L * (k - (n + 1) / 2)\n }\n }\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "e35168624b8b676c423f92100207d37f", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "87d61c32362195e323fbfeb0aeaa67f1", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9936305732484076, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\n// package cp\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readInts() = readLn().split(\" \").map { it.toInt() }\nprivate fun genRange(a:Int, b:Int, c:Int) = a..b step c\n\nfun main() {\n var (a,b) = readInts()\n var c = (a+1)/2\n if(b<=c) {\n println(2*b-1)\n }\n else {\n b -= c\n println(2*b)\n }\n}\n\n\n\n\n/*\n ==============MUTABLE LIST\n var ar : MutableList = mutableListOf(1,2,3,4,5)\n ar.add(10)\n ar.add(1,89) menyisipkan\n ar.removeAt(0)\n ar[1] = 99\n ==============For\n val ranges = 0.rangeTo(10) step 2\n for(value in ranges){}\n for((index,value) in ranges.withIndex()){}\n ==============ForEach\n ranges.forEach{value -> {}}\n ranges.forEach{index,value -> {}}\n note* untuk menghilangkan argumen lamda expression digunakan _\n contoh ranges.forEach{index,_ ->{}}\n */\n\n", "lang": "Kotlin", "bug_code_uid": "9848a20be135c2eb782964bc36a5aba0", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "ad853623327b441ba43721b17c1a59e3", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5005636978579482, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.*; \nimport java.math.*;\nimport java.io.*;\n\nfun main(args: Array) {\n var s = Scanner(System.`in`)\n var number = s.nextInt()\n var postion = s.nextInt()\n var list = ArrayList()\n for(i in 1 .. number step 2){\n list.add(i)\n }\n for(i in 2 .. number step 2){\n list.add(i)\n }\n \n print(list.get(postion-1))\n \n}\n", "lang": "Kotlin", "bug_code_uid": "7a9984ceac0f59d8bf1130cab3d7c3d6", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "41834aba5050fc7ad5d8c15693831d2a", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9127272727272727, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport codeforces.sliding\nimport java.io.PrintWriter\nimport java.util.*\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = Scanner(inputStream)\n val out = PrintWriter(outputStream)\n solve(`in`, out)\n out.close()\n}\n\nprivate fun solve(scanner: Scanner, out: PrintWriter) {\n val n = scanner.nextInt()\n val L = scanner.nextInt()\n scanner.nextLine()\n val kef = scanner.nextLine().split(\" \").map(String::toInt)\n val sash = scanner.nextLine().split(\" \").map(String::toInt)\n\n var m = kef.sliding(2).map { it[1] - it[0] }.toMutableList()\n var r = sash.sliding(2).map { it[1] - it[0] }.toMutableList()\n val kefDiffs = m + (L - m.sum())\n val sashDiffs = r + (L - r.sum())\n\n val s = kefDiffs.joinToString(transform = Int::toString, separator = \"\")\n val res = (s + s).contains(sashDiffs.joinToString(transform = Int::toString, separator = \"\"))\n\n if (res) {\n out.println(\"YES\")\n } else {\n out.println(\"NO\")\n }\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "58e52bdbe8b790cee94b466e2e651255", "src_uid": "3d931684ca11fe6141c6461e85d91d63", "apr_id": "af2279432bd9e62b32e202f86229071e", "difficulty": 1300, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9970220369267421, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val count = input.nextInt()\n val length = input.nextInt()\n\n val array = Array(count){0}\n for(i in 0 until count)\n array[i] = input.nextInt()\n\n val array2 = Array(count){0}\n for(i in 0 until count)\n array2[i] = input.nextInt()\n\n for(i in 0 until length - 1) {\n for(j in 0 until array.size) {\n if(array[j] > 0) array[j]--\n else if(array[j] == 0) array[j] = length - 1\n }\n if(equals(array, array2)) {\n print(\"YES\")\n return\n }\n }\n\n print(\"NO\")\n}\n\n\nfun equals(array: Array, array2: Array): Boolean {\n for(i in 0 until array.size) {\n if(!array.contains(array2[i])) {\n return false\n }\n }\n return true\n}", "lang": "Kotlin", "bug_code_uid": "ce5d605485fee1aca3eed9c05a38bd4d", "src_uid": "3d931684ca11fe6141c6461e85d91d63", "apr_id": "699ae731215d81aa4890027491a90d3d", "difficulty": 1300, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8672150411280846, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "fun tr(x: Int, y: Int): Int = x and y\nfun sq(x: Int, y: Int): Int = x or y\n\nfun main(args: Array) {\n val a = readLine()!!.toInt()\n val b = readLine()!!.toInt()\n val c = readLine()!!.toInt()\n val d = readLine()!!.toInt()\n\n val p1 = tr(a, b)\n val p2 = tr(c, d)\n val p3 = sq(b, c)\n val p4 = tr(a, d)\n\n val q1 = sq(p1, p2)\n val q2 = tr(p3, p4)\n\n println(tr(q1, q2))\n}\n", "lang": "Kotlin", "bug_code_uid": "d77a6237571f4ed679cd65abda8b0194", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "apr_id": "7788c6605d6630a76cf3d18e0c392213", "difficulty": 2000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.004985384574000682, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "val pole = listOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)\n\nfun main() {\n val (x, y) = readLine()!!.split(\" \").map { it.toInt() }\n println(if (pole[x*64 + y] == 0) \"OUT\" else \"IN\")\n}", "lang": "Kotlin", "bug_code_uid": "c1ebc8041b681e207750e69e8e33f55b", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "apr_id": "b49aa7b44f3a98d4aba09f31fc50406b", "difficulty": null, "tags": ["geometry", "dfs and similar", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.011534312505186292, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "val pole = listOf(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)\n\nfun main() {\n val (x, y) = readLine()!!.split(\" \").map { it.toInt() }\n println(if (pole[x*64 + y] == 0) \"OUT\" else \"IN\")\n}", "lang": "Kotlin", "bug_code_uid": "97118f855c9f2e8ecb4642f7dd861f9a", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "apr_id": "b49aa7b44f3a98d4aba09f31fc50406b", "difficulty": null, "tags": ["geometry", "dfs and similar", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4244541484716157, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*\nval reader = Scanner(System.`in`)\nfun main(args: Array){\n val n = reader.nextInt()\n\n val arr = Array(n,{i -> reader.nextInt()})\n\n arr.sort()\n\n\n while (arr[n-2] < arr[n-1])\n {\n arr[n-1] = arr[n-1]-arr[n-2]\n arr.sort()\n }\n var ans = 0\n for (i in arr)\n {\n ans+=i\n }\n\n print(ans)\n}", "lang": "Kotlin", "bug_code_uid": "5170fba5c73b1f4abbcd442219a63ea9", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "apr_id": "58fd5e0eb5df1cbc8bacbb9bd97f86c2", "difficulty": 1000, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9409448818897638, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nval reader = Scanner(System.`in`)\nvar l=0\nvar r=0\nvar ans = 0\nvar flag = false\nfun main(args: Array){\n val n = reader.nextInt()\n\n val arr = Array(n,{i -> reader.nextInt()})\n\n arr.sort()\n\n\n /* arr.forEach { print(it)\n print(\" \")}*/\n\n r=n-1\n l=n-2\n while (true)\n {\n if(arr[r]>arr[l])\n {\n arr[r] = arr[r] - arr[l]\n flag = true\n }\n l--\n r--\n\n if(l==-1)\n {\n if (flag) {\n flag = false\n r = n - 1\n l = n - 2\n arr.sort()\n }\n else\n {\n arr.forEach { ans+=it }\n }\n }\n\n }\n}", "lang": "Kotlin", "bug_code_uid": "9ef6ad169fca05429f45391112734bab", "src_uid": "042cf938dc4a0f46ff33d47b97dc6ad4", "apr_id": "58fd5e0eb5df1cbc8bacbb9bd97f86c2", "difficulty": 1000, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.964735516372796, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val length = readLine()!!.toInt()\n val values = readLine()!!.toCharArray().map { it.toInt() - 48 }\n val total = values.sum()\n var sum = 0\n var result = false\n for (pos in 0 until length - 1) {\n sum += values[pos]\n if (total % sum == 0) {\n result = solve(values, length, sum, pos + 1)\n if (result) break\n }\n }\n print(if (result) \"YES\" else \"NO\")\n}\n\nfun solve(values: List, length: Int, sum: Int, initialPos: Int): Boolean {\n var otherSum = 0\n for (pos in initialPos until length) {\n otherSum += values[pos]\n if (otherSum == sum) {\n otherSum = 0\n } else if (otherSum > sum) {\n return false\n }\n }\n return otherSum == 0\n}\n", "lang": "Kotlin", "bug_code_uid": "8346255b2d9c6a5d2e51329b6f5bcb40", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "a13406a7a429c461d99479ffbf4ab4e0", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9901719901719902, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val length = readLine()!!.toInt()\n val values = readLine()!!.toCharArray().map { it.toInt() - 48 }\n val total = values.sum()\n var sum = 0\n var result = false\n for (pos in 0 until length - 1) {\n sum += values[pos]\n if (sum != 0 && total % sum == 0) {\n result = solve(values, length, sum, pos + 1)\n if (result) break\n }\n }\n print(if (result || (sum == 0 && total == 0)) \"YES\" else \"NO\")\n}\n\nfun solve(values: List, length: Int, sum: Int, initialPos: Int): Boolean {\n var otherSum = 0\n for (pos in initialPos until length) {\n otherSum += values[pos]\n if (otherSum == sum) {\n otherSum = 0\n } else if (otherSum > sum) {\n return false\n }\n }\n return otherSum == 0\n}\n", "lang": "Kotlin", "bug_code_uid": "6bbf5cc96c797519e6b463dd25d9f75c", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "a13406a7a429c461d99479ffbf4ab4e0", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9935691318327974, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var str = readLine()\n var sum = 0\n for (ch in str!!) {\n sum += ch.toString().toInt()\n }\n var t = 0\n var flag = true\n for (i in 1 .. sum / 2) {\n t = 0\n flag = true\n for (ch in str) {\n t += ch.toString().toInt()\n when {\n t > i -> flag = false\n t == i -> t = 0\n }\n if (!flag) {\n break\n }\n }\n if (flag && t == 0) break\n }\n if (flag && t == 0 && sum >= 2) println(\"YES\") else println(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "dcb8b1148fcb46ee3d7243b9fb977034", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "6dadaa9e7445e5ce4b3482901a1685d6", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7089072543617998, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "\nimport java.io.InputStream\nimport java.util.*\n\nclass B {\n fun start(ins: InputStream) {\n val field = Array(3) { Array(3) { Array(3) { Array(3) { '.' } } } }\n\n for (i in 0..2) {\n for (j in 0..2) {\n for (k in 0..2) {\n for (t in 0..2) {\n field[i][j][k][t] = ins.read().toChar()\n }\n ins.read()\n }\n }\n }\n\n val scanner = Scanner(ins)\n val x = scanner.next().toInt()\n val y = scanner.next().toInt()\n\n val sx = if (x % 3 == 0) 2 else (x - 1) % 3\n val sy = if (y % 3 == 0) 2 else (y - 1) % 3\n\n var isCan = false\n for (i in field[sx])\n for (j in i[sy].indices) {\n if (i[sy][j] == '.') {\n isCan = true\n i[sy][j] = '!'\n }\n }\n if (!isCan) {\n for (i in field) {\n for (j in i) {\n for (k in j) {\n for (t in k.indices) {\n if (k[t] == '.')\n k[t] = '!'\n }\n }\n }\n }\n }\n\n for (i in 0..2) {\n for (j in 0..2) {\n for (k in 0..2) {\n for (t in 0..2) {\n print(field[i][j][k][t])\n }\n print(' ')\n }\n print(\"\\n\")\n }\n print(\"\\n\")\n }\n }\n}\n\nfun main(args: Array) {\n B().start(System.`in`)\n}", "lang": "Kotlin", "bug_code_uid": "a656a08b8c42f911916167426410f19c", "src_uid": "8f0fad22f629332868c39969492264d3", "apr_id": "07cc303352912d3e017d383f20701bb6", "difficulty": 1400, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.871313672922252, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "fun isVowel(c: Char): Boolean {\n return c in \"aeiou\"\n}\n\nfun main(args: Array) {\n\n val s = readLine()!!\n val good: Boolean = (0..s.length - 1).none { !isVowel(s[it]) && s[it] != 'n' && it + 1 < s.length && !isVowel(s[it + 1]) }\n\n if (good) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "2b5febf8f563aad96fe954146d4d6285", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "74dd89c90f41f1ca844ab12b1b44b696", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9880726786311448, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashSet\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\nfun main(args : Array) {\n Thread { run() }.start()\n}\n\nfun run() {\n\n val scanner = Scanner(System.`in`)\n val str = scanner.next()\n for (i in 1 until str.length) {\n if (!(str[i] in charArrayOf('a', 'o', 'u', 'i', 'e', 'n')) && !(str[i - 1] in charArrayOf('a', 'o', 'u', 'i', 'e', 'n'))) {\n println(\"NO\")\n return\n }\n }\n println(\"YES\")\n\n}\n\n\nclass Parser(`in`: InputStream) {\n private val BUFFER_SIZE = 1 shl 16\n private val din: DataInputStream\n private val buffer: ByteArray\n private var bufferPointer: Int = 0\n private var bytesRead: Int = 0\n\n init {\n din = DataInputStream(`in`)\n buffer = ByteArray(BUFFER_SIZE)\n bytesRead = 0\n bufferPointer = bytesRead\n }\n\n fun nextString(maxSize: Int): String {\n val ch = ByteArray(maxSize)\n var point = 0\n try {\n var c = read()\n while (c == ' '.toByte() || c == '\\n'.toByte() || c == '\\r'.toByte())\n c = read()\n while (c != ' '.toByte() && c != '\\n'.toByte() && c != '\\r'.toByte()) {\n ch[point++] = c\n c = read()\n }\n } catch (e: Exception) {}\n\n return String(ch, 0, point)\n }\n\n fun nextInt(): Int {\n var ret = 0\n val neg: Boolean\n try {\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n neg = c == '-'.toByte()\n if (neg)\n c = read()\n do {\n ret = ret * 10 + c - '0'.toInt()\n c = read()\n } while (c > ' '.toByte())\n\n if (neg) return -ret\n } catch (e: Exception) {}\n return ret\n }\n\n fun nextLong(): Long {\n var ret: Long = 0\n val neg: Boolean\n try {\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n neg = c == '-'.toByte()\n if (neg)\n c = read()\n do {\n ret = ret * 10 + c - '0'.toLong()\n c = read()\n } while (c > ' '.toByte())\n\n if (neg) return -ret\n } catch (e: Exception) {}\n\n return ret\n }\n\n fun nextDouble(): Double\n = nextString(10000).toDouble()\n\n private fun fillBuffer() {\n try {\n bytesRead = din.read(buffer, 0, BUFFER_SIZE)\n } catch (e: Exception) {}\n if (bytesRead == -1) buffer[0] = -1\n }\n\n private fun read(): Byte {\n if (bufferPointer == bytesRead) fillBuffer()\n return buffer[bufferPointer++]\n }\n}\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun LongArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun BooleanArray.print() {\n println(Arrays.toString(this))\n}\nfun nod(a: Long, b: Long): Long {\n var a1 = a\n var b1 = b\n while (a1 != 0L && b1 != 0L) {\n if (a1 < b1)\n b1 %= a1\n else\n a1 %= b1\n }\n return a1 + b1\n}\nfun nok(a: Long, b: Long): Long = a * b / nod(a, b)\nfun min(a: Char, b: Char): Int {\n if (a < b)\n return a.toInt()\n return b.toInt()\n}\nfun max(a: Char, b: Char): Int {\n if (a > b)\n return a.toInt()\n return b.toInt()\n}", "lang": "Kotlin", "bug_code_uid": "f2aed7d3ec221186e4a88d502bd4fb13", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "55e5beee135568cb99515b1488d05b12", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9936117936117936, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import javax.print.attribute.IntegerSyntax\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }\n\nfun isDiverse(s: String): Boolean {\n val sortedSet = s.toSortedSet()\n return sortedSet.size == s.length &&\n sortedSet.last().toInt() - sortedSet.first().toInt() + 1 == sortedSet.size\n}\n\nfun fine(s: String): Boolean {\n val vowels = \"aeiou\"\n val vowelsAndN = \"aeioun\"\n\n if(s.length == 1 && s !in vowelsAndN) return false\n\n for (i in 1 until s.length) {\n if (s[i - 1] !in vowelsAndN && s[i] !in vowels) return false\n }\n\n return true\n}\n\nfun main(args: Array) {\n val s = readLn()\n\n println(if (fine(s)) \"YES\" else \"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "9c830008772a091bab92f5e7c8789e83", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "501d27f0c8f9c13cda06b491534d0476", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9716713881019831, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val str1 = readLine()!!\n val exc = setOf(\"a\", \"o\", \"u\", \"i\", \"e\", \"n\")\n var prev = \"\"\n\n for (it in str1.split(\"\")) {\n if (prev.isEmpty() || exc.contains(prev)) {\n prev = it\n continue\n }\n\n if (!exc.contains(it)) {\n println(\"NO\")\n return\n }\n\n prev = it\n }\n\n println(\"YES\")\n}\n\n", "lang": "Kotlin", "bug_code_uid": "1248784dce466ec29c81b54859d6624b", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "950baef2319c9a846b7d0ba191b5c29f", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.16387766878245816, "equal_cnt": 29, "replace_cnt": 27, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n var sc = Scanner(System.`in`)\n var str = sc.next() + \"e\"\n\n var list = listOf('a', 'u', 'e', 'o', 'i')\n\n var array = Array(str.length + 2, { true })\n var i = 0\n while (i < str.length) {\n if (!list.contains(str[i]) && str[i] != 'n') {\n array[i] = false\n }\n i++\n }\n var j = 0\n var flag = false\n while (j < array.size - 1) {\n if (array[j] == false && array[j + 1] == false) {\n flag = true\n }\n if (array[j] == false && str[j + 1] == 'n') {\n flag = true\n }\n j++\n }\n if (!array[array.size - 3]) {\n flag = true\n }\n if (flag) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "e7862b3699e3b2df3c96c659a809cb4d", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "21821a65b7fc6439f04af1ec658076b7", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9041916167664671, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val s = readLine()!!\n val notConsonant = setOf('a', 'e', 'i', 'o', 'u', 'n')\n for ((pos, c) in s.withIndex()) {\n if (c !in notConsonant && pos == s.lastIndex) return print(\"NO\")\n if (c !in notConsonant && s[pos + 1] !in notConsonant) return print(\"NO\")\n }\n print(\"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "7fc702551eb5ef0391e1705089f94972", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "5bc6454f60d5718e6d58bbf669510a31", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9924021040327294, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.collections.HashSet\n\npublic class Main {\n\n public companion object {\n\n private val vowels = HashSet(arrayListOf('a', 'e', 'i', 'o', 'u'))\n private val noRestrictions = HashSet(arrayListOf('a', 'e', 'i', 'o', 'u', 'n'))\n\n private fun isCorrect(str: String): Boolean {\n str.forEachIndexed() { ind, c ->\n if (!noRestrictions.contains(c)) {\n if (ind == str.length - 1) return false\n else if (!vowels.contains(str[ind + 1])) return false\n }\n }\n\n return true\n }\n\n @JvmStatic\n public fun main(args: Array) {\n val scan = Scanner(System.`in`)\n\n val str = scan.nextLine().trim()\n\n println(if (isCorrect(str)) \"YES\" else \"NO\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "93971d30dee9ed4a68c1b6d595c57ddf", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "17a23a01246fff3eaa0f172b86be2696", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9973684210526316, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(arg: Array){\n\tval string = readLine().toString()\n\tvar univ = setOf('a','e','i','o','u','n')\n\tvar glas = setOf('a','e','i','o','u')\n\tif (string.last() in univ){\n\t\tvar prev = 'a'\n\t\tstring.forEach(){\n\t\t\tprintln(it)\n\t\t\tif (!(prev in univ) and !(it in glas)){\n\t\t\t\t\tprintln(\"NO\")\n\t\t\t\t\treturn\n\t\t\t}\n\t\t\tprev = it\n\t\t}\n\t\tprintln(\"YES\")\n\t}else{\n\t\tprintln(\"NO\")\n\t\treturn\n\t}\n}", "lang": "Kotlin", "bug_code_uid": "df813ccf41e2fbdd01ace0f0d3863ca8", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4", "apr_id": "c1f7c32baa4c50828b82c2ee977bf277", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9453125, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n var (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n println(\"${3 * minOf(y, minOf(b, r))}\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "d0aec28c3780da2a055678950c9f2b3c", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "4e8b52cfb0b7bc6d6c4d02334ad08b6a", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.10824313072439634, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "package warmup\n\nimport kotlin.math.min\n\n\n// https://codeforces.com/contest/1171/problem/B\n\n\nfun readInts() : List = readLine()?.split(\" \")?.map { it.toInt() }?.toList() ?: emptyList()\n\nfun s1() {\n val (y, b, r) = readInts()\n when {\n r in (y..b) || (y in r..b) || b in ((r+1) .. (y-1)) -> {\n println(if (r > 1) r + (r-1) + (r-2) else r)\n }\n b in (y + 1)..r -> println(y + (y+1) + (y+2))\n else -> println(b + (b+1) + (b-1))\n }\n}\n\nfun main(args: Array) {\n\n //while (true) { s1() }\n s1()\n}", "lang": "Kotlin", "bug_code_uid": "10d70ae5a7675ed68efa1037a62dab8c", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "264d5fac60c189342a0ae192ca6432fd", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.29519564140663695, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 11, "bug_source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n var m: Int = reader.nextInt()\n var list1: MutableList = mutableListOf()\n var list2: MutableList = mutableListOf()\n\n while(n>0){\n list1.add(n%10)\n n = n/10\n }\n list1.sort()\n if(list1[0]==0){\n for(i in 1..list1.size - 1){\n if(list1[i]!=0){\n list1[0]=list1[i]\n list1[i]=0\n break\n }\n }\n }\n\n while(m>0){\n list2.add(m%10)\n m = m/10\n }\n list2.reverse()\n\n if(list1==list2){println(\"OK\")}\n else {println(\"WRONG_ANSWER\")}\n}\n\n", "lang": "Kotlin", "bug_code_uid": "9e29593f5398fcd5693532b8cd3b435d", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "apr_id": "fbbb62aaedfdf5e20ac70ab4ea7d0064", "difficulty": 1100, "tags": ["sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9901960784313726, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n //val reader = Scanner(System.`in`)\n //var n: Int = reader.nextInt()\n // var m: Int = reader.nextInt()\n\n val n = readLine()!!\n val m = readLine()!!\n var a: Int = n.toInt()\n var b: Int = m.toInt()\n\n var list1: MutableList = mutableListOf()\n var list2: MutableList = mutableListOf()\n\n\n if (n.length != m.length) println(\"WRONG_ANSWER\")\n else if(n.length == 1 && m.length == 1 && n!= m ) println(\"WRONG_ANSWER\")\n else if (n.length == 1 && m.length == 1 && n == m ) println(\"OK\")\n else if(n==m) {\n if (a > 0 && b > 0) {\n while (a > 0) {\n list1.add(a % 10)\n a = a / 10\n }\n list1.sort()\n if (list1[0] == 0) {\n for (i in 1..list1.size - 1) {\n if (list1[i] != 0) {\n list1[0] = list1[i]\n list1[i] = 0\n break\n }\n }\n }\n\n while (b > 0) {\n list2.add(b % 10)\n b = b / 10\n }\n list2.reverse()\n\n if (list1 == list2) {\n println(\"OK\")\n } else {\n println(\"WRONG_ANSWER\")\n }\n }\n }\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "816fa1a079b6b8a693fe0a715a2cfa2d", "src_uid": "d1e381b72a6c09a0723cfe72c0917372", "apr_id": "fbbb62aaedfdf5e20ac70ab4ea7d0064", "difficulty": 1100, "tags": ["sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9791800815625671, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n val x = ir.nextInt()\n val y = ir.nextInt()\n val z = ir.nextInt()\n\n if (z == 0) {\n when {\n x == y -> pw.print('0')\n x > y -> pw.print('+')\n else -> pw.print('-')\n }\n } else {\n val x1 = x + z\n val y1 = y + z\n\n if (x1 == y || y1 == x)\n pw.print('?')\n else if (x1 > y1)\n pw.print('+')\n else if (y1 > x1)\n pw.print('-')\n else\n pw.print('?')\n }\n\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextFloat(): Float {\n return java.lang.Float.parseFloat(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "f7cc54709df4f2843f3d9f4a24a38a46", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "a7dca62f456b6692e457beb2938f0c59", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8490945674044266, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n var (x, y, z) = readLine()!!.split(' ').take(3).map { it.toInt() }\n var xz = x + z\n var yz = y + z\n println(if (xz > yz) \"+\" else if (xz < yz) \"-\" else if (xz > y && yz > x) \"?\" else \"0\")\n}\n\n", "lang": "Kotlin", "bug_code_uid": "547399ebf031d14a2db7ba83bdf958db", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "c8fd574f09e81ddb89acc276a1f9600b", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.803030303030303, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n var ligne = readLine()!!.toString().split(\" \")\n var x = Integer.parseInt(ligne.elementAt(0))\n var y = Integer.parseInt(ligne.elementAt(1))\n var z = Integer.parseInt(ligne.elementAt(2))\n var res =\"\"\n\n if( x > y ) res = \"+\"\n if( x < y ) res= \"-\"\n if( x==y && z==0) res=\"0\"\n if( x==y && z!=0) res=\"?\"\n println(\"$res\")\n}", "lang": "Kotlin", "bug_code_uid": "c49cfffcaa5933009ec346b1c65cb908", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "0a7675ca7347ad4ce5c3786bcb41da0f", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9529298751200769, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n var ligne = readLine()!!.toString().split(\" \")\n var x = Integer.parseInt(ligne.elementAt(0))\n var y = Integer.parseInt(ligne.elementAt(1))\n var z = Integer.parseInt(ligne.elementAt(2))\n var res =\"\"\n\n if( x > y && abs(x-y) > z) res = \"+\"\n if( x < y && abs(x-y) > z ) res= \"-\"\n if( x > y && abs(x-y) <= z) res = \"?\"\n if( x < y && abs(x-y) <= z ) res= \"?\"\n if( x==y && z==0) res=\"0\"\n if( x==y && z!=0) res=\"?\"\n println(\"$res\")\n}", "lang": "Kotlin", "bug_code_uid": "022486256ec0acc6867f871df0a79b14", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "0a7675ca7347ad4ce5c3786bcb41da0f", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9976635514018691, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(){\n val (x, y, z) = readLine()!!.split(' ').map { it.toInt() }\n\n val s = x-y\n if (s>0){\n if (s+z>0){\n println(\"+\")\n }else{\n println(\"?\")\n }\n }else if(s<0){\n if (s+z<0){\n println(\"-\")\n }else{\n println(\"?\")\n }\n }else{\n if (z==0){\n println(\"0\")\n }else{\n println(\"?\")\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "3470ef381594da9df818f4afadb738b5", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "80b38754703ecd980c6d4ffad5f73945", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.867109634551495, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "import kotlin.math.abs\n\nclass Main {\n fun main(): String {\n val (x, y, z) = readLine()!!.split(' ').map { it.toInt() }\n val xy = x - y\n\n return when {\n z >= abs(xy) -> \"?\"\n xy < 0 -> \"-\"\n xy > 0 ->\"+\"\n else -> \"0\"\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "411d366ac2cbcff77ec78a5358b5f06c", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "78bd68be61d7212eac1e8550bdae5c7b", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8774583963691377, "equal_cnt": 14, "replace_cnt": 2, "delete_cnt": 11, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import kotlin.math.abs\n\nclass program {\n fun main(args: Array) {\n val (x, y, z) = readLine()!!.split(' ').map { it.toInt() }\n val xy = x - y\n\n println(\n when {\n z >= abs(xy) -> \"?\"\n xy < 0 -> \"-\"\n xy > 0 -> \"+\"\n else -> \"0\"\n }\n )\n }\n}", "lang": "Kotlin", "bug_code_uid": "0b8d6059f01650299dfb10fccbd3e210", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "78bd68be61d7212eac1e8550bdae5c7b", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9946308724832215, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n\nfun main(){\n\tvar (x, y, z) = readInts()\n\t\n\tif (z == 0) {\n\t\tprintln( when {\n\t\t\tx > y -> \"+\"\n\t\t\tx < y -> \"-\"\n\t\t\telse -> \"0\"\n\t\t})\n\t} else {\n\t\tprintln( when {\n\t\t\tx > y -> \"+\"\n\t\t\tx < y -> \"-\"\n\t\t\telse -> \"?\"\n\t\t})\n\t}\n}\n", "lang": "Kotlin", "bug_code_uid": "1db860f0c038c1d77c119ae497053bd4", "src_uid": "66398694a4a142b4a4e709d059aca0fa", "apr_id": "34115c94035c858119937702d302c136", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9485011529592621, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n var n = input.nextInt()\n var m = input.nextInt()\n\n var step = 1\n\n var nodes = m * n\n while (true) {\n\n nodes = nodes - m - n + 1\n n--\n m--\n\n step++\n\n if (nodes <= 2) break\n }\n\n output.println(if (step % 2 != 0) \"Akshat\" else \"Malvika\")\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "a2205c141c126a996e3caa72e25db0e0", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "204bb1dbc2651b2881bdf9e9a59f3a15", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9673870333988213, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n var n = input.nextInt()\n var m = input.nextInt()\n\n var step = 1\n\n while (true) {\n n--\n m--\n\n step++\n\n if (n == 1 || m == 1) break\n }\n\n output.println(if (step % 2 != 0) \"Akshat\" else \"Malvika\")\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "5c86686029c8083936b1f29eb18cc663", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "204bb1dbc2651b2881bdf9e9a59f3a15", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8243478260869566, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val (n, m) = readInts()\n if (n == 1 || m == 1) {\n println(\"Akshat\")\n return\n }\n println(if (n % 2 != 0) \"Akshat\" else \"Malvika\")\n}\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }", "lang": "Kotlin", "bug_code_uid": "ef77c670500ce6ac2939a597773ec65b", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "ac874603de0c7baa27d5f223d1026e6d", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9779735682819384, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val m = scanner.nextInt()\n\n if (m == 1 || n == 1) {\n println(\"Akshat\")\n }\n val min = Math.min(n, m)\n if(min%2==0) {\n println(\"Malvika\")\n } else {\n println(\"Akshat\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "e9c879dd02f91ac49aaef0e4007be901", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "a0d5d4f4935cb851dc9731e5b97a4af3", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9507389162561576, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n var min = Math.min(n,m)\n\n if (min>2)min++\n if (min%2==0){\n println(\"Malvika\")\n }else{\n println(\"Akshat\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "a2c66fea419dd9e6c1d8406332350b0d", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "06e3608631110e13aa47d9dd9e21b242", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8461538461538461, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val (n, m) = reader.readLine().split(' ').map { it.toInt() }\n val pointsCount: Int = n * m\n val output = if (pointsCount % 2 == 0) \"Malvika\" else \"Akshat\"\n println(output)\n}", "lang": "Kotlin", "bug_code_uid": "f65403cd4d1d77b0a8ef94474fd9256c", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "5d3702e1aa949ee1228f6744f0f426c4", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6721763085399449, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "fun main(){\n val(n, m) = readLine()!!.split(' ').map(String::toInt)\n if(n % 2 == 1 && m % 2 == 1){\n print(\"Akshat\")\n }else{\n print(\"Malvika\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "f4ddf85831c0db1218e7d94981982570", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4", "apr_id": "42f82dcdbee267ce91ac1b2dece0c1aa", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9986684420772304, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val t = readLine()!!.split(\" \").map(String::toInt)\n var x=0\n var i=0\n while(i=0 && t[j]==0) j--\n if (i1) 1 else k+1\n }\n print(x)\n}", "lang": "Kotlin", "bug_code_uid": "dd6db48527bbd31779fa3f2872b1abe3", "src_uid": "2896aadda9e7a317d33315f91d1ca64d", "apr_id": "456be63164705081a4eb3a24f840a901", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.993963782696177, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val n = r.readLine()!!.toInt()\n val v = List(120){it+1}.joinToString(\"\")\n println(v[n-1])\n}", "lang": "Kotlin", "bug_code_uid": "8efd1cb37b28b559bcab18420bf38189", "src_uid": "2d46e34839261eda822f0c23c6e19121", "apr_id": "805bf427b40f6c50d885d20fa832b286", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7044247787610619, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main (args: Array) {\n\n var counter = 0\n var index = readLine()!!.toInt()\n\n while(index > 0){\n counter++\n index -= counter.toString().length\n }\n\n val length = counter.toString().length\n\n println(if ( length > 1) counter.toString()[index + 1].toInt() else counter)\n}", "lang": "Kotlin", "bug_code_uid": "38f4060835625912cbbfed1855fdda29", "src_uid": "2d46e34839261eda822f0c23c6e19121", "apr_id": "73e7367e0c36b47b642288eb27866ba6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.687392055267703, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main (args: Array) {\n\n var counter = 0\n var index = readLine()!!.toInt()\n\n while(index > 0){\n counter++\n index -= counter.toString().length\n }\n\n val length = counter.toString().length\n\n println(if ( length > 1) counter.toString()[index + 1].toString() else counter.toString())\n}", "lang": "Kotlin", "bug_code_uid": "d17b5723217fafa6fb0dc53c9bf7ad9d", "src_uid": "2d46e34839261eda822f0c23c6e19121", "apr_id": "73e7367e0c36b47b642288eb27866ba6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9977180527383367, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var n = readLine()!!.toInt()\n\n var set = (1..n).toMutableSet()\n var array = readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n\n if(array.all { it == 0 }) {\n println(1)\n return\n }\n\n for (item in array) {\n set.remove(item)\n }\n\n var s = set.map { it % 2 == 0 }.toList()\n var countFalse = s.count { !it }\n var countTrue = s.count { it }\n\n var answerArray = array.map { if (it == 0) null else it % 2 == 0 }.toTypedArray()\n\n var sections = mutableListOf
()\n\n var startIndex: Int? = null\n for (index in answerArray.indices) {\n if (answerArray[index] == null) {\n continue\n }\n\n if (startIndex == null) {\n startIndex = index\n continue\n }\n\n if (startIndex + 1 != index && answerArray[startIndex] == answerArray[index]) {\n sections.add(Section(startIndex, index, answerArray[startIndex]!!))\n }\n\n startIndex = index\n }\n\n sections.sortBy { it.end - it.start }\n\n for (sec in sections) {\n if (sec.isTrue && countTrue >= sec.size()\n || !sec.isTrue && countFalse >= sec.size()\n ) {\n for (i in sec.start + 1 until sec.end) {\n answerArray[i] = sec.isTrue\n }\n\n if (sec.isTrue) {\n countTrue -= sec.size()\n } else {\n countFalse -= sec.size()\n }\n }\n }\n\n if(answerArray.first() == null) {\n for(i in answerArray.indices) {\n if(answerArray[i] != null) {\n if(answerArray[i]!! && countTrue >= i\n || !answerArray[i]!! && countFalse >= i) {\n for(j in 0 until i) {\n answerArray[j] = answerArray[i]\n }\n\n if(answerArray[i]!!) {\n countTrue -= i\n } else {\n countFalse -= i\n }\n }\n break\n }\n }\n }\n\n if(answerArray.last() == null) {\n for(i in answerArray.size - 1 downTo 0) {\n if(answerArray[i] != null) {\n var size = answerArray.size - i - 1\n if(answerArray[i]!! && countTrue >= size || !answerArray[i]!! && countFalse >= size) {\n for(j in i + 1 until answerArray.size) {\n answerArray[j] = answerArray[i]\n }\n\n if(answerArray[i]!!) {\n countTrue -= size\n } else {\n countFalse -= size\n }\n }\n break\n }\n }\n }\n\n var index = 0\n while (index < answerArray.size) {\n if (answerArray[index] != null) {\n index++\n continue\n }\n\n var left = if (index > 0) answerArray[index - 1] else null\n var right = if (index < answerArray.size - 1) answerArray[index + 1] else null\n\n if(left == null && right == null) {\n index++\n continue\n }\n\n if((left == true || right == true || countFalse == 0) && countTrue > 0) {\n answerArray[index] = true\n countTrue--\n } else {\n if((left == false || right == false || countTrue == 0) && countFalse > 0) {\n answerArray[index] = false\n countFalse--\n }\n }\n\n if(index > 0 && left == null && right != null) {\n index--\n } else {\n index++\n }\n }\n\n\n var answer = 0\n for (i in 0 until answerArray.size - 1) {\n if (answerArray[i] != answerArray[i + 1]) {\n answer++\n }\n }\n\n println(answer)\n// println(answerArray.joinToString(\" \"))\n}\n\nclass Section(var start: Int, var end: Int, var isTrue: Boolean) {\n fun size() = end - start - 1\n}", "lang": "Kotlin", "bug_code_uid": "445da091b178684c2012e5d381ac819d", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "e4b4c00d5468201c559b16f704a4375e", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7679481241315423, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n var n = readLine()!!.toInt()\n\n var set = (1..n).toMutableSet()\n var array = readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n\n for (item in array) {\n set.remove(item)\n }\n\n var s = set.map { it % 2 == 0 }.toList()\n var countFalse = s.count { !it }\n var countTrue = s.count { it }\n\n var answerArray = array.map { if (it == 0) null else it % 2 == 0 }.toTypedArray()\n\n var sections = mutableListOf
()\n\n var startIndex: Int? = null\n for (index in answerArray.indices) {\n if (answerArray[index] == null) {\n continue\n }\n\n if (startIndex == null) {\n startIndex = index\n continue\n }\n\n if (startIndex + 1 != index && answerArray[startIndex] == answerArray[index]) {\n sections.add(Section(startIndex, index, answerArray[startIndex]!!))\n }\n\n startIndex = index\n }\n\n sections.sortBy { it.end - it.start }\n\n for (sec in sections) {\n if (sec.isTrue && countTrue >= sec.size()\n || !sec.isTrue && countFalse >= sec.size()\n ) {\n for (i in sec.start + 1 until sec.end) {\n answerArray[i] = sec.isTrue\n }\n }\n\n if (sec.isTrue) {\n countTrue -= sec.size()\n } else {\n countFalse -= sec.size()\n }\n }\n\n\n var index = 0\n while (index < answerArray.size) {\n if (answerArray[index] != null) {\n index++\n continue\n }\n\n var left = if (index > 0) answerArray[index - 1] else null\n var right = if (index < answerArray.size - 1) answerArray[index + 1] else null\n\n if(left == null && right == null) {\n index++\n continue\n }\n\n if((left == true || right == true || countFalse == 0) && countTrue > 0) {\n answerArray[index] = true\n countTrue--\n } else {\n if((left == false || right == false || countTrue == 0) && countFalse > 0) {\n answerArray[index] = false\n countFalse--\n }\n }\n\n if(index > 0 && left == null && right != null) {\n index--\n } else {\n index++\n }\n }\n\n\n var answer = 0\n for (i in 0 until answerArray.size - 1) {\n if (answerArray[i] != answerArray[i + 1]) {\n answer++\n }\n }\n\n println(answer)\n}\n\nclass Section(var start: Int, var end: Int, var isTrue: Boolean) {\n fun size() = end - start - 1\n}", "lang": "Kotlin", "bug_code_uid": "d0c0eeeff4a9cf81556958eebf0e2e75", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "e4b4c00d5468201c559b16f704a4375e", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.930921052631579, "equal_cnt": 19, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 12, "fix_ops_cnt": 18, "bug_source_code": "fun main() {\n val ar = arrayOf(5, 4, 3, 2, 1)\n var point = readLine()?.toInt()\n var count = 0\n var i=0\n while (point!!>0 && i) {\n var reader = Scanner(System.`in`)\n var x:Int = reader.nextInt()\n if (x==5)\n print(1)\n else\n print(((x/5)+1))\n}", "lang": "Kotlin", "bug_code_uid": "b50517b746c52298d6e39033d64ffd85", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "3325af91bfc37093fc0a7cfc21a392d8", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.717391304347826, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n val n = readInt()\n println(if (n in 1..5) 1 else n / 5 + 1)\n}\n\nprivate fun readInt() = readLine()!!.toInt()", "lang": "Kotlin", "bug_code_uid": "34fb3841632c72ff8f7307e9019809ef", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "5a1c44d89e7ae301c287538a1e31790b", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9812606473594548, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n\n var x: Int = readLine()!!.toInt()\n var count: Int = 0\n\n for (i in 0..x) {\n if (x <= 0) {\n break\n } else if (x - 5 > 0) {\n count += 1\n x -= 5\n } else if (x - 4 > 0) {\n count += 1\n x -= 4\n } else if (x - 3 > 0) {\n count += 1\n x -= 3\n } else if (x - 2 > 0) {\n count += 1\n x -= 2\n } else if (x - 1 > 0) {\n count += 1\n x -= 1\n } else {\n break\n }\n }\n\n println(count)\n \n}", "lang": "Kotlin", "bug_code_uid": "bda81b6cb4683b0efc6d96b96592be08", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "2ea68e461aa98c0fcfd4d5ad9d4d030c", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8635235732009926, "equal_cnt": 12, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 12, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*\n\nfun main() {\n\n val sc = Scanner(System.`in`)\n var a = sc.nextInt()\n if(a%10==5){\n print(a/5)\n }\n else{\n print(a/5+1)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "7cbd000c94a77c1d11b3c9f6fd41468a", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "c46050f09ebf4e10efc343e0e76a748c", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.789873417721519, "equal_cnt": 10, "replace_cnt": 0, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner\n\nfun main() {\n\n val x: Int = nextInt()\n if (x % 5 == 0) {\n \n println((x/5))\n } else {\n \n println((x/5)+1)\n }\n\n \n}", "lang": "Kotlin", "bug_code_uid": "02e856ee43b6a6ac6b3b49d9c1fe9100", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "fb6bdc42312d312f9f5221b700d8b71b", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.572139303482587, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val x = scanner.nextInt()\n val validMove = mutableListOf(5, 4, 3, 2, 1)\n\n var move = 0\n var i = 0\n while (move < x) {\n move += validMove[i]\n i += 1\n }\n\n println(i)\n}", "lang": "Kotlin", "bug_code_uid": "ba45f6facde198b7c724069c4854e630", "src_uid": "4b3d65b1b593829e92c852be213922b6", "apr_id": "83744afd5a607a66eacc0523099defb3", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9684265010351967, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.max\nimport kotlin.math.min\nimport kotlin.math.sqrt\n\nfun main(args : Array) {\n Thread { run() }.start()\n}\n\n\nfun run() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val input = IntArray(3) { scanner.nextInt() }.sorted()\n val res = IntArray(n + 1) { Int.MIN_VALUE }\n for (i in input)\n res[i] = 1\n for (i in 1..n) {\n if (res[i] == Int.MAX_VALUE)\n continue\n for (j in input)\n if (i + j <= n)\n res[i + j] = max(res[i + j], res[i] + 1)\n }\n println(res[n])\n}\n\n\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun LongArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}", "lang": "Kotlin", "bug_code_uid": "14d2e31fd2fb3acc4f8682b07b43b1ab", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "3076e71f125ae9320a8b2128fd591358", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.40725806451612906, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val (l, a, b, c) = r.readLine()!!.split(\" \").map { it.toInt() }\n fun f(len: Int): Int = when {\n len < 1 -> -Int.MAX_VALUE\n len == a -> maxOf(0, f(len - b), f(len - c)) + 1\n len == b -> maxOf(0, f(len - a), f(len - c)) + 1\n len == c -> maxOf(0, f(len - a), f(len - b)) + 1\n else -> maxOf(f(len - a), f(len - b), f(len - c)) + 1\n }\n println(f(l))\n}", "lang": "Kotlin", "bug_code_uid": "16c44da47067d2b4ae75ed623daa7b6c", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "fb3c6e5a85ca093ed4fd4e11163e982c", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8577472236911687, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "class Memorize(val func: (T) -> R) {\n val cache = mutableMapOf()\n\n operator fun getValue(thisRef: Any?, property: KProperty<*>) = { n: T ->\n cache.getOrPut(n) { func(n) }\n }\n}\n\nvar a by Delegates.notNull()\nvar b by Delegates.notNull()\nvar c by Delegates.notNull()\n\nval f:(Int) -> Int by Memorize { len ->\n when {\n len < 1 -> -Int.MAX_VALUE\n len == a -> maxOf(0, f(len - b), f(len - c)) + 1\n len == b -> maxOf(0, f(len - a), f(len - c)) + 1\n len == c -> maxOf(0, f(len - a), f(len - b)) + 1\n else -> maxOf(f(len - a), f(len - b), f(len - c)) + 1\n }\n}\nfun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val (l, x, y, z) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (l, x, y, z) = listOf(100, 1, 2, 3)\n a = x\n b = y\n c = z\n println(f(l))\n}", "lang": "Kotlin", "bug_code_uid": "40916705a72a188e16d20dc0fff7c731", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "fb3c6e5a85ca093ed4fd4e11163e982c", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.25483091787439616, "equal_cnt": 30, "replace_cnt": 20, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 30, "bug_source_code": "fun main(args: Array) {\n val (a, b, c, n) = readLine()!!.split(' ').sorted().map(String::toInt)\n var answer = 0\n var temp = 0\n var f: Long = 1\n var ti = n/c+1\n var tj = n/b+1\n var tk = n/a+1\n for(i in 0..ti){\n f++\n for(j in 0..tj){\n f++\n for(k in 0..tk){\n f++\n temp = k*a + j*b + i*c\n if(temp==n){\n answer = maxOf(answer, i+j+k)\n }\n }\n }\n }\n print(answer)\n}", "lang": "Kotlin", "bug_code_uid": "f7764697454bd7cc25d909008e64bb16", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "cb8ccfe991c7cd17cc28c3e5cac0a7fb", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9777777777777777, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n val (n , a , b , c) = readLine()!!.split(\" \").map { it.toInt() }\n\n val arr = IntArray(n + 1 , {p -> 0})\n val set = setOf(a , b , c)\n set.forEach {\n arr[it] = 1\n }\n\n\n for (i in 1..n){\n var max = 0\n\n set.forEach {\n if(i - it > 0 && arr[i - it] != 0)\n max = max(arr[i - it] + 1 , max)\n }\n\n arr[i] = max(max , arr[i])\n }\n\n\n println(arr[n])\n\n}", "lang": "Kotlin", "bug_code_uid": "1fa8e992fb4184b6d49ff3e6108a270e", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "eddb7304176f4b52cb609829a926dbdd", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8732099196646874, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val n = input.nextInt()\n\n val a = input.nextInt()\n val b = input.nextInt()\n val c = input.nextInt()\n\n var max = 0\n\n for (i in 0..(n / a)) {\n for (j in 0..(n / b)) {\n for (k in 0..(n / c)) {\n if (i * a + j * b + k * c == n && i + j + k > max) max = i + j + k\n }\n }\n }\n\n output.println(max)\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "4840526f69c039a393a4a121efd21bc3", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "83dabcfe072e7f5830a0f4b7124ababa", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9549494330370825, "equal_cnt": 31, "replace_cnt": 2, "delete_cnt": 22, "insert_cnt": 6, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*\n\nfun main() {\n val jin = Scanner(System.`in`)\n val n = mint(jin.nextInt())\n val mInv = mint(jin.nextInt()) pow -1\n val k = jin.nextInt()\n val dp = Array(k + 1) { Array(it + 2) { getM0 } }\n dp[0][0] = getM1\n for (x in 1..k) {\n for (y in 1..x) {\n dp[x][y] = ((n - mint(y) + getM1) * dp[x - 1][y - 1]) + (mint(y) * dp[x - 1][y])\n }\n }\n var answer = getM0\n var power = getM1\n for (y in 1..k) {\n power *= mInv\n answer += dp[k][y] * power\n }\n println(answer)\n}\n\nval getM0 = Mint(0)\nval getM1 = Mint(1)\nval getM2 = Mint(2)\n\nval getMOD: Long = 998244353\nval getMOD_TOTIENT = (getMOD - 1).toInt()\n\nfun mint(num: Long) = Mint(num % getMOD)\nfun mint(num: Int) = Mint(num % getMOD)\n\ninline class Mint(val num: Long) {\n\n operator fun plus(k: Mint) = mint(num + k.num)\n operator fun minus(k: Mint) = mint(num + getMOD - k.num)\n operator fun times(k: Mint) = mint(num * k.num)\n operator fun div(k: Mint) = this * (k pow -1)\n\n operator fun unaryMinus() = mint(getMOD - num)\n operator fun inc() = this + getM1\n operator fun dec() = this - getM1\n\n infix fun pow(power: Int): Mint {\n var e = power\n e %= getMOD_TOTIENT\n if (e < 0) {\n e += getMOD_TOTIENT\n }\n if (e == 0 && num == 0L) {\n return this\n }\n var b = this\n var res = Mint(1)\n while (e > 0) {\n if (e and 1 != 0) {\n res *= b\n }\n b *= b\n e = e shr 1\n }\n return res\n }\n\n override fun toString(): String = num.toString()\n}", "lang": "Kotlin", "bug_code_uid": "6723a97185e467b772371d9563ebb0b4", "src_uid": "e6b3e559b5fd4e05adf9f1cd1b22126b", "apr_id": "5adb5c4e97f7c9a1e156221816068797", "difficulty": 2600, "tags": ["dp", "probabilities", "combinatorics", "number theory", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9988814317673378, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun readInt() = readLine()!!.toInt()\n\nconst val MOD: Int = 1_000_000_000 + 7\n\ninline class IntMod(private val i: Int) {\n operator fun plus(increment: IntMod): IntMod = IntMod(Math.floorMod(i + increment.i, MOD))\n\n operator fun minus(other: IntMod): IntMod = IntMod(Math.floorMod(i - other.i, MOD))\n\n operator fun times(other: IntMod): IntMod = IntMod(Math.floorMod(i.toLong() * other.i, MOD.toLong()).toInt())\n operator fun times(other: Int): IntMod = this * other.moduloArithmetic()\n\n override fun toString(): String = i.toString()\n}\n\nfun Int.moduloArithmetic() : IntMod = IntMod(this % MOD)\n\nfun main() {\n val n = readInt()\n\n // Compute: n! - sum_i{1,n} choose(i-1, n-1)\n // = n! - 2^{n-1}\n\n var fact = 1.moduloArithmetic()\n var pow = 2.moduloArithmetic()\n for (i in 1 until n) {\n fact *= i+1\n pow *= 2\n }\n\n println(fact - pow)\n}\n", "lang": "Kotlin", "bug_code_uid": "c4afddb0c0231dfaee004a953c6adc41", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "apr_id": "bf3c90a5fa3583a37f905f2439323289", "difficulty": 1500, "tags": ["graphs", "dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.999574769666903, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\nfun main() { _writer.solve(); _writer.flush() }\n\nfun PrintWriter.solve() {\n var data = readLn().split(\"+\")\n if (data.size == 1) {\n println(data)\n }\n else {\n val hashData = data.groupingBy { it }.eachCount()\n val hashKey = hashData.keys.sorted().toList()\n var resultString = \"\"\n for (i in hashKey.indices) {\n hashData.get(hashKey[i])?.let {\n for (j in 0 until it) {\n resultString = resultString.plus(hashKey[i]).plus(\"+\")\n }\n }\n }\n println(resultString.dropLast(1))\n }\n }\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()", "lang": "Kotlin", "bug_code_uid": "33f1c738fad7756c0e7558fc2564662c", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "85aefb78f9bf65259037eb812ff6c45b", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8501742160278746, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n\n repeat(readLine()!!.toInt()) {\n val num = readLine()!!.toInt()\n val leastPrime = leastPrime(num)\n println(\"${num / leastPrime} ${num / leastPrime * (leastPrime - 1)}\")\n }\n\n}\n\nfun leastPrime(n: Int): Int {\n var num = 2\n if (n % 2 == 0)\n return 2\n num += 1\n while (n % num != 0) {\n num += 2\n }\n return num\n}", "lang": "Kotlin", "bug_code_uid": "42318d82711bf5a1b3cf5905accdcf15", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "3bc57ff7de0d373475c7c55f35c1cda3", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8863892013498312, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n\n repeat(readLine()!!.toInt()) {\n val num = readLine()!!.toInt()\n val leastPrime = leastPrime(num)\n println(\"${num / leastPrime} ${num / leastPrime * (leastPrime - 1)}\")\n }\n\n}\n\nfun leastPrime(n: Int): Int {\n var num = 2\n if (n % 2 == 0)\n return 2\n num += 1\n while (n % num != 0 && num < sqrt(n.toDouble())) {\n num += 2\n }\n return num\n}", "lang": "Kotlin", "bug_code_uid": "83b72cb406a4539fc994c38a992ef288", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "3bc57ff7de0d373475c7c55f35c1cda3", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8811777076761304, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.sqrt\n\n/**\n * Euler's totient function */\n\nfun main() {\n\n repeat(readLine()!!.toInt()) {\n val num = readLine()!!.toInt()\n val leastPrime = leastPrime(num)\n println(\"${num / leastPrime} ${num / leastPrime * (leastPrime - 1)}\")\n }\n\n}\n\nfun leastPrime(n: Int): Int {\n var num = 2\n if (n % 2 == 0)\n return 2\n num += 1\n while (n % num != 0 && num < sqrt(n.toDouble())) {\n num += 2\n }\n return num\n}", "lang": "Kotlin", "bug_code_uid": "a57049fa1579b985ee42024933a3d7af", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "3bc57ff7de0d373475c7c55f35c1cda3", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5607142857142857, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun readInts() = readLine()!!.split(\" \").map{i -> i.toInt()}.toMutableList()\nfun readInt() = readLine()!!.toInt()\nfun readLongs() = readLine()!!.split(\" \").map{i -> i.toLong()}.toMutableList()\n\nfun main() {\n val t = readInt()\n repeat(t) {\n val n = readInt()\n if (n % 2 == 0) {\n println(\"${n / 2} ${n / 2}\")\n } else {\n var a = n / 2\n var b = n / 2 + 1\n while(b % a != 0) {\n a--\n b++\n }\n println(\"$a $b\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "9ccfc37b5b93f7d37dfc5a66c3f3a804", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "2b79860fb5c5c55a0dce5eff5232f28c", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5593667546174143, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun readInts() = readLine()!!.split(\" \").map{i -> i.toInt()}.toMutableList()\nfun readInt() = readLine()!!.toInt()\nfun readLongs() = readLine()!!.split(\" \").map{i -> i.toLong()}.toMutableList()\n\nfun main() {\n val t = readInt()\n repeat(t) {\n val n = readInt()\n if (n % 2 == 0) {\n println(\"${n / 2} ${n / 2}\")\n } else {\n var a = sqrt(n.toDouble()).toInt()\n var b = n - a\n while(b % a != 0) {\n a--\n b++\n }\n println(\"$a $b\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "e9e6acb6987bf3c019d7bf20148c12f3", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "2b79860fb5c5c55a0dce5eff5232f28c", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7363494539781591, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun solve(n: Int) {\n var i = 2\n while (n % i != 0) {\n ++i\n }\n println(\"${n / i} ${n / i * (i - 1)}\")\n}\n\n\nfun main() {\n val t = readLine()!!.toInt()\n for (i in 1..t ) {\n solve(readLine()!!.toInt())\n }\n}", "lang": "Kotlin", "bug_code_uid": "d051e54233d403c5bc0b9ce2342063f5", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "246bc9abe8594fd1e92b5b65626ad312", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8132183908045977, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val count = scan.nextInt()\n for (i in 0 until count) {\n val n = scan.nextInt()\n var devider = 2\n while (n % devider != 0) devider++\n val a = n / devider\n println(\"$a ${n - a}\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "150908d92dbff35b7fcdc1b679179b43", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "1de7a920b56969f62242c3a07b0cfa71", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6949924127465857, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "fun readInt() = readLine()!!.toInt()\n\nfun main() {\n repeat(readInt()) {\n val n = readInt()\n println(solve(n))\n }\n}\n\nfun solve(n: Int): String {\n if (n % 2 == 0) return \"${n/2} ${n/2}\"\n var i = n / 2\n var j = n / 2 + 1\n while (j % i != 0) {\n i--\n j++\n }\n return \"$i $j\"\n}\n", "lang": "Kotlin", "bug_code_uid": "5a6f6c50c4dfad7a2f8c38ea497cb8fd", "src_uid": "3fd60db24b1873e906d6dee9c2508ac5", "apr_id": "2c75f6420a6585fc0438adf0bd2ffcc5", "difficulty": 1300, "tags": ["greedy", "math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.534769833496572, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.File\nimport java.util.*\n\nfun main() {\n// val scanner = Scanner(File(\"input.txt\"))\n val scanner = Scanner(System.`in`)\n val w1 = scanner.nextInt()\n val h1 = scanner.nextInt()\n val w2 = scanner.nextInt()\n val h2 = scanner.nextInt()\n\n val maxLeft = maxOf(w1, w2) + 1\n val maxTop = h1 + h2 + 1\n\n var count = 0\n for (x in 0..maxLeft) {\n for (y in 0..maxTop) {\n val isInsideFirst = x in 0..(w1 + 1) && y in 0..(h1 + 1)\n val isInsideSecond = x in 0..(w2 + 1) && y in h1..(h2 + 1)\n if (isInsideFirst || isInsideSecond) ++count\n }\n }\n print(count)\n}", "lang": "Kotlin", "bug_code_uid": "60ccf62cff431b69d6d146dcf4886c09", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "apr_id": "4b4ab0cdc245a2dd1d76f44170e9dce4", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.44357976653696496, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.File\nimport java.util.*\n\nfun main() {\n val scanner = Scanner(File(\"input.txt\"))\n// val scanner = Scanner(System.`in`)\n val w1 = scanner.nextInt()\n val h1 = scanner.nextInt()\n val w2 = scanner.nextInt()\n val h2 = scanner.nextInt()\n\n val maxRight = maxOf(w1, w2) + 1\n val maxTop = h1 + h2 + 1\n\n var count = 0\n for (x in 0..maxRight) {\n for (y in 0..maxTop) {\n val isInsideFirst = x in 0..(w1 + 1) && y in 0..(h1 + 1)\n val isInsideSecond = x in 0..(w2 + 1) && y in h1..(h1 + h2 + 1)\n if (isInsideFirst || isInsideSecond) ++count\n }\n }\n print(count)\n}", "lang": "Kotlin", "bug_code_uid": "4cf8b6fbf3f292e3ebe444bd881daa49", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "apr_id": "4b4ab0cdc245a2dd1d76f44170e9dce4", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5209923664122137, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.File\nimport java.util.*\n\nfun main() {\n// val scanner = Scanner(File(\"input.txt\"))\n val scanner = Scanner(System.`in`)\n val w1 = scanner.nextInt()\n val h1 = scanner.nextInt()\n val w2 = scanner.nextInt()\n val h2 = scanner.nextInt()\n\n val maxRight = maxOf(w1, w2) + 1\n val maxTop = h1 + h2 + 1\n\n var count = 0\n for (x in 0..maxRight) {\n for (y in 0..maxTop) {\n val isInsideFirst = x in 0..(w1 + 1) && y in 0..(h1 + 1)\n val isInsideSecond = x in 0..(w2 + 1) && y in h1..(h1 + h2 + 1)\n if (isInsideFirst || isInsideSecond) ++count\n }\n }\n print(count - w1 * h1 - w2 * h2)\n}", "lang": "Kotlin", "bug_code_uid": "b696da51f1bc31630b6b3e15abf33475", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "apr_id": "4b4ab0cdc245a2dd1d76f44170e9dce4", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9795918367346939, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun solve(ts:Long){\n var (w1,h1,w2,h2) = readLine()!!.split(\" \").map{it.toLong()};\n if(w1==w2){\n println((w1+h1+h2)*2 + 4);\n } else {\n println(w1+w2 + (h1+h2)*2 + 5);\n }\n}\n\nfun main(){\n var t=1L;\n //t=readLine()!!.toLong();\n for(i in 1..t) solve(i);\n}\n\n", "lang": "Kotlin", "bug_code_uid": "0b37e83d31eb82b95ca2f0ea20beaf4b", "src_uid": "b5d44e0041053c996938aadd1b3865f6", "apr_id": "6b75ab02abfbb8aa6647eb5d85ada5a6", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8563829787234043, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var s = readLine()!!.split(\" \");\n var d = s[1].toInt() - s[0].toInt();\n if (n > 2)\n for (i in 2 until s.count() - 1) {\n if (s[i].toInt() - s[i - 1].toInt() != d) {\n print(s[s.lastIndex]);\n return;\n }\n }\n print(s.last().toInt() + d);\n}", "lang": "Kotlin", "bug_code_uid": "d3d01cb0304e0f611f1d9c7fd1064114", "src_uid": "d04fa4322a1b300bdf4a56f09681b17f", "apr_id": "e6c772d8963f14d3f6313be7e87c16a6", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9667786487495335, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n\n val n = sc.nextInt()\n val y = sc.nextInt()\n val maxn = 1001\n val c = Array(maxn + 2) { Array(maxn + 2) { 0 } }\n\n c[0][1] = 1\n c[1][1] = 1\n\n for (z in 1..maxn) {\n for (k in 0..z) {\n c[k][z + 1] += c[k][z]\n c[k + 1][z + 1] += c[k][z]\n }\n }\n\n val fact = Array(maxn + 1) { 0 }\n\n fact[0] = 1\n for (i in 1..maxn) fact[i] = i * fact[i - 1]\n\n\n val p = Array(6) { 0 }\n for (z in 0..5) {\n var t = 1\n for (j in z downTo 0) {\n p[z] += t * c[z - j][z] * fact[j]\n t *= -1\n }\n }\n\n var res = 0\n for (x in n - y..n) {\n res += c[x][n] * p[n - x]\n }\n println(res + 1)\n\n\n\n}\n\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "86491092f6fc5b2affbed906bc07858f", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "apr_id": "09720b56c59d394c46f0bd117c1f3290", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9448223733938019, "equal_cnt": 11, "replace_cnt": 2, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "fun main(args: Array) {\n val fac: (Int) -> Int = {n -> var res = 1; for (p in 1 .. n) res *= p; res}\n \n fun d(n: Int): Int {\n val i: Int\n var res = 0\n\n for (i in 0 .. n) {\n val sign = {it: Int -> if (it % 2 == 0) 1 else -1}(i)\n res += sign * fac(n) / fac(i)\n }\n return res\n }\n \n fun c(n: Int, m: Int): Int{\n var p = 1\n for (i in (n - m + 1) .. n) {\n p *= i\n }\n return p / fac(m)\n }\n \n val s = readLine()!!.split(\" \").map { it -> it.toInt() }\n val n = s[0]\n val k = s[1]\n println((0 .. k).map { m -> c(n, m) * d(m) }.sum())\n}", "lang": "Kotlin", "bug_code_uid": "5d5011ef4a8f6cd88ba1fd1c210f6062", "src_uid": "96d839dc2d038f8ae95fc47c217b2e2f", "apr_id": "c69a4745a1bd7a3b477ba08956d99641", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7914691943127962, "equal_cnt": 24, "replace_cnt": 13, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 23, "bug_source_code": "import java.util.Scanner\n\nclass Pair(val p: Int,val x: Int,var y: Int)\n\nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val b = sc.nextInt()\n val pairs = arrayListOf()\n var j = 2\n var m = b\n\n var times = 0\n while (j <= m){\n if (m%j==0){\n m /= j\n times++\n }else{\n if (times > 0){\n pairs.add(Pair(j,times,0))\n }\n j++\n times = 0\n }\n }\n if (times > 0){\n pairs.add(Pair(j,times,0))\n }\n\n var min = Int.MIN_VALUE\n for(pair in pairs){\n m = n\n while (m>0){\n pair.y += m/pair.p\n m /= pair.p\n }\n if (min > pair.y/pair.x){\n min = pair.y/pair.x\n }\n }\n print(min)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "f4bd6394d325095ea9f492c1c4ec9d43", "src_uid": "491748694c1a53771be69c212a5e0e25", "apr_id": "53a5b312aab1cbfd9e55ec118f3178e2", "difficulty": 1700, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7938388625592417, "equal_cnt": 23, "replace_cnt": 12, "delete_cnt": 5, "insert_cnt": 5, "fix_ops_cnt": 22, "bug_source_code": "import java.util.Scanner\n\nclass Pair(val p: Int,val x: Int,var y: Int)\n\nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val b = sc.nextInt()\n val pairs = arrayListOf()\n var j = 2\n var m = b\n\n var times = 0\n while (j <= m){\n if (m%j==0){\n m /= j\n times++\n }else{\n if (times > 0){\n pairs.add(Pair(j,times,0))\n }\n j++\n times = 0\n }\n }\n if (times > 0){\n pairs.add(Pair(j,times,0))\n }\n\n var min = Int.MAX_VALUE\n for(pair in pairs){\n m = n\n while (m>0){\n pair.y += m/pair.p\n m /= pair.p\n }\n if (min > pair.y/pair.x){\n min = pair.y/pair.x\n }\n }\n print(min)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "7eb11c8a3b05ba43628451cdce30dad5", "src_uid": "491748694c1a53771be69c212a5e0e25", "apr_id": "53a5b312aab1cbfd9e55ec118f3178e2", "difficulty": 1700, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8391278727165586, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner\n\nclass Pair(val p: Long,val x: Long,var y: Long)\n\nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val b = sc.nextLong()\n val pairs = arrayListOf()\n var j = 2L\n var m = b\n\n var times = 0L\n while (j <= m){\n if (m%j==0L){\n m /= j\n times++\n }else{\n if (times > 0){\n pairs.add(Pair(j,times,0))\n }\n j++\n times = 0\n }\n }\n if (times > 0){\n pairs.add(Pair(j,times,0))\n }\n\n var min = Long.MAX_VALUE\n for(pair in pairs){\n m = n\n while (m>0){\n pair.y += m/pair.p\n m /= pair.p\n }\n if (min > pair.y/pair.x){\n min = pair.y/pair.x\n }\n }\n print(min)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "23dbcfec9c546de4414bbf141ccd8934", "src_uid": "491748694c1a53771be69c212a5e0e25", "apr_id": "53a5b312aab1cbfd9e55ec118f3178e2", "difficulty": 1700, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7420911528150134, "equal_cnt": 15, "replace_cnt": 3, "delete_cnt": 7, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main(args: Array ) {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n var b = sc.nextInt()\n val p = ArrayList()\n val d = ArrayList()\n var i = 1\n while ( ++ i * i <= b ) {\n if ( b % i != 0 ) continue\n p.add( i )\n var deg = 0\n while ( b % i == 0 ) {\n deg ++\n b /= i\n }\n d.add( deg )\n }\n if ( b > 1 ) {\n p.add( b )\n d.add( 1 )\n }\n\n var r = n\n for ( j in p.indices ) {\n var deg = 0L\n var t = n\n while ( t > 0 ) {\n t /= p[j]\n deg += t\n }\n r = Math.min( r, deg / d[j] )\n }\n\n println( r )\n}", "lang": "Kotlin", "bug_code_uid": "22987b80b5366044a982eb45f2758f1d", "src_uid": "491748694c1a53771be69c212a5e0e25", "apr_id": "a1750e90d8a1e5f1598099c5dae46a70", "difficulty": 1700, "tags": ["number theory", "math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9831824062095731, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.*\n\nfun main(args: Array)\n{\n val inp = readLine()!!.split(' ').map(String::toInt)\n var a = inp[0]\n var b = inp[1]\n while (max(a, b) >= 2 * min(a, b) && a != 0 && b != 0)\n {\n if (a > b)\n {\n a %= 2 * b\n continue\n }\n if (b > a)\n {\n b %= 2 * a\n }\n }\n println(\"$a $b\")\n}", "lang": "Kotlin", "bug_code_uid": "a3b2617613b51b29dae0752cc70a6080", "src_uid": "1f505e430eb930ea2b495ab531274114", "apr_id": "f9ddb322280aebc618df959a1a193f7d", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8888888888888888, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "fun main(args:Array) {\n var (a, b) = readLine()!!.split(\" \").map(String::toInt)\n\n proc@while(true) {\n if( a == 0 || b == 0 ) break@proc\n \n if( a - 2*b >= 0 ) {\n a = a - 2*b\n continue@proc // step1\n }else{\n // step3\n if( b - 2*a >= 0) {\n b = b - 2*a\n continue@proc\n } else {\n break@proc\n }\n }\n }\n println(\"${a} ${b}\")\n}", "lang": "Kotlin", "bug_code_uid": "6c9d5a4a142d5d8a293f2185cef6cf5c", "src_uid": "1f505e430eb930ea2b495ab531274114", "apr_id": "3301da9b97b0f672bffb5603fe545da4", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7942386831275721, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "fun main(args:Array) {\n var (a, b) = readLine()!!.split(\" \").map{ it.toBigDecimal() }\n\n proc@while(true) {\n if( a == 0.toBigDecimal() || b == 0.toBigDecimal() ) break@proc\n \n if( a - 2.toBigDecimal()*b >= 0.toBigDecimal() ) {\n a = a - 2.toBigDecimal()*b\n continue@proc // step1\n }else{\n // step3\n if( b - 2.toBigDecimal()*a >= 0.toBigDecimal()) {\n b = b - 2.toBigDecimal()*a\n continue@proc\n } else {\n break@proc\n }\n }\n }\n println(\"${a} ${b}\")\n}", "lang": "Kotlin", "bug_code_uid": "711b8a82d3d89143c07f43de1603a87f", "src_uid": "1f505e430eb930ea2b495ab531274114", "apr_id": "3301da9b97b0f672bffb5603fe545da4", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9844464775846294, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedInputStream\nimport java.io.BufferedWriter\nimport java.io.OutputStreamWriter\nimport java.util.*\nimport kotlin.collections.HashMap\n\nfun main(args: Array) {\n val scanner = Scanner(BufferedInputStream(System.`in`))\n val output = BufferedWriter(OutputStreamWriter(System.`out`))\n\n var a = scanner.nextInt()\n var b = scanner.nextInt()\n\n while(a >= 2*b || b >= 2*a){\n if(a == 0 || b == 0) break\n a %= (2*b)\n if(a != 0) b %= (2*a)\n }\n\n output.write(\"$a $b\")\n\n output.flush()\n}", "lang": "Kotlin", "bug_code_uid": "b80d0aa193bf476b76fb5ae87d323de8", "src_uid": "1f505e430eb930ea2b495ab531274114", "apr_id": "cc57321a8ea4717ad821f2ddf3b867d4", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8436363636363636, "equal_cnt": 21, "replace_cnt": 18, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "import java.util.*\n\nclass B {\n fun run(scan: Scanner) {\n val a = scan.nextInt()\n val b = scan.nextInt()\n var m = a\n var n = b\n while (true) {\n if (m == 0 || n == 0) {\n break\n } else if (m >= 2 * n) {\n m -= (m / (2 * n)) * 2 * n\n } else if (n >= 2 * m) {\n n -= (n / (2 * m)) * 2 * m\n } else {\n break\n }\n }\n println(\"$m $n\")\n }\n}\n\nfun main(args: Array) {\n B().run(Scanner(System.`in`))\n}", "lang": "Kotlin", "bug_code_uid": "18905ea4bed9dc74f523b101f71fae16", "src_uid": "1f505e430eb930ea2b495ab531274114", "apr_id": "7aae3808a97a5db5a44c86f3d26b151c", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9897959183673469, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (n, m) = br.readLine().split(\" \").map { it.toInt() }\n val minBound = min(n, m)\n val maxBound = max(n, m)\n println((1..minBound).fold(0){acc, i ->\n acc + (maxBound + i)/5 - i/5\n })\n}", "lang": "Kotlin", "bug_code_uid": "133c1332b7397bf1463ac6824ced68ee", "src_uid": "df0879635b59e141c839d9599abd77d2", "apr_id": "9458cb6fccab19ddeb44b0230fc78c65", "difficulty": 1100, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6481802426343154, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n var sol = 0\n for (i in 1..n) {\n var j = 5 - i % 5\n if (j == 0) {\n j = 5\n }\n while(j <= m) {\n sol++\n j += 5\n }\n }\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "f44f790c2d6754be4fb3a4514b17d363", "src_uid": "df0879635b59e141c839d9599abd77d2", "apr_id": "6b173b49b40136d1f616f880cd464daf", "difficulty": 1100, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9025641025641026, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n val (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n var sol = 0\n for (i in 1..n) {\n var j = 5 - i % 5\n if (j == 0) {\n j = 5\n }\n j = m - j\n if (j >= 0) {\n sol += 1 + j / 5\n }\n }\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "e085e7d4c97f52d55d47a5f416480985", "src_uid": "df0879635b59e141c839d9599abd77d2", "apr_id": "6b173b49b40136d1f616f880cd464daf", "difficulty": 1100, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9934181658622203, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nimport java.io.*\nimport java.lang.Math.*\n\n\nprivate fun exit(msg: String) {\n println(msg)\n System.exit(0)\n}\nprivate fun exit(msg: Int) = exit(\"\"+msg)\n\n\nfun main(args: Array) {\n val scan = object {\n private val reader = BufferedReader(InputStreamReader(System.`in`))\n private var tokenizer: StringTokenizer? = null\n \n internal operator fun next(): String {\n var t = tokenizer\n while (t == null || !t.hasMoreTokens()) {\n t = StringTokenizer(line())\n }\n return t.nextToken().apply { tokenizer = t }\n }\n \n internal fun int(): Int = next().toInt()\n internal fun long(): Long = next().toLong()\n internal fun double() = next().toDouble()\n \n internal fun line() = reader.readLine()\n \n }\n\n val n = scan.int()\n val m = scan.int()\n\n val xi = {x:Int ->\n IntArray(5) {i -> x / 5 + if (x % 5 >= i % 5) 1 else 0}.apply { this[0] -- }\n }\n val ni = xi(n)\n val mi = xi(m)\n\n val res = ni.mapIndexed { index, x -> x * mi[(5-index) % 5] }.sum()\n exit(res)\n}\n\n ", "lang": "Kotlin", "bug_code_uid": "84327c1da389920e605e9e4b81cd7ee9", "src_uid": "df0879635b59e141c839d9599abd77d2", "apr_id": "f2d578f95296bb31cbb73b01239c22b5", "difficulty": 1100, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7973214285714286, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*\nimport java.io.*\nimport java.lang.Math.*\n\n\nprivate fun exit(msg: String) {\n println(msg)\n System.exit(0)\n}\nprivate fun exit(msg: Int) = exit(\"\"+msg)\n\n\nfun main(args: Array) {\n val scan = object {\n private val reader = BufferedReader(InputStreamReader(System.`in`))\n private var tokenizer: StringTokenizer? = null\n \n internal operator fun next(): String {\n var t = tokenizer\n while (t == null || !t.hasMoreTokens()) {\n t = StringTokenizer(line())\n }\n return t.nextToken().apply { tokenizer = t }\n }\n \n internal fun int(): Int = next().toInt()\n internal fun long(): Long = next().toLong()\n internal fun double() = next().toDouble()\n \n internal fun line() = reader.readLine()\n \n }\n val n = scan.int()\n val a = IntArray(n) {\n var p = scan.int()\n while (p>1 && p % 2 == 0) p/=2\n while (p>1 && p % 3 == 0) p/=3\n p\n }\n if (a.all { it == a[0] })\n exit(\"Yes\")\n else\n exit(\"No\")\n}\n\n ", "lang": "Kotlin", "bug_code_uid": "59dfd1e49d2a02541bd2e4d5734f7cd8", "src_uid": "df0879635b59e141c839d9599abd77d2", "apr_id": "f2d578f95296bb31cbb73b01239c22b5", "difficulty": 1100, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5193868349864743, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var a: Int = reader.nextInt()\n var b: Int = reader.nextInt()\n var x: Int = reader.nextInt()\n var y: Int = reader.nextInt()\n\n var p1 = 0\n var p2 = 0\n\n if(a<=x || b<=y){\n print(0)\n print(\" \")\n print(0)\n }\n else{\n var a1 = a / x\n var b1 = b / y\n\n if(a1>=b1){\n p1 = b1 * x\n p2 = b1 * y\n }\n else{\n p1 = a1 * x\n p2 = a1 * y\n }\n print(p1)\n print(\" \")\n print(p2)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "6e3cf4903c68f77d066a6a462e68aa82", "src_uid": "97999cd7c6de79a4e39f56a41ff59e7a", "apr_id": "5f2e7daa00127572e1abc199651bd207", "difficulty": 1800, "tags": ["number theory", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9360518999073216, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main(arg: Array) {\n fun getMax(pos: Int, numbers: Array): Array = when (pos) {\n 0 -> numbers\n else -> {\n if (9 - numbers[pos] + (pos..numbers.size - 1).sumBy { 9 - numbers[it] } > 0) {\n numbers[pos - 1]--\n for (i in pos..numbers.size - 1) numbers[i] = 9\n }\n getMax(pos - 1, numbers)\n }\n }\n\n var numbers = readLine()!!.map { it - '0' }.toTypedArray()\n getMax(numbers.size - 1, numbers).forEach(::print)\n println()\n}\n", "lang": "Kotlin", "bug_code_uid": "0556da14f8d6abd4407354a9aa6e275e", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "f40af3d2cbfc09464bb2d7d215611dc3", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.992633517495396, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(arg: Array) {\n fun getMax(pos: Int, numbers: Array): Array = when (pos) {\n 0 -> numbers\n else -> {\n if (8 - numbers[pos] + (pos + 1..numbers.size - 1).sumBy { 9 - numbers[it] } > 0) {\n numbers[pos - 1]--\n for (i in pos..numbers.size - 1) numbers[i] = 9\n }\n getMax(pos - 1, numbers)\n }\n }\n\n var numbers = readLine()!!.map { it - '0' }.toTypedArray()\n println(getMax(numbers.size - 1, numbers).joinToString(\"\").toInt())\n}\n", "lang": "Kotlin", "bug_code_uid": "55b71bdc054012ce7094cb9a027b4108", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "f40af3d2cbfc09464bb2d7d215611dc3", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5885916203937406, "equal_cnt": 17, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 7, "fix_ops_cnt": 18, "bug_source_code": "fun main(args: Array) {\n val N = readLine()!!.toLong()\n val digits = Math.abs(N).toString().length.toDouble()\n val N2 = (N / Math.pow(10.0, digits - 1).toLong() - 1) * Math.pow(10.0, digits - 1).toLong() +\n (digits.toLong() - 2 downTo 0).sumByLong { 9 * Math.pow(10.0, it.toDouble()).toLong() }\n\n val Nsum = N.getSum()\n val N2sum = N2.getSum()\n if (Nsum > N2sum)\n println(N)\n else if (Nsum < N2sum)\n println(N2)\n else\n println(Math.max(N, N2))\n}\n\nfun Long.getSum(): Long {\n var sum = 0L\n var remainder = this\n while (remainder != 0L) {\n sum += remainder % 10\n remainder /= 10\n }\n return sum\n}\n\ninline fun Iterable.sumByLong(selector: (T) -> Long): Long {\n var sum: Long = 0L\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}", "lang": "Kotlin", "bug_code_uid": "8fa389881557c07ae111b4e8f5fd0e14", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "adb5f5f558da53422a52aecf729971fd", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5636957536164255, "equal_cnt": 21, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 22, "bug_source_code": "fun main(args: Array) {\n val NStr = readLine()!!\n var nines = 0\n while (NStr[nines] == '9')\n nines++\n nines--\n\n val N = NStr.takeLast(NStr.length - nines).toLong()\n val digits = Math.abs(N).toString().length.toDouble()\n val N2 = (N / Math.pow(10.0, digits - 1).toLong() - 1) * Math.pow(10.0, digits - 1).toLong() +\n (digits.toLong() - 2 downTo 0).sumByLong { 9 * Math.pow(10.0, it.toDouble()).toLong() }\n\n val Nsum = N.getSum()\n val N2sum = N2.getSum()\n print(\"9\".repeat(nines))\n if (Nsum > N2sum)\n println(N)\n else if (Nsum < N2sum)\n println(N2)\n else\n println(Math.max(N, N2))\n \n}\n\nfun Long.getSum(): Long {\n var sum = 0L\n var remainder = this\n while (remainder != 0L) {\n sum += remainder % 10\n remainder /= 10\n }\n return sum\n}\n\ninline fun Iterable.sumByLong(selector: (T) -> Long): Long {\n var sum: Long = 0L\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}", "lang": "Kotlin", "bug_code_uid": "6990111197b427c1202dd3a62cd20e2e", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "adb5f5f558da53422a52aecf729971fd", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9856801909307876, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val jin = BufferedReader(InputStreamReader(System.`in`))\n var (n, m, k) = jin.readLine().split(\" \").map { it.toInt() }\n var dir = jin.readLine().last() == 'l'\n val state = jin.readLine()\n var prev = mutableListOf(m)\n var answer = 0\n for (chara in state) {\n answer++\n val prevK = k\n if (k == 1) {\n dir = true\n } else if (k == n) {\n dir = false\n }\n if (dir) {\n k++\n } else {\n k--\n }\n val next = mutableSetOf()\n if (chara == '0') {\n for (x in prev) {\n if (x != k) {\n next.add(x)\n }\n if (x != 1 && x - 1 != prevK && x - 1 != k) {\n next.add(x - 1)\n }\n if (x != n && x + 1 != prevK && x + 1 != k) {\n next.add(x + 1)\n }\n }\n } else {\n next.addAll(1..n)\n next.remove(k)\n }\n if (next.isEmpty()) {\n println(\"Controller\")\n println(answer)\n return\n }\n }\n println(\"Stowaway\")\n}", "lang": "Kotlin", "bug_code_uid": "2b62072067e6aa24f6533a7746878d02", "src_uid": "2222ce16926fdc697384add731819f75", "apr_id": "58eae29afabf32466ff2e937494ba8f9", "difficulty": 1500, "tags": ["dp", "games", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9972473456547385, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val jin = BufferedReader(InputStreamReader(System.`in`))\n var (n, m, k) = jin.readLine().split(\" \").map { it.toInt() }\n var dir = jin.readLine().last() == 'l'\n val state = jin.readLine()\n var prev = mutableListOf(m)\n var answer = 0\n for (chara in state) {\n answer++\n val prevK = k\n if (k == 1) {\n dir = true\n } else if (k == n) {\n dir = false\n }\n if (dir) {\n k++\n } else {\n k--\n }\n val next = mutableSetOf()\n if (chara == '0') {\n for (x in prev) {\n if (x != k) {\n next.add(x)\n }\n if (x != 1 && x - 1 != prevK && x - 1 != k) {\n next.add(x - 1)\n }\n if (x != n && x + 1 != prevK && x + 1 != k) {\n next.add(x + 1)\n }\n }\n } else {\n next.addAll(1..n)\n next.remove(k)\n }\n if (next.isEmpty()) {\n println(\"Controller\")\n println(answer)\n return\n }\n prev = next.toList()\n }\n println(\"Stowaway\")\n}", "lang": "Kotlin", "bug_code_uid": "5a859714ee9448b9f8bd51c0ef0abc68", "src_uid": "2222ce16926fdc697384add731819f75", "apr_id": "58eae29afabf32466ff2e937494ba8f9", "difficulty": 1500, "tags": ["dp", "games", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.29279538904899133, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 19, "bug_source_code": "fun main() {\n val cmd = readLine()!!\n val path = mutableSetOf>()\n var x = 0\n var y = 0\n path.add(Pair(0, 0))\n var ok = true\n for (step in cmd) {\n when (step) {\n 'L' -> x--\n 'R' -> x++\n 'U' -> y--\n 'D' -> y++\n }\n if (path.contains(Pair(x, y))) {\n ok = false\n println(\"BUG\")\n break\n }\n path.add(Pair(x, y))\n }\n if (ok) println(\"OK\")\n}\n", "lang": "Kotlin", "bug_code_uid": "e5c2e09ad11e7838d93bb207d81252ab", "src_uid": "bb7805cc9d1cc907b64371b209c564b3", "apr_id": "3936c55303054ab398b85f83b5e6a1ec", "difficulty": 1400, "tags": ["graphs", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9671261930010604, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.sqrt\n\nfun main() {\n var n = readLine()!!.toLong()\n val coll = ArrayList()\n\n for (i in 2..sqrt(n.toDouble()).toLong() + 1) {\n if (n % i == 0.toLong()) {\n coll.add(i)\n\n n /= i\n\n while (n % i == 0.toLong()) {\n n /= i\n }\n }\n }\n\n if (!coll.any()) {\n println(n)\n } else if (coll.size == 1) {\n println(coll[0])\n } else {\n println(1)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "60793f6ce0a3a36208abd88adf9770e7", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "aa374ca49321f3fc4d4b375216069ce2", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9981637899375688, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007L\nfun factorize(a: Long): List> {\n val res = mutableListOf>()\n var x = a\n var i = 2\n while(i * i <= x) {\n var cnt = 0\n while (x % i == 0L) {\n cnt++\n x /= i\n }\n if (cnt > 0) res += Pair(i.toLong(), cnt)\n i++\n }\n if (x > 1) res += Pair(x, 1)\n return res\n}\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val N = nl()\n val fact = factorize(N)\n if (fact.isEmpty()) {\n out.println(N)\n } else if (fact.size == 1) {\n val f = fact[0].first\n out.println(f)\n } else {\n out.println(1)\n }\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "98c3c592d0e9c7963756eef008c91e9e", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "1bfa028e1d25725483f846f5df9cf319", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9986187845303868, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.sqrt\n\npublic data class Cont(var a : Char, var b: Char, var c : Int)\n\nfun main(args: Array) {\n var n = readLine()!!.toLong()\n\n var numbers = arrayListOf()\n\n var max = sqrt(n.toDouble()).toInt() + 1\n\n for (i in 2L..(max)) {\n if(n % i == 0L) {\n numbers.add(i)\n while (n % 2 == 0L) {\n n /= i\n }\n }\n }\n\n when {\n numbers.size == 0 -> {\n println(n)\n }\n numbers.size == 1 -> {\n if(n == 1L) {\n println(numbers.first())\n } else\n {\n println(1)\n }\n }\n else -> {\n println(1)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "2903e26249b35b3089a583778233aa7f", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "559920b2240f57f75434dd73a6732c1f", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9365325077399381, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.ceil\nimport kotlin.math.sqrt\n\nfun readints() = readLine()!!.split(\" \").map { it.toLong() }\nfun readstrs() = readLine()!!.split(\" \")\n\n\nfun gcd(a: Long, b: Long): Long {\n if (b == 0L) return a\n return gcd(b, a % b)\n}\n\nfun main() {\n val (n) = readints()\n var mm = -1L\n for (i in 2..(ceil(sqrt(n.toFloat())).toLong() + 1)) {\n if (n % i == 0L) {\n if (mm == -1L) {\n mm = i\n }\n mm = gcd(mm, i)\n mm = gcd(mm, n / i)\n }\n }\n if (mm == -1L) {\n println(n)\n } else {\n println(mm)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "412e8c9abd512301c30b8b61754a0f2a", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "3835202f761572aac83895c0b00eff50", "difficulty": 1500, "tags": ["number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.963855421686747, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n var b1s1 = readLine()!!\n var b1s2 = readLine()!!\n var b2s1 = readLine()!!\n var b2s2 = readLine()!!\n\n var s1 = (b1s1 + b1s2.reversed()).split(\"X\").joinToString()\n var s2 = b2s1 + b2s2.reversed().split(\"X\").joinToString()\n if (s1 == s2) {\n print(\"YES\")\n return\n }\n for (i in 0..4) {\n s1 = s1.substring(1) + s1[0]\n if (s1 == s2) {\n println(\"YES\")\n return\n }\n }\n print(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "4261e0ca46f9325ff37c36d4720f3170", "src_uid": "46f051f58d626587a5ec449c27407771", "apr_id": "7402de7da9ff4869b5ee3dadf6637f24", "difficulty": 1200, "tags": ["brute force", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9955827387020048, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n val n: Int = ir.nextInt()\n val c = ir.next().toCharArray()\n var min = 105\n\n for (i in 0 until (n - 3)) {\n var count = 0\n if (c[i] != 'A') {\n val num = (c[i] - 64).toInt()\n val n1 = Math.abs(27 - num)\n val n2 = Math.abs(1 - num)\n\n count += if (n1 <= n2)\n n1\n else\n n2\n }\n\n if (c[i + 1] != 'C') {\n val num = (c[i + 1] - 64).toInt()\n val n1 = Math.abs(29 - num)\n val n2 = Math.abs(3 - num)\n\n count += if (n1 <= n2)\n n1\n else\n n2\n }\n\n if (c[i + 2] != 'T') {\n val num = (c[i + 2] - 64).toInt()\n val n1 = Math.abs(6 + num)\n val n2 = Math.abs(20 - num)\n\n count += if (n1 <= n2)\n n1\n else\n n2\n }\n\n if (c[i + 3] != 'G') {\n val num = (c[i + 3] - 64).toInt()\n val n1 = Math.abs(33 - num)\n val n2 = Math.abs(7 - num)\n\n count += if (n1 <= n2)\n n1\n else\n n2\n }\n\n min = Math.min(count, min)\n pw.println(count)\n }\n\n pw.println(min)\n\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "26603ad5ebdab6ea84be300fd4263a18", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "apr_id": "6b6f31214f2450f50db2d9454070bf33", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6763224181360201, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.abs\n\nfun main() {\n var n = readInt()\n var str = readStr()!!\n var min = Int.MAX_VALUE\n var i = 0\n while (i < n-3) {\n var sum = 0\n sum += minOf(abs('A' - str[i]), abs('Z' - str[i] + 1))\n sum += minOf(abs('C' - str[i + 1]), abs('Z' - str[i + 1] + 3))\n sum += minOf(abs('T' - str[i + 2]), abs('Z' - str[i + 2] + abs('T' - 'A')))\n sum += minOf(abs('G' - str[i + 3]), abs('Z' - str[i + 3] + abs('G' - 'A')))\n\n min = minOf(min, sum)\n i++\n }\n println(min)\n}\n\n\nprivate fun readInts(): List = readLine()!!.split(' ').map { it.toInt() }\nprivate fun readLongs(): List = readLine()!!.split(' ').map { it.toLong() }\nprivate fun readInt(): Int = readLine()!!.toInt()\nprivate fun readLong(): Long = readLine()!!.toLong()\nprivate fun readStr(): String? = readLine()!!", "lang": "Kotlin", "bug_code_uid": "a224224a834a0e33d144b12a555d5c57", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "apr_id": "f454f7970076fece45c3c38a6c5e3c67", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8561827956989247, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\n//2019-04-20\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val genom = \"ACTG\"\n nextInt()\n val line = next()\n\n print((0..line.length - 4)\n .map { line.substring(it, it + 4) }\n .map { genom.diff(it) }\n .min())\n}\n\nprivate fun String.diff(s: String) = (0 until length).map { s[it].diff(get(it)) }.sum()\n\nprivate fun Char.diff(c: Char): Int {\n val a: MutableList = mutableListOf()\n a.addIfNotNegative(this - c)\n a.addIfNotNegative(c - this)\n a.addIfNotNegative(('Z' - this) + (c - 'A') + 1)\n a.addIfNotNegative((this - 'A') + ('Z' - this) + 1)\n return a.min()!!\n}\n\nprivate fun MutableList.addIfNotNegative(e: Int) {\n if (e >= 0) add(e)\n}\n", "lang": "Kotlin", "bug_code_uid": "bf4d0215fbf78076e84578772a4c9948", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "apr_id": "5666819ab0da9c02e9175dd60980ac59", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5638297872340425, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n readLine()\n val s = readLine()!!.toMutableList()\n\n // ACGT\n var r = 0\n \"ACGT\".forEach { c ->\n val m = s.minBy { minDistance(it, c) }!!\n r += (m - c)\n s.remove(m)\n }\n}\n\nfun minDistance(a: Char, b: Char) =\n if (a < b) {\n Math.min(b - a, a - b + 26)\n } else {\n Math.min(a - b, b - a + 26)\n }\n", "lang": "Kotlin", "bug_code_uid": "732a444a92a5d6091491507987dba7df", "src_uid": "ee4f88abe4c9fa776abd15c5f3a94543", "apr_id": "29b65b897165bb1a9e5b8fe8861dd2ff", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9740932642487047, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun solution (x: String): String =\n x.windowed(2).asSequence().groupBy { it }.maxBy { it.value.size }!!.key\n\n\nfun main(args: Array) {\n // myassert(solution(\"ABACABA\"),\"AB\")\n // myassert(solution(\"ZZZAA\"), \"ZZ\" )\n val s = readLine()!!\n println(solution(s))\n}", "lang": "Kotlin", "bug_code_uid": "6eebe0057df7dd01e29d4aaa10156b96", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "f6c84b7328c6fd6a8c7d3c64adbbef72", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7391952309985097, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val garden = readLine()!!.split(\" \").map { it.toInt() }\n val buckets = readLine()!!.split(\" \").map { it.toInt() }.sortedBy { -it }\n for (i: Int in 0 until garden[0]) {\n val bucket = garden[0] - i - 1\n if (garden[1] % buckets[bucket] == 0) {\n print(garden[1]/(bucket + 1))\n return\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "b5ae585773a1838b38e50dae2644a190", "src_uid": "80520be9916045aca3a7de7bc925af1f", "apr_id": "3c92f9a4ea67576b0d77b489ade75a4f", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7630769230769231, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\nimport java.math.BigInteger\nvar x:Int =0\nvar k:Int =1\n\nfun zero():Int\n{\n while(x%10==0) x/=10;\n return x\n}\n\ntailrec fun f():Int\n{\n if (x<10) return 9\n\n while(true) {\n if (x<10) return k+8\n x=zero()\n k++;\n }\n\n k+=10-x\n return k\n}\n\nfun main()\n{\n x=readLine()!!.toInt()\n println(f())\n}", "lang": "Kotlin", "bug_code_uid": "ff89f896de003a7119c7a05b457d8c8d", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "9f35f02783a91a9d1ee6d2e44b7d5100", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8758492896849908, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "package contest555\n\n/**\n * Reachable numbers\n *\n * http://codeforces.com/contest/1157/problem/A\n */\n\nfun reachableNumbers(n: Int, f: (Int) -> Int): List {\n tailrec fun reachableNumbersAcc(n: Int, f: (Int) -> Int, acc: List): List {\n if (f(n) in acc) return acc\n val m = f(n)\n return reachableNumbersAcc(m, f, acc + listOf(m))\n }\n return reachableNumbersAcc(n, f, listOf(n)).sorted()\n}\n\n/**\n * apply addition of 1 to n.\n * as long as the result is divisible to 10, keep dividing by 10\n */\nval f: (Int) -> Int = { n -> f(n) }\n\nfun f(n: Int): Int =\n removeTrailingZero(n + 1)\n\ntailrec fun removeTrailingZero(n: Int): Int =\n if ((n % 10) != 0) n else removeTrailingZero(n / 10)\n\n\n", "lang": "Kotlin", "bug_code_uid": "7f49d4e2c54fbffe7d56ec0b2176be21", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "58687b2a3a6b436ebbc2e4031b721493", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7917329093799682, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var n = readLine()!!.toInt() // read integer from the input\n val reached = HashSet() // a mutable hash set \n while (reached.add(n)) n = f(n) // iterate function f\n println(reached.size) // print answer to the output\n}\n", "lang": "Kotlin", "bug_code_uid": "f0c39756445c96c0bac787dec770dcf3", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "8c1c720ca035f73b1640ca250299601a", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8748387096774194, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun f(x: Int): Int {\n var y = x + 1\n while (y.rem(10) == 0) {\n y = y.div(10)\n }\n return y\n}\n\nfun reachableNums(n: Int): Int {\n val results: MutableSet = mutableSetOf()\n var m = n\n while (!results.contains(m)) {\n results.add(m)\n m = f(m)\n }\n// println(results)x\n return results.size\n}", "lang": "Kotlin", "bug_code_uid": "ed8151fd11cd53e1527761118d2c54a7", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "14e0e4a6d412d8ba349a1fc58fb53271", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.950661853188929, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun f(x: Int): Int {\n var y = x + 1\n while (y.rem(10) == 0) {\n y = y.div(10)\n }\n return y\n}\n\nfun reachableNums(n: Int): Int {\n val results: MutableSet = mutableSetOf()\n var m = n\n while (!results.contains(m)) {\n results.add(m)\n m = f(m)\n }\n// println(results)x\n return results.size\n}\nval a = readLine()!!.toInt()\nprintln(reachableNums(a))\n", "lang": "Kotlin", "bug_code_uid": "4acf49e622126d0c92dc55abc8704f2c", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "14e0e4a6d412d8ba349a1fc58fb53271", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9857433808553971, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n \n var inputNum = readLine()!!.toInt()\n \n val resultList = ArrayList()\n resultList.add(inputNum)\n \n while(true) {\n inputNum += 1\n inputNum = reachableNumbers(inputNum)\n if (inputNum in resultList) break\n else resultList.add(inputNum)\n }\n \n println(resultList.size)\n}\n \nfun reachableNumbers(inputNumber: Int): Int {\n if (inputNumber % 10 == 0) reachableNumbers(inputNumber/10)\n else inputNumber\n}", "lang": "Kotlin", "bug_code_uid": "886f5b9bce172ed2697258ad7af34626", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "6ae21b58b0cad0d085f882708ba02b29", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7811518324607329, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "fun main(input: Int): Int {\n\n var inputNum = input\n val resultList = ArrayList()\n\n resultList.add(inputNum)\n\n while(true) {\n inputNum += 1\n inputNum = reachableNumbers(inputNum)\n resultList.add(inputNum)\n if(inputNum == 1) break\n }\n\n return resultList.size\n}\n\nfun reachableNumbers(inputNumber: Int): Int {\n if (inputNumber % 10 == 0) return reachableNumbers(inputNumber/10)\n else return inputNumber\n}", "lang": "Kotlin", "bug_code_uid": "a2a2b0f9209f6ff50a3a8f533897f0cd", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "6ae21b58b0cad0d085f882708ba02b29", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.956, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var n = readInt()\n\n tailrec fun nozero(x : Int): Int = if(x / 10 != 0) x else nozero(x % 10)\n fun f(x: Int) = nozero(x + 1)\n val reached = hashSetOf()\n while(reached.add(n)) n = f(n)\n println(reached.size)\n}", "lang": "Kotlin", "bug_code_uid": "834af1d4dcec9e325683ad8d822a1683", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "a9cf37812390622419c2da2962d694ba", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8566108007448789, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "package com.rakeshpillai.kotlin\n\nfun main() {\n val num = readLine()!!.toInt()\n val output = getReachableNumberCount(num)\n println(output)\n}\n\nfun getReachableNumberCount(num: Int): Int {\n var count = 1\n var nextReachableNum = num\n\n while (nextReachableNum != 1) {\n nextReachableNum = nextReachableNumber(nextReachableNum)\n count++\n }\n\n return count\n}\n\nfun nextReachableNumber(num: Int): Int {\n var nextNum = num + 1\n while (nextNum % 10 == 0) {\n nextNum = nextNum / 10\n }\n\n return nextNum\n}\n", "lang": "Kotlin", "bug_code_uid": "e5d2618c962dcf70484bac0204952016", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "ffb76dccbfbb2be8c6842550c12053d7", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5057067603160668, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val n = readInt()\n if (n == 1) return println(9)\n println(reachable(readInt()))\n}\n\ntailrec fun reachable(n: Int, counter: Int = 1): Int =\n if (n != 1) reachable(f(n), counter + 1) else counter\n\nfun f(x: Int): Int =\n removeZero(x + 1)\n\ntailrec fun removeZero(x: Int): Int =\n if (x % 10 == 0) removeZero(x / 10) else x\n", "lang": "Kotlin", "bug_code_uid": "dc67e6fbe98e8514751ebf6fbe0941b5", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "6bc6814c9480b483a13caade9dd79211", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9850746268656716, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun f(x: Int) {\n var cur = x + 1\n while(cur % 10 == 0) cur /= 10\n return cur\n}\n\nfun main() {\n var n = readLine()!!.toInt()\n val reached = HashSet()\n while (reached.add(n)) n = f(n)\n println(reached.size)\n}", "lang": "Kotlin", "bug_code_uid": "4481626283dacdfe57af8f49b21e6e13", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "33974dbd32c98c6fe1bc622a18d669db", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.13834586466165413, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val (x, y) = readLine()!!.split(' ').map(String::toInt)\n println(x + y)\n}", "lang": "Kotlin", "bug_code_uid": "00f1eff45d3796b918b645ee1555197e", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "50e162d3674f959b7192d187cbe645cd", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.12982998454404945, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n val (x) = readLine()!!.map(String::toInt)\n println(x)\n}", "lang": "Kotlin", "bug_code_uid": "9418310130eac8d2432b139ecff3927a", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "50e162d3674f959b7192d187cbe645cd", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9801801801801802, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\n\nfun f(x: Int): Int = generateSequence(x + 1) { y -> y / 10 }\n.dropWhile{ y -> y % 10 == 0 && y!= 0}\n.first()\n\nfun ff(x: Int) = generateSequence(x, ::f)\n\nfun r(x: Int) = ff(x)\n .takeWhile(HashSet()::add)\n .count()\n\nfun main() {\n \n println(r(readInt()));\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "d0b26add706202ceda441f3f9a9f230b", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "90cb95a87e3a028eae9866d11e6ab933", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.22660098522167488, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "fun main(){\n var inputInt = readLine()!!.toInt()\n val inputInt = 8\n var numberStr = (inputInt+1).toString()\n numberStr.lastIndexOf(\"0\").let {\n if(it>0){\n print(numberStr.substring(0,numberStr.lastIndexOf(\"0\")-1))\n }else{\n print(numberStr)\n }\n }\n\n \n}", "lang": "Kotlin", "bug_code_uid": "e82b54339141d6c3d5a2d75521b56706", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "5d31a251beeb6bea339ca79637944597", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9294797687861271, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n var N = readLine()!!.toInt()\n var W = readLine()!!\n var C = 0\n var c = 0\n for (i in 0 until N) {\n when(W[i]){\n in 'A'..'Z'-> {\n C++\n c = C\n }\n ' '->{\n C = 0\n if (c < C) {\n c = C\n }\n }\n }\n }\n print(c)\n}", "lang": "Kotlin", "bug_code_uid": "f0c8a291cdefffaa45c83b4895eb4867", "src_uid": "d3929a9acf1633475ab16f5dfbead13c", "apr_id": "5f698a554e3d5fbc8e1c009af13ce025", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6375379939209727, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun > max(a: T, b: T): T = if (b > a) b else a\nfun > min(a: T, b: T): T = if (b < a) b else a\nfun Number.isEven(): Boolean = if (this.toInt() and 1 == 0) true else false\nfun Number.isOdd(): Boolean = !this.isEven()\n\nfun main(args: Array) {\n if (args.isNotEmpty()) System.setIn(FileInputStream(args[0]))\n val br = BufferedReader(InputStreamReader(System.`in`))\n val bw = BufferedWriter(OutputStreamWriter(System.out))\n\n var st = StringTokenizer(br.readLine())\n val n = st.nextToken().toInt()\n val arr = IntArray(n + 1)\n st = StringTokenizer(br.readLine())\n for (i in 1..n) {\n arr[i] = st.nextToken().toInt()\n }\n var answer = 1\n while (answer <= 100) {\n var ok = true\n for (i in 1..n) {\n val a = i\n var b = a\n for (j in 1..answer) {\n b = arr[b]\n }\n for (j in 1..answer) {\n b = arr[b]\n }\n if (b != a) {\n ok = false\n break\n }\n }\n if (ok) break\n ++answer\n }\n if (answer > 100) answer = -1\n bw.write(\"$answer\\n\")\n bw.newLine()\n bw.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "a183ad2a22d62e0e66a45387526f7fe3", "src_uid": "149221131a978298ac56b58438df46c9", "apr_id": "6641b9ea17b66b5dd96698f127f249d8", "difficulty": 1600, "tags": ["math", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8984962406015038, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*\n\nval visited = mutableSetOf()\n\ntailrec fun f(x: Int) {\n if (x in visited)\n return\n\n visited.add(x)\n\n var y = x + 1\n while (y % 10 == 0)\n y /= 10\n\n f(y)\n}\n\nfun solve(inp: BufferedReader, out: PrintWriter) {\n val x = inp.readLine()!!.toInt()\n f(x)\n out.println(visited.size)\n}\n\nfun main() {\n File(\"input.txt\").bufferedReader().use { inp ->\n PrintWriter(System.out.bufferedWriter()).use { out ->\n solve(inp, out)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "e57a1deedb1b634172682dfaab4f1de4", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "5af6d5d60c0dd6e24ccd024d70220a7a", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8291233283803864, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 10, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": " 1 import java.util.Scanner\n 2 \n 3 fun main() {\n 4 val reader = Scanner(System.`in`)\n 5 var x =reader.nextInt()\n 6 var cnt = 0\n 7 while(x>9)\n 8 {\n 9 x+=1\n 10 while(x%10==0)\n 11 x/=10\n 12 cnt+=1 \n 13 } \n 14 println(cnt+9)\n 15 }\n", "lang": "Kotlin", "bug_code_uid": "61b60c5aaa3d367be2e7d2b3fa6db898", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "94a019164f43de63e65298d68b1d4409", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.055201698513800426, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "package com.dishan.example.solutions\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\n\nfun f(x: Int): Int {\n var cur = x + 1\n while ( cur % 10 == 0)\n cur /= 10\n return cur\n}\n\nfun reachableCount(n: Int): Int {\n var x = n\n val reached = HashSet()\n while (reached.add(x))\n x = f(x)\n return reached.size\n}\n\nfun main() {\n val n = readInt()\n val count = reachableCount(n)\n println(count)\n}", "lang": "Kotlin", "bug_code_uid": "08c4105c201f3d923758f4975fa29213", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "a9e460d40be3732527dca3ed0eaf3b08", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9781591263650546, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "/**\n * You can edit, run, and share this code. \n * play.kotlinlang.org \n */\nfun toDo(n:Int):Int{\n var value1 = n\n var s = n.toString()\n var counter = 1\n var arrayList = ArrayList()\n while(true){\n value1 = value1 + 1\n s = value1.toString()\n while (s[s.length-1]=='0') {\n \ts = s.substring(0,s.length-1)\n value1 = s.toInt()\n }\n if (value1 in arrayList){\n break\n }\n else{\n arrayList.add(value1)\n counter+=1\n }\n }\n return counter\n}\n\n\nfun main() {\n var n = readLine()!1.toInt()\n print(toDo(n))\n}", "lang": "Kotlin", "bug_code_uid": "62b71a0868c81401d26723796ef56706", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "5eca5e8005027c4ba324d5113dde8298", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.35294117647058826, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "fun f(x : int): int {\n var cur = x+1\n while (cur % 10 == 0)\n {cur/=10}\nreturn cur }", "lang": "Kotlin", "bug_code_uid": "cbfd024b85320ad3d879f9c5dc4ed03d", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "23abef3d775a1b3a2273b4cda4cde7a7", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.37317784256559766, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "fun f(x : Int): Int {\n var cur = x+1\n while (cur % 10 == 0) cur/=10\n return cur \n }", "lang": "Kotlin", "bug_code_uid": "0c9397f04bbb45e971b2b7fabfb55c01", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "23abef3d775a1b3a2273b4cda4cde7a7", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5078740157480315, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "tailrec fun removeZeroes(x: Int): Int =\n if (x % 10 == 0) removeZeroes(x / 10) else x\n \nfun f(x: Int) = removeZeroes(x + 1)", "lang": "Kotlin", "bug_code_uid": "7a68dd939fd940730ca5b4211c8bde93", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "24abb99f86ed3f7f8d35c4d772e99b87", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.99581589958159, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun f(x:Int):Int\n{\n\tvar ss = x + 1\n\twhile(ss % 10 == 0)\n\t\tss /= 10\n\treturn ss\n}\n\nfun main(args:Array)\n{\n\tvar t = readLine()!!.toInt()\n\tvar hs = HashSet()\n\tvar cnt = 0\n\twhile(hs.add(x))\n\t{\n\t\tx = f(x)\n\t\tcnt++\n\t}\n\tprintln(cnt);\n}", "lang": "Kotlin", "bug_code_uid": "93d8dad7a2c750e826a3cd68b528642e", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "48f8669cf60570c9866cf7ecc81a0d07", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8371278458844134, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "fun main(args: Array) {\n while (true) {\n var input = readLine()!!.toInt();\n if (input == 1) {\n println(9)\n } else {\n println(getNumberOfVariations(input, 1))\n }\n\n }\n\n\n}\n\nfun getNumberOfVariations(input: Int, current: Int): Int {\n if (input == 1) {\n return current\n }\n var plusOne = input + 1\n return if (plusOne % 10 == 0) {\n\t\twhile(plusOne %10 == 0){\n\t\t\tplusOne /= 10\n\t\t}\n getNumberOfVariations(plusOne, current + 1)\n } else {\n getNumberOfVariations(plusOne, current + 1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "51a0cf4b84f6d06f0d3bf34552991e89", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "86885df8611b17faad9f0cd8cb8cf2bc", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9866875489428347, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "tailrec fun removeZeroesRecursion(number: Int): Int =\n if (number % 10 == 0) removeZeroesRecursion(number / 10) else number\n\nfun removeZeroesByRecursion(x: Int) = removeZeroesRecursion(x + 1)\n\nfun removeZeroes(number: Int): Int {\n var cur = number + 1\n while (cur % 10 == 0) cur /= 10\n return cur\n}\n\nfun main() {\n var n = readLine()!!.toInt()\n var reached = HashSet()\n // while (reached.add(n)) n = removeZeroes(n)\n while (reached.add(n)) n = removeZeroesByRecursion(n)\n println(reached.size)\n}\n\n// val number = 3232199\n// println(removeZeroesByRecursion(number))\n// println(removeZeroes(number))\n\nmain()\n", "lang": "Kotlin", "bug_code_uid": "ac5c556ed8655941b55902671aba5b33", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "ab16106ddbaa2b77f61b31389df18980", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9981447124304267, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "tailrec fun removeZeroes(x: Int): Int =\n if (x % 10 == 10) removeZeroes(x / 10) else x\n\nfun f(x: Int) = removeZeroes(x + 1)\n\nfun main() {\n var n = readLine()!!.toInt()\n val reached = HashSet()\n while (reached.add(n)) n = f(n)\n println(reached.size)\n}", "lang": "Kotlin", "bug_code_uid": "ad29a0cefa576ef48ec3f21114a6f481", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "3c5920dfa5cfbccb9072af4e496f467c", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8912655971479501, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.collections.HashSet\n\npublic fun f(n : Int): Int {\n var x = n + 1\n while (x % 10 == 0) x /= 10\n return x\n}\npublic fun main() {\n var n = readLine()!!.toInt()\n val st = HashSet()\n while (st.add(n)) \n n = f(n)\n ", "lang": "Kotlin", "bug_code_uid": "c6ec30d9151e929b0afd9818689bd40b", "src_uid": "055fbbde4b9ffd4473e6e716da6da899", "apr_id": "a1bb610313ffa56b235c0220a2eb9b62", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9295774647887324, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n fun Boolean.toInt() = if (this) 1 else 0\n\n val map = mapOf('q' to 9, 'r' to 5, 'b' to 3, 'k' to 3, 'p' to 1, '.' to 0, 'n' to 0)\n val sums = intArrayOf(0, 0)\n repeat(8) {\n for (c in readLine()!!)\n sums[c.isUpperCase().toInt()] += map[c.toLowerCase()] ?: error(\"not recognixed piece\")\n }\n print(if (sums[0] > sums[1]) \"Black\" else if (sums[0] == sums[1]) \"Draw\" else \"White\")\n}", "lang": "Kotlin", "bug_code_uid": "a6629dfcc0dd75a26a499276dcbd7094", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "apr_id": "78c5a45d550cbb5eae1392c5fe59c2d1", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9975124378109452, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val map = arrayOf('q' to 9, 'r' to 5, 'b' to 3, 'n' to 3, 'p' to 1).toMap()\n\n (0 until 8).sumBy {\n readLine()!!.toCharArray().sumBy {\n map[it.toLowerCase()]?:0 * if (it.isUpperCase()) 1 else -1\n }\n }.let {\n println(when {\n it < 0 -> \"Black\"\n it > 0 -> \"White\"\n else -> \"Draw\"\n })\n }\n}", "lang": "Kotlin", "bug_code_uid": "801ac4e4a543a2ab445d7a73a4ffb4fb", "src_uid": "44bed0ca7a8fb42fb72c1584d39a4442", "apr_id": "8a8050978ace9130424763d389cdc340", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9293785310734464, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "Is it an apple and a banana simultaneouSLY?\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readStrings() = readLn().split(\" \")\nfun readInts() = readStrings().map { it.toInt() }\n\nfun main(args: Array) {\n readLn().apply {\n if (this[indexOfLast { c -> c != '?' && c != ' ' }].toLowerCase() in \"aeiouy\") print(\"YES\") else print(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "df91904eab28108e1f0c6adfbab9a0c3", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "apr_id": "b78a511c94cea59b6d37c8f729048293", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9983974358974359, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n val stringValue : String = input.nextLine()\n\n for (index in stringValue.length-1 downTo 0){\n if (stringValue[index].isLetter()){\n when (stringValue[index].toUpperCase()) {\n 'A' -> println(\"YES\")\n 'E' -> println(\"YES\")\n 'I' -> println(\"YES\")\n 'O' -> println(\"YES\")\n 'U' -> println(\"YES\")\n 'Y' -> println(\"YES\")\n else ->{\n println(\"No\")\n }\n }\n return\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "01ad7fafe0a38a8ebe8e5ef82120db82", "src_uid": "dea7eb04e086a4c1b3924eff255b9648", "apr_id": "6a915ec78573562c8a09a3a6fba585e6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.986779745572462, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass BIT(n: Int) {\n private val N =\n if (Integer.highestOneBit(n) == n) n\n else Integer.highestOneBit(n) shl 1\n\n private val bit = IntArray(N + 1)\n\n fun sum(i: Int): Int {\n var x = i\n var s = 0\n while(x > 0) {\n s += bit[x]\n x -= x and -x\n }\n return s\n }\n\n fun add(i: Int, a: Int) {\n var x = i + 1\n while(x <= N) {\n bit[x] += a\n x += x and -x\n }\n }\n}\n\nfun main() {\n val (N) = readInts()\n val A = readInts().filter{it > 0}.toIntArray()\n A.sort()\n val win = A.size == 1 ||\n A.size == 2 && calc2(A) ||\n A.size == 3 && A[0] xor A[1] != A[2]\n\n if (win) println(\"BitLGM\")\n else println(\"BitAryo\")\n}\n\nfun calc2(A: IntArray): Boolean {\n val dp = Array(A[0] + 1) { BooleanArray(A[1] + 1) }\n for (i in 0..A[0]) {\n for (j in 0..A[1]) {\n var win = false\n for (l in 0 until i) {\n if (!dp[l][j]) win = true\n }\n for (l in 0 until j) {\n if (!dp[i][l]) win = true\n }\n for (l in 1..min(i, j)) {\n if (!dp[i - l][j - l]) win = true\n }\n dp[i][j] = win\n }\n }\n return dp[A[0]][A[1]]\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nprivate val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n} catch (t: Throwable) {\n false\n}\n\nprivate fun readLn() = readLine()!!\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }.toIntArray()\nprivate fun readLongs() = readStrings().map { it.toLong() }.toLongArray()\nprivate inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n}\nprivate fun debug(a: LongArray) {\n debug{a.joinToString(\" \")}\n}\nprivate fun debug(a: IntArray) {\n debug{a.joinToString(\" \")}\n}\nprivate fun debug(a: BooleanArray) {\n debug{a.map{if(it) 1 else 0}.joinToString(\"\")}\n}\nprivate fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "4e1dabfd03252436cd9f151ef5cd3d77", "src_uid": "7a33b4f94082c7ef80d7e87b58497fa7", "apr_id": "0b7bd09b6b14b75b3ddf4d63e9e5b014", "difficulty": 2100, "tags": ["dp", "games"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7761194029850746, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n val n = sc.nextInt()\n val m = sc.nextInt()\n val z = sc.nextInt()\n\n println(if (n==m) z/n else z/(n*m))\n}", "lang": "Kotlin", "bug_code_uid": "11d715e9788fd889cc2aadd0123d46a1", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "apr_id": "ffd7a6f6bb91b85eec6f14f1ea0d4b72", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9890350877192983, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package A\nimport java.util.Scanner\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n var a = input.nextInt()\n val a1 = a\n var b = input.nextInt()\n val b1 = b\n val c = input.nextInt()\n\n var ans = 0\n while(a <= c && b <= c) {\n if(a == b) {\n ans++\n a += a1\n b += b1\n } else if(a < b) {\n a += a1\n } else {\n b += b1\n }\n }\n print(ans)\n}", "lang": "Kotlin", "bug_code_uid": "3a8df900c8832f5e33eda56247deb5fc", "src_uid": "e7ad55ce26fc8610639323af1de36c2d", "apr_id": "cf40b3846d9995804fef97362692befc", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9592391304347826, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val len = r.readLine()!!.toInt()\n val (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n val min = (n + 1) / 2\n var p = false\n for (i in min..n){\n if (i%m==0){\n println(\"YES\")\n p = true\n }\n }\n if (!p) println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "38c08cd050fb4176e65b7e4a7f6b3741", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "647ec89b510cc4f8741e66b13fb5642f", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8782608695652174, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val (n, m) = readInts()\n val min = n / 2 + n % 2\n println(if (n < m) -1 else min + (m - min % m))\n}\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }", "lang": "Kotlin", "bug_code_uid": "dea4f4aa2a1639a01f35a45ef65c70f6", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "c00b340d05c00b366ba0c6c987d67c54", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.2968253968253968, "equal_cnt": 18, "replace_cnt": 11, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": "fun main() {\n var (n, m) = readInts()\n if (n==m){\n println(n)\n return\n }\n var min = if (n % m == 0 && (n / m) % m == 0) n / m else Int.MAX_VALUE\n var left = 2\n var right = n - 2\n while (right >= 2) {\n var ans = (right + left / 2)\n if (ans % m == 0) {\n min = minOf(ans, min)\n }\n right -= 2\n left += 2\n }\n println(if (min == Int.MAX_VALUE) -1 else min)\n\n\n}\n\n\nprivate fun readInts(): List = readLine()!!.split(' ').map { it.toInt() }\nprivate fun readLongs(): List = readLine()!!.split(' ').map { it.toLong() }\nprivate fun readInt(): Int = readLine()!!.toInt()\nprivate fun readLong(): Long = readLine()!!.toLong()\nprivate fun readStr(): String? = readLine()!!", "lang": "Kotlin", "bug_code_uid": "33c433db108d33bcae1672fb91fb0ae9", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "c781e67b02b9e3e906606a45353198fb", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9117043121149897, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n, m) = readInts()\n val a = n / 2\n val b = n % 2\n val extras = (a + b) % m\n print (if (extras > a) -1 else a + b + extras)\n}", "lang": "Kotlin", "bug_code_uid": "f62ba604f6202a63caa4e9803f528a0e", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "531ccd73be278488bb5d8d3b8b47874f", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9351432880844646, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "/**\n * Created by tux on 31.12.16.\n */\n\nfun main(args: Array) {\n val T = readLine()!!.split(\" \").map { Integer.parseInt(it) }\n if (T[1] > T[0]) {\n println(-1)\n return\n }\n\n val div = T[0] / 2\n val rest = if (T[0] % 2 != 0) (div / T[1] + 1) * T[1] - div else 0\n println(div + rest)\n}\n", "lang": "Kotlin", "bug_code_uid": "61becb9897d543607f73d9bfa020a2db", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "8199c91fd92f3115cfa8d026d21ef152", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.960577456968351, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "// Dreamoon \u0438 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0438\n\nfun main(args: Array) {\n\n val firstLine = readLine()!!.trim().split(\" \")\n\n val n = firstLine[0].toInt()\n val m = firstLine[1].toInt()\n\n var result = -1\n\n var found = false\n\n for (i in 0 .. n % 2 + 1){\n\n // n \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432\n\n result = foundStepCount(i, n)\n if (result % m == 0) {\n found = true\n break\n }\n\n }\n\n\n if (!found)\n println(-1)\n else\n println(result)\n\n}\n\nprivate fun foundStepCount(max2: Int, n: Int): Int {\n\n var steps = 0\n var currentStep = 0\n\n //println(\"max = $max2, n = $n\")\n\n while (currentStep < n){\n steps++\n if (max2 < steps) {\n currentStep += 2\n // print(\"2 \")\n }else {\n // print(\"1 \")\n currentStep++\n }\n\n }\n // println()\n // println(\"steps = $steps\")\n return steps\n}", "lang": "Kotlin", "bug_code_uid": "7e352b7e9cb5f888c903fead6c48eadd", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "238238ef8c4f84bedb42f8ea1bc5c6fc", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9821428571428571, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val (n, m) = readLine()!!.split(' ').map { it.toInt() }\n\n (n/2 .. n).forEach {\n if (it % m == 0){\n println(it)\n return\n }\n }\n println(-1)\n}", "lang": "Kotlin", "bug_code_uid": "fbea78020b5f8c23921c0c4560aa31fd", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "041ba8fcd65f48c4bf6a62ce2d4f421d", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7861771058315334, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import kotlin.math.ceil\n\nfun main(args: Array) {\n val l=readLine()!!.split(\" \").map(String::toInt)\n val x=l[0]/l[1]/2\n if (l[1]>l[0]) print(-1)\n else print((x*l[1]+l[1]*ceil((l[0]-x*l[1]*2.0))/l[1]).toInt())\n}", "lang": "Kotlin", "bug_code_uid": "e90ce20caf9d812d1742e0b74db1e063", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f", "apr_id": "a4b2661022d98c43b1c71b90d39b7ed1", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984779299847792, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var (f, l) = readLine()!!.split(\" \")\n var j = 0\n var ans = f[0].toString()\n for (i in 1 until f.length) {\n if (f[i].toInt() <= l[j].toInt()) {\n ans += f[i]\n }else{\n ans+=l[j]\n println(ans)\n return\n }\n }\n ans+=l[j]\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "e01a2f5fd774fb8dc305bc0e7d41e9c1", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "apr_id": "0d5cffa64773c628d19a33f04424ccac", "difficulty": 1000, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9101338432122371, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val (name, surname) = readLine()!!.split(\" \")\n val sol = StringBuilder()\n for (c in name) {\n if (c < surname.first()) sol.append(c)\n else break\n }\n sol.append(surname.first())\n print(sol.toString())\n}", "lang": "Kotlin", "bug_code_uid": "eacb8d61c950ee937947fb9d7ba38f57", "src_uid": "aed892f2bda10b6aee10dcb834a63709", "apr_id": "346e444ce8ce4c71eb4abaf4accffc7e", "difficulty": 1000, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9988649262202043, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashSet\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n val n: Int = ir.nextInt()\n val h: Int = ir.nextInt()\n val m: Int = ir.nextInt()\n val a = IntArray(n)\n var total = 0\n\n repeat(n) {\n a[it] = h\n }\n\n repeat(m) {\n val l = ir.nextInt() - 1\n val r = ir.nextInt() - 1\n val x = ir.nextInt()\n\n for (i in l..r)\n a[i] = Math.min(x, h)\n }\n\n repeat(n) {\n total += (a[it] * a[it])\n }\n\n pw.print(total)\n\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "3ab750bade1c9f3e14f8d90516f611b5", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "apr_id": "c65ad0cdf37309b32cd1f66d62dce944", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9251396648044693, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import kotlin.math.min\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readStrings() = readLn().split(\" \")\nfun readInts() = readStrings().map { it.toInt() }\n\nfun main(args: Array) {\n var (n, h, m) = readInts()\n var a = Array(n) { h }\n for (i in 1..m) {\n var (l, r, x) = readInts()\n l--; r--\n a[l] = min(a[l], x)\n a[r] = min(a[r], x)\n }\n var s = 0\n for (i in a) s += i * i\n print(s)\n}", "lang": "Kotlin", "bug_code_uid": "85e40b80c191b75a7322deb1509004cb", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "apr_id": "a240d3a03ed40135bbbbef2e98142337", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.987012987012987, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package cf2\n\nimport java.util.*\nimport kotlin.math.min\n\nval scanner = Scanner(System.`in`)\n\nfun main() {\n val n = scanner.nextInt()\n val h = scanner.nextInt()\n val m = scanner.nextInt()\n\n val heights = IntArray(n) { h }\n for (i in 0 until m) {\n val l = scanner.nextInt()\n val r = scanner.nextInt()\n val x = scanner.nextInt()\n for (j in l..r) {\n heights[j - 1] = min(heights[j - 1], x)\n }\n }\n\n System.out.println(heights.sumBy { it * it })\n}", "lang": "Kotlin", "bug_code_uid": "faac4b32c52ee8036c2d6a22bdbd8c12", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "apr_id": "e523dd4d99d4a0eb1d639577adf54337", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9770750988142293, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n\n\nfun main(){\n\tvar (k, h, o) = readInts()\n\tvar sum = 0\n\tvar b = IntArray(k,{h})\n\tfor(i in 0 until o){\n\t\tvar (l, r, w) = readInts()\n\t\tfor (j in l until r+1){\n\t\t\tb[j-1] = w\n\t\t}\n\t}\n\tfor(i in b) {\n\t\tsum += i*i\n\t}\n\tprintln(sum)\n}\n", "lang": "Kotlin", "bug_code_uid": "92b6ab1d817f7251223431c4c835fec8", "src_uid": "f22b6dab443f63fb8d2d288b702f20ad", "apr_id": "93b5dc9a7664b53fcf5b07aa405da7c2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.66484268125855, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val k = input.nextInt()\n val a = input.nextInt()\n val b = input.nextInt()\n\n val answer = a / k + b / k\n if(answer >= 1)\n print(answer)\n else\n print(-1)\n}", "lang": "Kotlin", "bug_code_uid": "6e7491ca0a99b844e2727b5328960456", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "apr_id": "ab058bd435af568eb09a1628a8b6c76c", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7987616099071208, "equal_cnt": 17, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 9, "fix_ops_cnt": 16, "bug_source_code": "fun main() {\n val (k, a, b) = readLine()!!.split(\" \").map(String::toLong)\n if (a < k || b < k)\n print(-1)\n else\n print(a / k + b / k)\n}", "lang": "Kotlin", "bug_code_uid": "94fa8c274756b40bd93432daa378cf75", "src_uid": "6e3b8193d1ca1a1d449dc7a4ad45b8f2", "apr_id": "8be083f15e2d22ddb79b09813f8dc0fd", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.921146953405018, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n val n = sc.nextLong()\n val k = sc.nextInt()\n\n println(n.round(k))\n}\n\nfun Long.round(k: Int): Long {\n var t = this\n var doub = 0\n while (t % 2 == 0L) {\n doub += 1\n t /= 2\n }\n var five = 0\n while (t % 5 == 0L) {\n five += 1\n t /= 5\n }\n\n var res = this\n while (doub < five || doub < k) {\n res *= 2\n doub += 1\n }\n while (five < doub || five < k) {\n res *= 5\n five += 1\n }\n return res\n}\n", "lang": "Kotlin", "bug_code_uid": "95bdf5811bb60421b60460ad6109ac21", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "apr_id": "34259a9d6f7f5574675a31578c3b756c", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7622641509433963, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n\tvar (n, k) = readLine()!!.split(' ').map(String::toInt)\n\tprintln(a + b)\n}", "lang": "Kotlin", "bug_code_uid": "7a80cbb647a18419aa6ca3c8f9a028f4", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a16b16314b26ecb462951ea998a15847", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.49523809523809526, "equal_cnt": 23, "replace_cnt": 17, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 22, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var d = readLine()\n var p = readLine()!!.split(' ').map(String::toInt)\n var m = -2\n for (i in 0..(n - 2)) {\n if (d!!.get(i) == 'R' && d!!.get(i + 1) == 'L' && (m == -2 || p.get(i + 1) - p.get(i) < m)) {\n m = (p.get(i + 1) - p.get(i))\n }\n }\n println(m / 2)\n}", "lang": "Kotlin", "bug_code_uid": "03d15ee60dbc37393c174554ee5f1b69", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a16b16314b26ecb462951ea998a15847", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9981132075471698, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.util.*\n\nfun main(args: Array) {\n with(Scanner(System.`in`)) {\n val n = nextLong()\n val m = nextLong()\n val k = nextLong()\n val r = k % (m * n)\n if (r < n) {\n println(\"${r+1} 1\")\n } else {\n val r0 = r - n\n val t0 = r0 / (m-1)\n val t1 = r0 % (m-1)\n if (t0 % 2 == 0L) {\n println(\"${n-t0} ${1+t1}\")\n } else {\n println(\"${n-t0} ${1+m-1-t1}\")\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "0d8c8910a3006f1bff065c3d1ff6c75d", "src_uid": "e88bb7621c7124c54e75109a00f96301", "apr_id": "aaa15edfd05d54dfcc2e4bc61bdc068f", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8896473265073948, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "/**\n * Created by seydazimovnurbol on 5/23/17.\n */\n\nimport java.util.*\nimport kotlin.system.exitProcess\n\nfun main(args: Array ) {\n var scanner : Scanner = Scanner(System.`in`)\n var n = scanner.nextInt()\n var k = scanner.nextInt()\n\n var a : ArrayList = ArrayList()\n\n var sum : Double = 0.0\n for (i in 1 .. n) {\n var x = scanner.nextInt()\n a.add(x)\n sum += x\n }\n sum /= n\n var cntK : Int = 0\n for (i in 0 .. n - 1)\n if (a[i] == k) cntK++;\n\n var need : Int = 0\n for (i in 0 .. n - 1) {\n if (a[i] < k) {\n var cnt : Int = k - 1 - a[i]\n a[i] += Math.min(cnt, cntK)\n cntK -= Math.min(cnt, cntK)\n need += k - 1 - a[i]\n }\n }\n\n if (sum + 0.5 >= k) println(0)\n else println(n + 2 * need)\n}", "lang": "Kotlin", "bug_code_uid": "27f01f6ba4850ba3a98c71da85242941", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "apr_id": "998c6949cbc64b301daa1c0376b8d824", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8733965421081985, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "/**\n * Created by seydazimovnurbol on 5/23/17.\n */\n\nimport java.util.*\nimport kotlin.system.exitProcess\n\nfun main(args: Array ) {\n\n var scanner : Scanner = Scanner(System.`in`)\n var n = scanner.nextInt()\n var k = scanner.nextInt()\n\n var a : ArrayList = ArrayList()\n\n var sum : Double = 0.0\n for (i in 1 .. n) {\n var x = scanner.nextInt()\n a.add(x)\n sum += x\n }\n sum /= n\n if (sum + 0.5 >= k) {\n println(0)\n exitProcess(1)\n }\n var cntK : Int = 0\n for (i in 0 .. n - 1)\n if (a[i] == k) cntK++;\n\n var need : Int = 0\n for (i in 0 .. n - 1) {\n if (a[i] < k) {\n var cnt : Int = k - 1 - a[i]\n a[i] += Math.min(cnt, cntK)\n cntK -= Math.min(cnt, cntK)\n need += k - 1 - a[i]\n }\n }\n\n println(n + 2 * need)\n}", "lang": "Kotlin", "bug_code_uid": "9d578da722dacd3b5ed2654fbc2528ce", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "apr_id": "998c6949cbc64b301daa1c0376b8d824", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.926605504587156, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numMarks, k) = readInts()\n val arr = readInts()\n print(((arr.sum() - numMarks * (k - 0.5)) / -0.5).toInt())\n}", "lang": "Kotlin", "bug_code_uid": "837864d744616d89eda6a11656b6f3eb", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "apr_id": "e7f0ce11952e0b4d6379d40662b4b594", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7960308710033076, "equal_cnt": 10, "replace_cnt": 2, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun main(args: Array) {\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n var total = 0\n readLine()!!.split(' ').map(String::toInt).forEach {\n total += it\n }\n var ans = 0\n while (true) {\n var n2 = n + ans\n var total2 = total + ans * k\n // print(\"$n2 $total2\\n\")\n if (total2 / n2 >= k - 1 && total2 % n2 >= (n2+1) / 2)\n break\n ans++\n }\n print(\"$ans\\n\")\n}\n", "lang": "Kotlin", "bug_code_uid": "f08d3d857b418016ff2e8e0703f9de2f", "src_uid": "f22267bf3fad0bf342ecf4c27ad3a900", "apr_id": "7d24d99606f8fb70658d38ba8878db16", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9992887624466572, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val cubes = (1..n).map { readLine()!!.split(\" \").map(String::toInt) }\n val combination = mutableListOf()\n\n cubes\n .flatMap { it }\n .forEach { it -> combination += \"$it\" }\n\n for (i in cubes.indices) {\n for (j in (i + 1) until cubes.size) {\n for (x in 0 until 6) {\n for (y in 0 until 6) {\n combination += \"${cubes[i][x]}${cubes[j][y]}\"\n combination += \"${cubes[j][x]}${cubes[i][y]}\"\n }\n }\n }\n }\n\n if (cubes.size == 3)\n for (i in 0 until 6) {\n for (j in 0 until 6) {\n for (k in 0 until 6) {\n combination += \"${cubes[0][i]}${cubes[1][j]}${cubes[2][k]}\"\n combination += \"${cubes[2][i]}${cubes[0][j]}${cubes[1][k]}\"\n combination += \"${cubes[1][i]}${cubes[2][j]}${cubes[0][k]}\"\n combination += \"${cubes[0][i]}${cubes[2][j]}${cubes[1][k]}\"\n combination += \"${cubes[1][i]}${cubes[0][j]}${cubes[2][k]}\"\n combination += \"${cubes[2][i]}${cubes[1][j]}${cubes[0][k]}\"\n }\n }\n }\n\n (0..999).forEach {\n if (!combination.any { x -> x.toInt() == it }) {\n println(it - 1)\n return\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "59cf5a50a8c58d62d76c2507d3e2e249", "src_uid": "20aa53bffdfd47b4e853091ee6b11a4b", "apr_id": "38841081440c0bd37ea48c15b2562bc1", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9133858267716536, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (start, interval, desired) = readLine()!!.split(\" \").map(String::toLong)\n if (desired == start) return print(\"YES\")\n print(if ((desired - (start + interval)) % interval in setOf(0L, 1L)) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "55eb2d138a0d426adb7e91d5377c58fd", "src_uid": "3baf9d841ff7208c66f6de1b47b0f952", "apr_id": "b418e172da51796d8390dacb87b06514", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8987341772151899, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\nprivate fun solve( x: Long) : Boolean{\n\n var a = x\n while (a != 0L)\n //print(a%10)\n if(a%10 == 8L || a%10 == -8L) {\n return true\n }\n else {\n a /= 10L\n }\n return false\n}\nval reader = Scanner(System.`in`)\nvar ans: Long = 0\nvar i: Long = 0\nfun main(args: Array){\n var n = reader.nextLong()\n\n\n // print(solve(n))\n if(n<=0)\n {\n while (!solve(++n)) ans++\n // print(ans+1)\n }\n else if(solve(n))\n {\n while (!solve(++n)) ans++\n //print(solve(n))\n print(ans+1)\n }\n else\n {\n while (!solve(++n)) ans++\n print(ans)\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "48e31b28b007077f34d383eac33b759b", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "apr_id": "921d91ff005d8a9b2fdcd8fd6280abdb", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.33681073025335323, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val valids = setOf(8, -8)\n val floor = readLine()!!.toInt()\n for (sol in 1..10) {\n var candidate = floor + sol\n while (candidate != 0)\n if (candidate % 10 in valids) return print(sol) else candidate /= 10\n }\n}", "lang": "Kotlin", "bug_code_uid": "6f6783d1be2c11f134da93db2a7554ca", "src_uid": "4e57740be015963c190e0bfe1ab74cb9", "apr_id": "f42064875beb5ae4626560aa80c69b6f", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7652399481193255, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array){\n\tval y = \" 31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31\"\n readLine()!!\n\tprintln(if(y.contains(readLine()!!)) \"YES\" else \"NO\"\n}", "lang": "Kotlin", "bug_code_uid": "913e9989473f18f22463d945b7b7931e", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "apr_id": "c1ca2d79ae68c3baa43e4b559cadd674", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7668393782383419, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array){\n\tval y = \" 31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31\"\n readLine()!!\n\tprintln(if(y.contains(readLine()!!)) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "b32267dba860702737999a09e7e7c095", "src_uid": "d60c8895cebcc5d0c6459238edbdb945", "apr_id": "c1ca2d79ae68c3baa43e4b559cadd674", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7494305239179955, "equal_cnt": 10, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 9, "bug_source_code": "import kotlin.math.abs\n\nfun main(args: Array) {\n\n val arr = listOf(1,1,1,2,2,3,3,6,6)\n val (a,b) = readLine()!!.split(\" \").map { it.toInt() }\n if(abs(a-b) == 9){\n print(6)\n return\n }\n if((a%2 == 0) && (b%2 == 0) && a != b)\n print(arr[abs(a-b)] +1 )\n else\n print(arr[abs(a-b)])\n\n}", "lang": "Kotlin", "bug_code_uid": "5d49b9dfc0820d75acd74ac85c2e8a66", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "2d43ac4238c946f106ebcab9a4a50157", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7422680412371134, "equal_cnt": 12, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 11, "bug_source_code": "import kotlin.math.abs\n\nfun main(args: Array) {\n\n val arr = listOf(1,1,1,2,2,3,3,6,6)\n val (a,b) = readLine()!!.split(\" \").map { it.toInt() }\n if(a-b == 9){\n print(6)\n return\n }\n if((a%2 == 0) && (b%2 == 0) && a != b)\n print(arr[abs(a-b)] +1 )\n else\n print(arr[abs(a-b)])\n\n}", "lang": "Kotlin", "bug_code_uid": "5b03ef98d1e9889ccaf47403a8a474e5", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "2d43ac4238c946f106ebcab9a4a50157", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8584269662921349, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var (a, b) = readLine()!!.split(\" \").map { it.toInt() }\n var result = 0\n\n if (a and b == 1) {\n print(1)\n return\n }\n\n while (a <= b) {\n a *= 3\n b *= 2\n result += 1\n }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "b93f38c20a17aaddfe33e6c3f7d04038", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "3cc92daaccb7c87353936abb25577e43", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.951310861423221, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val (x, y, z) = readLine()!!.split(' ').map { it.toInt() }\n val (a, b, c) = readLine()!!.split(' ').map { it.toInt() }\n if (a >= x && a - x + b >= y && y - (a - x + b) + c >= z) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "c042b381fe12de9ceb2951d0b664ba76", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "e9722c0d59575ffa7d7b8cfdeeea2e6f", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9991652754590985, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//package com.happypeople.codeforces.c1114\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\n\nfun main(args: Array) {\n try {\n A1114().run()\n } catch (e: Throwable) {\n println(\"\")\n e.printStackTrace()\n }\n}\n\nclass A1114 {\n fun run() {\n val sc = Scanner(systemIn())\n val hGreen=sc.nextInt()\n val hNotBlack=sc.nextInt()\n val hAny=sc.nextInt()\n var green=sc.nextInt()\n var purple=sc.nextInt()\n var black=sc.nextInt()\n\n val m1=hGreen<=green\n green+=hGreen\n val m2=hNotBlack<=green+purple\n val m3=hAny<=green+purple+black-hNotBlack\n val ans =m1 and m2 and m3\n if(ans)\n println(\"YES\")\n else\n println(\"NO\")\n }\n\n companion object {\n var inputStr: String? = null\n\n fun systemIn(): InputStream {\n if (inputStr != null)\n return ByteArrayInputStream(inputStr!!.toByteArray())\n else\n return System.`in`\n }\n\n var printLog = false\n fun log(str: String) {\n if (printLog)\n println(str)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "82ccae1e239bc2865a651100d29a2017", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "68ba47d31065b8bfef03b58eed83de3f", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9113207547169812, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nfun main(args: Array ) {\n val sc = Scanner(System.`in`)\n val want = IntArray( 3, { sc.nextInt() } )\n val have = IntArray( 3, { sc.nextInt() } )\n\n for ( i in want.indices.reversed() ) {\n want[i] -= have[i]\n if ( want[i] <= 0 ) continue\n for ( j in i - 1 downTo 0 ) {\n want[i] -= Math.min( want[i], have[j] )\n }\n if ( want[i] > 0 ) {\n println( \"NO\" )\n return\n }\n }\n println( \"YES\" )\n}", "lang": "Kotlin", "bug_code_uid": "c05e658e38479ba690b8dd12d707fb9e", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "bfd67035b37cefb0af993e81ad5073b7", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9969040247678018, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.File\nimport java.util.*\n\nfun main() {\n val scanner = Scanner(File(\"input.txt\"))\n// val scanner = Scanner(System.`in`)\n val x = scanner.nextInt() // All green\n val y = scanner.nextInt() // Green + purple\n val z = scanner.nextInt() // Any grapes\n val greenGrapesCount = scanner.nextInt()\n val purpleGrapesCount = scanner.nextInt()\n val blackGrapesCount = scanner.nextInt()\n\n if (x <= greenGrapesCount &&\n y <= (greenGrapesCount - x + purpleGrapesCount) &&\n z <= (greenGrapesCount - x + purpleGrapesCount - y + blackGrapesCount)) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "932efb6b357ddc49bc2b71d54291c343", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "a35c84647be43d96d6060e52dcf79436", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.17054263565891473, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "package main\n\nimport \"fmt\"\n\nfunc solve(x,y,z,a,b,c) {\n if a >= x\n return 0\n if a+b >= x+y\n return 0\n if a+b+c >= x+y+z\n return 0\n return 1\n}\n\nfunc main() {\n\tvar x, y, z, a, b, c int\n\tfmt.Scan(&x, &y, &z, &a, &b, &c)\n\tif solve(x,y,z,a,b,c) {\n\t\tfmt.Println(\"YES\")\n\t} else {\n\t\tfmt.Println(\"NO\")\n\t}\n}", "lang": "Kotlin", "bug_code_uid": "865a6ff685e35e616610ca0ceb7d77d6", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "60ba0becf5b6f5e250c98f2dbe4793c2", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9891304347826086, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val (x, y, z) = readLine()!!.split(' ').map(String::toInt)\n val (green, purple, black) = readLine()!!.split(' ').map(String::toInt)\n\n if (x <= green && y <= green+purple && z <= green+purple+black)\n print(\"YES\")\n else\n print(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "1c4da677d9442d01f3815ff97c45ee9b", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "c13733c79bd70cb8d68f994939be0fdd", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9648, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val (n,p,k) = readLine()!!.split(\" \").map { it.toInt() }\n var s = \"\"\n var c = \"\"\n var b = false\n\n val f= if (p-k <= 1) 1 else p-k\n val l= if (p+k >= n) n else p+k\n\n for (i in f..l) {\n when (i) {\n f -> if(i > 1) s = \"<<\" else b = true\n p -> if (i != 1) s = s.plus(\" ($i)\") else s = s.plus(\"($i)\")\n l -> if(i < n) c = \" >>\"\n }\n\n if (i != p && i >= 1 && i <= n && !b)\n s = s.plus(\" $i\").plus(c)\n else if (b) {\n s = s.plus(\"$i\").plus(c)\n b = false\n }\n }\n print(s)\n}", "lang": "Kotlin", "bug_code_uid": "1e95bdb59109283fbeec21d6aae575ab", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "apr_id": "fc8e101d6c77c8ac0236746fd0a70f24", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9949622166246851, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val (n, k, p) = readLine()!!.split(\" \").map { it.toInt() }\n\n val ans = mutableListOf()\n\n if (p - k > 1) ans.add(\"<<\")\n (max(1, p - k) until p).forEach { ans.add(\"$it\") }\n ans.add(\"($p)\")\n ((p + 1)..min(n, p + k)).forEach { ans.add(\"$it\") }\n if (p + k < n) ans.add(\">>\")\n\n println(ans.joinToString(\" \"))\n}", "lang": "Kotlin", "bug_code_uid": "e0c2c106962088b12166457cd490daa6", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "apr_id": "12daf9bfdfc04dc72dc776fb5aae7d37", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9765142150803461, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val givenList= readLine()!!.split(\" \").map { it.toInt() }\n val n=givenList[0]\n val p=givenList[1]\n val k=givenList[2]\n val string=\"($p)\"\n if ((p+k) < n && (p-k)>0 && (p-k)!=1){\n val backList=((p-k)until p).toList()\n val farwardList=(p+1.. (p+k)).toList()\n println( backList.joinToString(prefix = \"<< \",separator = \" \",postfix = \" $string\")+farwardList\n .joinToString(prefix=\" \",separator = \" \",postfix = \" >>\"))\n }\n else if ((p+k)>n && (p-k)>0 && (p-k)!=1){\n val backList=((p-k)until p).toList()\n val farwardList=(p+1..n).toList()\n println( backList.joinToString(prefix = \"<< \",separator = \" \",postfix =\" $string\")+farwardList\n .joinToString(prefix = \" \",separator = \" \"))\n }\n else if ((p+k)0 }\n val farwardList=(p+1..(p+k)).toList()\n if (backList.isEmpty())\n println( backList.joinToString(separator = \" \")+string+farwardList\n .joinToString(prefix = \" \",separator = \" \",postfix = \" >>\"))\n else\n println( backList.joinToString(separator = \" \",postfix = \" $string\")+farwardList\n .joinToString(prefix = \" \",separator = \" \",postfix = \" >>\"))\n }\n else if ((p+k) == n && (p-k)>0 && (p-k)!=1){\n val backList=((p-k)until p).toList()\n val farwardList=(p+1.. (p+k)).toList()\n println( backList.joinToString(prefix = \"<< \",separator = \" \",postfix = \" $string\")+farwardList\n .joinToString(prefix=\" \",separator = \" \"))\n }\n else if ((p+k) < n && (p-k)==0){\n val backList=if (p==1){ ((p-k).. 1).toList().filter { it>1 }}\n else{\n ((p-k).. 1).toList().filter { it>=1 }}\n val farwardList=(p+1.. (p+k)).toList()\n println( backList.joinToString(separator = \" \",postfix = \" $string\")+farwardList\n .joinToString(prefix=\" \",separator = \" \",postfix = \" >>\"))\n }\n else if ((p-k) == 1 && (p+k)>n){\n val backList=((p-k)until p).toList()\n val farwardList=(p+1 .. n).toList()\n println( backList.joinToString(separator = \" \",postfix = \" $string\")+farwardList\n .joinToString(prefix=\" \",separator = \" \"))\n }\n else if ((p-k) == 1 && (p+k)>\"))\n }\n else if ((p+k)>n && (p-k)<0){\n val backList=(1 until min(p,k)).toList()\n val farwardList=(p+1 ..max(p,k)).toList()\n println( backList.joinToString(separator = \" \",postfix = \" $string\")+farwardList\n .joinToString(prefix=\" \",separator = \" \"))\n }\n else if ((p+k)==n && (p-k)==1){\n val backList=((p-k)..k).toList()\n val farwardList=(p+1..(p+1)).toList()\n println( backList.joinToString(separator = \" \",postfix = \" $string\")+farwardList\n .joinToString(prefix=\" \",separator = \" \"))\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "3bf2fb599987ddb9150515d5ce4a2028", "src_uid": "526e2cce272e42a3220e33149b1c9c84", "apr_id": "41bc70ac89a850cd437dc2543f480822", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9973164654015718, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.*\nimport kotlin.math.*\n\nval maxn = 200005\nval sz = 1024 * 1024\nval inf0 = 2e9\nval inf = inf0.toInt()\nval INF0 = 4e18\nval INF = INF0.toLong()\nval eps = 1e-6\nval MOD = 998244353L\n\nfun solve() {\n val n = nextLong()\n val k = nextLong()\n val m = nextLong()\n val d = nextInt()\n var ans = 0L\n for (i in 1..d) {\n val num1 = k * (i - 1) + 1\n val num2 = k * i\n //x * num1 <= n <= x * (num2 + 1) - 1\n //n + 1 <= x * (num2 + 1)\n val xl = divup(n + 1, num2 + 1)\n val xr = n / num1\n if (m >= xl) ans = max(ans, min(xr, m) * i)\n }\n println(ans)\n}\n\nval multitest = false\n\nfun main() {\n var t = 1\n if (multitest) t = nextInt()\n for (i in 1..t) solve()\n out.flush()\n}\n\nfun maxPair(a: Pair, b: Pair): Pair {\n if (a.first > b.first) return a\n if (b.first > a.first) return b\n if (a.second > b.second) return a\n return b\n}\n\nfun back(a: ArrayList): Int {\n return a[a.size - 1]\n}\n\n//val t = IntArray(2 * sz)\n//val t = Array(2 * sz) { ArrayList() }\n\n/*\nfun add(v: Int, vl: Int, vr: Int, x: Int, y: Int) {\n if (vl == vr) {\n t[v].add(y)\n return\n }\n val vm = (vl + vr) / 2\n if (x <= vm)\n add(v * 2 + 1, vl, vm, x, y)\n else\n add(v * 2 + 2, vm + 1, vr, x, y)\n}\n\nfun build() {\n //for (i in (sz - 1)..(2 * sz - 2)) t[i].sort()\n var i = sz - 2\n while (i >= 0) {\n val n1 = t[2 * i + 1].size\n val n2 = t[2 * i + 2].size\n var i1 = 0\n var i2 = 0\n for (j in 1..(n1 + n2)) {\n if (i1 == n1) {\n t[i].add(t[2 * i + 2][i2++])\n } else if (i2 == n2) {\n t[i].add(t[2 * i + 1][i1++])\n } else {\n if (t[2 * i + 1][i1] < t[2 * i + 2][i2])\n t[i].add(t[2 * i + 1][i1++])\n else\n t[i].add(t[2 * i + 2][i2++])\n }\n }\n i--\n }\n}\n\nfun query(v: Int, vl: Int, vr: Int, lx: Int, rx: Int): Int {\n if (vl > rx || lx > vr) return 0\n if (vl >= lx && vr <= rx) {\n if (t[v].isEmpty()) return 0\n //return upperBound(t[v], ry) - lowerBound(t[v], ly)\n return upperBound(t[v], rx)\n }\n val vm = (vl + vr) / 2\n return query(v * 2 + 1, vl, vm, lx, rx) +\n query(v * 2 + 2, vm + 1, vr, lx, rx)\n}\n\n */\n\n/*\n\nfun upd(v: Int, vl: Int, vr: Int, i: Int, x: Int) {\n if (i < vl || i > vr) return\n if (vl == vr) {\n t[v] = x\n return\n }\n val vm = (vl + vr) / 2\n upd(v * 2 + 1, vl, vm, i, x)\n upd(v * 2 + 2, vm + 1, vr, i, x)\n t[v] = max(t[v * 2 + 1], t[v * 2 + 2])\n}\n\n*/\n\n/*\n\nfun query(v: Int, vl: Int, vr: Int, l: Int, r: Int): Int {\n if (vl > r || l > vr) return -1\n if (vl >= l && vr <= r) return t[v]\n val vm = (vl + vr) / 2\n return max(query(v * 2 + 1, vl, vm, l, r), query(v * 2 + 2, vm + 1, vr, l, r))\n}\n\n */\n\nfun upperBound(a: ArrayList, x: Int): Int {\n if (a[0] > x) return 0\n if (back(a) <= x) return a.size\n var l = 0\n var r = a.size - 1\n while (l != r) {\n val m = (l + r) / 2\n if (a[m] > x) r = m else l = m + 1\n }\n return l\n}\n\nfun lowerBound(a: ArrayList, x: Int): Int {\n if (back(a) < x) return a.size\n var l = 0\n var r = a.size - 1\n while (l != r) {\n val m = (l + r) / 2\n if (a[m] >= x) r = m else l = m + 1\n }\n return l\n}\n\n/*\n\nval fact = LongArray(maxn)\nval invfact = LongArray(maxn)\n\nfun calcFactorials() {\n fact[0] = 1\n for (i in 1..maxn - 1) fact[i] = (fact[i - 1] * i.toLong()) % MOD\n for (i in 0..maxn - 1) invfact[i] = powmod(fact[i], MOD - 2, MOD)\n}\n\nfun cnk(n: Int, k: Int, m: Long): Long {\n return ((fact[n] * invfact[k]) % m) * invfact[n - k] % m\n}\n\n*/\n\nfun powmod(x: Long, d: Long, m: Long): Long {\n if (d == 0L) return 1\n if (d % 2 == 0L) {\n val y = powmod(x, d / 2, m)\n return (y * y) % m\n }\n return x * powmod(x, d - 1, m) % m\n}\n\nfun divup(x: Int, y: Int): Int {\n return (x + y - 1) / y\n}\n\nfun divup(x: Long, y: Long): Long {\n return (x + y - 1) / y\n}\n\nfun gcd(x: Long, y: Long): Long {\n if (x == 0L || y == 0L) return x + y\n if (x > y) return gcd(x % y, y)\n return gcd(y % x, x)\n}\n\nfun end() {\n out.flush()\n System.exit(0)\n}\n\nfun printIntArray(a: IntArray) {\n for (x in a) print(\"$x \")\n print(\"\\n\")\n}\n\nfun printIntArrayList(a: ArrayList) {\n for (x in a) print(\"$x \")\n print(\"\\n\")\n}\n\nfun nextInt() = next().toInt()\nfun nextLong() = next().toLong()\nfun nextDouble() = next().toDouble()\n\nval reader = BufferedReader(InputStreamReader(System.`in`))\nval out = PrintWriter(System.out, false)\nvar tokenizer = StringTokenizer(\"\")\n\nfun println(o: Any) = out.println(o)\nfun print(o: Any) = out.print(o)\n\nfun next(): String {\n while (!tokenizer.hasMoreTokens())\n tokenizer = StringTokenizer(reader.readLine())\n return tokenizer.nextToken()\n}\n\nfun increase(map: HashMap, k: Int) {\n map[k] = 1 + if (map.containsKey(k)) map[k]!! else 0\n}\n\nfun decrease(map: HashMap, k: Int) {\n map[k] = -1 + if (map.containsKey(k)) map[k]!! else 0\n}", "lang": "Kotlin", "bug_code_uid": "60d69325c7449c4a80aa766681780e06", "src_uid": "ac2e795cd44061db8da13e3947ba791b", "apr_id": "3254456560988dc477a03427bf3a4e05", "difficulty": 2000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.30029806259314457, "equal_cnt": 32, "replace_cnt": 25, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 31, "bug_source_code": "import java.io.*\nimport java.util.*\n\nprivate const val localFileName = \"test\"\nprivate lateinit var out: PrintWriter\nprivate lateinit var bf: BufferedReader\nprivate var stok = StringTokenizer(\"\")\nprivate fun read(): String {\n while (!stok.hasMoreTokens()) stok = StringTokenizer(bf.readLine())\n return stok.nextToken()\n}\n\nprivate fun solve() {\n val (n, m) = bf.readLine().trim().split(' ').map(String::toInt)\n val a = Array(n + 2) {\n if (it == 0 || it == n + 1) BooleanArray(m + 2) { false }\n else (\".\" + bf.readLine().trim() + \".\").map {it == 'X'}.toBooleanArray()\n }\n\n class Filler {\n private val data = Array(n + 2) { IntArray(m + 2 )}\n\n fun fillRect(r1: Int, c1: Int, r2: Int, c2: Int) {\n change(r1, c1, 1)\n if (c2 <= m) change(r1, c2 + 1, -1)\n if (r2 <= n) change(r2 + 1, c1, -1)\n if (r2 <= n && c2 <= m) change(r2 + 1, c2 + 1, 1)\n }\n\n private fun change (r: Int, c: Int, value: Int) {\n data[Math.max(r, 0)][Math.max(c, 0)] += value\n }\n\n fun getResult(): Array {\n val ans = Array(n + 2) { BooleanArray(m + 2)}\n for (i in 0 until n + 2) {\n for (f in 0 until m + 2) {\n if (i > 0) data[i][f] += data[i - 1][f]\n if (f > 0) data[i][f] += data[i][f - 1]\n if (i > 0 && f > 0) data[i][f] -= data[i - 1][f - 1]\n ans[i][f] = data[i][f] > 0\n }\n }\n return ans\n }\n }\n\n fun get_source(range: Int): Array {\n val findSourceFiller = Filler()\n for (i in 0 until n + 2) {\n for (f in 0 until m + 2) {\n if (a[i][f]) continue\n findSourceFiller.fillRect(i - range, f - range, i + range, f + range)\n }\n }\n\n return findSourceFiller.getResult()\n }\n\n fun ok(range: Int): Boolean {\n val cur_source = get_source(range)\n val recoverFiller = Filler()\n for (i in 0 until n + 2) {\n for (f in 0 until m + 2) {\n if (cur_source[i][f]) continue\n recoverFiller.fillRect(i - range, f - range, i + range, f + range)\n }\n }\n\n val res = recoverFiller.getResult()\n return res.contentDeepEquals(a)\n }\n\n var l = 0\n var r = 1\n while (ok(r)) r *= 2\n while (l < r) {\n val mid = (l + r + 1) / 2\n if (ok(mid)) l = mid\n else r = mid - 1\n }\n\n out.println(l)\n val source = get_source(l)\n for (i in 1..n) {\n out.println(source[i].map { if (it) '.' else 'X' }.joinToString(\"\").substring(1, m + 1))\n }\n}\n\nfun main() {\n if (System.getProperty(\"ONLINE_JUDGE\") == null) {\n assert(localFileName != \"\")\n System.setIn(FileInputStream(File(\"$localFileName.inp\")))\n System.setOut(PrintStream(File(\"$localFileName.out\")))\n }\n\n out = PrintWriter(System.out!!, false)\n bf = BufferedReader(InputStreamReader(System.`in`))\n\n solve()\n out.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "ec0b1e4029f18dbc193132fd2d0b310e", "src_uid": "63c4006a0a6284f9825aaabfc4c28fd1", "apr_id": "8e5dba51080f55cb5c54d915c23bd1c8", "difficulty": 2400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9411764705882353, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\nimport java.lang.System.err\n\nprivate const val localFileName = \"test\"\nprivate lateinit var out: PrintWriter\nprivate lateinit var bf: BufferedReader\nprivate var stok = StringTokenizer(\"\")\nprivate fun read(): String {\n while (!stok.hasMoreTokens()) stok = StringTokenizer(bf.readLine())\n return stok.nextToken()\n}\n\nprivate fun solve() {\n val mod = 998244353L\n val maxn = 201010\n fun Long.sqr() = this * this\n fun Long.mpow(exp: Long): Long = when {\n exp == 0L -> 1L\n (exp and 1L) == 1L -> this * this.mpow(exp - 1) % mod\n else -> this.mpow(exp / 2).sqr() % mod\n }\n\n val inv_2 = 2L.mpow(mod - 2)\n\n val fac = LongArray(maxn)\n val inv_fac = LongArray(maxn)\n fac[0] = 1\n for (i in 1 until maxn) fac[i] = (fac[i - 1] * i) % mod\n for (i in 0 until maxn) inv_fac[i] = fac[i].mpow(mod - 2)\n\n val pow2 = LongArray(maxn)\n pow2[0] = 1\n for (i in 1 until maxn) pow2[i] = pow2[i - 1] * 2L % mod\n\n fun comb(n: Int, k: Int) = fac[n] * inv_fac[k] % mod * inv_fac[n - k] % mod\n\n val n = read().toInt()\n val k = read().toLong()\n if (k == 1L) {\n out.println(0)\n return\n }\n val a = List(n) { read().toInt() }.distinct().toMutableList()\n if (a[0] == a.last())\n a.removeAt(a.lastIndex)\n\n var ans = 0L\n\n for (cnt0 in 0 until a.size) {\n var cur_ans = pow2[a.size - cnt0]\n if ((a.size - cnt0) % 2 == 0)\n cur_ans = (cur_ans + mod - comb(a.size - cnt0, (a.size - cnt0) / 2)) % mod\n cur_ans = (cur_ans * inv_2) % mod\n cur_ans = cur_ans * comb(a.size, cnt0) % mod * (k - 2).mpow(cnt0.toLong()) % mod\n ans = (ans + cur_ans) % mod\n }\n ans = ans * k.mpow((n - a.size).toLong()) % mod\n out.println(ans)\n}\n\nfun main() {\n if (System.getProperty(\"ONLINE_JUDGE\") == null) {\n assert(localFileName != \"\")\n System.setIn(FileInputStream(File(\"$localFileName.inp\")))\n System.setOut(PrintStream(File(\"$localFileName.out\")))\n }\n\n out = PrintWriter(System.out!!, false)\n bf = BufferedReader(InputStreamReader(System.`in`))\n\n solve()\n out.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "94caeee22894ba25f749334cb4c3264e", "src_uid": "63c4006a0a6284f9825aaabfc4c28fd1", "apr_id": "8e5dba51080f55cb5c54d915c23bd1c8", "difficulty": 2400, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5685279187817259, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n operator fun List.component6(): E = this[5]\n\n val info = readInts()\n val smaller = info.subList(0, 4).min()!!\n val top = min(smaller, info[5])\n print(max(0, top - info[4]))\n}", "lang": "Kotlin", "bug_code_uid": "8629b7354c5222af29abec471ccf1b5e", "src_uid": "63b9dc70e6ad83d89a487ffebe007b0a", "apr_id": "e4d0367f688c0e3401eb7634d4386471", "difficulty": 1100, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9981391886862672, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\nimport java.math.BigInteger\n\nfun main(args: Array) {\n if (args.size > 0) {\n input = FileInputStream(args[0])\n }\n var str = nextLine()\n var tokens = str!!.split(\"VK\")\n var ans = tokens.size - 1 + if (tokens.filter { it.length > 1 && it != \"KV\" }.isNotEmpty()) 1 else 0\n println(ans)\n}\n\nfun String.toBigInteger() = BigInteger(this)\nfun String.toBigDecimal() = BigDecimal(this)\n\nvar input = System.`in`\n\nval sb = StringBuilder()\nval buffer = ByteArray(4096)\nvar pos = 0\nvar size = 0\n\nfun nextString(): String? {\n var c = skipWhitespace()\n if (c < 0) return null\n\n return sb.run {\n setLength(0)\n\n do {\n append(c.toChar())\n c = read()\n } while (c > ' '.toInt())\n\n toString()\n }\n}\n\nfun nextLine(): String? {\n var c = read()\n if (c < 0) return null\n\n return sb.run {\n setLength(0)\n\n while (c >= 0 && c != '\\n'.toInt()) {\n append(c.toChar())\n c = read()\n }\n\n toString()\n }\n}\n\nfun nextLong(): Long {\n var c = skipWhitespace()\n\n val sign = if (c == '-'.toInt()) {\n c = read()\n -1\n } else 1\n\n var ans = 0L\n\n while (c > ' '.toInt()) {\n ans = ans * 10 + c - '0'.toInt()\n c = read()\n }\n\n return sign * ans\n}\n\nfun nextInt() = nextLong().toInt()\nfun nextDouble() = nextString()?.toDouble() ?: 0.0\nfun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO\nfun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO\n\nfun nextStrings(n: Int) = Array(n) { nextString() ?: \"\" }\nfun nextInts(n: Int) = IntArray(n) { nextInt() }\nfun nextLongs(n: Int) = LongArray(n) { nextLong() }\nfun nextDoubles(n: Int) = DoubleArray(n) { nextDouble() }\nfun nextBigIntegers(n: Int) = Array(n) { nextBigInteger() }\nfun nextBigDecimals(n: Int) = Array(n) { nextBigDecimal() }\n\nfun nextStrings(n: Int, m: Int) = Array(n) { nextStrings(m) }\nfun nextInts(n: Int, m: Int) = Array(n) { nextInts(m) }\nfun nextLongs(n: Int, m: Int) = Array(n) { nextLongs(m) }\nfun nextDoubles(n: Int, m: Int) = Array(n) { nextDoubles(m) }\nfun nextBigIntegers(n: Int, m: Int) = Array(n) { nextBigIntegers(m) }\nfun nextBigDecimals(n: Int, m: Int) = Array(n) { nextBigDecimals(m) }\n\nprivate fun skipWhitespace(): Int {\n while (true) {\n val c = read()\n if (c > ' '.toInt() || c < 0) return c\n }\n}\n\nprivate fun read(): Int {\n while (pos >= size) {\n if (size < 0) return -1\n size = input.read(buffer, 0, buffer.size)\n pos = 0\n }\n return buffer[pos++].toInt()\n}", "lang": "Kotlin", "bug_code_uid": "bce84408d1a9dd0e22d84e447f8ab137", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "apr_id": "a03ef94b53f43926f7389d775f0eb9e4", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8958333333333334, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n val tokens = readLine()!!.split(\"VK\")\n val ans = tokens.size - 1 + tokens.map { if (it.length > 1 && it != \"KV\") 1 else 0 }.sum()\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "dd300b898068e80b12bac22d0a89b3e8", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "apr_id": "8726553448e058013a36d15bfe04e332", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.39599555061179087, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val k = readLine()!!.toInt()\n val min: Int\n val max: Int\n\n when {\n n == k -> {\n min = 0\n max = 0\n }\n \n (n - k) == 1 -> {\n min = 1\n max = 1\n }\n \n (n / k) > 2 -> {\n min = 1\n max = k\n }\n \n else -> {\n min = 1\n max = n - k\n }\n }\n\n println(\"$min $max\")\n}", "lang": "Kotlin", "bug_code_uid": "da7f2fb2861fdbae9188ad983ebc36e0", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "405d7e78e05aae7901d9b84b15916e85", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7137355584082157, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val str = readLine()!!.split(\" \")\n val n = str[0].toInt()\n val k = str[1].toInt()\n val min: Int\n val max: Int\n\n if (k == 0 || n == k) {\n min = 0\n max = 0\n } else if ((n.toFloat() / 3) > k) {\n min = 1\n max = 2 * k\n } else {\n min = 1\n max = n - k\n }\n\n println(\"$min $max\")\n}", "lang": "Kotlin", "bug_code_uid": "32cfe44f4a9cfa5a3085ca66bc6f8dee", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "405d7e78e05aae7901d9b84b15916e85", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6938325991189427, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "fun main(args: Array) {\n val str = readLine()!!.split(\" \")\n val n = str[0].toLong()\n val k = str[1].toLong()\n val min: Int\n val max: Int\n\n if (k == 0) {\n min = 0\n max = 0\n }\n else if (n == k) {\n min = 0\n max = 0\n }\n else if ((n - k) == 1) {\n min = 1\n max = 1\n }\n else if ((n.toFloat() / k) > 2F) {\n min = 1\n max = k + 1\n }\n else {\n min = 1\n max = n - k\n }\n\n println(\"$min $max\")\n}", "lang": "Kotlin", "bug_code_uid": "0e886dbd14540e439464bc120208802d", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "405d7e78e05aae7901d9b84b15916e85", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6812585499316005, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import kotlin.math.min\n\nfun main(args: Array) {\n val (n, k) = readLine()?.split(\" \")?.map(String::toLong) ?: return\n val (a, b) = ex2(n, k)\n println(\"$a $b\")\n}\n\nfun ex2(n: Long, k: Long): Pair {\n if (n == k) return 0L to 0L\n\n val a = 1L\n val b = min(n - k, n - n / 3)\n\n return a to b\n}", "lang": "Kotlin", "bug_code_uid": "e724ddfce8f9cd589b87e8775da9f44c", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "b74deb027df9ebc72a9e1f1eb62631e6", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9969552806850619, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var n = readLine()!!\n var one = 0\n var toCheck = Integer.parseInt(n)\n if (n.length < 2) {\n when (toCheck) {\n 1 -> println(\"one\")\n 2 -> println(\"two\")\n 3 -> println(\"three\")\n 4 -> println(\"four\")\n 5 -> println(\"five\")\n 6 -> println(\"six\")\n 7 -> println(\"seven\")\n 8 -> println(\"eight\")\n 9 -> println(\"nine\")\n }\n } else {\n when (Integer.parseInt(n[0].toString())) {\n 1 -> {\n when (Integer.parseInt(n[1].toString())) {\n 0-> println(\"ten\")\n 1 -> println(\"eleven\")\n 2 -> println(\"twelve\")\n 3 -> println(\"thirteen\")\n 4 -> println(\"fourteen\")\n 5 -> println(\"fifteen\")\n 6 -> println(\"sixteen\")\n 7 -> println(\"seventeen\")\n 8 -> println(\"eighteen\")\n 9 -> println(\"nineteen\")\n }\n }\n 2 -> {\n print(\"twenty\")\n when (Integer.parseInt(n[1].toString())) {\n 1 -> println(\"-one\")\n 2 -> println(\"-two\")\n 3 -> println(\"-three\")\n 4 -> println(\"-four\")\n 5 -> println(\"-five\")\n 6 -> println(\"-six\")\n 7 -> println(\"-seven\")\n 8 -> println(\"-eight\")\n 9 -> println(\"-nine\")\n }\n }\n 3 -> {\n print(\"thirty\")\n when (Integer.parseInt(n[1].toString())) {\n 1 -> println(\"-one\")\n 2 -> println(\"-two\")\n 3 -> println(\"-three\")\n 4 -> println(\"-four\")\n 5 -> println(\"-five\")\n 6 -> println(\"-six\")\n 7 -> println(\"-seven\")\n 8 -> println(\"-eight\")\n 9 -> println(\"-nine\")\n }\n }\n 4 -> {\n print(\"forty\")\n when (Integer.parseInt(n[1].toString())) {\n 1 -> println(\"-one\")\n 2 -> println(\"-two\")\n 3 -> println(\"-three\")\n 4 -> println(\"-four\")\n 5 -> println(\"-five\")\n 6 -> println(\"-six\")\n 7 -> println(\"-seven\")\n 8 -> println(\"-eight\")\n 9 -> println(\"-nine\")\n }\n }\n 5 -> {\n print(\"fifty\")\n when (Integer.parseInt(n[1].toString())) {\n 1 -> println(\"-one\")\n 2 -> println(\"-two\")\n 3 -> println(\"-three\")\n 4 -> println(\"-four\")\n 5 -> println(\"-five\")\n 6 -> println(\"-six\")\n 7 -> println(\"-seven\")\n 8 -> println(\"-eight\")\n 9 -> println(\"-nine\")\n }\n }\n 6 -> {\n print(\"sixty\")\n when (Integer.parseInt(n[1].toString())) {\n 1 -> println(\"-one\")\n 2 -> println(\"-two\")\n 3 -> println(\"-three\")\n 4 -> println(\"-four\")\n 5 -> println(\"-five\")\n 6 -> println(\"-six\")\n 7 -> println(\"-seven\")\n 8 -> println(\"-eight\")\n 9 -> println(\"-nine\")\n }\n }\n 7 -> {\n print(\"seventy\")\n when (Integer.parseInt(n[1].toString())) {\n 1 -> println(\"-one\")\n 2 -> println(\"-two\")\n 3 -> println(\"-three\")\n 4 -> println(\"-four\")\n 5 -> println(\"-five\")\n 6 -> println(\"-six\")\n 7 -> println(\"-seven\")\n 8 -> println(\"-eight\")\n 9 -> println(\"-nine\")\n }\n }\n 8 -> {\n print(\"eighty\")\n when (Integer.parseInt(n[1].toString())) {\n 1 -> println(\"-one\")\n 2 -> println(\"-two\")\n 3 -> println(\"-three\")\n 4 -> println(\"-four\")\n 5 -> println(\"-five\")\n 6 -> println(\"-six\")\n 7 -> println(\"-seven\")\n 8 -> println(\"-eight\")\n 9 -> println(\"-nine\")\n }\n }\n 9 -> {\n print(\"ninety\")\n when (Integer.parseInt(n[1].toString())) {\n 1 -> println(\"-one\")\n 2 -> println(\"-two\")\n 3 -> println(\"-three\")\n 4 -> println(\"-four\")\n 5 -> println(\"-five\")\n 6 -> println(\"-six\")\n 7 -> println(\"-seven\")\n 8 -> println(\"-eight\")\n 9 -> println(\"-nine\")\n }\n }\n }\n }\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "b4ca837632e12a15ec51759aade58082", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "apr_id": "a33da9bfad4a66a98e3739c21fba60bf", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9982046678635548, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n val numToText = listOf(\"zero\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\", \"ten\",\n \"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fivteen\", \"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\")\n val tens = listOf(\"\", \"\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\")\n print(\n when {\n n < 20 -> numToText[n]\n n % 10 == 0 -> tens[n / 10]\n else -> tens[n / 10] + '-' + numToText[n % 10]\n }\n )\n}\n", "lang": "Kotlin", "bug_code_uid": "ac0450c32a5f055623a344a0464e4428", "src_uid": "a49ca177b2f1f9d5341462a38a25d8b7", "apr_id": "7c628609b99a60c7c4e6fc62c5440654", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9928571428571429, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\nfun main(args: Array) {\n val n: Long = readLine()!!.toLong()\n var t = n\n var cnt = 0\n while (t >= 10) {\n cnt++\n t /= 10\n }\n t++\n while (cnt > 0) {\n t *= 10\n cnt--\n }\n print(t)\n print('\\n')\n}\n", "lang": "Kotlin", "bug_code_uid": "76ec102204a4118e9cb2d670fd3d83f8", "src_uid": "a3e15c0632e240a0ef6fe43a5ab3cc3e", "apr_id": "24bc6e645c8ef282612de168daec2fdc", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.3861538461538462, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "fun main(args: Array) {\n readA()\n}\n\nfun readA() {\n readLine()\n val data = readLine()!!.split(\" \").map { it.toInt() }\n val result = solveA(data)\n println(result)\n}\n\nfun solveA(data: List): Int {\n val middle = data.dropWhile { it == 0 }.dropLastWhile { it == 1 }\n val beginAndEndCount = data.size - middle.size\n val zeroesCount = middle.count { it == 0 }\n val onesCount = middle.size - zeroesCount\n return beginAndEndCount + Math.max(zeroesCount, onesCount)\n}\n", "lang": "Kotlin", "bug_code_uid": "d408a87916d157d8db4f65033962729d", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "apr_id": "773ba928a477e4f985ec4f3ffe4f93a0", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8468179080505922, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n}\n\nval MAX_N = (1e6 + 10).toInt()\nval INF = (1e9 + 7).toInt()\nval MOD = (1e9 + 7).toInt()\nval INF_F = 1e-6\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n val n = reader.nextInt()\n val a = reader.nextArrayInt(n)\n var i = 0\n while (i < n && a[i] == 0) {\n i++\n }\n if (i == n) {\n writer.println(n)\n return\n }\n\n var r = n - 1\n while (r >= i && a[r] == 1) {\n r--\n }\n\n if (r < i) {\n writer.println(n)\n return\n }\n\n val l = i\n\n var count0 = 0\n while (i <= r) {\n if (a[i] == 0) {\n count0++\n }\n i++\n }\n\n writer.println(n - min(r - l + 1 - count0, count0))\n}\n\n/*\n\n6\n0 1 0 0 0 1\n\n* */\n\nfun gcd(a: Int, b: Int): Int {\n return if (b == 0) a else gcd(b, a % b)\n}\n\nclass InputReader(stream: InputStream) {\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n}", "lang": "Kotlin", "bug_code_uid": "e7d14dde28f4b62b7397a4d6f57c6a43", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "apr_id": "57c321f1a57539bd40720e666eb947c1", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.96036866359447, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n}\n\nval MAX_N = (1e6 + 10).toInt()\nval INF = (1e9 + 7).toInt()\nval MOD = (1e9 + 7).toInt()\nval INF_F = 1e-6\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n val n = reader.nextInt()\n val a = reader.nextArrayInt(n)\n\n val count0 = a.filterIndexed { index, value -> index in l..r && value == 0 }.count()\n var ans = n - min(r - l + 1 - count0, count0)\n for (i in 0 until n) {\n val x0 = a.filterIndexed { index, value -> index in 0..i && value == 0 }.count()\n val x1 = a.filterIndexed { index, value -> index in i + 1 until n && value == 1 }.count()\n ans = max(ans, x0 + x1)\n }\n writer.println(ans)\n}\n\nfun gcd(a: Int, b: Int): Int {\n return if (b == 0) a else gcd(b, a % b)\n}\n\nclass InputReader(stream: InputStream) {\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n}", "lang": "Kotlin", "bug_code_uid": "5c7122430a77e4af1b2b756e64b0b45a", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "apr_id": "57c321f1a57539bd40720e666eb947c1", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9848197343453511, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n}\n\nval MAX_N = (1e6 + 10).toInt()\nval INF = (1e9 + 7).toInt()\nval MOD = (1e9 + 7).toInt()\nval INF_F = 1e-6\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n val n = reader.nextInt()\n val a = reader.nextArrayInt(n)\n var ans = 0\n for (i in 0 until n) {\n val x0 = a.filterIndexed { index, value -> index in 0..i && value == 0 }.count()\n val x1 = a.filterIndexed { index, value -> index in i + 1 until n && value == 1 }.count()\n ans = max(ans, x0 + x1)\n }\n writer.println(ans)\n}\n\nfun gcd(a: Int, b: Int): Int {\n return if (b == 0) a else gcd(b, a % b)\n}\n\nclass InputReader(stream: InputStream) {\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n}", "lang": "Kotlin", "bug_code_uid": "25fe5e01532dd958e280c5c714aa9a20", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "apr_id": "57c321f1a57539bd40720e666eb947c1", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9378969654199012, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun solve() {\n val n = nextInt()\n val a = nextArray(n)\n var cnt = a.count { it == 0 }\n var s = 0\n var z = 0\n var ans = Math.max(cnt,n - cnt)\n for(i in a.indices) {\n if(a[i] == 1) {\n s++\n ans = Math.max(ans,s + cnt - z)\n }\n else z++\n }\n pw.println(ans)\n}\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextLine() = if(hasNext()) st.nextToken(\"\\n\")!! else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n,{nextInt()})\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nval br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nval pw = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "3ab3aace259ed4f582d80e549b77228b", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "apr_id": "0b120a75afa89f61054024d6cc1d4d5c", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9579004920721705, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.lang.AssertionError\nimport java.util.*\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n \nprivate fun myAssert(x: Boolean) {\n if (!x) {\n throw AssertionError()\n }\n}\n \nfun main(args: Array) {\n var n = readInt()\n var lst = readInts()\n var one = 0\n var zero = 0\n for (i in 0 until n) {\n if (lst[i] == 1) {\n one++\n } else {\n zero++\n }\n }\n println(maxOf(one, zero))\n}", "lang": "Kotlin", "bug_code_uid": "856bafbe4c349f3052566fce8f9a133d", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95", "apr_id": "a9d77f58a34030a31433458f7b973a77", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9773427587456951, "equal_cnt": 11, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.io.OutputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.InputMismatchException\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author prakhar17252\n */\nobject Main {\n fun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = InputReader(inputStream)\n val out = PrintWriter(outputStream)\n val solver = AWrongSubtraction()\n solver.solve(1, `in`, out)\n out.close()\n }\n\n internal class AWrongSubtraction {\n fun solve(testNumber: Int, `in`: InputReader, out: PrintWriter) {\n var n = `in`.nextInt()\n var k = `in`.nextInt()\n\n while (k-- > 0) {\n if (n % 10 == 0) {\n n /= 10\n } else {\n --n\n }\n }\n out.println(n)\n }\n\n }\n\n internal class InputReader(private val stream: InputStream) {\n private val buf = ByteArray(1024)\n private var curChar: Int = 0\n private var numChars: Int = 0\n private val filter: InputReader.SpaceCharFilter? = null\n\n fun read(): Int {\n if (numChars == -1) {\n throw InputMismatchException()\n }\n if (curChar >= numChars) {\n curChar = 0\n try {\n numChars = stream.read(buf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (numChars <= 0) {\n return -1\n }\n }\n return buf[curChar++].toInt()\n }\n\n fun nextInt(): Int {\n var c = read()\n while (isSpaceChar(c)) {\n c = read()\n }\n var sgn = 1\n if (c == '-'.toInt()) {\n sgn = -1\n c = read()\n }\n var res = 0\n do {\n if (c < '0'.toInt() || c > '9'.toInt()) {\n throw InputMismatchException()\n }\n res *= 10\n res += c - '0'.toInt()\n c = read()\n } while (!isSpaceChar(c))\n return res * sgn\n }\n\n fun isSpaceChar(c: Int): Boolean {\n return filter?.isSpaceChar(c) ?: isWhitespace(c)\n }\n\n interface SpaceCharFilter {\n fun isSpaceChar(ch: Int): Boolean\n\n }\n\n companion object {\n\n fun isWhitespace(c: Int): Boolean {\n return c == ' '.toInt() || c == '\\n'.toInt() || c == '\\r'.toInt() || c == '\\t'.toInt() || c == -1\n }\n }\n\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "f8eeb31170d248d4cf5cc8b3264bac00", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "21a775fe815cba71004f92cd06b98df6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6750392464678179, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun decrease(number: String, times: String): Int {\n var lastChar = number.takeLast(1)\n var lastCharAsNumber = lastChar.toInt()\n var newNumber = number.toInt()\n\n for(j in 1..times.toInt()) {\n if(lastCharAsNumber!=0) {\n newNumber= newNumber-1;\n }\n else {\n newNumber=newNumber/10;\n }\n\n lastChar = newNumber.toString().takeLast(1)\n lastCharAsNumber = lastChar.toInt()\n }\n return newNumber\n}\n\n", "lang": "Kotlin", "bug_code_uid": "6b2bbb2346345a794940538a5f4d42c8", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "fa5d918a6b2b6721867c4023753f6b41", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6254295532646048, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "package com.test\n\nfun main(args: Array) {\n val result = decrease(args[0].toInt(),args[1].toInt())\n println(result)\n}\n\nfun decrease(number: Int, times: Int): Int {\n var numberStr = number.toString()\n var lastChar = numberStr.takeLast(1)\n var lastCharAsNumber = lastChar.toInt()\n var newNumber = number\n\n for(j in 1..times) {\n if(lastCharAsNumber!=0) {\n newNumber= newNumber-1;\n }\n else {\n newNumber=newNumber/10;\n }\n\n numberStr = newNumber.toString()\n lastChar = numberStr.takeLast(1)\n lastCharAsNumber = lastChar.toInt()\n }\n return newNumber\n}\n\n", "lang": "Kotlin", "bug_code_uid": "e9513235f5f3984b77db993b085a3d69", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "fa5d918a6b2b6721867c4023753f6b41", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6666666666666666, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "// if the last digit of the number is non-zero, she decreases the number by one;\n// if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).\n\nfun main(args: Array) {\n println(readLine().split(\" \").map { it.toInt() }.let { dec(it[0], it[1]) })\n}\n\nfun dec(n: Int, k: Int): Int = if (k == 0) n else dec(if (n % 10 == 0) n / 10 else n - 1, k - 1)\n", "lang": "Kotlin", "bug_code_uid": "7e62611ec040800852522b910203ab5f", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "df149d7607b60337fd0fb59263ba28b5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.971677559912854, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: List): Unit {\n println(readLine()!!.split(\" \").map { it.toInt() }.let { dec(it[0], it[1]) })\n}\n \nprivate fun dec(n: Int, k: Int): Int = if (k == 0) n else dec(if (n % 10 == 0) n / 10 else n - 1, k - 1)", "lang": "Kotlin", "bug_code_uid": "7748ed5eb03154aebfbc1c9cd7aa1c8f", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "df149d7607b60337fd0fb59263ba28b5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.27058823529411763, "equal_cnt": 21, "replace_cnt": 10, "delete_cnt": 7, "insert_cnt": 5, "fix_ops_cnt": 22, "bug_source_code": "#include \nusing namespace std;\n\nint main()\n{\n int n,k,i;\n cin>>n>>k;\n while(k--){\n if(n%10==0)\n n/=10;\n else\n n--;\n }\n cout<) {\n try {\n `in` = BufferedReader(InputStreamReader(System.`in`))\n out = PrintWriter(System.out)\n solve()\n `in`!!.close()\n out!!.close()\n } catch (e: Throwable) {\n e.printStackTrace()\n exit(1)\n }\n\n }\n}", "lang": "Kotlin", "bug_code_uid": "b6dac910826a0ab431952c8177828a84", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "96aed588dcfb5760d5c0a2901f4df1d6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7801857585139319, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n var number = args.first()\n val deductor = args[1].toInt()\n\n for (x in deductor downTo 1) {\n if (number[number.length - 1].toInt() - '0'.toInt() > 0 ) {\n number = (number.toInt() - 1).toString()\n } else {\n if (number.isNotEmpty())\n number = number.dropLast(1)\n else\n number = \"0\"\n }\n }\n println(number)\n}\n", "lang": "Kotlin", "bug_code_uid": "8d7823799be908b0ea5ea95960ba2d81", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4916f6fdce52378d7971cd292e246698", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9553805774278216, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main()\n{\n var (n, k) = readLine()!!!.split(\" \").map { it.toInt() }\n \n while (k > 0)\n {\n if (n % 10 == 0) n /= 10\n else n -= 1\n }\n \n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "ed3fe2364e9f168c8bd79c3321808546", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3ba0a583006d0f6d2dbd94482fd38aad", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9606299212598425, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main()\n{\n var (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n \n while (k > 0)\n {\n if (n % 10 == 0) n /= 10\n else n -= 1\n }\n \n println(n)\n}\n", "lang": "Kotlin", "bug_code_uid": "93f5c98753ccf632fb29b310d8948494", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3ba0a583006d0f6d2dbd94482fd38aad", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5821917808219178, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "typealias TanyaInt = Int\n\nfun TanyaInt.decrement(): Int =\n if (this % 10 == 0) {\n this / 10\n } else {\n this - 1\n }\n\ninfix fun TanyaInt.subtract(subtrahend: Int): Int =\n (1..subtrahend).fold(this) { acc, _ ->\n acc.decrement()\n }\n\nfun Array.minuend(): Int = this.first().toInt()\nfun Array.subtrahend(): Int = this.last().toInt()\n\nfun main(args: Array) {\n\n val result = args.minuend() subtract args.subtrahend()\n\n print(result)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "829a841b6231ab69ec87a166a30f1abd", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a7317970e335791c87a405f497c3224d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9782278481012658, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package kotlinheroes.episode2.practice.a\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\ntypealias TanyaInt = Int\n\ndata class Operators(val minuend: Int, val subtrahend: Int)\n\nfun TanyaInt.decrement(): Int =\n if (this % 10 == 0) {\n this / 10\n } else {\n this - 1\n }\n\ninfix fun TanyaInt.subtract(subtrahend: Int): Int =\n (1..subtrahend).fold(this) { acc, _ ->\n acc.decrement()\n }\n\nfun List.minuend(): Int = this.first().toInt()\nfun List.subtrahend(): Int = this.last().toInt()\n\nfun readInput(): Operators {\n val inputStreamReader = InputStreamReader(System.`in`)\n val bufferedReader = BufferedReader(inputStreamReader)\n\n val inputLine = bufferedReader.readLine()\n val input = inputLine.split(\" \")\n\n return Operators(\n minuend = input.minuend(),\n subtrahend = input.subtrahend()\n )\n}\n\nfun main() {\n\n val (minuend, subtrahend) = readInput()\n\n val result = minuend subtract subtrahend\n\n print(result)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "b0f993f5a50d6bc98910f4081188071b", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a7317970e335791c87a405f497c3224d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9428868120456906, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "typealias TanyaInt = Int\n\ndata class Operators(val minuend: Int, val subtrahend: Int)\n\nfun TanyaInt.decrement(): Int =\n if (this % 10 == 0) {\n this / 10\n } else {\n this - 1\n }\n\ninfix fun TanyaInt.subtract(subtrahend: Int): Int =\n (1..subtrahend).fold(this) { acc, _ ->\n acc.decrement()\n }\n\nfun StringTokenizer.nextInt(): Int = this.nextToken().toInt()\n\nfun readInput(inputStream: InputStream): Operators {\n val inputStreamReader = InputStreamReader(inputStream)\n val bufferedReader = BufferedReader(inputStreamReader)\n\n val inputLine = bufferedReader.readLine()\n val tokenizer = StringTokenizer(inputLine, \" \")\n\n return Operators(\n minuend = tokenizer.nextInt(),\n subtrahend = tokenizer.nextInt()\n )\n}\n\nfun main() {\n\n val (minuend, subtrahend) = readInput(System.`in`)\n\n val result = minuend subtract subtrahend\n\n print(result)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "6b8a866810f2960c9c17b6bedfb5a368", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a7317970e335791c87a405f497c3224d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9819639278557114, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "private fun readInts() = readLine()!!.split(\" \").map { it.toInt() }\n\nfun main()\n{\n //val n: Int\n //val k: Int\n val (n, k) = readInts()\n\n for(do_this in 1..k)\n {\n if(n%10 == 0) n = n/10\n else n = n-1\n }\n\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "ebfc89641c5266788bde90ca9eb5a33c", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "e67823e5cdfcbb983468a23650cb0206", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8446601941747572, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n var value = readLine()!!\n val count = readLine()!!.toInt()\n for (i in 1..count)\n value = minusOne(value)\n print(value)\n}\nprivate fun minusOne(value: String) =\n if (value.last() == '0')\n value.substring(0, value.length - 1)\n else\n (value.toInt() - 1).toString()", "lang": "Kotlin", "bug_code_uid": "01162760b356a4b1de9178b8f99fe7da", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "601792353aa96fa947d9e3af8264d3d0", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9734888653234358, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package artemser.practice\nfun main(args: Array) {\n val input = readLine()\n if (input != null) {\n val numbers = input.split(\" \")\n print(calcWrong(numbers))\n }\n}\n\nfun calcWrong(numbers: List): Int{\n var value = numbers[0].toInt()\n val amount = numbers[1].toInt()\n for (x in amount downTo 1){\n value = calc(value);\n }\n return value;\n}\n\nfun calc(value: Int): Int {\n return if (value % 10 == 0) value/10\n else value-1\n}\n\n", "lang": "Kotlin", "bug_code_uid": "d8e52511044d6cc65ee4d0ec3fd55038", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "d0d61e8d9828acd4ef053353cfd0622c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5378151260504201, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) = wrongSubstraction(args[0].toInt(), args[1].toInt())\n\nfun wrongSubstraction(n: Int, k: Int) = (1..k).fold(n) { acc, _ -> if (acc % 10 == 0) acc / 10 else acc - 1 }", "lang": "Kotlin", "bug_code_uid": "d07c42f4fe75f6927b703b33980f0196", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "716e8c01f53d4c05557bda2bb0d5ed2b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7021276595744681, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "val inputs = readLine().orEmpty().split(' ', limit = 2)\n\nval number = inputs.first()\nval executions = inputs.last()\n\nvar output = number\nrepeat(executions) {\n val lastDigit = output % 10\n if (lastDigit > 0) {\n output -= 1\n } else {\n output /= 10\n }\n}\nprintln(output)", "lang": "Kotlin", "bug_code_uid": "c345077dbe391b74963d9abff8af9f25", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "e21ed0e99c70e3f8d588d8cdf0ccdb5d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8028776978417266, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val number = args.first().toInt()\n val executions = args.last().toInt()\n\n var output = number\n repeat(executions) {\n val lastDigit = output % 10\n if (lastDigit > 0) {\n output -= 1\n } else {\n output /= 10\n }\n }\n println(output)\n}", "lang": "Kotlin", "bug_code_uid": "422a52b3ca7c1f85061605905527aded", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "e21ed0e99c70e3f8d588d8cdf0ccdb5d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8436681222707424, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "package app\n\nfun main(args: Array) {\n println(Decreasing().decrease(args[0].toInt(), args[1].toInt()))\n}\n\nclass Decreasing {\n\n fun decrease(source: Int, times: Int): Int {\n var result = source\n 1.rangeTo(times).map {\n result = decreaseWithRules(result)\n }\n return result\n }\n\n\n\n private fun decreaseWithRules(number: Int) =\n when(lastDigit(number)) {\n 0 -> number / 10\n else -> number - 1\n }\n\n private fun lastDigit(number: Int) = number % 10\n}", "lang": "Kotlin", "bug_code_uid": "3f1ef2f1022afb7a8e4ad602ebf3d9ba", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4bfdde92dfc5f82b29886de18f22f188", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.872791519434629, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n println(Decreasing().decrease(args[0].toInt(), args[1].toInt()))\n}\n\nclass Decreasing {\n\n fun decrease(source: Int, times: Int): Int {\n var result = source\n 1.rangeTo(times).map {\n result = decreaseWithRules(result)\n }\n return result\n }\n\n\n\n private fun decreaseWithRules(number: Int) =\n when(lastDigit(number)) {\n 0 -> number / 10\n else -> number - 1\n }\n\n private fun lastDigit(number: Int) = number % 10\n}", "lang": "Kotlin", "bug_code_uid": "267313233b6d86af02b1818ec8b8b426", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4bfdde92dfc5f82b29886de18f22f188", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6755852842809364, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n var first = args[0].toInt()\n val number = args[1].toInt()\n (1..number).forEach {\n if (first % 10 == 0){\n first = first / 10\n } else {\n first--\n }\n }\n println(first)\n}", "lang": "Kotlin", "bug_code_uid": "fff9745ec627af47b2a7e360da3fcbcc", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "aecf6056d1d46a81b14b1c024be88f15", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.23570190641247835, "equal_cnt": 16, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 17, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n int x,y;\n scanf(\"%d %d\",&x,&y);\n while(y--)\n {\n if(x%10==0) x=x/10;\n else x--;\n }\n printf(\"%d\\n\",x);\n return 0;\n}\n", "lang": "Kotlin", "bug_code_uid": "1f9bb146394e2bf6a54effe8403cd5c0", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "dd1525a3fc6b3753733afbcc0fc6b550", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8762214983713354, "equal_cnt": 23, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 19, "fix_ops_cnt": 24, "bug_source_code": "val input = readLine()!!\nval (nStr, kStr) = input.split(\" \")\n\nval zero = '0'.toInt()\nval k = kStr.toInt()\n\nval (restK, restN) = nStr\n .foldRight(k to \"\") { c, (accK, accS) ->\n if (accK == 0) {\n accK to (c + accS)\n } else {\n val digit = c.toInt() - zero\n val newDigit = digit - accK\n val subs = accK - digit\n if (newDigit < 0) {\n (subs - 1) to accS\n } else {\n subs to ((newDigit.toChar() + zero) + accS)\n }\n }\n }\n\nprintln(restN)\n", "lang": "Kotlin", "bug_code_uid": "f3315c282bee2d757877e3a771defe80", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3e0c494976512fb2c278f4e45361a800", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\n\nfun next() = readLine()!!\nfun nextInt() = next().toInt()\nfun nextInts() = next().split(\" \").map { it.toInt() }\nfun nextLongs() = next().split(\" \").map { it.toLong() }\n\nfun main(args: Array) {\n var n = nextInt()\n var k = nextInt()\n\n for (i in 0 until k) {\n if (n % 2 == 0) n /= 10\n else n--\n }\n println(n)\n \n}", "lang": "Kotlin", "bug_code_uid": "bc54c7ab92966159af64012e3269eda2", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "d7acc596289b618f807fd9011d688d6c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8214285714285714, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "\nimport java.util.Scanner\nfun main() {\n val reader = Scanner(System.`in`)\n var num:Long = reader.nextLong()\n var counter:Long=reader.nextLong()\n while(counter!=0&&(num/10)!=0){\n counter--;\n if (num % 10 == 0) {\n while (num % 10 == 0) {\n num = num / 10\n }\n } else {\n num--\n }\n }\n println(num)\n}", "lang": "Kotlin", "bug_code_uid": "b658865fb6e48153a225e7177b75adb9", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "2a433c5535da899bc43258068a58c6f2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9777158774373259, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.OutputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.Scanner\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author maxkibble\n */\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = Scanner(inputStream)\n val out = PrintWriter(outputStream)\n val solver = TaskA()\n solver.solve(1, `in`, out)\n out.close()\n}\n\nfun solve(testNumber: Int, `in`: Scanner, out: PrintWriter) {\n var n = `in`.nextInt()\n var k = `in`.nextInt()\n while (k > 0) {\n if (n % 10 == 0)\n n /= 10\n else\n n--\n k--\n }\n out.println(n)\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "d79a89a6ef5ebb6b5e9b499cf305229e", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "ec7878069a226aaef9bb13210f5bc458", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9969418960244648, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n\n\nfun main(args: Array) {\n\n val reader = Scanner(System.`in`)\n\n var x:Int = reader.nextInt()\n var k:Int = reader.nextInt()\n\n for (x in 0 until k)\n {\n var mod = x % 10\n if(mod == 0)\n {\n x/=10;\n }\n else x--\n }\n println(x)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "e924fbf038e84e15d3e2551bf05747dd", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "427e1da52bf2876c5559b207ea35c4eb", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8925619834710744, "equal_cnt": 10, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*\n\nvar arr = readLine()!!.split(' ')\nvar iter = arr[1].toInt()\nvar chislo = arr[0].toInt()\nwhile (iter > 0) {\n if (chislo % 10 != 0) chislo -= 1\n else chislo /= 10\n iter -= 1\n}\nprint(chislo)", "lang": "Kotlin", "bug_code_uid": "5a39dea7b0d913ff42003d1511feaa9a", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "67e0acfd4e8d79dd4559ff2c9a44d5ce", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9842180774748924, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.ArrayList\nimport java.util.Comparator\nimport java.util.HashSet\nimport java.util.Scanner\n\n @JvmStatic fun main(args:Array) {\n var `in` = Scanner(System.`in`)\n var n = `in`.nextInt()\n var k = `in`.nextInt()\n for (i in 0 until k)\n {\n if (n % 10 == 0)\n n /= 10\n else\n n--\n }\n println(n)\n }\n", "lang": "Kotlin", "bug_code_uid": "3665102df8f4509ae358494ff565e486", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "414fbb2bc9835ccf25aba7b328aa5720", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9796791443850268, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Comparator\n\n//import kotlin.math.abs\n\nfun main(args: Array) {\n\n var str = readLine()!!\n\n var old: Char = ' '\n var ans = \"\"\n for(elem in str){\n if(elem != '/' || (old != '/')){\n ans += elem;\n }\n old = elem;\n }\n\n if (ans.endsWith(\"/\")){\n ans = ans.substring(0 , ans.length - 1)\n }\n\n print(ans)\n\n}\n\nclass Pair(x: Long, y: Long) {\n var x: Long = x;\n var y: Long = y;\n}", "lang": "Kotlin", "bug_code_uid": "68431edc11a31c0f303607935ec379e1", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "apr_id": "1a120975cb54bae5da2967f81d714d3f", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9899141953936474, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.PriorityQueue\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n println(readLn().replace(Regex(\"\"\"//+\"\"\"), \"/\").removeSuffix(\"/\"))\n}\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}", "lang": "Kotlin", "bug_code_uid": "fb67496ebddc275e99d4563d677425ed", "src_uid": "6c2e658ac3c3d6b0569dd373806fa031", "apr_id": "207a39f6910805aa84ad3138f72f3aaa", "difficulty": 1700, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.994535519125683, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.math.BigInteger\n\nfun main() {\n val n = readLine()!!.toInt()\n if (n % 2 == 0) {\n println(pow(2.toBigInteger(), n))\n } else {\n println(0)\n }\n}\n\ntailrec fun pow(a: BigInteger, n: Int, ans: BigInteger = BigInteger.ONE): BigInteger{\n if(n == 0) return ans\n return pow(a * a, n.ushr(1), if(n.and(1) == 1) ans * a else ans)\n}", "lang": "Kotlin", "bug_code_uid": "163e412903a3e1a2d2f008d42528286a", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "9002c89ed4b45142b91ef5a8cdf2563a", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9967213114754099, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.math.BigInteger\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!.toInt()\n //val v = r.readLine()!!.split(\" \").map { it.toLong() }\n when(n%2){\n 0 -> println(BigInteger.valueOf(2).pow(n))\n 1 -> println(0)\n\n }\n}", "lang": "Kotlin", "bug_code_uid": "58beae86b0d549abc4367cd69538f3c1", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "0c01f8ca2f27f9158ab00c1357dbbf20", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8467153284671532, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n if (n % 2 == 0) {\n println((n / 2) * 2)\n } else println(0)\n}", "lang": "Kotlin", "bug_code_uid": "40ae5bd959b3b91be583ddc3467a521f", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "5f117935a86657087da549deaeb88498", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9575530586766542, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun readInt() = readLine()!!.toInt()\n\nfun readLong() = readLine()!!.toLong()\n\nfun readInts() = readLine()!!.split(' ').map(String::toInt).toIntArray()\n\nfun readLongs() = readLine()!!.split(' ').map(String::toLong).toLongArray()\n\nfun readInts(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = readInt()\n return a\n}\n\nfun readLongs(n: Int): LongArray {\n val a = LongArray(n)\n for (i in 0 until n) a[i] = readLong()\n return a\n}\n\nfun readLines(n: Int): Array {\n val s = Array(n) { \"\" }\n for (i in 0 until n) s[i] = readLine()!!\n return s\n}\n\n\nfun main() {\n val n = readInt()\n println(if (n % 2 == 0) n else 0)\n}", "lang": "Kotlin", "bug_code_uid": "0ba04529223cef19624c342961c9469d", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "0fe5b7dd719b270007d0ccf53fb33b75", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8615384615384616, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n var testCase = readLine()!!.toInt()\n if (testCase%2==0){\n println(testCase)\n }else{\n println(0)\n }\n}", "lang": "Kotlin", "bug_code_uid": "05c006c2baa42837e02c823c5f6008f2", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "5b00b36cbcea76213202a40be56632ea", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8881650380021715, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.math.BigInteger\n\nprivate fun readLn() = readLine()!!\nprivate fun readLong() = readLn().toLong()\nprivate fun readLongs() = readLn().split(\" \").map { it.toLong() }\nprivate fun readInt() = readLn().toInt()\nprivate fun readInts() = readLn().split(\" \").map { it.toInt() }\n\n\nfun main() {\n val n = readInt()\n\n if (n % 2 == 0) {\n val valueOf = BigInteger.valueOf((n / 2).toLong())\n println(valueOf.pow(2))\n } else {\n println(0)\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "911138bd269bac24d7f9da110a698302", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "fcfe8300c223efbe9d0b522c5c3d8177", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6949152542372882, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt();\n println( if (n % 2 == 0) n else 0 )\n}", "lang": "Kotlin", "bug_code_uid": "d46e802d0ecaf141249710ff3475f1f9", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "aab899ab124c34c4823b97ab45346a06", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7903225806451613, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val n = readLine()!!.toFloat()\n println( if (n.rem(2) > 0) n.pow(n/2) else 0 )\n}", "lang": "Kotlin", "bug_code_uid": "794aad3156f6d3fe260d8ed909e5da9f", "src_uid": "4b7ff467ed5907e32fd529fb39b708db", "apr_id": "aab899ab124c34c4823b97ab45346a06", "difficulty": 1000, "tags": ["dp", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9512555391432792, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n \nfun main( args: Array) {\n val scan = Scanner( System.`in`)\n \n var num:Int = scan.nextInt()\n var k:Int = scan.nextInt()\n \n println(\"Read num=$num k=$k)\n for( i in 1..k) {\n \tif ( num % 10 > 0 ) {\n num = num - 1\n } else {\n num = num / 10\n }\n }\n println(num)\n}", "lang": "Kotlin", "bug_code_uid": "69989b51ae38c8a7c62cb356b147b2be", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "208a505188c03e687958a98205012c2a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9897750511247444, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\nfun main(args: Array) {\n // Creates a reader instance which takes\n // input from standard input - keyboard\n val reader = Scanner(System.`in`)\n // nextInt() reads the next integer from the keyboard\n var n:Int = reader.nextInt()\n // println() prints the following line to the output screen\n var k:Int = reader.nextInt()\n for(i in 1..k)\n {\n if(n%10)\n n--\n else\n n=n/10\n }\n println(result)\n}\n", "lang": "Kotlin", "bug_code_uid": "dde988aa2819865b5a03918cfa305552", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "7a4569e0cace8f3e481351ab4cc5da21", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6655112651646448, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n var n = args[0].toInt()\n val k = args[1].toInt()\n\n for (i in 1..k) {\n val last = n % 10\n if(last == 0) {\n n /= 10\n } else {\n n -= 1\n }\n }\n\n print(n)\n\n}", "lang": "Kotlin", "bug_code_uid": "6db8e3ecd041ac1f3c08c8b2c41ccf51", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "85d471b0851348411382b76dda19f063", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8473895582329317, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner \nfun main(args: Array) { \n val read = Scanner(System.`in`) \n \n var n = read.nextInt() \n var k = read.nextInt()\n for(var i=0;i) {\n /*if (args.size != 2) {\n println(\"Please provide 2 numbers as command-line arguments\")\n return\n }*/\n\n val (value1, value2) = try {\n Pair(args[0].toInt(), args[1].toInt())\n } catch (ex: Exception) {\n throw IllegalArgumentException(\"Arguments provided are invalid.\\nPlease provide 2 numbers as command-line arguments ${listOf(args)}\")\n }\n val result = subtraction(value1, value2)\n println(result)\n}\n\nfun validateInput(args: Array): Pair {\n val (value1, value2) = try {\n Pair(args[0].toInt(), args[1].toInt())\n } catch (ex: Exception) {\n throw IllegalArgumentException(\"Arguments provided are invalid.\\nPlease provide 2 numbers as command-line arguments \")\n }\n\n if (value1.toDouble() !in 2.toDouble()..10.toDouble().pow(9)) {\n throw IllegalArgumentException(\"First argument must be a value between 2 and 10^9\")\n }\n if (value2 !in 1..50) {\n throw IllegalArgumentException(\"Second argument must be a value between 1 and 50\")\n }\n return Pair(value1, value2)\n}\n\nfun subtraction(value1: Int, value2: Int): Int {\n var finalValue = value1\n for (i in 0 until value2) {\n //non-zero\n val result = if (finalValue % 10 != 0) {\n finalValue - 1\n } else {\n finalValue / 10\n }\n finalValue = result\n }\n return finalValue\n}\n", "lang": "Kotlin", "bug_code_uid": "adfd8501b4de3450e57dff1a40e0cce9", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "8f32b3b575a10e22d1b4d831376572a5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9955022488755623, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n var integer:Int = reader.nextInt()\n var integer1:Int = reader.nextInt()\n while(integer1)\n {\n if(integer%10==0){integer/=10}\n else{\n integer--\n }\n integer1--\n }\n println(integer)\n}", "lang": "Kotlin", "bug_code_uid": "2520adb53e8d81cb294106581db2ff9c", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "84f17a7ee10e56fbbe58a694e77a380f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9425124201561391, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\n \nprivate val OUTPUT_LINES = mutableListOf()\nprivate fun outputLn(s: String) { OUTPUT_LINES += s }\n \nfun go() {\n var (n , k) = readLongs()\n for(i in 1..k){\n if(n%10 == 0)\n n/=10;\n else\n n-=1;\n }\n outputLn(\"${n+1}\")\n}\n \nfun main() {\n val T = readInt()\n for (t in 1..T) { go() }\n println(OUTPUT_LINES.joinToString(\"\\n\"))\n}", "lang": "Kotlin", "bug_code_uid": "15ad92f5cf2dcc92a26f6819f7114e36", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "c7f3d057fc750581d90c60f00eee4678", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.03741746148202495, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.io.OutputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.InputMismatchException\n/**\n* Built using CHelper plug-in\n* Actual solution is at the top\n*/\nobject Main {\n @JvmStatic fun main(args:Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = InputReader(inputStream)\n val out = PrintWriter(outputStream)\n val solver = AWrongSubtraction()\n solver.solve(1, `in`, out)\n out.close()\n }\n internal class AWrongSubtraction {\n fun solve(testNumber:Int, `in`:InputReader, out:PrintWriter) {\n val n = `in`.nextInt()\n val k = `in`.nextInt()\n while (k-- > 0)\n {\n // out.println(n + \" \" + (n % 10));\n if ((n % 10) == 0)\n {\n n /= 10\n }\n else\n {\n n--\n }\n }\n out.println(n)\n }\n }\n internal class InputReader(stream:InputStream) {\n private val stream:InputStream\n private val buf = ByteArray(1024)\n private val curChar:Int = 0\n private val numChars:Int = 0\n private val filter:InputReader.SpaceCharFilter\n init{\n this.stream = stream\n }\n fun read():Int {\n if (numChars == -1)\n {\n throw InputMismatchException()\n }\n if (curChar >= numChars)\n {\n curChar = 0\n try\n {\n numChars = stream.read(buf)\n }\n catch (e:IOException) {\n throw InputMismatchException()\n }\n if (numChars <= 0)\n {\n return -1\n }\n }\n return buf[curChar++].toInt()\n }\n fun nextInt():Int {\n val c = read()\n while (isSpaceChar(c))\n {\n c = read()\n }\n val sgn = 1\n if (c == '-'.toInt())\n {\n sgn = -1\n c = read()\n }\n val res = 0\n do\n {\n if (c < '0'.toInt() || c > '9'.toInt())\n {\n throw InputMismatchException()\n }\n res *= 10\n res += c - '0'.toInt()\n c = read()\n }\n while (!isSpaceChar(c))\n return res * sgn\n }\n fun isSpaceChar(c:Int):Boolean {\n if (filter != null)\n {\n return filter.isSpaceChar(c)\n }\n return isWhitespace(c)\n }\n interface SpaceCharFilter {\n fun isSpaceChar(ch:Int):Boolean\n }\n companion object {\n fun isWhitespace(c:Int):Boolean {\n return c == ' '.toInt() || c == '\\n'.toInt() || c == '\\r'.toInt() || c == '\\t'.toInt() || c == -1\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "a704d7964718aa58690f8b746a27b4b1", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a526641f4d086ac58b1b57dd993c6519", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.43187066974595845, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun getSub(s: Long): Long{\n val n = s%10\n return if(n != 0L)\n s-1\n else s/10\n\n}\n\nfun wrongSub(x: Long, y: Int){\n while(true){\n val s1 = getSub(x)\n if( y == 1) {\n print(s1)\n break\n }\n wrongSub(s1, y-1)\n }\n}\nfun main() {\n val x = readLine()?.toLong()\n val y = readLine()?.toInt()\n wrongSub(x, y)\n\n}", "lang": "Kotlin", "bug_code_uid": "e4933bb931acceb12b8b9461d2df8688", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "8b3c64031d6052315164b12941ec352d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.2898550724637681, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun getSub(s: Long): Long{\n val n = s%10\n return if(n != 0L)\n s-1\n else s/10\n\n}\n\nfun wrongSub(x: Long, y: Int){\n while(true){\n val s1 = getSub(x)\n if( y == 1) {\n print(s1)\n break\n }\n wrongSub(s1, y-1)\n }\n}\nfun main() {\n val n = readLine()?.split(\" \").orEmpty()\n val x = n[0].toLong()\n val y = n[1].toInt()\n wrongSub(x, y)\n\n}", "lang": "Kotlin", "bug_code_uid": "4a2a1217d85d8fa63b93336dc0965206", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "8b3c64031d6052315164b12941ec352d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8867403314917127, "equal_cnt": 12, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 13, "fix_ops_cnt": 13, "bug_source_code": "val parts = readLine()!!.split(' ')\nval n = parts.first().toMutableList()\nval k = parts.last().toInt()\n\nrepeat(k) {\n val lastChar = n.last()\n if (lastChar == '0') {\n n.removeAt(n.lastIndex)\n } else {\n n[n.lastIndex] = lastChar.toInt().dec().toChar()\n }\n}\n\nprintln(n.joinToString(separator = \"\"))", "lang": "Kotlin", "bug_code_uid": "5e0c1a0cdadc55eb463b56fcbb5246f3", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "9adf8dd6af58dfe85be96fdb884d9f7d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9920844327176781, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n \tval(n,k)=readLine()!!.split(' ').map(String::toInt)\n for (i in 1..k) {\n \tif( n % 10 == 0) n = n / 10\n else n = n-1\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "41f179b81a19f76a9a4103e3c41b0aa5", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "9d150fa23b5dda90475878c55889dc83", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.826530612244898, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": " fun main(args: Array) {\n var n = readLine()!!.toInt()\n var k = readLine()!!.toInt()\n for (i in 1..k) {\n \tif( n % 10 == 0) n = n / 10\n else n = n-1\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "3bf9befa01740b9ede3cdd251f366397", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "9d150fa23b5dda90475878c55889dc83", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7009443861490031, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var n = readInts()\n while (n[1] != 0) {\n n.set(1, n[1]-1)\n if (n[0] % 10 == 0)\n n.set(0, n[0]/ 10)\n else\n n.set(0, n[0]-1)\n }\n print(n)\n\n}", "lang": "Kotlin", "bug_code_uid": "5e36c06cbb56199e8a7a4f582c448a6a", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "7d8d66bdf48f0672f45840589c2b6be7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9635036496350365, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array)\n{\n val sc = Scanner(System.`in`)\n\n var n = sc.nextInt() \n var k = sc.nextInt() \n\n for(i in 1..k)\n {\n n = if(n % 10 == 0) {\n n / 10\n } else {\n n - 1\n }\n }\n println(n)\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "c261c647056ab7e4351bdaba5599b452", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3ea258c4ef66fd03a812b2d50234e7cc", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6920289855072463, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array)\n{\n var n: Int =Integer.valueOf(readLine()) \n var k: Int =Integer.valueOf(readLine()) \n\n for(i in 1..k)\n {\n n = if(n % 10 == 0) {\n n / 10\n } else {\n n - 1\n }\n }\n println(n)\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "bca4adb0307ca74aed71fb7649dd3680", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3ea258c4ef66fd03a812b2d50234e7cc", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8772563176895307, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "\nfun main(args :Array) {\n print(wrongSubstraction(args))\n}\n\nfun wrongSubstraction(args: Array): String {\n\n var number = args[0]\n var times = Integer.valueOf(args[1])\n\n while (times > 0) {\n number = wrongSubstractionNumber(number, times)\n times--\n }\n return number\n}\n\nfun wrongSubstractionNumber(number: String, times: Int): String {\n if (number.last() == '0') {\n return number.substring(0, number.length - 1)\n }\n return (Integer.valueOf(number) - 1).toString()\n}\n", "lang": "Kotlin", "bug_code_uid": "3dc6fd937371a5fdfeac33aa5a8e15eb", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "25ecbe6d7eeb86cf1b2d235904fdc517", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8766233766233766, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": " fun main() {\n val n = readLine()!!.toInt()\n val k = readLine()!!.toInt()\n var result = n\n repeat((1..k).count()) {\n if (result % 10 == 0)\n result /= 10\n else\n result--\n }\n\n print(result)\n}", "lang": "Kotlin", "bug_code_uid": "5af142b91055e30cf543f9d105d25acb", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4b8ef612fb14dd6209aeb3f3166dfb14", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.726643598615917, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "fun main(args : Array) {\nvar k: Int\nvar n: Int\n var result = n\n repeat((1..k).count()) {\n if (result % 10 == 0)\n result /= 10\n else\n result--\n }\n\n print(result)\n}", "lang": "Kotlin", "bug_code_uid": "86222785ee7c41604c0f4debd9379f6d", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4b8ef612fb14dd6209aeb3f3166dfb14", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8414298808432631, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": " fun subtract(n: Int, k: Int): String {\n return doSubtract(n.toString(), k)\n }\n\n fun doSubtract(n: String, k: Int): String {\n if (k == 0) {\n return n\n }\n val last = n.takeLast(1)\n println(last)\n return if (last == \"0\") {\n doSubtract(n.dropLast(1), k - 1)\n } else {\n val lastMinusOne = (last.toInt() - 1).toString()\n println(lastMinusOne)\n doSubtract(n.dropLast(1) + lastMinusOne, k - 1)\n }\n }", "lang": "Kotlin", "bug_code_uid": "c3ccfc8440df7392e160d5fa08195366", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "37ae058acd3efa23869bdb79f27ea46c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7688098495212038, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "fun main(args: Array) {\n println(wrongSubtraction(args[0].toInt(), args[1].toInt()))\n}\n\nfun wrongSubtraction(n: Int, k: Int): Int {\n var result = n\n for (i in 1..k) {\n if (result % 10 == 0) {\n result /= 10\n } else {\n result -= 1\n }\n }\n return result\n}", "lang": "Kotlin", "bug_code_uid": "bc7083888eecad45357c0f07d5be74f0", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "0a57bd3732fdc78baedf9bb3c9e6fc69", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6797546012269938, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n val n = args[0]\n var k = args[1].toInt()\n\n val output = with(n.map { it.toString().toInt() }.toMutableList()) {\n while (k-- > 0) {\n if (last() > 0) {\n this[lastIndex] -= 1\n } else {\n removeAt(lastIndex)\n }\n }\n\n this\n }.joinToString(\"\")\n\n println(output)\n}", "lang": "Kotlin", "bug_code_uid": "b42dd0e67f20646da4147c769ba269d6", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "e154df5c0c84c4f3e313b9802666ce9b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9923294307630198, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.File\nimport java.io.InputStream\nimport java.lang.Integer.max\nimport java.util.*\nimport java.util.HashMap\n\nfun T.digitSum() = this.toString().fold(0) { acc, next -> acc + next.toInt() - '0'.toInt() }\n\nfun solve(inp: InputReader) {\n val (n, s) = inp.nextLine().split(\" \").map(String::toInt)\n var current = s\n while (current <= n && current - current.digitSum() < s) {\n current += 1\n }\n val res = max(n - current + 1, 0)\n println(res)\n}\n\n\nfun main(args: Array) = solve(initIO(\"Mine\" in args))\n\nfun initIO(isLocal: Boolean) = when (isLocal) {\n true -> InputReader(File(\"input.txt\").inputStream())\n false -> InputReader(System.`in`)\n}\n\nclass InputReader(inputStream: InputStream) {\n val reader = inputStream.bufferedReader()\n var tokenizer = StringTokenizer(\"\")\n\n fun nextLine(): String = when {\n tokenizer.hasMoreTokens() -> tokenizer.nextToken(\"\")!!\n else -> reader.readLine()!!\n }\n\n fun nextWord(): String {\n while (!tokenizer.hasMoreTokens()) {\n tokenizer = StringTokenizer(nextLine())\n }\n return tokenizer.nextToken()!!\n }\n\n fun nextInt() = nextWord().toInt()\n\n fun nextLong() = nextWord().toLong()\n}\n\n", "lang": "Kotlin", "bug_code_uid": "3f5f88682c3f560ca6f2c3e0d765fd4d", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "apr_id": "aa80a13b24450cbe09e145c96384bbfb", "difficulty": 1600, "tags": ["dp", "math", "brute force", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9177403369672944, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "import java.io.*\nimport java.text.CharacterIterator\nimport java.util.*\n\n/**\n * Created by ramilagger on 6/15/17.\n *\n */\n\nfun sum(n: String): Int {\n var sum = 0\n n.chars().forEach({ \n sum += Character.getNumericValue(it)\n })\n return sum\n}\n\nfun f(n : Long) = n - sum(n.toString())\n\nfun solve(){\n val n = nextLong()\n val s = nextLong()\n var lo = 0L\n var hi = n\n while (lo < hi) {\n val mid = (lo + hi) / 2\n if(f(mid) < s) lo = mid + 1\n else hi = mid - 1\n }\n if(n != hi) pw.println(n - hi + 1)\n else pw.println(if(f(n) < s) 0 else 1)\n}\n\n\nfun hasNext() : Boolean {\n if(st.hasMoreTokens())\n else\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\n//fun nextArray(n : Int) = IntArray(n,{ nextInt() })\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\nval br = if(ONLINE_JUDGE) BufferedReader(InputStreamReader(System.`in`)) else BufferedReader(FileReader(\"in.txt\"))\nval pw = if(ONLINE_JUDGE) PrintWriter(BufferedWriter(OutputStreamWriter(System.out))) else PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\nvar st = StringTokenizer(\"\")\n\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "cecd3ed0d7832da15d62074107d769f3", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "apr_id": "eebc41e695413d167705ff337ee3af82", "difficulty": 1600, "tags": ["dp", "math", "brute force", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9986657771847899, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\n/**\n * Created by ramilagger on 6/15/17.\n *\n */\n\nfun sum(n: String): Int {\n var sum = 0\n for (i in n.indices)\n sum += Character.getNumericValue(n[i])\n return sum\n}\n\nfun f(n : Long) = n - sum(n.toString())\n\nfun solve(){\n val n = nextLong()\n val s = nextLong()\n var lo = 0L\n var hi = n\n while (lo <= hi) {\n val mid = lo + (hi - lo) / 2\n if(f(mid) < s) lo = mid + 1\n else hi = mid - 1\n }\n if(hi == -1L) pw.println(n)\n else {\n if (n != hi) pw.println(n - hi + 1)\n else pw.println(if (f(n) < s) 0 else 1)\n }\n}\n\n\nfun hasNext() : Boolean {\n if(st.hasMoreTokens())\n else\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\nval br = if(ONLINE_JUDGE) BufferedReader(InputStreamReader(System.`in`)) else BufferedReader(FileReader(\"in.txt\"))\nval pw = if(ONLINE_JUDGE) PrintWriter(BufferedWriter(OutputStreamWriter(System.out))) else PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\nvar st = StringTokenizer(\"\")\n\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "4a69495d646e05e96a2af4c464dceb90", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "apr_id": "eebc41e695413d167705ff337ee3af82", "difficulty": 1600, "tags": ["dp", "math", "brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9974968710888611, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/**\n * Created by denis on 18.06.17.\n */\nfun main(args: Array){\n var (x, s) = readLine()!!.split(' ').map(String::toLong)\n var left: Long = 1\n var right: Long = x\n var f: Long\n if (x - num(x) < s) print(0)\n else {\n while(left < right){\n f = (left + right) / 2\n if(f - num(f) >= s) {\n right = f - 1\n }\n else {\n if((f+1) - num(f+1) >= s){\n right = f + 1\n break\n }\n else\n left = f + 1\n }\n }\n print(x - right + 1)\n\n }\n\n }\npublic fun num(xx: Long): Long {\n var sum: Long = 0\n var x: Long = xx\n while(x > 0){\n sum += x % 10\n x /= 10\n }\n return sum\n}\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "1eedd56d8b06be9cb124e92f21c65d23", "src_uid": "9704e2ac6a158d5ced8fd1dc1edb356b", "apr_id": "8dc939e55ea346334af7043d79e3d8b0", "difficulty": 1600, "tags": ["dp", "math", "brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.962536023054755, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n data class R(var t: Long, var m: Int, var f: Boolean)\n readLine()\n readLine()!!.split(\" \").fold(R(1, 1, true)) { acc, i ->\n if (i == \"1\") {\n if (!acc.f) acc.t *= acc.m\n acc.m = 1\n acc.f = false\n } else {\n acc.m++\n }\n acc\n }.run { print(t) }\n}", "lang": "Kotlin", "bug_code_uid": "95714384967efc71841620537dcb53f6", "src_uid": "58242665476f1c4fa723848ff0ecda98", "apr_id": "acc48e110f6fb1d04677586878fe1a84", "difficulty": 1300, "tags": ["combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9665827036104114, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.InputStream\nimport java.util.*\n\nprivate class FScanner internal constructor(inputStream: InputStream = System.`in`) {\n internal val br = BufferedReader(InputStreamReader(inputStream))\n internal var st = StringTokenizer(\"\")\n\n internal fun hasNext(): Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n }\n\n internal operator fun next() =\n if (hasNext()) st.nextToken()!!\n else throw RuntimeException(\"No tokens\")\n\n internal fun nextInt() = next().toInt()\n\n internal fun nextLong() = next().toLong()\n\n internal fun nextLine() =\n if (hasNext()) st.nextToken(\"\\n\")\n else throw RuntimeException(\"No tokens\")\n\n internal fun nextIntArray(n: Int) = IntArray(n, { nextInt() })\n\n internal fun nextLongArray(n: Int) = LongArray(n, { nextLong() })\n}\n\n\nfun main(args: Array) {\n val sc = FScanner()\n val n = sc.nextInt()\n val s = sc.nextLine()\n val b = sc.nextIntArray(n)\n\n val rev = PriorityQueue>(compareBy { it.second })\n var sum = b.sum()\n\n val remChar = IntArray(26)\n (0 until n / 2).forEach {\n val inv = n - it - 1\n if (s[it] == s[inv]) {\n// println(\"${s[it]} - ${b[it]} - ${b[n - it - 1]}\")\n if (b[it] < b[inv]) {\n remChar[s[it].toByte() - 'a'.toByte()]++\n rev += Triple(s[inv], b[inv], s[it])\n sum -= b[it]\n } else {\n remChar[s[inv].toByte() - 'a'.toByte()]++\n rev += Triple(s[it], b[it], s[inv])\n sum -= b[inv]\n }\n } else {\n rev += Triple(s[it], b[it], s[inv])\n rev += Triple(s[inv], b[inv], s[it])\n }\n }\n\n val remStat = PriorityQueue>(compareBy> { -it.second })\n remChar\n .forEachIndexed { index, i ->\n if (i > 0) {\n remStat += Pair((index + 'a'.toByte()).toChar(), i)\n }\n }\n\n// println(remStat.joinToString(\" \"))\n// println(sum)\n\n if (remStat.isNotEmpty()) {\n var x = remStat.poll()\n var xleft = x.second\n while (remStat.isNotEmpty()) {\n val y = remStat.poll()\n if (y.second <= xleft) {\n xleft -= y.second\n } else {\n xleft = y.second - xleft\n x = y\n }\n }\n// println(\"Need remove ${x.first} $xleft\")\n// println(rev.joinToString(\" \"))\n //find different x\n while (xleft > 0) {\n val re = rev.poll()\n if (re.first != x.first && re.third != x.first) {\n// println(\"Remove $re\")\n xleft--\n sum -= re.second\n }\n }\n }\n\n\n\n println(sum)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "4a53edc8fc498b905e146d3a4489bb64", "src_uid": "896555ddb6e1c268cd7b3b6b063fce50", "apr_id": "3d6ced302137845bc025efda1c9e48e7", "difficulty": 2500, "tags": ["graphs", "flows", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9576470588235294, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "import java.io.FileInputStream\nimport kotlin.math.max\n\nfun main() {\n// changeStandardInput()\n val n = readIntLn()\n val a = readInts()\n val freq = IntArray(n + 1)\n\n var maxCount = 0\n var maxValue = 0\n a.forEach { value ->\n freq[value]++\n if (freq[value] > maxCount) {\n maxCount = freq[value]\n maxValue = value\n }\n }\n\n for (i in freq.indices) {\n if (maxCount == freq[i] && maxValue != i) {\n println(n)\n return\n }\n }\n\n var ans = 0\n for (i in freq.indices) {\n if (freq[i] > 0 && i != maxValue) {\n ans = max(ans, findZeroSum(a, i, maxValue))\n }\n }\n\n println(ans)\n}\n\n\nfun findZeroSum(a: List, negValue: Int, posValue: Int): Int {\n val map = HashMap()\n map[0] = -1\n\n var sum = 0\n var bestAns = 0\n\n for (i in a.indices) {\n val value = when (a[i]) {\n negValue -> -1\n posValue -> 1\n else -> 0\n }\n sum += value\n val oppositeIndex = map[sum]\n\n if (oppositeIndex != null) {\n bestAns = max(bestAns, i - oppositeIndex)\n } else {\n map[sum] = i\n }\n }\n\n return bestAns\n}\n\nprivate fun readLn() = readLine()!!\nprivate fun readIntLn() = readLn().toInt()\nprivate fun readLongLn() = readLn().toLong()\nprivate fun readDoubleLn() = readLn().toDouble()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\n\nprivate fun changeStandardInput() {\n System.setIn(FileInputStream(\"input.txt\"))\n}", "lang": "Kotlin", "bug_code_uid": "5d74f0eeb6da94f0b69e10b5cfe14da1", "src_uid": "a06ebb2734365ec97d07cd1b6b3faeed", "apr_id": "69c70d0f7bef9fd44389df23b2ed4253", "difficulty": 2600, "tags": ["data structures", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9817544883958547, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.FileInputStream\nimport kotlin.math.max\n\n\nprivate lateinit var positions: Array>\n\n\nfun main() {\n// changeStandardInput()\n val n = readIntLn()\n val a = readInts()\n\n val freq = IntArray(n + 1)\n\n var maxCount = 0\n var maxValue = 0\n\n positions = Array(n + 1) { mutableListOf() }\n\n a.forEachIndexed { index, value ->\n freq[value]++\n if (freq[value] > maxCount) {\n maxCount = freq[value]\n maxValue = value\n }\n positions[value].add(index)\n }\n\n for (i in freq.indices) {\n if (maxCount == freq[i] && maxValue != i) {\n println(n)\n return\n }\n }\n\n var ans = 0\n for (i in freq.indices) {\n if (freq[i] > 0 && i != maxValue) {\n val cur = findZeroSum2(positions[maxValue], positions[i], maxCount, n)\n ans = max(ans, cur)\n }\n }\n\n println(ans)\n}\n\n\nfun findZeroSum2(aPos: List, bPos: List, maxCount: Int, n: Int): Int {\n val map = IntArray(2 * maxCount + 1) { -100 }\n map[maxCount] = -1\n\n val merged = merge(aPos, bPos, n)\n var sum = 0\n var bestAns = 0\n for (i in merged.indices) {\n val (value, index) = merged[i]\n sum += value\n val oppositeIndex = map[sum + maxCount]\n\n if (oppositeIndex != -100) {\n bestAns = max(bestAns, index - oppositeIndex)\n } else {\n map[sum + maxCount] = index\n }\n }\n\n return bestAns\n}\n\nprivate fun merge(aPos: List, bPos: List, n: Int): List {\n val merged = ArrayList(aPos.size + bPos.size + 2)\n if (aPos[0] != 0 && bPos[0] != 0) {\n merged.add(IntPair(0, 0))\n }\n\n var i = 0\n var j = 0\n while (i < aPos.size || j < bPos.size) {\n if (j >= bPos.size || (i < aPos.size && aPos[i] < bPos[j])) {\n merged.add(IntPair(1, aPos[i++]))\n } else {\n merged.add(IntPair(-1, bPos[j++]))\n }\n }\n if (merged.last().index != n - 1) {\n merged.add(IntPair(0, n - 1))\n }\n return merged\n}\n\n\nprivate data class IntPair(\n val value: Int,\n val index: Int\n) : Comparable {\n override fun compareTo(other: IntPair): Int {\n val cmp = value.compareTo(other.value)\n return if (cmp == 0) index.compareTo(other.index) else cmp\n }\n}\n\nfun findZeroSum(a: List, negValue: Int, posValue: Int, maxCount: Int): Int {\n val map = IntArray(2 * maxCount + 1) { -100 }\n map[maxCount] = -1\n\n var sum = 0\n var bestAns = 0\n\n for (i in a.indices) {\n val value = when (a[i]) {\n negValue -> -1\n posValue -> 1\n else -> 0\n }\n sum += value\n val oppositeIndex = map[sum + maxCount]\n\n if (oppositeIndex != -100) {\n bestAns = max(bestAns, i - oppositeIndex)\n } else {\n map[sum + maxCount] = i\n }\n }\n\n return bestAns\n}\n\nprivate fun readLn() = readLine()!!\nprivate fun readIntLn() = readLn().toInt()\nprivate fun readLongLn() = readLn().toLong()\nprivate fun readDoubleLn() = readLn().toDouble()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\n\nprivate fun changeStandardInput() {\n System.setIn(FileInputStream(\"input.txt\"))\n}", "lang": "Kotlin", "bug_code_uid": "a2a26bb48f0c748646060af4325863f7", "src_uid": "a06ebb2734365ec97d07cd1b6b3faeed", "apr_id": "69c70d0f7bef9fd44389df23b2ed4253", "difficulty": 2600, "tags": ["data structures", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984987034256858, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.FileInputStream\nimport kotlin.math.max\n\n\nprivate lateinit var positions: Array>\n\n\nfun main() {\n// changeStandardInput()\n val n = readIntLn()\n val a = readInts()\n\n val freq = IntArray(n + 1)\n\n var maxCount = 0\n var maxValue = 0\n\n positions = Array(n + 1) { mutableListOf() }\n\n a.forEachIndexed { index, value ->\n freq[value]++\n if (freq[value] > maxCount) {\n maxCount = freq[value]\n maxValue = value\n }\n positions[value].add(index)\n }\n\n for (i in freq.indices) {\n if (maxCount == freq[i] && maxValue != i) {\n println(n)\n return\n }\n }\n\n var ans = 0\n for (i in freq.indices) {\n if (freq[i] > 0 && i != maxValue) {\n val cur = findZeroSum2(positions[maxValue], positions[i], maxCount, n)\n ans = max(ans, cur)\n }\n }\n\n println(ans)\n}\n\nval map = IntArray(400_010)\n\nfun findZeroSum2(aPos: List, bPos: List, maxCount: Int, n: Int): Int {\n map.fill(-100, 2 * maxCount + 2)\n\n map[maxCount] = -1\n\n merge(aPos, bPos, n)\n var sum = 0\n var bestAns = 0\n for (i in 0 until size) {\n val (value, index) = merged[i]\n sum += value\n val oppositeIndex = map[sum + maxCount]\n\n if (oppositeIndex != -100) {\n val r = if (i + 1 < size) merged[i + 1].index else index\n val rDiff = if (r != index) 1 else 0\n bestAns = max(bestAns, (r - rDiff) - oppositeIndex)\n } else {\n map[sum + maxCount] = index\n }\n }\n\n return bestAns\n}\n\nprivate var size = 0\nprivate val merged = Array(200_002) {\n IntPair(0, 0)\n}\n\nprivate fun merge(aPos: List, bPos: List, n: Int) {\n size = 0\n if (aPos[0] != 0 && bPos[0] != 0) {\n merged[size].index = 0\n merged[size].value = 0\n size++\n }\n\n var i = 0\n var j = 0\n while (i < aPos.size || j < bPos.size) {\n if (j >= bPos.size || (i < aPos.size && aPos[i] < bPos[j])) {\n merged[size].value = 1\n merged[size].index = aPos[i++]\n } else {\n merged[size].value = -1\n merged[size].index = bPos[j++]\n }\n size++\n }\n\n if (merged[size - 1].index != n - 1) {\n merged[size].value = 0\n merged[size].index = n - 1\n size++\n }\n}\n\n\nprivate data class IntPair(\n var value: Int,\n var index: Int\n) : Comparable {\n override fun compareTo(other: IntPair): Int {\n val cmp = value.compareTo(other.value)\n return if (cmp == 0) index.compareTo(other.index) else cmp\n }\n}\n\nfun findZeroSum(a: List, negValue: Int, posValue: Int, maxCount: Int): Int {\n val map = IntArray(2 * maxCount + 1) { -100 }\n map[maxCount] = -1\n\n var sum = 0\n var bestAns = 0\n\n for (i in a.indices) {\n val value = when (a[i]) {\n negValue -> -1\n posValue -> 1\n else -> 0\n }\n sum += value\n val oppositeIndex = map[sum + maxCount]\n\n if (oppositeIndex != -100) {\n bestAns = max(bestAns, i - oppositeIndex)\n } else {\n map[sum + maxCount] = i\n }\n }\n\n return bestAns\n}\n\nprivate fun readLn() = readLine()!!\nprivate fun readIntLn() = readLn().toInt()\nprivate fun readLongLn() = readLn().toLong()\nprivate fun readDoubleLn() = readLn().toDouble()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\n\nprivate fun changeStandardInput() {\n System.setIn(FileInputStream(\"input.txt\"))\n}", "lang": "Kotlin", "bug_code_uid": "53f55b02d277aaa2d745666e1e45b57a", "src_uid": "a06ebb2734365ec97d07cd1b6b3faeed", "apr_id": "69c70d0f7bef9fd44389df23b2ed4253", "difficulty": 2600, "tags": ["data structures", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9982935153583617, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport java.text.SimpleDateFormat\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val a = sc.nextLine()\n val b = sc.nextLine()\n val c = SimpleDateFormat(\"HH:mm\")\n val d1 = c.parse(a)\n val d2 = c.parse(b)\n var e = d1.time - d2.time\n if (e < 0)\n e += 24 * 60 * 60 * 1000\n val h = e/(60 * 60 * 1000)\n val m = (e%(60 * 60 * 1000))/(60 * 1000)\n when {\n h<10&&m<10 -> println(\"0$h:0$m\")\n h>10&&m<10 -> println(\"$h:0$m\")\n h<10&&m>10 -> println(\"0$h:$m\")\n else -> println(\"$h:$m\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "b436544ad707203a22eaccbb1f683c3b", "src_uid": "595c4a628c261104c8eedad767e85775", "apr_id": "3d609af854907868cc4fb62932f242aa", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8673740053050398, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n var (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n var step = 0\n var gabage = 0\n while (n > 0 || gabage > k) {\n step += n\n n /= k\n gabage += n % k\n step += gabage / k\n gabage = gabage % k\n }\n println(step)\n}", "lang": "Kotlin", "bug_code_uid": "59550223e23b029ab103a3e17fc193f5", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "1c6c06f2de09b9af76e11f26ffb0f32b", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9622212107419208, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.*\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport kotlin.concurrent.thread\nimport kotlin.math.roundToInt\n\n\nobject programkt {\n abstract class Task {\n fun > min(a: T, b: T) = if (a > b) b else a\n fun > max(a: T, b: T) = if (a < b) b else a\n fun abs(a: T) = if(a > 0) a else -(a)\n fun abs(a: T) = if(a > 0) a else -(a)\n fun abs(a: T) = if(a > 0) a else -(a)\n abstract fun solve(scanner: FastScanner, printer: PrintWriter)\n }\n\n class FastScanner(inpStr: InputStream, var br: BufferedReader = BufferedReader(InputStreamReader(inpStr)), var stok: StringTokenizer? = null){\n private fun nextToken(): String? {\n while (stok == null || !stok!!.hasMoreTokens())\n stok = StringTokenizer(br.readLine() ?: return null)\n return stok!!.nextToken()\n }\n\n fun nextInt() = nextToken()!!.toInt()\n fun nextLong() = nextToken()!!.toLong()\n fun nextDouble() = nextToken()!!.toDouble()\n fun nextChar() = br.read().toChar()\n fun nextString() = nextToken()!!\n fun nextLine() = br.readLine()\n fun nextBigInteger() = BigInteger(nextToken()!!)\n fun nextBigDecimal() = BigDecimal(nextToken()!!)\n }\n\n @JvmStatic fun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val scanner = FastScanner(inputStream)\n val printer = PrintWriter(outputStream)\n\n /* TASK */\n val solver = TaskC()\n /* TASK */\n\n solver.solve(scanner, printer)\n printer.close()\n }\n\n class TaskA: Task() {\n override fun solve(scanner: FastScanner, printer: PrintWriter) {\n val length = scanner.nextInt()\n val check = { a: Int, b: Int -> abs(a-b) <= 1 }\n val arr = Array(length) { 0 }\n (0 until length).forEach { arr[it] = scanner.nextInt() }\n\n (0 until length).forEach {l ->\n (l until length).forEach { r ->\n }\n }\n }\n }\n\n class TaskC: Task() {\n override fun solve(scanner: FastScanner, printer: PrintWriter) {\n var a = scanner.nextLong()\n var b = scanner.nextLong()\n var c = 0L\n var cnt = 0L\n while(a >= 0) {\n a--\n cnt++\n c++\n if(c==b) a++\n }\n printer.println(cnt)\n }\n }\n\n class TaskG: Task() {\n override fun solve(scanner: FastScanner, printer: PrintWriter) {\n fun code(n: Long, x: Long): Long {\n var count = 0L\n if(x == 1L) return 1L\n for(i in (1L..n+1L)) {\n if(i == 1L && n >= x) {\n count += 1\n } else if(x % i == 0L && i != 1L && x <= n * i) {\n count += 1\n }\n }\n return count\n }\n val n = scanner.nextLong()\n val x = scanner.nextLong()\n if(n < x/n) {\n println(0)\n System.exit(0)\n }\n printer.println(code(n,x))\n }\n }\n\n class TaskI: Task() {\n override fun solve(scanner: FastScanner, printer: PrintWriter) {\n val word = scanner.nextString()\n\n val crossedResult = scanner.nextString()\n val crossIndexOrder = Array(word.length) { scanner.nextInt() }\n val wordCharArray = Array(word.length, word::get)\n\n var lastIndex = -1\n\n crossIndexOrder.forEachIndexed { index, item ->\n wordCharArray[item - 1] = null\n\n val checkString = wordCharArray.toFancyString()\n val checkResult = checkString.contains(crossedResult)\n if (checkResult) lastIndex = index + 1\n if (checkString.length <= crossedResult.length) {\n println(lastIndex)\n return\n }\n }\n }\n\n private fun Array.toFancyString() = joinToString(separator = \"\") { it?.toString() ?: \"\" }\n }\n}", "lang": "Kotlin", "bug_code_uid": "6e5d0218024e60cabe9e97a9a2bccf66", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "1ff93357e9f7d2ea032ade3a4c26afca", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8275862068965517, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "fun main(){\n var (a,b) = readLine()!!.split(' ').map { it.toInt() }\n\n var sum = a\n while(a != 0){\n a /= b\n sum += a\n }\n\n println(sum)\n}", "lang": "Kotlin", "bug_code_uid": "baaf4c85b44ab3c813c92cc447290fcf", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "dfa9826c3e1dcbe166cb2f070ea9deed", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8137108792846498, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (a, b) = br.readLine().split(\" \").map { it.toInt() }\n var i = a/b\n var remCandles = 0\n while (i > 0){\n i /= b\n if (i != 0) remCandles++\n }\n println(a + a/b + remCandles)\n}", "lang": "Kotlin", "bug_code_uid": "745d4a9db46ffa51cdd24ea8c23d0986", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "ef2d3ac7f78c6794f36a03bbebc53290", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.803030303030303, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (a, b) = br.readLine().split(\" \").map { it.toInt()}\n var i = a\n var candles = a\n while (i > 1){\n i /= b\n candles += i\n i += i % b\n }\n println(candles)\n}", "lang": "Kotlin", "bug_code_uid": "999ace11760b3cba541c2ca13e1403b3", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "ef2d3ac7f78c6794f36a03bbebc53290", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.804630969609262, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (a, b) = br.readLine().split(\" \").map { it.toInt()}\n var i = a\n var candles = a\n var rest = 0\n while (i > 1){\n rest += i % b\n i /= b\n candles += i\n }\n println(candles + rest / b)\n}", "lang": "Kotlin", "bug_code_uid": "62dc545999c105f9cca9676d8ccea2d9", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "ef2d3ac7f78c6794f36a03bbebc53290", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8915254237288136, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (a, b) = br.readLine().split(\" \").map { it.toInt()}\n var i = a\n var candles = a\n while (i >= b){\n candles += i/b\n i = i/b + i % b\n }\n\n println(candles)\n}", "lang": "Kotlin", "bug_code_uid": "fa7b47f315537480f391962facf59401", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "ef2d3ac7f78c6794f36a03bbebc53290", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6973684210526315, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n var (dividend, divisor) = readLine()?.split(\" \")!!.map { s -> s.toInt() }\n var total = 0\n while (dividend >= divisor) {\n total += dividend\n val remainder = dividend % divisor\n dividend /= divisor\n dividend += remainder\n }\n print(total + dividend)\n}\n", "lang": "Kotlin", "bug_code_uid": "9ed5740ee6874e4c005103497623821d", "src_uid": "a349094584d3fdc6b61e39bffe96dece", "apr_id": "d90ddbb028ea45ca1fc078435a607d7a", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9989837398373984, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.StringTokenizer\n\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n\n val s = sc.next()\n\n for (i in 0 until s.length) {\n if (s[i] == '1') {\n var sum = 0\n for (j in i until s.length) {\n if (s[j] == '0') sum += 0\n }\n if (sum >= 6) println(\"yes\")\n else println(\"no\")\n return\n\n }\n }\n println(\"no\")\n\n}\n\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "3600b10b8c43cde6f93645b296fd4f3f", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "apr_id": "2e67d93ec050bd99b0489f87c11fae09", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.623608017817372, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val s = readLine()!!\n var c = 0\n for (i in (s.length-1).downTo(0)){\n if(s[i]=='1'&&c==6) return print(\"yes\")\n if(s[i]=='0') c++\n }\n print(\"no\")\n}", "lang": "Kotlin", "bug_code_uid": "af74663ccebf0825bae90232bcece914", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "apr_id": "6392213ec538cd43c0a73788fda79c1f", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9826086956521739, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n println(if (readLine()!!.matches(\".*1+[01*]{6,}\".toRegex())) \"yes\" else \"no\")\n}", "lang": "Kotlin", "bug_code_uid": "0bf0145807962d5dbbdfc67ff907e53b", "src_uid": "88364b8d71f2ce2b90bdfaa729eb92ca", "apr_id": "09d17a30b103d7dc7ae0f5cfff0f0d45", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8080971659919028, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 15, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\n\nfun PrintWriter.solve(sc: FastScanner) {\n val n = sc.nextInt()\n val p = Array(n) { sc.nextInt() }\n var even = n / 2\n var odd = (n + 1) / 2\n for (i in 0 until n) {\n if (p[i] != 0) {\n if (p[i] % 2 == 0) even--\n else odd--\n }\n }\n var ans = 0\n val ee = mutableListOf()\n val eo = mutableListOf()\n val oo = mutableListOf()\n val e = mutableListOf()\n val o = mutableListOf()\n var streak = 0\n for (i in 0 until n) {\n if (p[i] == 0) streak++\n else {\n if (streak == i) {\n if (p[i] % 2 == 0) e.add(streak)\n else o.add(streak)\n } else {\n val j = i - streak - 1\n if (p[i] % 2 == 0 && p[j] % 2 == 0) ee.add(streak)\n else if (p[i] % 2 == 1 && p[j] % 2 == 1) oo.add(streak)\n else eo.add(streak)\n }\n streak = 0\n }\n }\n if (streak > 0) {\n val j = n - streak - 1\n if (p[j] % 2 == 0) e.add(streak)\n else o.add(streak)\n }\n for (s in ee) {\n if (s == 0) continue\n even -= s\n if (even < 0) ans += 2\n }\n for (s in oo) {\n if (s == 0) continue\n odd -= s\n if (odd < 0) ans += 2\n }\n for (s in e) {\n if (s == 0) continue\n even -= s\n if (even < 0) ans++\n }\n for (s in o) {\n if (s == 0) continue\n odd -= s\n if (odd < 0) ans++\n }\n ans += eo.count()\n println(ans)\n}\n\nfun main() {\n val writer = PrintWriter(System.out, false)\n writer.solve(FastScanner(System.`in`))\n writer.flush()\n}\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n", "lang": "Kotlin", "bug_code_uid": "43545177511d75c9904993bc704eb529", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "d89b51e507cf7a6728ea7fb172d0c7d8", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9622496147919877, "equal_cnt": 20, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 19, "fix_ops_cnt": 19, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\n\nfun PrintWriter.solve(sc: FastScanner) {\n val n = sc.nextInt()\n val p = Array(n) { sc.nextInt() }\n var even = n / 2\n var odd = (n + 1) / 2\n for (i in 0 until n) {\n if (p[i] != 0) {\n if (p[i] % 2 == 0) even--\n else odd--\n }\n }\n var ans = 0\n val ee = mutableListOf()\n val eo = mutableListOf()\n val oo = mutableListOf()\n val e = mutableListOf()\n val o = mutableListOf()\n var streak = 0\n for (i in 0 until n) {\n if (p[i] == 0) streak++\n else {\n if (streak == i) {\n if (p[i] % 2 == 0) e.add(streak)\n else o.add(streak)\n } else {\n val j = i - streak - 1\n if (p[i] % 2 == 0 && p[j] % 2 == 0) ee.add(streak)\n else if (p[i] % 2 == 1 && p[j] % 2 == 1) oo.add(streak)\n else eo.add(streak)\n }\n streak = 0\n }\n }\n if (streak == n) {\n println(if (n == 1) 0 else 1)\n return\n }\n if (streak > 0) {\n val j = n - streak - 1\n if (p[j] % 2 == 0) e.add(streak)\n else o.add(streak)\n }\n ee.sort()\n oo.sort()\n e.sort()\n o.sort()\n for (s in ee) {\n val num = minOf(s, even)\n if (s > even) ans += 2\n even -= num\n odd -= s - num\n }\n for (s in oo) {\n val num = minOf(s, odd)\n if (s > odd) ans += 2\n odd -= num\n even -= s - num\n }\n for (s in e) {\n val num = minOf(s, even)\n if (s > even) ans++\n even -= num\n odd -= s - num\n }\n for (s in o) {\n val num = minOf(s, odd)\n if (s > odd) ans++\n odd -= num\n even -= s - num\n }\n ans += eo.count()\n println(ans)\n}\n\nfun main() {\n val writer = PrintWriter(System.out, false)\n writer.solve(FastScanner(System.`in`))\n writer.flush()\n}\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n", "lang": "Kotlin", "bug_code_uid": "a8ff5a0c26384b3115318985205f0464", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "d89b51e507cf7a6728ea7fb172d0c7d8", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8465473145780051, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": " import java.util.*\n\n data class Row(var left: Int = -1, var right: Int = -1, var length: Int = 0)\n\n fun main(args: Array){\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n if (n==1){\n println(0)\n return\n }\n var even = n/2 + n%2\n var odd = n/2\n val rows = arrayListOf()\n var left = -1\n var right = -1\n var answer = 0\n var length = 0\n for (i in 0 until n){\n var a = scanner.nextInt()\n if (a==0){\n length++\n continue\n }\n\n if (length==0){\n a%=2\n if (a!=left && left!=-1){\n answer++\n }\n left=a\n if (a==0){\n odd--\n }\n else{\n even--\n }\n }\n else{\n right = a%2\n rows.add(Row(left, right, length))\n left = right\n right=-1\n length=0\n if (a%2==0){\n odd--\n }\n else{\n even--\n }\n }\n }\n if (length!=0){\n rows.add(Row(left, right, length))\n }\n rows.sortBy { it.length }\n for (row in rows){\n if (row.left ==-1 && row.right==-1){\n answer+=1\n continue\n }\n if (row.left ==-1 || row.right==-1){\n if (row.left+row.right+1==0){\n if (row.length<=odd){\n odd-=row.length\n }\n else{\n answer+=1\n }\n }\n else{\n if (row.length<=even){\n even-=row.length\n }\n else{\n answer+=1\n }\n }\n continue\n }\n\n if (row.left!=row.right){\n answer++\n }\n else{\n if (row.left==0){\n if (row.length<=odd){\n odd-=row.length\n }\n else{\n answer+=2\n }\n }\n else{\n if (row.length<=even){\n even-=row.length\n }\n else{\n answer+=2\n }\n }\n }\n }\n println(answer)\n }", "lang": "Kotlin", "bug_code_uid": "1808b113578ce74e252e8aa994cde6ac", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "be1e4a4d16fe8900cd51398b92d8f8c3", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9919191919191919, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n fun Boolean.toInt() = if (this) 1 else 0\n val board = Array(4) { readLine()!! }\n for (r in 0..2)\n for (c in 0..2) {\n var counter = 0\n counter += (board[r][c] == board[r][c + 1]).toInt()\n counter += (board[r][c] == board[r + 1][c]).toInt()\n counter += (board[r][c] == board[r + 1][c + 1]).toInt()\n if (counter >= 2) {\n print(\"YES\")\n return\n }\n }\n print(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "0da422bac19b92240034fee53f1fad6c", "src_uid": "01b145e798bbdf0ca2ecc383676d79f3", "apr_id": "cdacab189976afd957c41bf4cfea3786", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6495263870094723, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\nimport kotlin.system.exitProcess\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var a = sc.nextInt()\n var b = sc.nextInt()\n var c = sc.nextInt()\n a *= 10\n for(i in 1..100000) {\n if(c == (a / b) % 10) {\n println(i)\n exitProcess(0)\n }\n a *= 10\n }\n println(-1)\n}\n\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "2f820a0d44a3c948b40deab7bf29f606", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "apr_id": "bc6af57b7144618cadaec24e40438c8a", "difficulty": 1300, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9614512471655329, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (a, b, c) = readInts()\n var dividend = 10 * (a % b)\n var quotient = dividend / b\n var sol = 1\n val visited = mutableSetOf()\n while (quotient != c) {\n sol++\n if (quotient in visited) return print(-1)\n visited.add(quotient)\n dividend = 10 * dividend % b\n quotient = dividend / b\n }\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "f324cef3b56cd50b8ca34dc80f8cb1c2", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "apr_id": "be760eb2d14fa0090e540422307d6763", "difficulty": 1300, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9136939010356732, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n a %= b\n a*=10\n var n = 1\n val met: MutableSet = mutableSetOf(a)\n while (true) {\n if (a / b == c) {\n print(n)\n return\n }\n a %= b\n if (met.contains(a)) {\n print(-1)\n return\n }\n met.add(a)\n a*=10\n n++\n }\n}", "lang": "Kotlin", "bug_code_uid": "6c539e8b04e9b45205106d6dfcd591a7", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "apr_id": "5176864566aef0eaee8be73ff6d69755", "difficulty": 1300, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9108695652173913, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n a %= b\n a *= 10\n var n = 1\n val met: MutableSet = hashSetOf()\n while (true) {\n if (a / b == c) {\n print(n)\n return\n }\n if (a > b) {\n if (met.contains(a)) {\n print(-1)\n return\n }\n met.add(a)\n }\n a %= b\n a *= 10\n n++\n }\n}", "lang": "Kotlin", "bug_code_uid": "66b2bfc49dae44e1fcc96b806928fc2e", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910", "apr_id": "5176864566aef0eaee8be73ff6d69755", "difficulty": 1300, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6152046783625731, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*\n \nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n\tval arr=readLine()!!.split(\" \").map{it.toInt()}\n var i=1\n while(true)\n {\n \tif(i%2==0)\n \tarr[1]=arr[1]-i\n \telse \n arr[0]=arr[0]-i\n \tif(arr[0]<0 || arr[1]<0) \n break\n \ti=i+1\n }\n if(arr[1]<0)\n print(\"Valera\")\n else\n print(\"Vladik\")\n\n\t\n}\n", "lang": "Kotlin", "bug_code_uid": "e425a84817ab9aa9dbb90dab09df4262", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "apr_id": "90f7e09367a984c56e3025fa5692c7f1", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9896193771626297, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\n\nfun main(args: Array)\n{\n var reg=Regex(\" \")\n var s=readLine()!!.split(reg)\n var a=s[0].toInt()\n var b=s[1].toInt()\n var i=0\n var flag=0\n var demand=1\n while(a>0&&b>0)\n {\n if(i%2==0)\n {\n if(a= give) a -= give else return print(\"Vladik\")\n if (b >= give + 1) b -= give + 1 else return print(\"Valera\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "2c2b8d44ab8c6df1021e9c9e724cafa6", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "apr_id": "d153aaf7d85e98ed51d62c90a9261786", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.997883149872989, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun min(a:Double,b:Double) = if (ab) a else b\nfun min(a:Long,b:Long) = if (ab) a else b\n\nvar cin: BufferedReader? = null\nvar cout: PrintWriter? = null\nvar tok = StringTokenizer(\"\")\nfun init() {\n Locale.setDefault(Locale.US)\n cin = BufferedReader(InputStreamReader(System.`in`))\n cout = PrintWriter(System.`out`)\n}\n\nvar nul=0.toLong();\nvar one=1.toLong();\nvar two=2.toLong();\nvar three=3.toLong();\nvar four=4.toLong();\nvar five=5.toLong();\nfun powmod(a:Long,b:Long,mod:Long):Long {\n\n if (b==1.toLong()) return a;\n var k=powmod(a,b/2,mod);\n if (b%2==0.toLong())\n { return (k*k)%mod }\n else { k=k*k; k=k%mod; k=k*a; k=k%mod; return k; }\n}\nfun prime (p:Long):Long {\n if (p==one) return 0.toLong();\n var i=two;\n while (i*i<=p) {if (p%i==nul) return i; i++; }\n return one;\n}\nfun inv (a:Long,mod:Long):Long {\nreturn powmod(a,mod-2,mod);\n}\n\nfun readString(): String {\n while (!tok.hasMoreTokens()) {\n tok = StringTokenizer(cin!!.readLine())\n }\n return tok.nextToken()\n}\n\n\nfun readInt() = readString().toInt()\n\nfun readIntArray(size: Int) = Array(size, { i -> readInt() })\n\nfun readLong() = readString().toLong()\nfun readLongArray(size: Long) = Array(size.toInt(), { i -> readLong() })\nfun readLn():String = readLine()!!.toString()\nfun readLongs() = readLn().split(\" \").map{it.toLong()}\nfun solve() {\n\n\n /*\n var map=hashMapOf();\n map[q] <=> map.getOrDefault(q,0)\n \u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043f\u0430\u0440 - k=v.sortedWith(compareBy({it.first},{it.second}));\n prLong(\"${k[i].second}\"); - \u0432\u044b\u0432\u043e\u0434 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0430\u0440\u044b\n var m=ArrayList (); <=> vector\n getline(cin,a) <=> readLine()!!.last()\n readLong() - \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e\n readLongs() - \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u0435\u043b\n readLine()!!.toCharArray() - \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0447\u0430\u0440\u043e\u0432 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438\n\n */\n /* --------- */\n // \u0412\u0421\u0415\u0413\u0414\u0410 \u041f\u0418\u0421\u0410\u0422\u042c \u0412 \u041b\u041e\u041d\u0413\u0410\u0425\n var q=readLongArray(two);\n var x=q[0];\n var y=q[1];\n var cur=one;\n var ans1=nul;\n var ans2=nul;\n while (x>=cur) {x-=cur; ans1++; cur+=2; }\n cur=two;\n while (y>=cur) {y-=cur; ans2++; cur+=2; }\n if (x>y) print(\"Valera\"); else print(\"Vladik\");\n\n /* --------- */\n\n}\n\nfun main() {\n init();\n\n var T=one;\n //T=readLong();\n for (i55555 in 1..T) solve()\n}\n", "lang": "Kotlin", "bug_code_uid": "85162ffe22f7265a870e2dab4bfbb1c5", "src_uid": "87e37a82be7e39e433060fd8cdb03270", "apr_id": "54383ef41ef1b14df3f8cd487ba7de2a", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7296898079763663, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n var sc = Scanner(System.`in`)\n while(true) {\n var n = sc.nextInt()\n var m = sc.nextInt()\n var i = 0\n while (m >= 0) {\n var index = (i % n) + 1\n if (m < index) break\n m -= index\n i++\n }\n print(m)\n }\n}", "lang": "Kotlin", "bug_code_uid": "3ba257dc37f5fcae608dd94a11f8f56a", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "apr_id": "ff650de31fb0a79b1301e375e2e8175e", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9377845220030349, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val n : Long\n var b : Long\n var h : Long\n var k : Long = 0\n val scan = Scanner(System.`in`)\n n = scan.nextLong()\n b = scan.nextLong()\n h = b\n while (b > 0){\n println(k)\n k++\n h -= k\n if (k == n) k = 0\n b-= k +1;\n }\n println(h)\n\n}", "lang": "Kotlin", "bug_code_uid": "4a86d7ab6536951199acb7735b1106cc", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "apr_id": "f64e5b90d61128885807a83e6126dd53", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9691629955947136, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val n : Long\n var b : Long\n var h : Long\n var k : Long = 0\n val scan = Scanner(System.`in`)\n n = scan.nextLong()\n b = scan.nextLong()\n h = b\n while (b > 0){\n println(k)\n k++\n h -= k\n if (k == n) k = 0\n b-= k +1;\n }\n println(h)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "d527f62a6f1b1c106eaa694e4850e066", "src_uid": "5dd5ee90606d37cae5926eb8b8d250bb", "apr_id": "f64e5b90d61128885807a83e6126dd53", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7992007992007992, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val s = readLine()!!\n var curSide = 0\n curSide = if (s.length % 2 == 0)\n 1\n else -1\n\n var source = 0\n var target = s.length - 2\n if (s.length == 1) target = 0\n val ar = CharArray(s.length)\n var modifier = -2\n while (source < s.length) {\n ar[target] = s[source]\n source++\n if (target == 0) {\n target = 1\n modifier = 2\n } else\n target += modifier\n }\n println(ar.joinToString(\"\"))\n}", "lang": "Kotlin", "bug_code_uid": "d1550f2ccd49e9398fb9f0adf67658fb", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "apr_id": "fd24b3b0d47ba9674df803054b3eaacd", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9738610903659447, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nfun main(args: Array) {\n// var n = readLine()!!.toInt()\n// var arr2 = readLine()!!.split(\" \").map { x -> x.toInt() }\n// var arr = readLine()!!.split(\" \").map { x -> x.toInt() }\n//\n// var n = arr[0]\n// var k = arr[1]\n//\n// var x = n/(k-1)*k+k-1\n//\n// while ((x/k) * (x%k) != n) {\n//\n// x*=2\n// }\n\n var str = readLine()!!\n\n if (str.length == 1) {\n print(str)\n return\n }\n\n var n = str.length / 2-1\n var res = \"\"\n var k = -1\n for ((i, s) in str.withIndex()) {\n n += i * k\n if (str.indices.contains(n))\n res += str[n]\n k*=-1\n\n }\n\n println(res)\n}\n", "lang": "Kotlin", "bug_code_uid": "4b22b9d72f5d14946e1ca43ab42f9c6c", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "apr_id": "63c0a849d309dd417312c67527b300f7", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.12628865979381443, "equal_cnt": 10, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "\nfun main(args : Array) {\n\n val F = readLine()!!\n val M = readLine()!!\n val S = readLine()!!\n\n if(F==M && F==S && M==S){ println(\"?\") }\n else if(F!=M && F!=S && M!=S){ println(\"?\") }\n else if(F==\"rock\" && M==\"paper\"){\n if(M==S) { println(\"?\") }\n else{ println(\"M\") }\n }\n else if(M==\"rock\" && F==\"paper\"){\n if(F==S) { println(\"?\") }\n else{ println(\"F\") }\n }\n else if(S==\"rock\" && M==\"paper\"){\n if(M==F) { println(\"?\") }\n else{ println(\"M\") }\n }\n\n else if(F==\"scissors\" && M==\"paper\"){\n if(M==S) { println(\"F\") }\n else{ println(\"?\") }\n }\n else if(M==\"scissors\" && F==\"paper\"){\n if(F==S) { println(\"M\") }\n else{ println(\"?\") }\n }\n else if(S==\"scissors\" && M==\"paper\"){\n if(M==F) { println(\"S\") }\n else{ println(\"?\") }\n }\n\n else if(F==\"scissors\" && M==\"rock\"){\n if(M==S) { println(\"?\") }\n else{ println(\"M\") }\n }\n else if(M==\"scissors\" && F==\"rock\"){\n if(F==S) { println(\"?\") }\n else{ println(\"F\") }\n }\n else if(S==\"scissors\" && M==\"rock\"){\n if(M==F) { println(\"?\") }\n else{ println(\"M\") }\n }\n}", "lang": "Kotlin", "bug_code_uid": "b61f397f5cca95b203a624507558463e", "src_uid": "072c7d29a1b338609a72ab6b73988282", "apr_id": "c33039a3c9551c9de35c3486554468c9", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9913544668587896, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val hands = IntArray(3)\n val stringToNum = mapOf(\"rock\" to 1, \"paper\" to 2, \"scissors\" to 4)\n val posToWinner = \"FMS\"\n for (pos in 0..2) hands[pos] = stringToNum[readLine()!!]!!\n for (pos in 0..2)\n if (hands[pos] == hands[(pos + 1) % 3] + hands[(pos + 2) % 3]) return print(posToWinner[pos])\n print('?')\n}", "lang": "Kotlin", "bug_code_uid": "fcab3d576c9309c5b6b779b3f12e8dba", "src_uid": "072c7d29a1b338609a72ab6b73988282", "apr_id": "5add482b879b5f04534fac9bff79c850", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9221902017291066, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val hands = IntArray(3)\n val stringToNum = mapOf(\"rock\" to 1, \"paper\" to 2, \"scissors\" to 4)\n val posToWinner = \"FMS\"\n for (pos in 0..2) hands[pos] = stringToNum[readLine()!!]!!\n for (pos in 0..2)\n if (hands[pos] == hands[(pos + 1) % 7] + hands[(pos + 2) % 7]) return print(posToWinner[pos])\n print('?')\n}", "lang": "Kotlin", "bug_code_uid": "d0ba6c0d9048c0a29e78f0d0fed0bb5e", "src_uid": "072c7d29a1b338609a72ab6b73988282", "apr_id": "5add482b879b5f04534fac9bff79c850", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8928571428571429, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val a = readLine()!!.trim()\n val voewels = arrayOf('a','e','i','o','u')\n val evens = arrayOf('0','2','4','6','8')\n val r = a.count { it in voewels || it in evens }\n println(r)\n}", "lang": "Kotlin", "bug_code_uid": "8dbfec3024deb09f17fab745a33183b1", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "apr_id": "c83605a69e8f3bfa958a938bb46df47e", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9983388704318937, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val vowels = listOf('a', 'e', 'i', 'o', 'u')\n val digits = \"1234567890\".toList()\n val s = Scanner(System.`in`)\n with(s) {\n var total = 0\n nextLine()\n .forEach {\n when (it) {\n in vowels -> {\n total++\n }\n\n in digits -> {\n if (it.toInt() % 2 == 0) {\n total++\n }\n }\n }\n }\n println(total)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "a974e0dce1292825c4f7475a57e6a967", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "apr_id": "135d38e73659c03df1bcf7fd87fb7527", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.883183568677792, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\n\nprivate val reader = BufferedReader(InputStreamReader(System.`in`))\nprivate val out = PrintWriter(System.out)\nprivate var st = StringTokenizer(\"\")\n\nfun next(): String {\n while (!st.hasMoreTokens())\n st = StringTokenizer(reader.readLine())\n return st.nextToken()\n}\n\nfun ni() = next().toInt()\nfun nl() = next().toLong()\nfun nd() = next().toDouble()\nfun print(obj: Any) = out.print(obj)\nfun close() = out.close()\n\nfun main(args: Array) {\n val text = next()\n val v = setOf('a', 'e', 'i', 'o', 'u', '0', '2', '4', '6', '8')\n print(text.filter { it in v }.count())\n close()\n}", "lang": "Kotlin", "bug_code_uid": "633c78bbd01a8105e82116b11d941c7c", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "apr_id": "d76e7aa02a8141bf2faa25d81fb65a6c", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9961977186311787, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) = with(java.util.Scanner(System.`in`)) {\n var s = readLine()!!\n var (res, entahapa) = s.partition { (it.isDigit() && it.toInt()%2==0) || it == 'a' || it == 'u' || it == 'o' || it == 'i' || it == 'e' }\n println(res.count())\n}", "lang": "Kotlin", "bug_code_uid": "b08d86957af655188d636388c34543a4", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "apr_id": "01c77e5a1389f005a834639451242ab1", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9331210191082803, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val arr = next().toCharArray().filter { it.vowel() }\n print(\"${arr.size}\")\n}\n\nfun Char.vowel(): Boolean {\n val v = arrayListOf('a', 'e', 'i', 'o', 'u', '0', '2', '4', '6', '8')\n return v.filter { it == this }.any()\n}\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "899a67a348e3fbe1d2d398f3a3db1deb", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "apr_id": "b55947be267947746591f1ebd56d7b08", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.90020366598778, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.*\n\nfun main(args: Array) {\n var vowelsAndEvens = setOf(\n 'a', 'o', 'e', 'u', 'i',\n '0', '2', '4', '6', '8')\n\n var string = readLine() ?: \"\"\n println(string.count { it in vowelsAndEvens })\n\n}", "lang": "Kotlin", "bug_code_uid": "ae8b3894b14abdeaa8c86b98047ccd53", "src_uid": "b4af2b8a7e9844bf58ad3410c2cb5223", "apr_id": "c5b4e3762843f555f9767b0341d544d8", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9951325040562466, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : InputReader, pw : PrintWriter) {\n\n val n : Int = ir.nextInt()\n val v : Int = ir.nextInt()\n var total = n - 1\n\n if ((n - 1) > v)\n for (i in 2 until (n - v + 1))\n total += i\n\n print(total)\n\n}\n\nclass InputReader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "9d49d5ce165f9cbb5a928aee9dd72baa", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "apr_id": "9ef76542f62d5398e68bcd8c2dee91b9", "difficulty": 900, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.447351209941138, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun readIntList() = readLine()!!.split(' ').map(String::toInt).toMutableList()\nfun readLongList() = readLine()!!.split(' ').map(String::toLong).toMutableList()\nfun readInt() = readLine()!!.toInt()\n\n\nfun main(args: Array) {\n\n val (n , v) = readIntList()\n\n var sum = 0\n var level = 0\n while(level < n){\n var min = min(n - level , v)\n\n sum += level * min\n\n level += min(n - level , v)\n }\n\n\n println(sum)\n\n}", "lang": "Kotlin", "bug_code_uid": "c6b0ed31a4b3426c5e3a71e1caa8bb20", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "apr_id": "4c1b9ebfe7ed2e9f7beec0cc606b366b", "difficulty": 900, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8962472406181016, "equal_cnt": 12, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 12, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*\nimport kotlin.collections.HashMap\n\nfun main(args : Array) {\n val input = Scanner(System.`in`)\n var city = HashMap()\n\n var j=0\n val n = input.nextInt()\n val u = input.nextInt()\n var sum = u\n for (i in n downTo 1){\n city.put(i, j)\n if (j < u){\n j++\n } else {\n sum += i*1\n }\n }\n println(sum-1)\n}", "lang": "Kotlin", "bug_code_uid": "6346b8ce3d87457fcd2448819729afad", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "apr_id": "6ef3ceddf26bbe3d4e22e5f6a362c4e5", "difficulty": 900, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8769544527532291, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun findMin(n: Int, v: Int): Int {\n var cap = 0\n var money = 0\n var rem: Int\n for (i in 1 .. n){\n rem = n - i\n if (cap < rem){\n val missingInTank: Int\n if ((v - cap) <= rem){\n missingInTank = v - cap\n }else{\n missingInTank = (v - cap) - rem\n }\n cap += missingInTank\n money += i*missingInTank\n }\n\n cap--\n }\n return money\n}\n\nfun main(args: Array){\n val br = BufferedReader(InputStreamReader(System.`in`))\n val nv = br.readLine().split(\" \").map { it.toInt() }\n val n = nv[0]\n val v = nv[1]\n println(findMin(n, v))\n\n}", "lang": "Kotlin", "bug_code_uid": "6d256ac2eaf9a465ad36c5a1c32215ef", "src_uid": "f8eb96deeb82d9f011f13d7dac1e1ab7", "apr_id": "e5455a55dd564eb1e7696b14652ea79c", "difficulty": 900, "tags": ["dp", "math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7806691449814126, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "//package com.happypeople.codeforces.c1113\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\n\nfun main(args: Array) {\n try {\n A1113().run()\n } catch (e: Throwable) {\n println(\"\")\n e.printStackTrace()\n }\n}\n\nclass A1113 {\n fun run() {\n val sc = Scanner(systemIn())\n val n=sc.nextInt()\n val v=sc.nextInt()\n\n var ans=minFuel(n, v)\n println(\"$ans\")\n }\n\n fun minFuel(n:Int, v:Int):Int {\n if(n-1<=v)\n return n-1 // tank as much as needed in first city\n else {\n // make take full, drive as long as possible\n var ans=v\n var x=(n-1)%v+1 // first tank stop\n //log(\"first tankstop: $x\")\n ans+=(x*(x-1))\n x+=v\n while(x) {\n val sc = Scanner(System.`in`)\n val l = sc.nextInt()\n val r = sc.nextInt()\n val x = sc.nextInt()\n val y = sc.nextInt()\n val k = sc.nextInt()\n\n for(i in x..y){\n if( i * k in l..r ){\n println(\"YES\")\n return\n }\n }\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "155d8e000445d50aeeba4610f5f56e98", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "apr_id": "41b457128ef4a495905c8113f5f604a3", "difficulty": 1200, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9614700652045051, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"unused\", \"UnusedImport\")\n\nimport java.io.BufferedReader\nimport java.io.FileReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nval ONLINE = System.getProperty(\"ONLINE_JUDGE\") != null\nval inp = BufferedReader(if (ONLINE) InputStreamReader(System.`in`) else FileReader(\"in.txt\"))\n\ninline fun readTokens() = inp.readLine()!!.split(' ')\ninline fun readInts() = readTokens().map { it.toInt() }\ninline fun readInt() = inp.readLine()!!.toInt()\ninline fun readLine() = inp.readLine()!!\n\ntailrec fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)\n\nfun main(args: Array) {\n val (l, r, x, y, k) = readInts()\n val lr = l..r\n for (z in x..y) {\n if (k * z in lr) {\n println(\"YES\")\n return\n }\n }\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "6b2251bfbde99c9f64487ee3ba2c74be", "src_uid": "1110d3671e9f77fd8d66dca6e74d2048", "apr_id": "2a0283deeb19745016382be05447007e", "difficulty": 1200, "tags": ["brute force", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9872253449156873, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport com.korektur.codeforces.round640.SolutionD\nimport java.io.PrintWriter\nimport java.util.*\n\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(\n _reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\ninline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }\n\nfun main() {\n var t = readInt()\n while(t-- > 0) {\n\n val n = readInt()\n val arr = readIntArray(n);\n\n var ansA = 0\n var ansB = 0\n var i = 0\n var j = arr.size - 1\n var cnt = 0\n var prevCnt = 0\n while (i <= j) {\n cnt++\n var curCnt = 0\n if (cnt % 2 == 1) {\n while (i <= j && prevCnt >= curCnt) {\n ansA += arr[i]\n curCnt += arr[i++]\n }\n } else {\n while (i <= j && prevCnt >= curCnt) {\n ansB += arr[j]\n curCnt += arr[j--]\n }\n }\n prevCnt = curCnt\n }\n\n output { println(\"$cnt $ansA $ansB\") }\n }\n}", "lang": "Kotlin", "bug_code_uid": "c62926789e6547539f2c0312940b5d4e", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "1f24cd22eafe9af4ec3463e71b681eb0", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9242298084929226, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*\n\nfun main() {\n val scan = Scanner(System.`in`)\n\n repeat(scan.nextInt()) {\n scan.nextInt()\n val sweets = readLine()!!.split(\" \").mapTo(LinkedList()) { s -> s.toInt() }\n var aliceScore = 0\n var bobScore = 0\n var turnNumber = 0\n var prevScore = 0\n while (sweets.isNotEmpty()) {\n val aliceTurn = isAliceTurn(++turnNumber)\n val score = turn({ eatCandy(sweets, if (aliceTurn) sweets::removeFirst else sweets::removeLast) }, prevScore)\n if (aliceTurn) {\n aliceScore += score\n } else {\n bobScore += score\n }\n\n prevScore = score\n }\n\n println(\"$turnNumber $aliceScore $bobScore\")\n }\n}\n\nprivate fun isAliceTurn(turnNumber: Int) = turnNumber % 2 != 0\n\nprivate fun eatCandy(sweets: LinkedList, removeFun: () -> Int): Int? =\n if (sweets.isNotEmpty()) removeFun() else null\n\nprivate fun turn(eatCandy: () -> Int?, prevScore: Int): Int {\n var score = 0\n while (score <= prevScore) {\n score += eatCandy() ?: return score\n }\n\n return score\n}", "lang": "Kotlin", "bug_code_uid": "08fe704c5917e42a0a126ba52eb01026", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "3b79e77fb9d1d2ba8fa601630ed74117", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9854628921193573, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nfun main(args: Array): Unit = with(Scanner(System.`in`)) {\n repeat(nextInt()) {\n val n = nextInt()\n val d = ArrayDeque((0 until n).map { nextInt() })\n var a = 0\n var b = 0\n var prev = 0\n var turn = true\n var turns = 0\n while (!d.isEmpty()) {\n var x = 0\n turns++\n if (turn) {\n do {\n x += d.pollFirst()\n }\n while (!d.isEmpty() && x <= prev)\n a += x\n }\n else {\n do {\n x += d.pollLast()\n }\n while (!d.isEmpty() && x <= prev)\n b += x\n }\n prev = x\n turn = !turn\n }\n println(\"$turns $a $b\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "cc170b17eacb988501d39de84ed52651", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "8dad2cf1d4652e2b8acb8e268fd7d819", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.461490875347974, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.io.PrintWriter\nimport java.util.*\n\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\ninline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }\n\ndata class CandyStat(\n val aTotal: Int = 0,\n val bTotal: Int = 0,\n val last: Int = 0,\n val forward: Boolean = true,\n val steps: Int = 0\n)\n\nfun f(candies: List): List {\n\n fun recur(list: List, stat: CandyStat): List {\n return when {\n list.isEmpty() -> {\n listOf(stat.steps, stat.aTotal, stat.bTotal)\n }\n stat.forward -> {\n val (newList, sum) = if (list.sum() <= stat.last) listOf() to list.sum()\n else {\n var temp = listOf(list.first())\n while (temp.sum() <= stat.last) {\n temp = list.take(temp.size + 1)\n }\n list.drop(temp.size) to temp.sum()\n }\n\n recur(newList, stat.copy(\n aTotal = stat.aTotal + sum,\n forward = false,\n steps = stat.steps + 1,\n last = sum\n ))\n }\n else -> {\n val (newList, sum) = if (list.sum() <= stat.last) listOf() to list.sum()\n else {\n var temp = listOf(list.last())\n while (temp.sum() <= stat.last) {\n temp = list.takeLast(temp.size + 1)\n }\n list.dropLast(temp.size) to temp.sum()\n }\n\n recur(newList, stat.copy(\n bTotal = stat.bTotal + sum,\n forward = true,\n steps = stat.steps + 1,\n last = sum\n ))\n }\n }\n }\n\n return recur(candies.drop(1), CandyStat(\n aTotal = candies.first(),\n last = candies.first(),\n steps = 1,\n forward = false\n ))\n}\n\nfun main() {\n val count = readInt()\n\n val results = (0 until count).map {\n val length = readInt()\n val line = readLn().split(\" \").map { it.toInt() }\n f(line)\n }\n\n output {\n results.forEach {\n println(it.joinToString(\" \"))\n }\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "04ce9fb015f5030bcafafdb7c8387e7b", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "746a3e4c452584eb8d17b8f495c1025e", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.580221093516582, "equal_cnt": 13, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 12, "bug_source_code": "fun main() {\n val numberOfTests = readLine()!!.toInt()\n\n (1..numberOfTests).map { _ ->\n readLine()\n val candies = readLine()!!.split(\" \").map { it.toInt() }\n Game(candies).play().displayResult()\n }\n}\n\ndata class Player(var lastValueEaten: Int = 0, var totalEaten: Int = 0){\n fun eatCandy(candyValue: Int){\n lastValueEaten += candyValue\n totalEaten += candyValue\n }\n}\n\nclass Game(private var candies: List) {\n private var numberOfTurn: Int = 0\n private val alice = Player()\n private val bob = Player()\n\n private var lastPlayer = bob\n private var currentPlayer = alice\n\n fun play(): Game {\n while (candies.isNotEmpty()) {\n candies = candies.dropWhile { candyValue ->\n val res = currentPlayer.lastValueEaten <= lastPlayer.lastValueEaten\n\n if (res) { currentPlayer.eatCandy(candyValue) }\n\n res\n }\n\n prepareNextTurn()\n }\n\n return this\n }\n\n fun displayResult() = println(\"$numberOfTurn ${alice.totalEaten} ${bob.totalEaten}\")\n\n private fun prepareNextTurn() {\n numberOfTurn++\n\n lastPlayer.lastValueEaten = 0\n\n val tmp = lastPlayer\n lastPlayer = currentPlayer\n currentPlayer = tmp\n\n candies = candies.reversed()\n }\n}", "lang": "Kotlin", "bug_code_uid": "0d144409266c2205509b71354a537a9c", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "144f9df938ae4b935bbbcce06975ae34", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8257703081232493, "equal_cnt": 17, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 17, "bug_source_code": "\nfun main() {\n val numberOfTests = readLine()!!.toInt()\n\n (1..numberOfTests).map { _ ->\n readLine()\n val candies = readLine()!!.split(\" \").map { it.toInt() }\n Game(candies).play().displayResult()\n }\n\n// Game(listOf(3,1,4,1,5,9,2,6,5,3,5)).play().displayResult()\n}\n\ndata class Player(var lastValueEaten: Int = 0, var totalEaten: Int = 0, var index: Int){\n fun eatCandy(candyValue: Int){\n lastValueEaten += candyValue\n totalEaten += candyValue\n }\n\n}\n\nclass Game(private var candies: List) {\n private var numberOfTurn: Int = 0\n private val alice = Player(index = 0)\n private val bob = Player(index = candies.lastIndex)\n\n private var lastPlayer = bob\n private var currentPlayer = alice\n\n fun play(): Game {\n while (alice.index <= bob.index) {\n while (currentPlayer.lastValueEaten <= lastPlayer.lastValueEaten && (alice.index <= bob.index)){\n currentPlayer.eatCandy(candies[currentPlayer.index])\n moveIndex()\n }\n\n prepareNextTurn()\n }\n\n return this\n }\n\n private fun moveIndex(){\n when(currentPlayer){\n alice -> currentPlayer.index++\n bob -> currentPlayer.index--\n }\n }\n\n fun displayResult() = println(\"$numberOfTurn ${alice.totalEaten} ${bob.totalEaten}\")\n\n private fun prepareNextTurn() {\n numberOfTurn++\n\n lastPlayer.lastValueEaten = 0\n\n val tmp = lastPlayer\n lastPlayer = currentPlayer\n currentPlayer = tmp\n }\n}", "lang": "Kotlin", "bug_code_uid": "68ef86c75d44ea9b1e3d25cf1228dcb3", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "144f9df938ae4b935bbbcce06975ae34", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9860100727476218, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val scanner = Scanner(System.`in`)\n val t:Int = scanner.nextLine().toInt()\n for (i in 1..t) {\n val n = scanner.nextLine().toInt()\n val C = scanner.nextLine()!!.split(\" \").map { it.toInt() }.toMutableList()\n candies(C)\n }\n}\n\nfun candies(C: MutableList) {\n var moves = 0\n var aliceTot = 0\n var bobTot = 0\n var prev = 0\n var aOrB = true\n var curr : Int\n while (C.isNotEmpty()) {\n curr = 0\n do {\n if (aOrB) {\n curr += C.removeAt(0)\n } else {\n curr += C.removeAt(C.size - 1)\n }\n } while (curr <= prev && C.isNotEmpty())\n\n if (aOrB) {\n aliceTot += curr\n } else {\n bobTot += curr\n }\n\n prev = curr\n aOrB = !aOrB\n moves++\n }\n println(\"$moves $aliceTot $bobTot\")\n}", "lang": "Kotlin", "bug_code_uid": "781a9ccf9a93678d945a4e20f565187b", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "961ce9c82a8362758f0e887c8472f429", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9997115661955581, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.math.*\n\nfun main(args: Array) {\n\tval t = readLine()!!.toInt()\n\tfor (i in 1..t) {\n\t\tval n = readLine()!!.toInt()\n\t\tval arr = readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n\t\tval (total, a, b) = solve(n, arr)\n\t\tprintln(\"%d %d %d\".format(total, a, b))\n\t}\n}\n\nfun solve(n: Int, arr: IntArray): Triple {\n\tval cumsum_1 = IntArray(n)\n\tval cumsum_2 = IntArray(n)\n\tcumsum_1[0] = arr[0]\n\tcumsum_2[n - 1] = arr[n - 1]\n\tfor (i in 1..(n - 1)) {\n\t\tcumsum_1[i] = cumsum_1[i - 1] + arr[i]\n\t\tcumsum_2[n - 1 - i] = cumsum_2[n - i] + arr[n - 1 - i]\n\t}\n\tvar a = 0\n\tvar index_1 = -1\n\tvar b = 0\n\tvar index_2 = n\n\tvar prv = 0\n\tvar turn = 0\n\twhile (index_2 - index_1 > 1) {\n\t\tturn += 1\n\t\tif (turn % 2 == 1) {\n\t\t\tval base = if (index_1 == -1) { 0 } else { cumsum_1[index_1] }\n\t\t\tval index = binary_search(prv + base, index_1 + 1, index_2 - 1, cumsum_1)\n\t\t\tif (index == null) {\n\t\t\t\tprv = cumsum_1[index_2 - 1] - base\n\t\t\t\ta += prv\n\t\t\t\tindex_1 = index_2 - 1\n\t\t\t} else {\n\t\t\t\tprv = cumsum_1[index] - base\n\t\t\t\ta += prv\n\t\t\t\tindex_1 = index\n\t\t\t}\n\t\t} else {\n\t\t\tval base = if (index_2 == n) { 0 } else { cumsum_2[index_2] }\n\t\t\tval index = binary_search(prv + base, index_2 - 1, index_1 + 1, cumsum_2)\n\t\t\tif (index == null) {\n\t\t\t\tprv = cumsum_2[index_1 + 1] - base\n\t\t\t\tb += prv\n\t\t\t\tindex_2 = index_1 + 1\n\t\t\t} else {\n\t\t\t\tprv = cumsum_2[index] - base\n\t\t\t\tb += prv\n\t\t\t\tindex_2 = index\n\t\t\t}\n\t\t}\n\t}\n\treturn Triple(turn, a, b)\n}\n\nfun binary_search(x: Int, s: Int, e: Int, arr: IntArray): Int? {\n\tif (arr[e] <= x) {\n\t\treturn null\n\t}\n\tif (arr[s] > x) {\n\t\treturn sz\n\t}\n\tvar l = s\n\tvar r = e\n\twhile (abs(r - l) > 1) {\n\t\tval mid = (l + r) / 2\n\t\tif (arr[mid] > x) {\n\t\t\tr = mid\n\t\t} else {\n\t\t\tl = mid\n\t\t}\n\t}\n\treturn r\n}\n", "lang": "Kotlin", "bug_code_uid": "7d96d60df7147f7cd2b49f9c4bc01e5e", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "aa0cdd0a0d8c002dec7b90661de05cba", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6362579895409646, "equal_cnt": 22, "replace_cnt": 21, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 23, "bug_source_code": "import java.util.Scanner\nobject ChocolateBar {\n var NOOFMOVES:Int = 0\n var ALICEEATS:Int = 0\n var BOBEATS:Int = 0\n @JvmStatic fun main(args:Array) {\n val scanner = Scanner(System.`in`)\n if (scanner.hasNext())\n {\n val testCases = scanner.nextInt()\n for (i in 0 until testCases)\n {\n val n = scanner.nextInt()\n val arr = IntArray(n)\n for (j in 0 until n)\n {\n arr[j] = scanner.nextInt()\n getMoves(arr)\n }\n println(NOOFMOVES + \" \" + ALICEEATS + \" \" + BOBEATS)\n }\n }\n }\n fun getMoves(arr:IntArray) {\n val aliceEats = 0\n val bobEats = 0\n val i = 0\n val j = arr.size - 1\n val noOfMoves = 0\n val previous = 0\n val isAliceTurn = true\n val isBobTurn = false\n while (i <= j)\n {\n if (isAliceTurn)\n {\n val sum = 0\n while (sum < previous + 1 && i <= j)\n {\n sum += arr[i]\n aliceEats += arr[i]\n i++\n }\n noOfMoves++\n previous = sum\n isAliceTurn = false\n isBobTurn = true\n }\n else\n {\n val sum = 0\n while (sum < previous + 1 && i <= j)\n {\n sum += arr[j]\n bobEats += arr[j]\n j--\n }\n noOfMoves++\n previous = sum\n isAliceTurn = true\n isBobTurn = false\n }\n }\n //System.out.println(noOfMoves+\" \"+aliceEats+\" \"+bobEats);\n\n NOOFMOVES = noOfMoves\n ALICEEATS = aliceEats\n BOBEATS = bobEats\n }\n}", "lang": "Kotlin", "bug_code_uid": "9f2b3b140222e15abf7dac93ac15c334", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "e5b1f6ea78c6769a8b1c580e43421e4a", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9987046632124352, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\n//Namy 007\nfun main(args: Array): Unit = with(Scanner(System.`in`)) {\n\trepeat(nextInt()) {\n\t\tval s = nextInt()\n\t\t val d = ArrayDeque((0 until n).map { nextInt() })\n\t\t var a = 0\n\t\t var b = 0\n\t\t var prev = 0\n\t\t var turn = true\n\t\t var turns = 0\n\t\twhile (!d.isEmpty()) {\n\t\t\tvar x = 0\n\t\t\t turns++\n\t\t\tif (turn) {\n\t\t\t\tdo {\n\t\t\t\t\tx += d.pollFirst()\n\t\t\t\t}\n\t\t\t\twhile (!d.isEmpty() && x <= prev)\n\t\t\t\t\ta += x\n\t\t\t\t}\n\t\t\telse {\n\t\t\t\tdo {\n\t\t\t\t\tx += d.pollLast()\n\t\t\t\t}\n\t\t\t\twhile (!d.isEmpty() && x <= prev)\n\t\t\t\t\tb += x\n\t\t\t\t}\n\t\t\tprev = x\n\t\t\t turn = !turn\n\t\t}\n\t\tprintln(\"$turns $a $b\")\n\t}\n}", "lang": "Kotlin", "bug_code_uid": "3eec39b81681f2d40ecbd873c91d5f3f", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "35348a3dc6e21cbace311477f17b3c53", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8367129135538954, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "// 23.05.2020\n\n\nimport java.util.*\nimport kotlin.system.exitProcess\n\nprivate fun readLn() = readLine ()!! // string line\nprivate fun readInt() = readLn ().toInt () // single int\nprivate fun readStrings() = readLn ().split(\" \") // list of strings\nprivate fun readInts() = readStrings ().map { x: String -> x.toInt() } // list of ints\n \nfun readIntArrays (vararg arrays: IntArray)\n{\n\tfor (i in 0 until arrays [0].size)\n\t\tfor (j in arrays.indices)\n\t\t\tarrays [j][i] = readInt ()\n}\n \nfun main ()\n{\n\tval t = readInt ();\n\tfor ( i in 0 until t )\n\t{\n \tval n = readInt ()\n\t\tval a = IntArray (n)\n\n\t\treadIntArrays (a)\n\n\t\tvar k : Int = 1\n\t\tvar pa : Int = a [0]\n\t\tvar pb : Int = 0\n\t\tvar ta : Int = pa\n\t\tvar tb : Int = 0\n\t\tvar i : Int = 1\n\t\tvar j : Int = n-1\n\t\twhile ( i <= j )\n\t\t{\n\t\t\tvar cur : Int = 0\n\t\t\tk ++\n\t\t\tif ( k % 2 == 0 )\t// BOB\n\t\t\t{\n\t\t\t\twhile ( j >= i && cur <= pa )\n\t\t\t\t{\n\t\t\t\t\tcur += a [j]; j --\n\t\t\t\t}\n\t\t\t\ttb += cur; pb = cur\n\t\t\t\tif ( j < i )\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twhile ( j >= i && cur <= pb )\n\t\t\t\t{\n\t\t\t\t\tcur += a [i]; i ++\n\t\t\t\t}\n\t\t\t\tta += cur; pa = cur\n\t\t\t\tif ( j < i )\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tprint (k); print (\" \"); print (ta); print (\" \"); println (tb)\n\t}\n}\n", "lang": "Kotlin", "bug_code_uid": "74078a87bca596d7c8ffa561067dd41f", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "d067d00cfd32b542e4a2b245cbc6d4b1", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9875376020627418, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\n\nprivate fun splitString() = readLn().split(\" \")\nprivate fun readInts() = splitString().map { it.toInt() }.toMutableList()\n\nfun main() {\n val t = readInt()\n (1..t).forEach {\n val a = readInt()\n val b = readInts()\n solve(a, b)\n }\n}\n\nfun solve(a: Int, b: MutableList) {\n var alice = 0\n var aliceSum = 0\n var bob = 0\n var bobSum = 0\n var rounds = 0\n var aliceRound = true\n while (b.size > 0) {\n when (aliceRound) {\n true -> {\n do {\n alice += b.removeFirst()\n } while (alice <= bob && b.isNotEmpty())\n aliceSum += alice\n bob = 0\n aliceRound = false\n rounds++\n }\n false -> {\n do {\n bob += b.removeLast()\n } while (bob <= alice && b.isNotEmpty())\n bobSum += bob\n alice = 0\n aliceRound = true\n rounds++\n }\n }\n }\n println(\"$rounds $aliceSum $bobSum\")\n}\n\n", "lang": "Kotlin", "bug_code_uid": "0a7078ed3e1996320792c2c6643e3187", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "d091c941858f8986574297e4d20c4f11", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9387990762124712, "equal_cnt": 34, "replace_cnt": 0, "delete_cnt": 33, "insert_cnt": 0, "fix_ops_cnt": 33, "bug_source_code": "import java.util.*\n\n fun main(args: Array) {\n val `in` = Scanner(System.`in`)\n for (T in `in`.nextInt() downTo 1) {\n val n = `in`.nextInt()\n val a = IntArray(n)\n for (i in 0 until n) {\n a[i] = `in`.nextInt()\n }\n val s = IntArray(n + 1)\n for (i in 0 until n) {\n s[i + 1] = s[i] + a[i]\n }\n var i = 0\n var j = n - 1\n var steps = 0\n var alice = 0\n var bob = 0\n val used = BooleanArray(n)\n var prev = 0\n while (true) {\n run {\n var t = 0\n while (i < n && prev >= t) {\n if (used[i]) {\n i++\n continue\n }\n t += a[i]\n used[i] = true\n i++\n }\n if (t != 0) {\n steps++\n alice += t\n prev = t\n } else\n break\n }\n run {\n var t = 0\n while (j >= 0 && prev >= t) {\n if (used[j]) {\n j--\n continue\n }\n t += a[j]\n used[j] = true\n j--\n }\n if (t != 0) {\n steps++\n bob += t\n prev = t\n } else\n break\n }\n }\n println(\"$steps $alice $bob\")\n }\n }", "lang": "Kotlin", "bug_code_uid": "3b7e5918dcc9f81878be42275e89cc77", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "c5d855b039f70a21653289c3f7ffe2bc", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9343379978471474, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main(){\n val scanner= Scanner(System.`in`)\n for(t:Int in 1 .. scanner.nextInt()) {\n var arr=ArrayList()\n for(i:Int in 1..scanner.nextInt()){\n arr.add(scanner.nextInt())\n }\n var lastSum=0\n var sumi=0\n var sumj=0\n var sum=0\n var turn=true\n var count=1\n while(arr.size>0){\n if(turn){\n var i = arr.removeFirst()\n sumi+=i\n sum+=i\n }else{\n var j = arr.removeLast()\n sumj+=j\n sum+=j\n }\n if(lastSum) { \n val input = Scanner(System.`in`)\n val t = input.nextInt()\n for(i in 0 until t){\n val n = input.nextInt() \n var i:Int = 0\n val sz:Int = input.nextInt()\n var arr = Array(sz){0}\n while( i < sz){\n arr[i] = readLine()!!.toInt()\n i++\n }\n var l:Int = 0\n var r:Int = sz-1\n var a:Int = 0\n var b:Int = 0\n var mov:Int = 0\n var mx:Int = 0\n var f:Int = 0\n while(l <= r){\n f = 1-f\n mov++\n if(f == 1){\n var sum:Int = 0\n while(sum <= mx || l <= r){\n sum += arr[l]\n l++\n }\n a += sum\n mx = sum\n }\n else{\n var sum:Int = 0\n while(sum <= mx || l <= r){\n sum += arr[r]\n r--\n }\n b += sum\n mx = sum\n }\n }\n println(mov + \" \" + a + \" \" + b)\n }\n}", "lang": "Kotlin", "bug_code_uid": "f9952b392b6f7ee2e839e6ddffefa3a6", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "cebc5e20a9e5a3c858e1efc92d9c7196", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9676025917926566, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner\n \nfun main(args:Array) { \n val input = Scanner(System.`in`)\n val t = input.nextInt()\n for(i in 0 until t){\n var i:Int = 0\n val sz:Int = input.nextInt()\n var arr = Array(sz){0}\n while( i < sz){\n arr[i] = readLine()!!.toInt()\n i++\n }\n var l:Int = 0\n var r:Int = sz-1\n var a:Int = 0\n var b:Int = 0\n var mov:Int = 0\n var mx:Int = 0\n var f:Int = 0\n while(l <= r){\n f = 1-f\n mov++\n if(f == 1){\n var sum:Int = 0\n while(sum <= mx || l <= r){\n sum += arr[l]\n l++\n }\n a += sum\n mx = sum\n }\n else{\n var sum:Int = 0\n while(sum <= mx || l <= r){\n sum += arr[r]\n r--\n }\n b += sum\n mx = sum\n }\n }\n print(mov)\n print(\" \")\n print(a)\n print(\" \")\n print(b)\n print(\"\\n\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "19327752567c9cf567ac1d95b2decd66", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "cebc5e20a9e5a3c858e1efc92d9c7196", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3556901774123756, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "var aTotal :Int = 0\nvar bTotal:Int = 0\nvar aMove :Int = 0\nvar bMove:Int = 0\nvar steps = 0\n\nfun moveA(list: MutableList): MutableList{\n steps +=1\n return if(bMove == 0){\n aTotal += list[0]\n aMove = list[0]\n list.removeAt(0)\n list\n }\n else{\n var aValTemp = 0\n while(aValTemp <= bMove && list.size >=0){\n aValTemp += list[0]\n aTotal += list[0]\n list.removeFirst()\n }\n aMove = aValTemp\n list\n }\n}\nfun moveB(list: MutableList): MutableList{\n steps +=1\n var bValTemp = 0\n while(bValTemp <= aMove && list.size > 0){\n bValTemp += list[list.size - 1]\n bTotal += list[list.size - 1]\n list.removeLast()\n }\n bMove = bValTemp\n return list\n}\n\nfun main(args: Array) {\n var cases = readLine()!!.toInt()\n while (cases > 0) {\n aTotal = 0\n bTotal = 0\n aMove = 0\n bMove = 0\n steps = 0\n var gameLength = readLine()!!.toInt()\n var game = readLine()!!.split(' ').map(String::toInt).toMutableList()\n while(game.size > 0){\n game = moveA(game)\n if(game.size > 0) {\n game = moveB(game)\n }\n }\n println(\"$steps $aTotal $bTotal\")\n cases -= 1\n }\n}", "lang": "Kotlin", "bug_code_uid": "820199d4748f6cfbd2b3b9165360073e", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "7d9b81158a47586bcfbe106304dc7029", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6480558325024925, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "fun main(args: Array) {\n var cases = readLine()!!.toInt()\n while (cases > 0) {\n var aTotal = 0\n var bTotal = 0\n var aMove = 0\n var bMove = 0\n var steps= 0\n var gameLength = readLine()!!.toInt()\n val list = readLine()!!.split(' ').map(String::toInt).toMutableList()\n while(list.isNotEmpty()){\n var aValTemp = 0\n while (aValTemp <= bMove && list.size >= 0) {\n aValTemp += list.removeAt(0)\n }\n aTotal += aValTemp\n aMove = aValTemp\n if(aValTemp > 0) steps += 1\n if(list.isNotEmpty()) {\n var bValTemp = 0\n while(bValTemp <= aMove && list.isNotEmpty()){\n bValTemp += list.removeAt(list.size -1)\n }\n bTotal += bValTemp\n bMove = bValTemp\n if(bValTemp > 0) steps += 1\n }\n }\n println(\"$steps $aTotal $bTotal\")\n cases -= 1\n }\n}", "lang": "Kotlin", "bug_code_uid": "a186f52badd6d5f0cb60c05e52e0a922", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "7d9b81158a47586bcfbe106304dc7029", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8599531615925059, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.PrintWriter\n\nval pw = PrintWriter(System.out)\nfun main(args: Array) {\n val T=nint()\n repeat(T){\n val n=nint()\n val vs=nlint()\n val deq=ArrayDeque(vs)\n val re= mutableListOf(0,0,0)\n var last=0\n repeat(1123456){\n if(deq.isEmpty()) return@repeat\n var sum=0\n while(deq.isNotEmpty() && sum<=last){\n sum+=deq.removeFirst()\n }\n re[1]+=sum\n if(sum>0) ++re[0]\n last=sum\n sum=0\n while(deq.isNotEmpty() && sum<=last){\n sum+=deq.removeLast()\n }\n re[2]+=sum\n if(sum>0) ++re[0]\n last=sum\n sum=0\n }\n println(re.joinToString(\" \"))\n }\n pw.flush()\n}\n\nfun next() = readLine()!!\nfun nint() = next().toInt()\nfun nlong() = next().toLong()\nfun ndouble() = next().toDouble()\nfun nlstring() = next().split(\" \")\nfun nlint() = nlstring().map { it.toInt() }\nfun nllong() = nlstring().map { it.toLong() }\nfun nldouble() = nlstring().map { it.toDouble() }", "lang": "Kotlin", "bug_code_uid": "d089b14fa2f60a4e5facea59a9bedf54", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "5c70b78a4154f20c66afd56773da92ca", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8721037998146431, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.PrintWriter\n\nval pw = PrintWriter(System.out)\n@ExperimentalStdlibApi\nfun main(args: Array) {\n val T=nint()\n repeat(T){\n val n=nint()\n val vs=nlint()\n val deq=ArrayDeque(vs)\n val re= mutableListOf(0,0,0)\n var last=0\n repeat(1123456){\n if(deq.isEmpty()) return@repeat\n var sum=0\n while(deq.isNotEmpty() && sum<=last){\n sum+=deq.removeFirst()\n }\n re[1]+=sum\n if(sum>0) ++re[0]\n last=sum\n sum=0\n while(deq.isNotEmpty() && sum<=last){\n sum+=deq.removeLast()\n }\n re[2]+=sum\n if(sum>0) ++re[0]\n last=sum\n sum=0\n }\n println(re.joinToString(\" \"))\n }\n pw.flush()\n}\n\nfun next() = readLine()!!\nfun nint() = next().toInt()\nfun nlong() = next().toLong()\nfun ndouble() = next().toDouble()\nfun nlstring() = next().split(\" \")\nfun nlint() = nlstring().map { it.toInt() }\nfun nllong() = nlstring().map { it.toLong() }\nfun nldouble() = nlstring().map { it.toDouble() }", "lang": "Kotlin", "bug_code_uid": "192b3c74ef754e96c75fbfc80169194d", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "5c70b78a4154f20c66afd56773da92ca", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9813211845102505, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces.KotlinHeroesPractice4\n\nfun readString() = readLine()!!\n\nfun readInt() = readString().toInt()\nfun readLong() = readString().toLong()\n\nfun readIntArray() = readString().split(\" \").map { it.toInt() }\nfun readLongArray() = readString().split(\" \").map { it.toLong() }\n\nfun main() {\n repeat(readInt()) {\n readInt()\n val set = readIntArray().toMutableList()\n var turns = 0\n var aTotal = 0\n var bTotal = 0\n var last = 0\n var a = true\n while (set.isNotEmpty()) {\n turns++\n var current = 0\n while (current <= last && set.isNotEmpty()) {\n if (a) {\n current += set.first()\n set.removeAt(0)\n } else {\n current += set.last()\n set.removeAt(set.lastIndex)\n }\n }\n if (a) {\n aTotal += current\n } else {\n bTotal += current\n }\n last = current\n a = !a\n }\n println(\"$turns $aTotal $bTotal\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "950f903789b3fb062a67ded745eccb0e", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "2aa32e42df941e9ba98ba3a56c77100b", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9981378026070763, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n\nfun main(args: Array) {\n var t = readInt()\n for (tc in 0..t - 1) {\n var n = readInt()\n var a = readInts()\n var x = 0\n var y = 0\n var s = 1\n var ant = 0\n var l = 0\n var r = n - 1\n while (l <= r) {\n if (s % 2) {\n var cur = 0\n while (l <= r && cur <= ant) {\n cur += a[l]\n l++\n }\n ant = cur\n x += cur\n } else {\n var cur = 0\n while (l <= r && cur <= ant) {\n cur += a[r]\n r--\n }\n ant = cur\n y += cur\n }\n s++\n }\n println(\"${s - 1} ${x} ${y}\")\n }\n}\n\n\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "65eef079d3b6531f48ad1ea46c024a28", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "2ee7da5c52fd438ad7c6aa01e13e0303", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5828025477707006, "equal_cnt": 19, "replace_cnt": 8, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "fun main() {\n val times = readLine()?.toInt() ?: 0\n repeat(times) {\n var count = 0\n val sizeOfList = readLine()?.toInt() ?: 0\n val listOfCandies = readLine()?.split(' ')?.map { it.toInt() }?.toMutableList() ?: mutableListOf()\n var aliceCandyCount = 0\n var bobCandyCount = 0\n var currentHighest = 1\n if (sizeOfList == 1) {\n aliceCandyCount = listOfCandies[0]\n count++\n } else {\n while (listOfCandies.isNotEmpty()) {\n var aliceCandyRoundCount = 0\n var bobCandyRoundCount = 0\n while (currentHighest >= aliceCandyRoundCount)\n aliceCandyRoundCount += listOfCandies.removeAt(0)\n aliceCandyCount += aliceCandyRoundCount\n currentHighest = aliceCandyRoundCount\n count++\n try {\n while (currentHighest >= bobCandyRoundCount)\n bobCandyRoundCount += listOfCandies.removeAt(listOfCandies.lastIndex)\n } catch (ex: Exception) {\n bobCandyCount += listOfCandies.sum()\n listOfCandies.clear()\n }\n bobCandyCount += bobCandyRoundCount\n currentHighest = bobCandyRoundCount\n count++\n }\n }\n println(count)\n println(\"$aliceCandyCount $bobCandyCount\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "70b31ffca8280d5fbf38a64b48fa7d7c", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "6ffdfb96798550b78e330bf73e8b1afc", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995962858296327, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\nimport java.util.ArrayDeque as Deque\nimport kotlin.collections.ArrayList as List\nimport kotlin.collections.HashMap as HMap\nimport kotlin.collections.HashSet as HSet\n\n\nprivate val br = BufferedReader(InputStreamReader(System.`in`))\nprivate var st = StringTokenizer(\"\")\nprivate var pw = PrintWriter(System.out)\n\nfun main() {\n val n = nextInt()\n if (n == 0)\n println(15)\n if (n == 1)\n println(14)\n if (n == 2)\n println(12)\n if (n == 3)\n println(13)\n if (n == 4)\n println(8)\n if (n == 5)\n println(9)\n if (n == 6)\n println(10)\n if (n == 7)\n println(11)\n if (n == 8)\n println(0)\n if (n == 9)\n println(1)\n if (n == 10)\n println(2)\n if (n == 11)\n println(3)\n if (n == 12)\n println(4)\n if (n == 13)\n println(5)\n if (n == 14)\n println(6)\n if (n == 15)\n println()\n}\n\nprivate fun next(): String {\n if (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st.nextToken()\n}\n\nprivate fun nextInt() = next().toInt()\nprivate fun nextLong() = next().toLong()", "lang": "Kotlin", "bug_code_uid": "c7414cdd660348eec583849441cfa8cf", "src_uid": "879ac20ae5d3e7f1002afe907d9887df", "apr_id": "3e0b9f95b04b1133d6ad2ffb5f719ed5", "difficulty": null, "tags": ["brute force", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6420133538777607, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 14, "bug_source_code": "\nfun main()\n{\n var mp =HashMap()\n mp.put('A',0)\n mp.put('B',0)\n mp.put('C',0)\n var s:String\n var test:String\n s= readLine()!!.toString()\n if(s[1]=='>')\n mp.set(s[0],+1)else\n mp.set(s[2],+1)\n s= readLine()!!.toString()\n if(s[1]=='>')\n mp.set(s[0],+1)else\n mp.set(s[2],+1)\n s= readLine()!!.toString()\n\n if(mp.get(s[0])==1||mp.get(s[0])==1)\n {\n if(mp.get(s[0])==1)\n {\n if(s[1]=='>') mp.set(s[0],+2)else\n mp.set(s[2],+1)\n }else\n {\n if(s[1]=='>') mp.set(s[0],+1)else\n mp.set(s[2],+2)\n }\n }else\n {\n if(s[1]=='>')\n mp.set(s[0],+1)else\n mp.set(s[2],+1)\n }\n val result = mp.toList().sortedBy { (_, value) -> value}.toMap()\n if(mp['A']==1&&mp['B']==1&&mp['C']==1)\n print(\"Impossible\") else\n {\n for (entry in result) {\n print(entry.key)\n\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "1ba80db470b629bf4cfdd90a92d42831", "src_uid": "97fd9123d0fb511da165b900afbde5dc", "apr_id": "1f45f768152b5eca7c7e8dd641797f24", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.025899280575539568, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\n\nval scanner = Scanner(System.`in`)\n\nfun readLong(): Long = scanner.nextLong()\n\nval luckyNumbers = arrayOf(4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777, 4444, 4447, 4474, 4477, 4744, 4747, 4774, 4777, 7444, 7447, 7474, 7477, 7744, 7747, 7774, 7777, 44444, 44447, 44474, 44477, 44744, 44747, 44774, 44777, 47444, 47447, 47474, 47477, 47744, 47747, 47774, 47777, 74444, 74447, 74474, 74477, 74744, 74747, 74774, 74777, 77444, 77447, 77474, 77477, 77744, 77747, 77774, 77777, 444444, 444447, 444474, 444477, 444744, 444747, 444774, 444777, 447444, 447447, 447474, 447477, 447744, 447747, 447774, 447777, 474444, 474447, 474474, 474477, 474744, 474747, 474774, 474777, 477444, 477447, 477474, 477477, 477744, 477747, 477774, 477777, 744444, 744447, 744474, 744477, 744744, 744747, 744774, 744777, 747444, 747447, 747474, 747477, 747744, 747747, 747774, 747777, 774444, 774447, 774474, 774477, 774744, 774747, 774774, 774777, 777444, 777447, 777474, 777477, 777744, 777747, 777774, 777777, 4444444, 4444447, 4444474, 4444477, 4444744, 4444747, 4444774, 4444777, 4447444, 4447447, 4447474, 4447477, 4447744, 4447747, 4447774, 4447777, 4474444, 4474447, 4474474, 4474477, 4474744, 4474747, 4474774, 4474777, 4477444, 4477447, 4477474, 4477477, 4477744, 4477747, 4477774, 4477777, 4744444, 4744447, 4744474, 4744477, 4744744, 4744747, 4744774, 4744777, 4747444, 4747447, 4747474, 4747477, 4747744, 4747747, 4747774, 4747777, 4774444, 4774447, 4774474, 4774477, 4774744, 4774747, 4774774, 4774777, 4777444, 4777447, 4777474, 4777477, 4777744, 4777747, 4777774, 4777777, 7444444, 7444447, 7444474, 7444477, 7444744, 7444747, 7444774, 7444777, 7447444, 7447447, 7447474, 7447477, 7447744, 7447747, 7447774, 7447777, 7474444, 7474447, 7474474, 7474477, 7474744, 7474747, 7474774, 7474777, 7477444, 7477447, 7477474, 7477477, 7477744, 7477747, 7477774, 7477777, 7744444, 7744447, 7744474, 7744477, 7744744, 7744747, 7744774, 7744777, 7747444, 7747447, 7747474, 7747477, 7747744, 7747747, 7747774, 7747777, 7774444, 7774447, 7774474, 7774477, 7774744, 7774747, 7774774, 7774777, 7777444, 7777447, 7777474, 7777477, 7777744, 7777747, 7777774, 7777777, 44444444, 44444447, 44444474, 44444477, 44444744, 44444747, 44444774, 44444777, 44447444, 44447447, 44447474, 44447477, 44447744, 44447747, 44447774, 44447777, 44474444, 44474447, 44474474, 44474477, 44474744, 44474747, 44474774, 44474777, 44477444, 44477447, 44477474, 44477477, 44477744, 44477747, 44477774, 44477777, 44744444, 44744447, 44744474, 44744477, 44744744, 44744747, 44744774, 44744777, 44747444, 44747447, 44747474, 44747477, 44747744, 44747747, 44747774, 44747777, 44774444, 44774447, 44774474, 44774477, 44774744, 44774747, 44774774, 44774777, 44777444, 44777447, 44777474, 44777477, 44777744, 44777747, 44777774, 44777777, 47444444, 47444447, 47444474, 47444477, 47444744, 47444747, 47444774, 47444777, 47447444, 47447447, 47447474, 47447477, 47447744, 47447747, 47447774, 47447777, 47474444, 47474447, 47474474, 47474477, 47474744, 47474747, 47474774, 47474777, 47477444, 47477447, 47477474, 47477477, 47477744, 47477747, 47477774, 47477777, 47744444, 47744447, 47744474, 47744477, 47744744, 47744747, 47744774, 47744777, 47747444, 47747447, 47747474, 47747477, 47747744, 47747747, 47747774, 47747777, 47774444, 47774447, 47774474, 47774477, 47774744, 47774747, 47774774, 47774777, 47777444, 47777447, 47777474, 47777477, 47777744, 47777747, 47777774, 47777777, 74444444, 74444447, 74444474, 74444477, 74444744, 74444747, 74444774, 74444777, 74447444, 74447447, 74447474, 74447477, 74447744, 74447747, 74447774, 74447777, 74474444, 74474447, 74474474, 74474477, 74474744, 74474747, 74474774, 74474777, 74477444, 74477447, 74477474, 74477477, 74477744, 74477747, 74477774, 74477777, 74744444, 74744447, 74744474, 74744477, 74744744, 74744747, 74744774, 74744777, 74747444, 74747447, 74747474, 74747477, 74747744, 74747747, 74747774, 74747777, 74774444, 74774447, 74774474, 74774477, 74774744, 74774747, 74774774, 74774777, 74777444, 74777447, 74777474, 74777477, 74777744, 74777747, 74777774, 74777777, 77444444, 77444447, 77444474, 77444477, 77444744, 77444747, 77444774, 77444777, 77447444, 77447447, 77447474, 77447477, 77447744, 77447747, 77447774, 77447777, 77474444, 77474447, 77474474, 77474477, 77474744, 77474747, 77474774, 77474777, 77477444, 77477447, 77477474, 77477477, 77477744, 77477747, 77477774, 77477777, 77744444, 77744447, 77744474, 77744477, 77744744, 77744747, 77744774, 77744777, 77747444, 77747447, 77747474, 77747477, 77747744, 77747747, 77747774, 77747777, 77774444, 77774447, 77774474, 77774477, 77774744, 77774747, 77774774, 77774777, 77777444, 77777447, 77777474, 77777477, 77777744, 77777747, 77777774, 77777777, 444444444, 444444447, 444444474, 444444477, 444444744, 444444747, 444444774, 444444777, 444447444, 444447447, 444447474, 444447477, 444447744, 444447747, 444447774, 444447777, 444474444, 444474447, 444474474, 444474477, 444474744, 444474747, 444474774, 444474777, 444477444, 444477447, 444477474, 444477477, 444477744, 444477747, 444477774, 444477777, 444744444, 444744447, 444744474, 444744477, 444744744, 444744747, 444744774, 444744777, 444747444, 444747447, 444747474, 444747477, 444747744, 444747747, 444747774, 444747777, 444774444, 444774447, 444774474, 444774477, 444774744, 444774747, 444774774, 444774777, 444777444, 444777447, 444777474, 444777477, 444777744, 444777747, 444777774, 444777777, 447444444, 447444447, 447444474, 447444477, 447444744, 447444747, 447444774, 447444777, 447447444, 447447447, 447447474, 447447477, 447447744, 447447747, 447447774, 447447777, 447474444, 447474447, 447474474, 447474477, 447474744, 447474747, 447474774, 447474777, 447477444, 447477447, 447477474, 447477477, 447477744, 447477747, 447477774, 447477777, 447744444, 447744447, 447744474, 447744477, 447744744, 447744747, 447744774, 447744777, 447747444, 447747447, 447747474, 447747477, 447747744, 447747747, 447747774, 447747777, 447774444, 447774447, 447774474, 447774477, 447774744, 447774747, 447774774, 447774777, 447777444, 447777447, 447777474, 447777477, 447777744, 447777747, 447777774, 447777777, 474444444, 474444447, 474444474, 474444477, 474444744, 474444747, 474444774, 474444777, 474447444, 474447447, 474447474, 474447477, 474447744, 474447747, 474447774, 474447777, 474474444, 474474447, 474474474, 474474477, 474474744, 474474747, 474474774, 474474777, 474477444, 474477447, 474477474, 474477477, 474477744, 474477747, 474477774, 474477777, 474744444, 474744447, 474744474, 474744477, 474744744, 474744747, 474744774, 474744777, 474747444, 474747447, 474747474, 474747477, 474747744, 474747747, 474747774, 474747777, 474774444, 474774447, 474774474, 474774477, 474774744, 474774747, 474774774, 474774777, 474777444, 474777447, 474777474, 474777477, 474777744, 474777747, 474777774, 474777777, 477444444, 477444447, 477444474, 477444477, 477444744, 477444747, 477444774, 477444777, 477447444, 477447447, 477447474, 477447477, 477447744, 477447747, 477447774, 477447777, 477474444, 477474447, 477474474, 477474477, 477474744, 477474747, 477474774, 477474777, 477477444, 477477447, 477477474, 477477477, 477477744, 477477747, 477477774, 477477777, 477744444, 477744447, 477744474, 477744477, 477744744, 477744747, 477744774, 477744777, 477747444, 477747447, 477747474, 477747477, 477747744, 477747747, 477747774, 477747777, 477774444, 477774447, 477774474, 477774477, 477774744, 477774747, 477774774, 477774777, 477777444, 477777447, 477777474, 477777477, 477777744, 477777747, 477777774, 477777777, 744444444, 744444447, 744444474, 744444477, 744444744, 744444747, 744444774, 744444777, 744447444, 744447447, 744447474, 744447477, 744447744, 744447747, 744447774, 744447777, 744474444, 744474447, 744474474, 744474477, 744474744, 744474747, 744474774, 744474777, 744477444, 744477447, 744477474, 744477477, 744477744, 744477747, 744477774, 744477777, 744744444, 744744447, 744744474, 744744477, 744744744, 744744747, 744744774, 744744777, 744747444, 744747447, 744747474, 744747477, 744747744, 744747747, 744747774, 744747777, 744774444, 744774447, 744774474, 744774477, 744774744, 744774747, 744774774, 744774777, 744777444, 744777447, 744777474, 744777477, 744777744, 744777747, 744777774, 744777777, 747444444, 747444447, 747444474, 747444477, 747444744, 747444747, 747444774, 747444777, 747447444, 747447447, 747447474, 747447477, 747447744, 747447747, 747447774, 747447777, 747474444, 747474447, 747474474, 747474477, 747474744, 747474747, 747474774, 747474777, 747477444, 747477447, 747477474, 747477477, 747477744, 747477747, 747477774, 747477777, 747744444, 747744447, 747744474, 747744477, 747744744, 747744747, 747744774, 747744777, 747747444, 747747447, 747747474, 747747477, 747747744, 747747747, 747747774, 747747777, 747774444, 747774447, 747774474, 747774477, 747774744, 747774747, 747774774, 747774777, 747777444, 747777447, 747777474, 747777477, 747777744, 747777747, 747777774, 747777777, 774444444, 774444447, 774444474, 774444477, 774444744, 774444747, 774444774, 774444777, 774447444, 774447447, 774447474, 774447477, 774447744, 774447747, 774447774, 774447777, 774474444, 774474447, 774474474, 774474477, 774474744, 774474747, 774474774, 774474777, 774477444, 774477447, 774477474, 774477477, 774477744, 774477747, 774477774, 774477777, 774744444, 774744447, 774744474, 774744477, 774744744, 774744747, 774744774, 774744777, 774747444, 774747447, 774747474, 774747477, 774747744, 774747747, 774747774, 774747777, 774774444, 774774447, 774774474, 774774477, 774774744, 774774747, 774774774, 774774777, 774777444, 774777447, 774777474, 774777477, 774777744, 774777747, 774777774, 774777777, 777444444, 777444447, 777444474, 777444477, 777444744, 777444747, 777444774, 777444777, 777447444, 777447447, 777447474, 777447477, 777447744, 777447747, 777447774, 777447777, 777474444, 777474447, 777474474, 777474477, 777474744, 777474747, 777474774, 777474777, 777477444, 777477447, 777477474, 777477477, 777477744, 777477747, 777477774, 777477777, 777744444, 777744447, 777744474, 777744477, 777744744, 777744747, 777744774, 777744777, 777747444, 777747447, 777747474, 777747477, 777747744, 777747747, 777747774, 777747777, 777774444, 777774447, 777774474, 777774477, 777774744, 777774747, 777774774, 777774777, 777777444, 777777447, 777777474, 777777477, 777777744, 777777747, 777777774, 777777777, 4444444444)\n\nfun main() = (readLong()..readLong())\n .let { range ->\n var sum = 0L\n for (i in range) sum += luckyNumbers.first { luckyNumber -> luckyNumber >= i }\n sum\n }\n .run(::println)\n", "lang": "Kotlin", "bug_code_uid": "8d552d8af8d6cdbefa302bbe54c47f5f", "src_uid": "8a45fe8956d3ac9d501f4a13b55638dd", "apr_id": "e3300d2ad031fdb1a399cf3e488e8b8e", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7350427350427351, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 15, "bug_source_code": "fun main() {\n val (n, pos, l, r) = readLine()!!.split(\" \").map(String::toInt)\n val toDelete = mutableListOf()\n if (l > 1)\n toDelete.add(pos - l)\n if (r < n)\n toDelete.add(r - pos)\n toDelete.sort()\n var sol = 0\n when (toDelete.size) {\n 1 -> sol += toDelete[0] + 1\n 2 -> sol += toDelete[0] + 1 + toDelete[0] + toDelete[1] + 1\n }\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "788a1913335d24bdc5bdc574d15dc2ea", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "apr_id": "0aae76bd7461c8a810d935cf935e3a66", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9435215946843853, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val n = nextInt(); val pos = nextInt()\n val l = nextInt(); val r = nextInt()\n\n val leftToRight = pos - l + 1 + (1 + r - l) * (if (r != n) 1 else 0)\n val rightToLeft = r - pos + 1 + (1 + r - l) * (if (l != 1) 1 else 0)\n\n if (l == 1 && r == n) {\n print(0)\n } else {\n print(minOf(leftToRight, rightToLeft))\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "5bcdbe31f36dc9187a7be1cd6046fc4c", "src_uid": "5deaac7bd3afedee9b10e61997940f78", "apr_id": "1a653f73a71b8e22f13769eb66d09449", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9421052631578948, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nfun main(args : Array) {\n val n1 = readLine()!!\n var n = n1.toInt()\n var a = 0\n for (i in 0..n1.length - 1) {\n if (n1[i] == '4' || n1[i] == '7') {\n a++\n }\n }\n\n if(a==n1.length){\n println(\"YES\")\n }\n else if(n%4==0 || n%7==0){\n println(\"YES\")\n }\n else{\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "ff09efc49791433fd95b59e74edcd196", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "a5149f3ab3accb496d704facb983b8a2", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4401114206128134, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "fun main()\n{\n var given = readLine()!!\n var has = given.filter { it == '4' || it == '7' }\n println(if (has.length == given.length)\"YES\" else \"NO\")\n\n}", "lang": "Kotlin", "bug_code_uid": "8a9a73ed5f26386d76e36d4042103d57", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "1ad65c7f62bef5005ab444659e624f0b", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.41367521367521365, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "fun main(args: Array) {\n var j = readLine()!!.toInt()\n var J = j.toString()\n var A47 = Array(10){4;7;47;74;447;474;477;774;747;744}\n var K1:Boolean = true\n var K2:Boolean = true\n for (i in 1..50) {\n A47[i] = 4\n }\n for (i in 0 until A47.size){\n if (j % 7 == A47[i]){\n K1 = true\n }\n else{\n K2 = false\n }\n }\n if (K1 == K2)\n print(\"YES\")\n else {\n print(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "7c4b46a9c1b77ad02ba921ba1e048927", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "cdbe968755853794fa0c9011005cf74c", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9957924263674615, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun ans(): String {\n val arr = arrayOf(4, 7, 47, 74, 447, 474, 477, 774, 747, 744)\n val num = readLine()\n val num1: Int? = num?.toInt()\n\n arr.forEach {i->\n\n if (num1 != null) {\n \n if (num1 == i || num1 % i == 0) {\n return \"YES;\n }\n }\n }\nreturn \"NO;\n}\n\nfun main() {\n\nprint(ans())\n}", "lang": "Kotlin", "bug_code_uid": "e18b75f6d81bcf65e085ad8b5fd641bb", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "3c4c3faa2e278e002053645ded2c0fa2", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.882051282051282, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "\n\nfun main() {\n readLine()?.let { checkNumber(it) }\n}\n\nfun checkNumber(n: String) {\n if (n.substring(0, 2).contains(\"47\") || n.substring(0, 2).contains(\"74\")\n || n.toInt() % 4 == 0\n || n.toInt() % 7 == 0\n || n.toInt() == 4\n || n.toInt() == 7)\n {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "9baef315e959829deb967e029f67f928", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "c93de750715ed99c8fefcd7024b25fa8", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9941656942823804, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val input1 = readLine()!!.split(\" \")\n\n val n: Long = input1[0].toLong()\n val k: Long = input1[1].toLong()\n\n val input2 = readLine()!!.split(\" \")\n\n var count = 0\n for (i in 0 until input2.size) {\n if (input2[i].toLong() >= input2[k.toInt()].toLong() && input2[i].toLong() > 0L) {\n count++\n } else {\n break\n }\n }\n print(count)\n}", "lang": "Kotlin", "bug_code_uid": "d50aa7eda2afda67dd7e5f04ff756d39", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "6200ccea1ec30e2a597a4526866c6cbf", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9969512195121951, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nfun main() { var reader = Scanner(System.`in`)\n var n= reader.nextInt()\n var k= reader.nextInt()\n var arr = Array(n){0}\n for (i in 0..n-1) arr[i]=reader.nextInt()\n var count =0\n for (i in 0..n-1)\n {\n if (arr[i]>=arr[k]&&arr[i]>0)\n count++\n }\n print(count)\n\n}", "lang": "Kotlin", "bug_code_uid": "9a9796ba21441d0d51d3933412566619", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "668af15fe858ed26cc40aa0c7cee0179", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9959016393442623, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "// codeforces problem 158 A\n\nfun main() {\n val k = readLine()!!.split(regex = \"\\\\s\".toRegex()).map { it.toInt() }[1]\n val p = readLine()!!.split(regex = \"\\\\s\".toRegex()).map { it.toInt() }\n\n println(p.count { it > 0 && it >= p[k]})\n}\n", "lang": "Kotlin", "bug_code_uid": "f4f11463e800ac4ddb8158f31eefc663", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "63613bb5c97dea0c4ce10552b53470dc", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6917416189697465, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val (n, k) = reader.readLine().split(\" \").map { it.toInt() }.toTypedArray()\n val participants: Array = reader.readLine().split(\" \").map { it.toInt() }.toTypedArray()\n\n var counter = if (k > 1 && participants[k] > 0) { k } else { 0 }\n if (participants[k] <= 0) {\n println(counter)\n return\n }\n var a: Int = k\n while (a < n) {\n if (participants[k - 1] <= participants[a]) { counter++ }\n a++\n }\n if (participants[k - 1] <= participants[n-1]) { counter++ }\n println(counter)\n}", "lang": "Kotlin", "bug_code_uid": "2825e1ac2b9df860d2b8abd382de98dd", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "14af8d348ef3139f81b6af1b0c8d5aec", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9177777777777778, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nclass Solution {\n fun main(args : Array){\n var input = Scanner(System.`in`)\n var n = input.nextInt()\n var k = input.nextInt()\n var sum =0;\n input.nextLine()\n var arrayInput = input.nextLine()\n var results = arrayInput.split(\" \").map { it.toInt() }.let { values ->\n sum =values.filter { it >= values[k-1] && values[k-1] > 0 }.size\n }\n System.out.println(\"${sum}\")\n\n }\n}\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "bfceb81bb7cd9e3879a2a4282abd6705", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "83120115a75b6b33fc16f133c1098db2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9974619289340102, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val k = sc.nextInt()\n val scores = mutableListOf()\n\n for (num in 1..n) {\n scores.add(sc.nextInt())\n }\n\n println(nextRound(k, scores))\n}\n\nfun nextRound(place: Int, scores: List): Int {\n return scores.filter { it > 0 && it >= scores[place] }.size\n}", "lang": "Kotlin", "bug_code_uid": "ed8fbdd1f83e196599341bc161720b8b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "0d71720d4f43bda0369bd62cb6161d8f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9958419958419958, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.File\nimport java.util.*\nimport kotlin.math.ceil\n\nfun main()\n{\n var scanner = Scanner(System.`in`)\n var n : Int = scanner.nextInt()\n var k : Int = scanner.nextInt()\n\n var array = mutableListOf()\n for (i in 0 until n)\n {\n var number = scanner.nextInt()\n array.add(number)\n }\n var counter = 0\n for (i in 0 until n)\n {\n if(array[i] >= array[k] && array[k] > 0)\n counter++\n }\n println(counter)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "a233066c0f5bfd7200a52836a87ab354", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "98422aa2cfba11efb1a3df78e6ba1ba6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.995049504950495, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(arg: Array){\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n val a = readLine()!!.split(' ').map(String::toByte)\n println(a.filter {it >= a.get(k) && it > 0}.size)\n}", "lang": "Kotlin", "bug_code_uid": "b0f7caa1d3b197955873361f884b7f20", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "86d6c5acab84a45d994fce1b52105f25", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9753231492361927, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val line = readLine() ?: \"\"\n val ints = line.split(\" \").map { it.toInt() }\n val k = ints[0]\n val n = ints[1]\n val scores = (readLine() ?: \"\").split(\" \").map { it.toInt() }.sorted().reversed()\n var last = 1\n var min = scores[n-last]\n while (min ==0 && last != k-1){\n last+=1\n min = scores[n-last]\n }\n if(min!=0) println(scores.lastIndexOf(min)+1)\n else println(0)\n}", "lang": "Kotlin", "bug_code_uid": "10c0dd45d0feff85aa76a42b67260847", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "d73490d17038c0130dd4aabf9604dbcd", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9771908763505402, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "val line = readLine() ?: \"\"\n val ints = line.split(\" \").map { it.toInt() }\n val k = ints[0]\n val n = ints[1]\n val scores = (readLine() ?: \"\").split(\" \").map { it.toInt() }.sorted().reversed()\n var last = 1\n var min = scores[n-last]\n while (min ==0 && n - last > 0){\n last+=1\n min = scores[n-last]\n }\n if(min!=0) println(scores.lastIndexOf(min)+1)\n else println(0)", "lang": "Kotlin", "bug_code_uid": "2a2fc58283581b2bb134023eda554f17", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "d73490d17038c0130dd4aabf9604dbcd", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.30579964850615116, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "fun main()\n{\n var n = readLine()!!.toInt()\n for (i in 0 until n)\n {\n var s = readLine().toString()\n if (s.length > 10)\n {\n var c: String = s[0].toString() + (s.length - 2).toString() + s.last().toString()\n println(c)\n }\n else\n println(s)\n }\n}", "lang": "Kotlin", "bug_code_uid": "7f7414c089d69fc7a673f3e413891ea7", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "eb8de605ec7bd973897fcd4c30ee04ee", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5936842105263158, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "// Codeforces - 158A\nfun main() {\n var (n, k) = readLine()!!.split(' ').map { it.toInt() }\n val scores = readLine()!!.split(' ').map { it.toInt() }\n\n if (scores[k] == 0) {\n print(0)\n return\n }\n\n var passed = k + 1\n while (k + 1 < n && scores[k + 1] > 0 && scores[k + 1] == scores[k]) {\n passed += 1\n k += 1\n }\n println(passed)\n}", "lang": "Kotlin", "bug_code_uid": "09b0e6b8799b5b64bff7efcb07839121", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "aa6055ef5d6ceeeb9ba68c7a5a2193de", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9982425307557118, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var s = readLine()!!\n val n = s.substringBefore(\" \").toInt()\n val k = s.substringAfter(\" \").toInt()\n val contestants = IntArray(n)\n s = readLine()!!\n for (i in contestants.indices) {\n contestants[i] = s.substringBefore(\" \").toInt()\n s = s.substringAfter(\" \")\n }\n println(toNextRound(contestants, k))\n}\n\nfun toNextRound(contestants: IntArray, k: Int): Int {\n var count = 0\n for (i in contestants) {\n if (i >= contestants[k] && i > 0) count++\n if (i < contestants[k]) break\n }\n return count\n}", "lang": "Kotlin", "bug_code_uid": "3eebf7cde5a7b85f58d8cc80d9a9a2cb", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "f35c3d81f853c33e08a0b8d08457e533", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.924119241192412, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val k = sc.nextInt()\n val arr = Array(n, {sc.nextInt()}).toList()\n for (i in 0 until arr.size) {\n if (arr[i] < arr[k]) {\n println(i)\n return\n }\n }\n println(if (arr[0] == 0) 0 else arr.size)\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "837115105f5fa46884f42e894c42398a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "436b270d85260674d361635a126a3872", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9859841560024375, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces.mix\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n\nfun main() {\n val word = readLn()\n var count = 0\n var lastPicked = 'a'\n word.forEach { letterAt ->\n val distance = Math.abs((lastPicked - letterAt))\n count += distance.coerceAtMost(26 - distance)\n lastPicked = letterAt\n }\n println(count)\n}", "lang": "Kotlin", "bug_code_uid": "32b9c802f1d191adbf713e4064fbacfd", "src_uid": "ecc890b3bdb9456441a2a265c60722dd", "apr_id": "5241eed5f08f5bb1e13e23e961412393", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9956331877729258, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main()\n{\n val (given, left, rite) = readLine().split(' ').map{ it.toInt()}\n val mins = (1 shl left) + (given - left - 1)\n val maxs = (1 shl rite) - 1 + (1 shl rite - 1) * (given - rite)\n println(\"$mins $maxs\")\n\n}", "lang": "Kotlin", "bug_code_uid": "71325e1923871d283ca816d9b1906949", "src_uid": "ce220726392fb0cacf0ec44a7490084a", "apr_id": "812ef1497c794c93715f9267876793dd", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.2700251889168766, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "import kotlin.math.sqrt\n\nfun main() {\n fun fac(i: Int): Set {\n val a = mutableSetOf()\n if (i%2==0) {\n a+=2\n a+=i/2\n }\n (1..sqrt(i.toDouble()).toInt() step 2).forEach {\n if (i % it == 0) {\n a += it\n a += i / it\n }\n }\n return a\n }\n\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n val b = 1000000007L\n //val v = r.readLine()!!.split(\"\").filter { it.isNotEmpty() }\n val (max, len) = r.readLine()!!.split(\" \").map { it.toInt() }\n // i : num to res\n val dp = Array(len) { LongArray(max + 1) { -1 } }\n fun f(n: Int, i: Int): Long {\n var ans = 0L\n when {\n dp[i][n] != -1L -> {\n return dp[i][n]\n }\n i == 0 -> {\n dp[i][n] = 1\n ans++\n }\n else -> {\n val fac = fac(n)\n fac.forEach {\n ans += f(n / it, i - 1)\n }\n }\n }\n dp[i][n] = ans % b\n return dp[i][n]\n }\n println((1..max).fold(0L) { acc, i -> (acc + f(i, len - 1)) % b })\n /*repeat(r.readLine()!!.toInt()) {\n val len = r.readLine()!!.toInt()\n val v1 = r.readLine()!!.split(\" \").map { it.toInt() }\n val v = r.readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n }*/\n\n}", "lang": "Kotlin", "bug_code_uid": "983ee68a2a44e7eb5f8e0a64aa8898b7", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "apr_id": "045f269288aaeeafb2a23a0710f9ca6a", "difficulty": 1400, "tags": ["dp", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.28077527501309585, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "import kotlin.math.sqrt\nfun main() {\n fun fac(i: Int): Set {\n val a = mutableSetOf()\n (1..sqrt(i.toDouble()).toInt()).forEach {\n if (i % it == 0) {\n a += it\n a += i / it\n }\n }\n return a\n }\n\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n val b = 1000000007L\n //val v = r.readLine()!!.split(\"\").filter { it.isNotEmpty() }\n val (max, len) = r.readLine()!!.split(\" \").map { it.toInt() }\n // i : num to res\n val dp = Array(len) { LongArray(max + 1) { -1 } }\n fun f(n: Int, i: Int): Long {\n var ans = 0L\n when {\n dp[i][n] != -1L -> {\n return dp[i][n]\n }\n i == 0 -> {\n dp[i][n] = 1\n ans++\n }\n else -> {\n val fac = fac(n)\n fac.forEach {\n ans += f(n / it, i - 1)\n }\n }\n }\n dp[i][n] = ans % b\n return dp[i][n]\n }\n println((1..max).fold(0L) { acc, i -> (acc + f(i, len - 1)) % b })\n /*repeat(r.readLine()!!.toInt()) {\n val len = r.readLine()!!.toInt()\n val v1 = r.readLine()!!.split(\" \").map { it.toInt() }\n val v = r.readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n }*/\n\n}", "lang": "Kotlin", "bug_code_uid": "8794499abed82868deccd0f25be79334", "src_uid": "c8cbd155d9f20563d37537ef68dde5aa", "apr_id": "045f269288aaeeafb2a23a0710f9ca6a", "difficulty": 1400, "tags": ["dp", "combinatorics", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.745945945945946, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val (n, m, a, b) = r.readLine()!!.split(\" \").map { it.toInt() }\n\n var act = r.readLine()!!\n when{\n act[0] != '-' -> println(act.toInt())\n else -> {\n act = act.removeRange(0..0)\n val size = act.length\n val last = act[size-1]\n val second = act[size-1]\n if (last>=second) {\n act = act.removeRange(size-1..size-1)\n } else{\n act = act.removeRange(size-2..size-2)\n }\n s.append(\"-\")\n s.append(act.toInt())\n println(s)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "2ab887ad26db26706b0475b787e26a8f", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "apr_id": "17f89ef5cafc0efaf69c36d58bba11f3", "difficulty": 900, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6446280991735537, "equal_cnt": 15, "replace_cnt": 6, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "fun main() {\n var a = readLine()!!.toInt()\n if (a >= 0) {\n print(a)\n return\n }\n val s = (-a).toString()\n println((0 until s.length)\n .map { s.removeRange(it..it) }\n .map { -it.toInt() }\n .filter { it.toString().length == s.length }\n .max())\n}", "lang": "Kotlin", "bug_code_uid": "8ff21cb543d31c96bfa443d82d5bb5ea", "src_uid": "4b0a8798a6d53351226d4f06e3356b1e", "apr_id": "dcc8d08a6911b3cb2a4ee35695f2d01d", "difficulty": 900, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5934306569343065, "equal_cnt": 18, "replace_cnt": 15, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 18, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun > max(a: T, b: T): T = if (b > a) b else a\nfun > min(a: T, b: T): T = if (b < a) b else a\nfun Number.isEven(): Boolean = if (this.toInt() and 1 == 0) true else false\nfun Number.isOdd (): Boolean = !this.isEven()\n\nfun main(args: Array) {\n if (args.isNotEmpty()) System.setIn(FileInputStream(args[0]))\n val br = BufferedReader(InputStreamReader(System.`in`))\n val bw = BufferedWriter(OutputStreamWriter(System.out))\n\n val st = StringTokenizer(br.readLine())\n val on = st.nextToken().toInt()\n val om = st.nextToken().toInt()\n val k = st.nextToken().toLong()\n val n = min(on, om); val m = max(on, om)\n var nds = 1; var cum: Long = 1L; var dnum = 1\n while (true) {\n if (cum >= k) break\n if (dnum < m && dnum < n) {\n ++nds\n } else if (dnum >= m){\n --nds\n }\n cum += nds\n ++dnum\n }\n cum -= nds\n\n val startl: Int; val startr: Int; val numiter: Int\n if (dnum <= m) {\n startl = 1\n startr = dnum\n numiter = min(n, dnum)\n } else {\n startl = dnum - m + 1\n startr = m\n numiter = min(m - (dnum - m), n - (dnum - m))\n }\n val arr = mutableListOf()\n for (i in 0..numiter-1) {\n arr.add((startl + i) * (startr - i).toLong())\n }\n arr.sort()\n val idx = k - cum -1\n bw.write(\"${arr[idx.toInt()]}\\n\")\n bw.close()\n}\n", "lang": "Kotlin", "bug_code_uid": "2d68b470d0421fc137cf0b4327feed36", "src_uid": "13a918eca30799b240ceb9de47507a26", "apr_id": "cfae23133a942c2f7cd91dfe7b1b60a3", "difficulty": 1800, "tags": ["brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.984468339307049, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n var str = scanner.next()\n var ind = 0\n var b = false\n while (ind < str.length - 2) {\n if (str[ind] == 'W' && str[ind + 1] == 'U' && str[ind + 2] == 'B') {\n if (b)\n print(' ')\n b = false\n ind += 3\n }\n else {\n print(str[ind])\n b = true\n ind++\n }\n }\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n//class Pair(var a: Int, var b: Int): Comparable {\n// override fun compareTo(other: Pair): Int {\n// return b - a - other.b + other.a\n// }\n//}", "lang": "Kotlin", "bug_code_uid": "ae236edfa30990dd1e75deb770ca2b18", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "2df9f22fcb3da14fa20ae411f9b3b402", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8421052631578947, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n\tprintln(readLine()!!.replace(\"WUB\",\"\"))\n}\n", "lang": "Kotlin", "bug_code_uid": "0b3f2f2b68fbd1cf5b808f524ea18f97", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "fc689c9e45013b2c1734f90d98a21569", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8793774319066148, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val s = readLine()!!\n println(s.replace(\"(WUB)*\".toRegex(), \" \").replace(\"\\\\s+\".toRegex(), \" \").trim())\n}", "lang": "Kotlin", "bug_code_uid": "cb4ea6d4e8dafbff30cdb537e0c73c33", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "67c909660a92ad611e18a047c13e0e40", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9951456310679612, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val pos = readLine()!!\n if (pos in setOf(\"a1\", \"h1\", \"a8\", \"h8\")) return print(4)\n if (pos[0] == 'a' || pos[0] == 'h' || pos[1] == '1' || pos[1] == '8') return print(5)\n print(8)\n}", "lang": "Kotlin", "bug_code_uid": "00efdc04bd21f9bb06afe0e8170081fc", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "apr_id": "ff9f5fad117d653aff8b0ffc2b767921", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6749140893470791, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.File\nimport java.io.PrintWriter\n\nfun main(args: Array) {\n val onlineJudge = System.getProperty(\"ONLINE_JUDGE\") == \"true\"\n val input = if (onlineJudge) System.`in`.bufferedReader() else File(\"input.txt\").bufferedReader()\n val output = if (onlineJudge) PrintWriter(System.out.writer(), true) else PrintWriter(File(\"output.txt\"))\n\n solve(input, output)\n}\n\nprivate fun solve(input: BufferedReader, output: PrintWriter) {\n //todo implement the task solution\n}", "lang": "Kotlin", "bug_code_uid": "2015ae0574ab0ade977039bd4fd7bb1e", "src_uid": "6994331ca6282669cbb7138eb7e55e01", "apr_id": "b5317c604a19682ce395bcc0a46fc153", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9932885906040269, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "\nfun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n val (len, v1, v2, p1, p2) = r.readLine()!!.split(\" \").map { it.toInt() }\n val t1 = v1*len+2*p1\n val t2 = v2*len+2*p2\n when{\n t1>t2 -> println(\"First\")\n t2 > t1 -> println(\"Second\")\n else -> println(\"Friendship\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "18f88a8f6d6686cd9bd0ee1828f45db1", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "apr_id": "68c984517618c83a98a203d4ab5cfad9", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9850746268656716, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package a\n\nimport java.util.*\n\nfun main() {\n\n val scanner = Scanner(System.`in`)\n\n val t = scanner.nextLine().split(' ').map { it.toInt() }\n\n val first = t[0] * t[1] + 2 * t[3]\n val second = t[0] * t[2] + 2 * t[4]\n\n when {\n first < second -> println(\"First\")\n first > second -> println(\"Second\")\n else -> println(\"Friendship\")\n }\n\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "b17e9a49d5fe85d3ebb229c743c984ac", "src_uid": "10226b8efe9e3c473239d747b911a1ef", "apr_id": "242a6d5949e53287ca6e95d328cf4704", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8186813186813187, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n\n println(1)\n\n\n\n\n}", "lang": "Kotlin", "bug_code_uid": "dcef67d983e7a688d21adcdc3504f6e4", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "apr_id": "1f19388679c59078c328d9bfe386bfa3", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9938650306748467, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package avito\n\nfun main(args: Array) {\n val input = readLine()!!.toInt()\n if(input<=2){\n println(input)\n }else{\n println(1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "11930c88aba28dfce9f05027b192b1f9", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "apr_id": "91792f7444fb4a34a2f04fa82bf73581", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9846153846153847, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n print(if (readLine()!!.toInt() == 1) 2 else 1)\n}", "lang": "Kotlin", "bug_code_uid": "ce5a4a7dfa1fb4ab55db641c5725a5bd", "src_uid": "c30b372a9cc0df4948dca48ef4c5d80d", "apr_id": "9a5f40f947806c9f7b5e781a69c9fca0", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9555895865237366, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.collections.*\nimport kotlin.io.*\nimport kotlin.math.*\nimport kotlin.Array\n\nclass Main{\n\n fun solve(inp : InputReader) {\n var (n,k) = inp.readlnInts()\n var lo = 0\n var hi = n\n var mid : Int = (lo + hi) / 2\n var ans = 2 * n \n while(lo <= hi){\n mid = (lo + hi) / 2\n var v : Int = 0\n var pw = 1\n while(pw <= mid){\n v += (mid / pw).toInt()\n pw *= k\n }\n if(v >= n){\n ans = min(ans,mid)\n hi = mid - 1\n } else {\n lo = mid + 1\n }\n }\n print(ans)\n }\n\n class InputReader{\n public fun readln() = readLine()!!\n public fun readlnInt() = readln().toInt()\n public fun readlnLong() = readln().toLong()\n public fun readlnDouble() = readln().toDouble()\n\n public fun readlnStrings() = readln().split(\" \")\n public fun readlnInts() = readlnStrings().map{it.toInt()}\n public fun readlnLongs() = readlnStrings().map{it.toLong()}\n public fun readlnDoubles() = readlnStrings().map{it.toDouble()}\n }\n}\n\nfun main(args : Array ){\n Main().solve(Main.InputReader())\n}\n", "lang": "Kotlin", "bug_code_uid": "ba3ae89aaa35e59bd627fa36abd731fc", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "apr_id": "bceef54d8bcf44c0c1f011364a9216b1", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9992691839220463, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\nfun main() {\n output {\n val n = readInt()\n val k = readInt()\n\n val ans = (1..n).binarySearchBy { v ->\n var c = 0\n var d = 1\n\n while(true) {\n val cn = v/d\n if(cn == 0) break\n c += cn\n d *= k\n }\n\n if(c < n) -1 else 1\n }.ceil\n\n println(ans)\n }\n}\n\nfun IntRange.binarySearchBy(goldilocks: (Int) -> Int): BinarySearchResult {\n var low = start\n var high = endInclusive\n\n while (low <= high) {\n val mid = low.and(high) + low.xor(high).shr(1)\n val cmp = goldilocks(mid)\n\n when {\n cmp < 0 -> low = mid + 1\n cmp > 0 -> high = mid - 1\n else -> return BinarySearchResult(mid, true)\n }\n }\n return BinarySearchResult(low, false)\n}\nval BinarySearchResult.floor get() = if(exactFound) value else value - 1\ninline val BinarySearchResult.ceil get() = value\n\ndata class BinarySearchResult(val value: T, val exactFound: Boolean)\n\n/** IO code start */\n@JvmField val _reader = System.`in`.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(System.out, false)\ninline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }\nfun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks", "lang": "Kotlin", "bug_code_uid": "a568a4d828174725880d9b99cbbf59c9", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "apr_id": "bb110b2c36dadf0f9cb9fafd6b5bb97a", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6793893129770993, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun calcSum (v: Int, k: Int): Int {\n tailrec fun go (k: Int, acc: Int): Int =\n if (v/k == 0) acc\n else go(k*k, acc + v/k)\n return go(k, v)\n}\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (n, k) = br.readLine().split(\" \").map { it.toInt() }\n var v = n*(k - 1)/k\n while (calcSum(v, k) < n) {\n v++\n }\n println(v)\n}", "lang": "Kotlin", "bug_code_uid": "500e596ec38e5bcfe0c54ebf436fb9eb", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "apr_id": "7b6aee7ae4c51ff4c868bf4dc1427ad0", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8183520599250936, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun calcSum (v: Int, k: Int): Int {\n tailrec fun go (summand: Int, acc: Int): Int =\n if (summand == 0) acc\n else go(summand/k, acc + summand)\n return go(v, 0)\n}\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (n, k) = br.readLine().split(\" \").map { it.toInt() }\n var v = n*(k - 1)/k\n while (calcSum(v, k) < n) {\n v++\n }\n println(v)\n}", "lang": "Kotlin", "bug_code_uid": "2df142e50e9d589eda1d965a3a458184", "src_uid": "41dfc86d341082dd96e089ac5433dc04", "apr_id": "7b6aee7ae4c51ff4c868bf4dc1427ad0", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7443419949706622, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 6, "bug_source_code": "import java.lang.Integer.*\nimport java.util.Scanner\n\nval MOD: Long = 1000000000 + 7\nvar fibs: HashMap = HashMap()\n\nfun countFib(n: Int): Long {\n if (fibs.containsKey(n)) {\n return fibs[n]!!\n }\n if (n <= 0) {\n fibs[n] = 1\n return 1\n }\n\n fibs[n] = countFib(n - 1) + countFib(n - 2)\n return fibs[n]!!\n}\n\nfun F(n: Int, m: Int) : Long {\n // n >= m\n if (m == 1) {\n return (countFib(n - 1) + countFib(n - 1)) % MOD\n }\n\n var ans: Long = 0\n ans = (ans + countFib(m - 3)) % MOD\n ans = (ans + countFib(n - 3)) % MOD\n for (i in 2 until n) {\n ans = (ans + countFib(n - i - 2)) % MOD\n }\n\n ans = (ans + countFib(m - 2)) % MOD\n return (ans + ans) % MOD\n}\n\nfun main(args: Array) {\n fibs[0] = 1\n fibs[-1] = 1\n for (i in 1 until 100000 + 1) {\n fibs[i] = fibs[i - 1]!! + fibs[i - 2]!!\n }\n\n val input = Scanner(System.`in`)\n val n = input.nextInt()\n val m = input.nextInt()\n\n val ans = F(max(n, m), min(n, m))\n println(ans)\n// for (v in fibs) {\n// println (v.key.toString() + \" \" + v.value.toString())\n// }\n}", "lang": "Kotlin", "bug_code_uid": "643d8831a1642c21e58f6210a06ff18d", "src_uid": "0f1ab296cbe0952faa904f2bebe0567b", "apr_id": "86e8759b63e9e7b1e3121761a405dcac", "difficulty": 1700, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9973725696269049, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "val debug = false\n\nfun readInt() = readLine()!!.toInt()\nfun readInts() = readLine()!!.split(' ').map { it.toInt() }\n\nfun main() {\n val t = readInt()\n for (i in 1..t) {\n val (_, k, l) = readInts()\n val ds = readInts()\n println(if (solve(k, l, ds)) \"Yes\" else \"No\")\n }\n}\n\nfun tDepth(depth: Int, i: Int, k: Int): Int = if (i <= k) depth + i else depth - (i - k)\n\nfun solve(k: Int, l: Int, ds: List): Boolean {\n val n = ds.size\n val w = 2*k\n var s = Array(w) { true }\n\n for (p in n-1 downTo 0) {\n val depth = ds[p]\n\n var ns = Array(w) { true }\n for (i in 0 until w) {\n ns[i] = tDepth(depth, i, k) <= l && (s[(i + 1) % w])\n }\n for (i in w-1 downTo 0) {\n ns[i] = ns[i] || (tDepth(depth, i, k) <= l && ns[(i + 1) % w])\n }\n\n s = ns\n if (debug) println(\"p=$p, s=${s.contentToString()}, depth=$depth\")\n }\n\n return s.any { it }\n}\n", "lang": "Kotlin", "bug_code_uid": "27f8829cd3405d9c58e520a1873faf55", "src_uid": "4941b0a365f86b2e2cf686cdf5d532f8", "apr_id": "0aa56be9a201d12702120337269eabb8", "difficulty": 1900, "tags": ["dp", "brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.3171355498721228, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n var output = false\n for (a in 0..n / 1234567) {\n for (b in 0..(n - a * 1234567) / 123456) {\n for (c in 0..(n - a * 1234567 - b * 123456) / 1234) {\n if (a * 1234567 + b * 123456 + c * 1234 == n) {\n output = true\n break\n }\n }\n if(output) break\n }\n if (output) break\n }\n if (output) print(\"YES\") else print(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "09439bb0aa942959a7e625d044fda5fb", "src_uid": "72d7e422a865cc1f85108500bdf2adf2", "apr_id": "b34cc3636e7c17aad12ca2d61a6a0145", "difficulty": 1300, "tags": ["brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8926630434782609, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner\nimport kotlin.math.ceil\nimport kotlin.math.sqrt\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var x: Int = reader.nextInt()\n var y: Int = reader.nextInt()\n\n var a = x.toDouble()\n var b = y.toDouble()\n var r = sqrt(a*a+b*b)\n\n if((x>=0 && y>=0) || (x<=0 && y<=0) ){\n if (ceil(r).toInt() == r.toInt() || ceil(r).toInt() % 2 == 1) {\n println(\"black\")\n } else if (ceil(r).toInt() % 2 == 0) {\n println(\"white\")\n }\n }\n else{\n if (ceil(r).toInt() == r.toInt() || ceil(r).toInt() % 2 == 1) {\n println(\"white\")\n } else if (ceil(r).toInt() % 2 == 0) {\n println(\"black\")\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "c552445fb8017970c3c9ce0d880d623e", "src_uid": "8c92aac1bef5822848a136a1328346c6", "apr_id": "e72b7bd3515e32a46703f5bc776e9853", "difficulty": 1300, "tags": ["geometry", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6897233201581028, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "\nfun main(args : Array) {\n var input = System.`in`.bufferedReader()\n try {\n var n = input.readLine().toLong()\n var i = 0\n \n --n\n \n var ans = 0L\n while (n shr i > 0) {\n ans += ((n shr (i + 1)) + 1) * (1L shl i)\n ++i\n }\n println(ans)\n } finally {\n input.close()\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "cd559776a7007291b30acf848ddd77a5", "src_uid": "a98f0d924ea52cafe0048f213f075891", "apr_id": "0831222d79c384fb1f24db1cc902b73d", "difficulty": 1900, "tags": ["dp", "bitmasks", "math", "implementation", "graphs"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8769716088328076, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val len = r.readLine()!!.toInt()\n //val (len, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c) = r.readLine()!!.split(\" \").map { it.toInt() }\n println(minOf(a+b+c, 2*a+2*b))\n}", "lang": "Kotlin", "bug_code_uid": "ff59334d404f654f60a1e5cb57d68cf1", "src_uid": "26cd7954a21866dbb2824d725473673e", "apr_id": "55707aca46c0993b31ca7c4b691e56c1", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8805031446540881, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val len = r.readLine()!!.toInt()\n //val (len, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c) = r.readLine()!!.split(\" \").map { it.toInt() }\n println(minOf(a+b+c, 2*a+2*b))\n}", "lang": "Kotlin", "bug_code_uid": "7f6e94a900c0b72f0192753ebd5cb2b8", "src_uid": "26cd7954a21866dbb2824d725473673e", "apr_id": "55707aca46c0993b31ca7c4b691e56c1", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.min\n\n/* http://codeforces.com/problemset/problem/599/A */\n\nfun main() {\n val (d1, d2, d3) = readLine()!!.split(\" \").map { it.toInt() }\n val fullCycleTrip = d1 + d2 + d3\n val twoLegsTrip = 2 * d1 + 2 * d2\n println(min(fullCycleTrip, twoLegsTrip))\n}", "lang": "Kotlin", "bug_code_uid": "3db286136d13a9d7090641ea40b0df07", "src_uid": "26cd7954a21866dbb2824d725473673e", "apr_id": "81a5ec7507b78929d4674c5759f040d2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8520710059171598, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val (d1, d2, d3) = readLine()!!.split(' ').map { it.toInt() }\n println(minOf(d1 + d2 + d3, (d1 + d2) * 2))\n}", "lang": "Kotlin", "bug_code_uid": "c628d67ada5e1e72732bbeeafcff74da", "src_uid": "26cd7954a21866dbb2824d725473673e", "apr_id": "a0ebdb260c6379d0ceac0cb219dab58c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8038277511961722, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (d1, d2, d3) = readInts()\n print(min(d1 + d2 + d3, d1 + d1 + d2 + d2))\n}", "lang": "Kotlin", "bug_code_uid": "1ad79ae749825192dc10b36608949bdc", "src_uid": "26cd7954a21866dbb2824d725473673e", "apr_id": "7b056e5d938bcedbc1065149d1a65e88", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7199444058373871, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun readInts() : List {\n val x_nullable_str = readLine()\n if (x_nullable_str == null) {\n throw Exception(\"Could not read ints.\")\n } else {\n val x_str = x_nullable_str\n val xs = x_str.split(' ').map(String::toInt)\n return xs\n }\n}\n\nfun main(args : Array) {\n val a_b_c = readInts()\n if (a_b_c.size < 3) {\n throw Exception(\"Did not get 3 integers as input.\")\n }\n val a = a_b_c[0]\n val b = a_b_c[1]\n val c = a_b_c[2]\n val cost_1 = 2 * (a + b)\n val cost_2 = a + b + c\n when (cost_1 < cost_2) {\n true -> println(\"${cost_1}\")\n else -> println(\"${cost_2}\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "ffefd366949d6f21e6627ed91b7d8e01", "src_uid": "26cd7954a21866dbb2824d725473673e", "apr_id": "fd6145d9a768e26e34c3fb7915a0ce92", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9181547619047619, "equal_cnt": 66, "replace_cnt": 2, "delete_cnt": 65, "insert_cnt": 0, "fix_ops_cnt": 67, "bug_source_code": "object MainActivity {\n\n @JvmStatic\n fun main(args: Array) {\n\n val a = readLine()!!.splitToIntArray()\n val x = readLine()!!.toCharArray()\n val k = a[1]\n\n for (i in 0 until x.size) {\n var m = i\n for (j in i + 1 until x.size) {\n if (x[j] < x[m]) {\n m = j\n }\n }\n val q = x[i]\n x[i] = x[m]\n x[m] = q\n }\n\n var s = \"\"\n\n s += x[0]\n\n for (i in 1 until x.size) {\n val c = x[i]\n if ((c - s.last()) < 2) continue\n s += c\n }\n\n if (s.length < k) {\n System.out.println(-1)\n } else {\n s = s.substring(0 until k)\n var ans = 0\n for (c in s) {\n ans += c.toInt() - 'a'.toInt() + 1\n }\n System.out.println(ans)\n }\n\n\n }\n\n private fun String.splitToIntArray(): IntArray {\n val n = length\n if (n == 0) return IntArray(0) // EMPTY\n var res = IntArray(4)\n var m = 0\n var i = 0\n while (true) {\n var cur = 0\n var neg = false\n var c = get(i) // expecting number, IOOB if there is no number\n if (c == '-') {\n neg = true\n i++\n c = get(i) // expecting number, IOOB if there is no number\n }\n while (true) {\n val d = c.toInt() - '0'.toInt()\n require(d >= 0 && d <= 9) { \"Unexpected character '$c' at $i\" }\n require(cur >= Integer.MIN_VALUE / 10) { \"Overflow at $i\" }\n cur = cur * 10 - d\n require(cur <= 0) { \"Overflow at $i\" }\n i++\n if (i >= n) break\n c = get(i)\n if (c == ' ') break\n }\n if (m >= res.size) res = res.copyOf(res.size * 2)\n res[m++] = if (neg) cur else (-cur).also { require(it >= 0) { \"Overflow at $i\" } }\n if (i >= n) break\n i++\n }\n if (m < res.size) res = res.copyOf(m)\n return res\n }\n}", "lang": "Kotlin", "bug_code_uid": "adb8aaea69e8a0ec6d3584732a19135d", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "apr_id": "ec15766b8496c370c2a8e4dac5985952", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9850448654037887, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n val n = sc.nextInt()\n var k = sc.nextInt()\n\n sc.nextLine()\n val str = sc.nextLine()\n\n val set = TreeSet()\n for(c in str)\n set.add(c)\n\n var sum = 0\n var last = 'A'\n for(c in set) {\n if(c - last > 1) {\n last = c\n sum += (c - 'a') + 1\n k--\n }\n if(k == 0)\n break\n }\n print(set)\n\n print(if(k == 0) sum else -1)\n}", "lang": "Kotlin", "bug_code_uid": "4339d362f0f812dd4489489676065ca6", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "apr_id": "8cef9bbc27f77af405fb1cea7a762c58", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9563507668108533, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedReader\nimport java.util.*\n\n\nfun main(args: Array) {\n val offset = 96\n var n = 0 // \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0438\n var k = 0 // \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u044b\n var a = charArrayOf()\n val bufferedReader = BufferedReader(System.`in`.bufferedReader())\n var lineNumber = 1\n while (true) {\n val line = (bufferedReader.readLine())\n val scanner = Scanner(line)\n when (lineNumber) {\n 1 -> {\n n = scanner.nextInt()\n k = scanner.nextInt()\n }\n 2 -> {\n var s = scanner.next()\n a = s.toCharArray()\n }\n }\n if (lineNumber == 2) break\n lineNumber++\n }\n\n a.sort()\n val rocket = CharArray(k)\n rocket[0] = a[0]\n var sum = a[0].toInt() - offset\n\n loop@ for (i in 1 until k) {\n for (j in 0 until a.size) {\n val currValue = a[j]\n if (currValue.toInt() == 0) continue\n if ((currValue - rocket[i - 1]) >= 2) {\n rocket[i] = currValue\n sum += currValue.toInt() - offset\n a[j] = 0.toChar()\n continue@loop\n }\n }\n }\n\n if (rocket[k - 1].toInt() == 0) {\n print(-1)\n } else {\n print(sum)\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "9a976126a16370818044e01baaf6fa74", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "apr_id": "9e9db0209ab1a359bc9c5a667b14a63b", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.963855421686747, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var (n, k) = readInts()\n var str = readStr()!!.toList().sorted().joinToString(\"\")\n var count = 0\n var sum = str[0].toInt() - 97 + 1\n var last = \"\"\n last += str[0]\n for (i in 1 until str.length) {\n if (str[i].toInt() - last[last.length - 1].toInt() >= 2) {\n sum += str[i].toInt() - 97 + 1\n last += str[i]\n\n }\n if (last.length == k) {\n println(sum)\n return\n }\n }\n println(-1)\n\n}\n\nprivate fun readInts(): List = readLine()!!.split(' ').map { it.toInt() }\nprivate fun readLongs(): List = readLine()!!.split(' ').map { it.toLong() }\nprivate fun readInt(): Int = readLine()!!.toInt()\nprivate fun readLong(): Long = readLine()!!.toLong()\nprivate fun readStr(): String? = readLine()\n\n", "lang": "Kotlin", "bug_code_uid": "9bb30987927b9ff430f758d222eebee0", "src_uid": "56b13d313afef9dc6c6ba2758b5ea313", "apr_id": "caad7f1dd12c58d59004c268abdd5fe0", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5858156028368794, "equal_cnt": 16, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "fun main() {\n\n var count = readLine()!!.toInt()\n\n for(c in 0 until count) {\n var (n, k, d) = readLine()!!.split(\" \").map { it.toInt() }\n var numbers = readLine()!!.split(\" \").map { it.toInt() }.toIntArray()\n\n var set = numbers.take(k).toMutableSet()\n var numNumber = set.size\n for(i in k until n) {\n set.remove(numbers[i - k])\n set.add(numbers[i])\n numNumber = Math.min(numNumber, set.size)\n }\n\n println(numNumber)\n }\n}", "lang": "Kotlin", "bug_code_uid": "d7549d0f96d462a9ab96a4e9c02cd068", "src_uid": "56da4ec7cd849c4330d188d8c9bd6094", "apr_id": "cdda8a55f5c21036b183970177e2de62", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8101386896221904, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*\n\nfun main() {\n\n val scanner = Scanner(System.`in`)\n\n val destPoint = scanner.nextInt()\n val maxLitersCount = scanner.nextInt()\n val stationCoordinate = scanner.nextInt()\n val ridesCount = scanner.nextInt()\n\n var ans = 0\n\n var currentFuel = maxLitersCount\n var distanceToRide: Int\n\n if (maxLitersCount < stationCoordinate) {\n println(-1)\n return\n } else {\n currentFuel -= stationCoordinate\n }\n\n for (currentRideNumber in 0..ridesCount) {\n distanceToRide = if (currentRideNumber.rem(2) == 0) {\n destPoint - stationCoordinate\n } else {\n stationCoordinate\n }\n if (currentRideNumber < ridesCount) {\n distanceToRide *= 2\n }\n if (maxLitersCount < distanceToRide) {\n println(-1)\n return\n } else if (currentFuel < distanceToRide) {\n ans += 1\n currentFuel = maxLitersCount\n }\n\n currentFuel -= distanceToRide\n }\n\n println(ans)\n\n\n\n}\n", "lang": "Kotlin", "bug_code_uid": "4d2e00e36a8fc5d08ba7bad14b1fa56d", "src_uid": "283aff24320c6518e8518d4b045e1eca", "apr_id": "a94d4ff210793f68dc69b36136b74782", "difficulty": 1500, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9611267605633803, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (a, b, f, k) = readLine()!!.split(\" \").map { it.toInt() }\n var x = 0\n var y = b\n var ans = 0\n repeat(k - 1) {\n when {\n k > 2 && x == a && 2 * f > b -> {\n print(-1)\n return\n }\n k > 1 && x == 0 && 2 * (a - f) > b -> {\n print(-1)\n return\n }\n x == 0 && a + a - f > y -> {\n x = a\n y = b - (x - f)\n ans++\n }\n x == 0 -> {\n x = a\n y -= a\n }\n x == a && a + f > y -> {\n x = 0\n y = b - f\n ans++\n }\n x == a -> {\n x = 0\n y -= a\n }\n }\n }\n if (y < a) ans++\n print(ans)\n}", "lang": "Kotlin", "bug_code_uid": "005cc91aaf7c467f9b482e7d99781639", "src_uid": "283aff24320c6518e8518d4b045e1eca", "apr_id": "924c2877bdaa52ebc1e2b57773c5220d", "difficulty": 1500, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8067226890756303, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nimport kotlin.collections.HashMap\n\nfun main() {\n val `in` = Scanner(System.`in`)\n val count = `in`.nextInt()\n val b = HashMap()\n for (i in 0 until count) {\n b[`in`.nextInt()] = 1\n }\n println(b.size)\n}", "lang": "Kotlin", "bug_code_uid": "df7f512720df1047037f766a6c33d5b4", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "apr_id": "594d9f999ef40d06a87b0ae2ee4a073f", "difficulty": 800, "tags": ["sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9343715239154616, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "//kotlinc kot.kt -include-runtime -d kot.jar\n//java -jar kot.jar\nimport kotlin.math.*\nimport java.util.ArrayList\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of ints\n\nfun main(){\n\tvar n = readInt()\n\tvar arr: ArrayList = ArrayList(n)\n\tfor(i in 0..n-1){\n\t\tvar x = readInt()\n\t\tarr.add(x)\n\t}\n\tvar cnt: ArrayList = ArrayList(20020)\n\tfor(i in 0..(20020-1)){\n\t\tcnt.add(0)\n\t}\n\tvar ans = 0\n\tfor(i in 0..n-1){\n\t\tvar aa = arr[i.toInt()]\n\t\tif( (arr[i.toInt()] > 0) && (cnt[aa] == 0) ) { \n\t\t\tans = ans + 1\n\t\t\tcnt[aa] = 1\n\t\t}\n\t}\n\tprintln(ans)\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n}\n", "lang": "Kotlin", "bug_code_uid": "964640af058bc2bbba7a76e5c0150cdc", "src_uid": "3b520c15ea9a11b16129da30dcfb5161", "apr_id": "c318b0f6ed966e6c1b7a05d682a23941", "difficulty": 800, "tags": ["sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7796610169491526, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n val password = readLine()!!\n val binaryToDecimal = mutableMapOf()\n for (num in 0..9)\n binaryToDecimal[readLine()!!] = num\n var sol = 0\n for (start in 0..70 step 10)\n sol = sol * 10 + binaryToDecimal[password.substring(start..start + 9)]!!\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "4529ec699ef5e1fa0c66ddd02827e0e4", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9", "apr_id": "96900c4e209fc36dfdb6cfb37d372d74", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9996355685131195, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val q = readInt()\n\n readMultiLineIntList(q) {\n val num = it.toString()[0].toString().toInt()\n order(when(it.toString().length) {\n 1 -> \"${((num - 1) * 10 + 1)}\"\n 2 -> \"${((num - 1) * 10 + 3)}\"\n 3 -> \"${((num - 1) * 10 + 6)}\"\n 4 -> \"${(num * 10)}\"\n else -> \"\"\n })\n }\n\n drop()\n}\n\n// region Technolib\n/*\n Author: Timofey Chicherin (TimDev, TwMicro)\n Collaborators: [no]\n License: Apache License 2.0\n GitHub: https://github.com/twmicro/technolib/\n*/\n\nvar toPrint = \"\"\n/*\n readLines -\n Reads a count of lines\n*/\n\n// Simple variant\nfun readLines(count: Int): MutableList {\n val lines = mutableListOf()\n for (i in 0 until count) lines.add(readLine()!!)\n return lines\n}\n\n// Inline variant, works like forEach\ninline fun readLines(count: Int, action: (String) -> Unit): MutableList {\n val lines = mutableListOf()\n for (i in 0 until count) {\n lines.add(readLine()!!)\n action.invoke(lines.last())\n }\n return lines\n}\n\n\n/*\n readMultiLineIntList -\n Reads a count of lines and converts it to MutableList\n*/\n\n// Simple variant\nfun readMultiLineIntList(count: Int): MutableList {\n val lines = mutableListOf()\n for (i in 0 until count) lines.add(readLine()!!.toInt())\n return lines\n}\n\n// Inline variant, works like forEach\ninline fun readMultiLineIntList(count: Int, action: (Int) -> Unit): MutableList {\n val lines = mutableListOf()\n for (i in 0 until count) {\n lines.add(readLine()!!.toInt())\n action.invoke(lines.last())\n }\n return lines\n}\n\n\n/*\n readIntList -\n Reads single line of integers\n*/\n\n// Simple variant\nfun readIntList(seperator: String = \" \"): MutableList = readLine()!!.split(seperator).toIntList()\n\n// Inline variant, works like forEach\nfun readIntList(seperator: String = \" \", action: (Int) -> Unit) = readIntList(seperator).forEach(action)\n\n/*\n List.toIntList -\n Converts string list to int list\n*/\n\nfun List.toIntList(): MutableList {\n val result = mutableListOf()\n forEach {\n result.add(it.toInt())\n }\n return result\n}\n\n/*\n order(ln) -\n Adds text to print stack. Don't forget to use drop() or dropln() in the end of your program!\n (ln) - adds \\n to the end of text\n*/\n\nfun order(text: String) {\n toPrint += text\n}\n\nfun orderln(text: String) {\n toPrint += text + \"\\n\"\n}\n\n/*\n drop(ln) -\n Prints all the text from the print stack\n*/\nfun drop() = print(toPrint)\nfun dropln() = println(toPrint)\n\n/*\n readInt -\n Shortcut for readLine()!!.toInt()\n*/\nfun readInt(): Int = readLine()!!.toInt()\n// endregion", "lang": "Kotlin", "bug_code_uid": "f1f4bdfeab2d2c574a7b38586ea590f5", "src_uid": "289a55128be89bb86a002d218d31b57f", "apr_id": "a546119b841cd6dd7556efffadf2e021", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9354838709677419, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main() = repeat(readLine()!!.toInt()) {\n val x = readLine()!!\n val dig = x[0] - '0'\n println((dig - 1) * 10 + x.size() * (x.size() + 1) / 2)\n}", "lang": "Kotlin", "bug_code_uid": "9a5363648f513b13df4b4cceeeb17002", "src_uid": "289a55128be89bb86a002d218d31b57f", "apr_id": "7ddfc0bf5fa4e7d53e4bbb0904238864", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7948207171314741, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\n\ndata class Windows(val three: Int, val five: Int, val seven: Int)\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val t = nextInt()\n// val t = 1\n repeat(t) {\n val n = nextInt()\n val d = n % 10\n var before = (d - 1) * 10\n val length = n.toString().length\n if (length == 1) {\n before = 0\n }\n for (i in 1 until 5) {\n if (length >= i) {\n before += i\n }\n }\n println(before)\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "caaacfde368d5c7dcebab429364a3e1a", "src_uid": "289a55128be89bb86a002d218d31b57f", "apr_id": "62ceb0c4bf68f665ed33e5ae4869969a", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9951219512195122, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n val (row, column) = r.readLine()!!.split(\" \").map { it.toInt() }\n val rs = mutableListOf()\n val cs = mutableSetOf()\n repeat(row){\n val v = r.readLine()!!\n var has = false\n for (i in 0..column-1){\n if (v[i]=='S'){\n cs += i\n has = true\n }\n }\n if (has) rs += it\n }\n val rsize = rs.size\n val csize = cs.size\n val ans = (row-rsize)*column + (column-csize)*row\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "1e4692436e95218e95ab3311ae398b44", "src_uid": "ebaf7d89c623d006a6f1ffd025892102", "apr_id": "b33ba59e3bb94cc3f9367674c61de51c", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6501955939880585, "equal_cnt": 27, "replace_cnt": 16, "delete_cnt": 6, "insert_cnt": 5, "fix_ops_cnt": 27, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.lang.Math.pow\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.log\nimport kotlin.math.log2\nimport kotlin.math.min\n\nfun main(args: Array)\n = Thread { run() }.start()\n\nfun run() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val m = scanner.nextInt()\n val arr = Array(m) { Triple(scanner.nextInt(), scanner.nextInt(), scanner.nextInt(), it) }.sorted()\n val b = IntArray(n) { 0 }\n arr.forEach { b[it.b - 1] = m + 1 }\n for (i in 0 until m) {\n if (arr[i].b - arr[i].a < arr[i].c || arr[i].b < arr[i].c) {\n println( \"-1\")\n return\n }\n var k = 0\n for (j in arr[i].b - 2 downTo arr[i].a - 1) {\n if (b[j] == 0) {\n b[j] = arr[i].i + 1\n k++\n if (k == arr[i].c)\n break\n }\n }\n if (k != arr[i].c) {\n println(-1)\n return\n }\n }\n b.forEach { print(\"$it \") }\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n\n//class Pair(val a: Int, val b: Int): Comparable {\n// override fun compareTo(other: Pair): Int {\n// return a - other.a\n// }\n//}\n\nclass Triple(val a: Int, val b: Int, val c: Int, val i : Int): Comparable {\n override fun compareTo(other: Triple): Int {\n return b - a - other.b + other.a\n }\n}", "lang": "Kotlin", "bug_code_uid": "e4580fed1425393422db7b981e0f3f14", "src_uid": "02d8d403eb60ae77756ff96f71b662d3", "apr_id": "01135b9a88d1c03c0e1b1e021165979c", "difficulty": 1700, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.974169741697417, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val (target, p) = readLine()!!.split(\" \").map { it.toInt() }\n\n (1..31).forEach { k ->\n val v = target - k * p\n if (v <= 0) return@forEach\n if (Integer.bitCount(v) > k) return@forEach\n\n val lowestOneBit = Integer.lowestOneBit(v)\n if (k > lowestOneBit) return@forEach\n println(k)\n return@main\n }\n\n println(-1)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "edbfce1744bd7af5634ad1a469594df9", "src_uid": "9e86d87ce5a75c6a982894af84eb4ba8", "apr_id": "d96acbc8dfcc8c9f69a0001898013e33", "difficulty": 1600, "tags": ["math", "brute force", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.968944099378882, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (r1, r2) = br.readLine().split(\" \").map { it.toInt() }\n val (c1, c2) = br.readLine().split(\" \").map { it.toInt() }\n val (d1, d2) = br.readLine().split(\" \").map { it.toInt() }\n val x4 = -(d2 - c2 - r2)/2\n val x3 = r2 - x4\n val x2 = d2 - x3\n val x1 = r1 - x2\n val sol = listOf(x1, x2, x3, x4)\n println(\n if (sol.all { it in (1..9) } && sol.toSet().size == sol.size) {\n \"$x1 $x2\\n$x3 $x4\"\n } else {\n \"-1\"\n }\n )\n}", "lang": "Kotlin", "bug_code_uid": "7464d380ab6cd389a3813ad97f3dd4ed", "src_uid": "6821f502f5b6ec95c505e5dd8f3cd5d3", "apr_id": "e38640a1df601eaaa04d80da6ad5e617", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.37924865831842575, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "\nfun main(args : Array) {\n\n val d1 = readLine()!!\n val d2 = readLine()!!\n\n var list1: MutableList = mutableListOf()\n var list2: MutableList = mutableListOf()\n\n for (char in d1) {\n list1.add(char)\n }\n for (char in d2) {\n list2.add(char)\n }\n\n var t = d1.toInt()+d2.toInt()\n\n println(\"YES\")\n\n\n}", "lang": "Kotlin", "bug_code_uid": "925099e69dec1e73d184b8f86c1272b4", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "apr_id": "32b21c44b77e387cbf596045853e2fed", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8944578313253012, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 8, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "fun main (args:Array){\n var num1 = readLine()!!.toInt()\n var num2 = readLine()!!.toInt()\n\n var result = num1 + num2\n\n var num_1 = \"\"\n var num_2 = \"\"\n var result_ = \"\"\n\n var resultTemp = \"\"\n\n var temp = num1\n while(temp > 0) {\n var i = temp % 10\n temp /= 10\n if (i == 0)\n continue\n num_1 = i.toString() + num_1\n }\n\n temp = num2\n while(temp > 0) {\n var i = temp % 10\n temp /= 10\n if (i == 0)\n continue\n num_2 = i.toString() + num_2\n }\n\n temp = result\n while(temp > 0) {\n var i = temp % 10\n temp /= 10\n if (i == 0)\n continue\n result_ = i.toString() + result_\n }\n\n if('0' in result.toString()) {\n for(i in result.toString()){\n if(i == '0'){\n continue\n }\n resultTemp += i\n }\n if (num_1.toInt() + num_2.toInt() == result_.toInt() && resultTemp == result_)\n print(\"YES\")\n else\n print(\"NO\")\n }else\n print(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "a917306be80fce9d5223ed306a7864e1", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "apr_id": "fb4c2827bb28770d2b1627ed5bcb5012", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.596820809248555, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.math.BigInteger\n\nfun main() {\n var a = readStr()!!\n var b = readStr()!!\n var a1 = b.replace(\"0\", \"\")\n var b1 = b.replace(\"0\", \"\")\n\n var withZero: Long = ((BigInteger(a) + BigInteger(b)).toString().replace(\"0\",\"\")).toLong()\n var withOutZero: Long = (BigInteger(a1) + BigInteger(b1)).toLong()-1\n println(if (withOutZero == withZero) \"YES\" else \"NO\")\n\n}\n\nprivate fun readInts(): List = readLine()!!.split(' ').map { it.toInt() }\nprivate fun readLongs(): List = readLine()!!.split(' ').map { it.toLong() }\nprivate fun readInt(): Int = readLine()!!.toInt()\nprivate fun readLong(): Long = readLine()!!.toLong()\nprivate fun readStr(): String? = readLine()!!", "lang": "Kotlin", "bug_code_uid": "e5a201ed57c03cb164700fafda0aa897", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "apr_id": "45a9d1d7d9b10175b748f27ce18ae455", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.23408924652523774, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val a = readLine()!!\n val b = readLine()!!\n val c = (a.toInt() + b.toInt()).toString()\n val aZeros = a.zeros()\n val bZeros = b.zeros()\n val cZeros = c.zeros()\n\n if (aZeros.subtract(b.zeros()).isEmpty() && bZeros.subtract(cZeros).isEmpty()) print(\"YES\") else print(\"NO\")\n}\n\nfun String.zeros(): Set {\n val output = mutableSetOf()\n this.forEachIndexed { index, c -> if (c == '0') output.add(index) }\n\n return output.toSet()\n}", "lang": "Kotlin", "bug_code_uid": "86941bf8ec684f435308448f9cb8c846", "src_uid": "ac6971f4feea0662d82da8e0862031ad", "apr_id": "06411da30f88c778535ad6c86733cc82", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9992706053975201, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.FileReader\nimport java.util.*\n\n/**\n * Created by thuanle on 7/16/17.\n */\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n// val sc = Scanner(FileReader(\"B.in2\"))\n val board = Array(10, { CharArray(10) })\n for (i in 0..9) {\n val s = sc.nextLine()\n for (j in 0..9) {\n board[i][j] = s[j]\n }\n }\n\n for (i in 0..9) {\n for (j in 0..9) {\n val r = XOD(0, 0)\n val c = XOD(0, 0)\n val x1 = XOD(0, 0)\n val x2 = XOD(0, 0)\n for (k in 0..5) {\n r += convert(board, i, j + k)\n c += convert(board, i + k, j)\n x1 += convert(board, i + k, j + k)\n x2 += convert(board, i + k, j - k)\n }\n if (r.test() || c.test() || x1.test() || x2.test()) {\n println(\"YES\")\n return\n }\n }\n }\n\n println(\"NO\")\n}\n\ndata class XOD(var x: Int, var d: Int) {\n operator fun plusAssign(xod: XOD) {\n x += xod.x\n d += xod.d\n }\n\n fun test() = x == 5 || (x == 4 && d == 1)\n}\n\nfun convert(board: Array, x: Int, y: Int) = when {\n x < 0 || 9 < x -> XOD(0, 0)\n y < 0 || 9 < y -> XOD(0, 0)\n else -> when (board[x][y]) {\n 'X' -> XOD(1, 0)\n '.' -> XOD(0, 1)\n else -> XOD(0, 0)\n }\n}\n\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "a7fde2c952f01e2d2dcc96eca90c2a01", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "apr_id": "1c51a601d300585554d69b799c6ca041", "difficulty": 1600, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.2345505617977528, "equal_cnt": 14, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "import java.io.File\nimport java.io.FileInputStream\nimport java.io.FileReader\nimport java.util.*\n\n/**\n * Created by thuanle on 7/16/17.\n */\nfun main(args: Array) {\n// val sc = Scanner(System.`in`)\n val sc = Scanner(FileReader(\"B.in1\"))\n val board = Array(10, { CharArray(10) })\n for (i in 0..9) {\n val s = sc.nextLine()\n for (j in 0..9) {\n board[i][j] = s[j]\n }\n }\n\n for (i in 0..9) {\n var count = 0\n for (j in 0..9) {\n when (board[i][j]) {\n 'O' -> count = 0\n 'X' -> count++\n '.' -> {\n if (j > 0) {\n when (board[i][j - 1]) {\n 'X' -> count++\n else -> count = 1\n }\n }\n }\n }\n if (count >= 5) {\n println(\"YES\")\n return\n }\n }\n }\n\n for (j in 0..9) {\n var count = 0\n for (i in 0..9) {\n when (board[i][j]) {\n 'O' -> count = 0\n 'X' -> count++\n '.' -> {\n if (i > 0) {\n when (board[i-1][j]) {\n 'X' -> count++\n else -> count = 1\n }\n }\n }\n }\n if (count >= 5) {\n println(\"YES\")\n return\n }\n }\n }\n\n\n for (t in 0..18) {\n val start = Math.max(0, t - 9)\n val end = Math.min(t, 9)\n for (i in start..end) {\n var count = 0\n val j = t - i\n when (board[i][j]) {\n 'O' -> count = 0\n 'X' -> count++\n '.' -> {\n if (i > start) {\n when (board[i - 1][j + 1]) {\n 'X' -> count++\n else -> count = 1\n }\n }\n }\n }\n if (count >= 5) {\n println(\"YES\")\n return\n }\n }\n }\n\n for (t in -9..9) {\n val start = Math.max(0, t)\n val end = Math.min(t, 0)\n for (i in start..end) {\n var count = 0\n val j = i - t\n when (board[i][j]) {\n 'O' -> count = 0\n 'X' -> count++\n '.' -> {\n if (i > start) {\n when (board[i - 1][j - 1]) {\n 'X' -> count++\n else -> count = 1\n }\n }\n }\n }\n if (count >= 5) {\n println(\"YES\")\n return\n }\n }\n }\n\n\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "b04e81ac52471eb7161be09f3f7da92b", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "apr_id": "1c51a601d300585554d69b799c6ca041", "difficulty": 1600, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9736981465136805, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nvar checkVertical = fun (x : Int,y : Int,map : Array) : Boolean {\n if(x + 4 < 10) {\n var seen = false\n for (i in x..x + 4) {\n if(map[i][y] == '.') if(!seen) seen = true else return false\n if(map[i][y] == 'O') return false\n }\n return true\n }\n return false\n}\n\nvar checkHorizontal = fun (x : Int,y : Int,map : Array) : Boolean {\n if(y + 4 < 10) {\n var seen = false\n for (i in y..y + 4) {\n if(map[x][i] == '.') if(!seen) seen = true else return false\n if(map[x][i] == 'O') return false\n }\n return true\n }\n return false\n}\n\nvar check2 =fun (x : Int,y : Int,map : Array) : Boolean {\n if(y + 4 < 10 && x - 4 >= 0) {\n var seen = false\n for (i in 1..4) {\n if(map[x - i][y + i] == '.') if(!seen) seen = true else return false\n if(map[x - i][y + i] == 'O') return false\n }\n return true\n }\n return false\n}\n\nvar check3 = fun (x : Int,y : Int,map : Array) : Boolean {\n if(y - 4 >= 10 && x + 4 < 10) {\n var seen = false\n for (i in 1..4) {\n if(map[x + i][y - i] == '.') if(!seen) seen = true else return false\n if(map[x + i][y - i] == 'O') return false\n }\n return true\n }\n return false\n}\n\n\nfun solve() {\n val map = Array(10,{next()})\n val a = arrayOf(checkVertical,checkHorizontal,check2,check3)\n var ok = false\n map.forEachIndexed {\n i,_ ->\n map[i].forEachIndexed {\n j,c -> if(c == 'X') {\n a.forEach {\n ok = ok.or(it(i, j, map))\n }\n }\n }\n }\n pw.println(if(ok) \"Yes\" else \"No\")\n}\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextLine() = if(hasNext()) st.nextToken(\"\\n\") else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n,{nextInt()})\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nval br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nval pw = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "3e87d5a165ab0330c0dbd208164991fc", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "apr_id": "cc18d35c162a96b2838ef0686905e6f3", "difficulty": 1600, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.99858806918461, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nvar checkVertical = fun (x : Int,y : Int,map : Array) : Boolean {\n if(x + 4 < 10) {\n var seen = false\n for (i in x..x + 4) {\n if(map[i][y] == '.') if(!seen) seen = true else return false\n if(map[i][y] == 'O') return false\n }\n return true\n }\n return false\n}\n\nvar checkHorizontal = fun (x : Int,y : Int,map : Array) : Boolean {\n if(y + 4 < 10) {\n var seen = false\n for (i in y..y + 4) {\n if(map[x][i] == '.') if(!seen) seen = true else return false\n if(map[x][i] == 'O') return false\n }\n return true\n }\n return false\n}\n\nvar check2 =fun (x : Int,y : Int,map : Array) : Boolean {\n if(x + 4 < 10 && y + 4 < 10) {\n var seen = false\n for (i in 1..4) {\n if(map[x + i][y + i] == '.') if(!seen) seen = true else return false\n if(map[x + i][y + i] == 'O') return false\n }\n return true\n }\n return false\n}\n\nvar check3 = fun (x : Int,y : Int,map : Array) : Boolean {\n if(y - 4 >= 0 && x + 4 < 10) {\n var seen = false\n for (i in 1..4) {\n if(map[x + i][y - i] == '.') if(!seen) seen = true else return false\n if(map[x + i][y - i] == 'O') return false\n }\n return true\n }\n return false\n}\n\n\nfun solve() {\n val map = Array(10,{next()})\n val a = arrayOf(checkVertical,checkHorizontal,check2,check3)\n var ok = false\n map.forEachIndexed {\n i,wtf ->\n map[i].forEachIndexed {\n j,c -> if(c == 'X') {\n a.forEach {\n ok = ok.or(it(i, j, map))\n }\n }\n }\n }\n pw.println(if(ok) \"Yes\" else \"No\")\n}\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextLine() = if(hasNext()) st.nextToken(\"\\n\") else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n,{nextInt()})\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nval br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nval pw = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "db84f81684a8eecc3a25dff00e14435e", "src_uid": "d5541028a2753c758322c440bdbf9ec6", "apr_id": "cc18d35c162a96b2838ef0686905e6f3", "difficulty": 1600, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5748031496062992, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 6, "insert_cnt": 3, "fix_ops_cnt": 16, "bug_source_code": "//package com.happypeople.codeforces.c1100\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\nimport kotlin.math.abs\n\nfun main(args: Array) {\n try {\n A().run()\n } catch (e: Throwable) {\n println(\"\")\n }\n}\n\nclass A {\n fun run() {\n val sc = Scanner(systemIn())\n val n=sc.nextInt()\n val k=sc.nextInt()\n val tabs=(1..n).map { sc.nextInt() }\n\n val sums=IntArray(k)\n for(i in tabs.indices)\n sums[i%k]+=tabs[i]\n\n val sumAll=tabs.sum()\n if(sumAll<0) {\n val ans = abs(sumAll - sums.max()!!)\n println(\"$ans\")\n } else {\n val ans = abs(sumAll - sums.min()!!)\n println(\"$ans\")\n }\n }\n\n companion object {\n var inputStr: String? = null\n\n fun systemIn(): InputStream {\n if (inputStr != null)\n return ByteArrayInputStream(inputStr!!.toByteArray())\n else\n return System.`in`\n }\n\n var printLog = false\n fun log(str: String) {\n if (printLog)\n println(str)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "5f7716a5ba71bca6f393777c6cacf2e6", "src_uid": "6119258322e06fa6146e592c63313df3", "apr_id": "7d4403d32bda1d6885ccce0a3af374e8", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.936, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n readLine()\n var count = 0\n val s = readLine()!!.filterIndexed { index, _ ->\n val ok = index == count\n if (ok) {\n count += count + 1\n }\n ok\n }\n println(s)\n}", "lang": "Kotlin", "bug_code_uid": "5e0c8a721ee5668be80790472d723776", "src_uid": "08e8c0c37b223f6aae01d5609facdeaf", "apr_id": "25c00dcff8a08d98cee1aa10c5bcef7f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8204924543288324, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 16, "bug_source_code": "enum class SetType {\n EMPTY,\n LINE,\n WHOLE_FIELD\n}\n\ntypealias Line = Triple\n\nfun Line.setType(): SetType {\n if (first == 0 && second == 0 && third == 0) return SetType.WHOLE_FIELD\n if (first == 0 && second == 0) return SetType.EMPTY\n return SetType.LINE\n}\n\nfun calcDet(line1: Line, line2: Line) = line1.first * line2.second - line1.second * line2.first\n\nfun calcIntersections(line1: Line, line2: Line): Int {\n if (line1.setType() == SetType.EMPTY || line2.setType() == SetType.EMPTY) return 0\n if (line1.setType() == SetType.WHOLE_FIELD || line2.setType() == SetType.WHOLE_FIELD) return -1\n val det = calcDet(line1, line2)\n return if (calcDet(line1, line2) != 0) 1 else 0\n}\n\n\nfun main(args: Array) {\n val line1 = readLine()!!.split(\" \").filter { it.isNotBlank() }.map { it.toInt() }.toIntArray()\n val line2 = readLine()!!.split(\" \").filter { it.isNotBlank() }.map { it.toInt() }.toIntArray()\n\n val line1T = Triple(line1[0], line1[1], line1[2])\n val line2T = Triple(line2[0], line2[1], line2[2])\n\n println(calcIntersections(line1T, line2T))\n}", "lang": "Kotlin", "bug_code_uid": "996ec132d366d89bd013690989cbef72", "src_uid": "c8e869cb17550e888733551c749f2e1a", "apr_id": "9bf8842ed3f747a2ee3c86ed556b4cb8", "difficulty": 2000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6004480955937267, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val a = readLine()!!.split(\" \").drop(1).map(String::toInt)\n val b = a.toSet().toList()\n\n var sum = 0L\n for (i in a.indices) {\n sum = sum * 100 + (a[i] - 1)\n }\n\n println(sum)\n\n /*\n if (b.sorted() == listOf(1, 2, 3)) {\n println(\"1 2 3\")\n } else {\n // 1 6 27 49 80 27 33 27 100 54\n println(\"1 6 27 27 27 33 49 54 80 100\")\n }\n */\n}\n", "lang": "Kotlin", "bug_code_uid": "eb38cf59a656e8acfb0ed50ca487f34c", "src_uid": "29e481abfa9ad1f18e6157c9e833f16e", "apr_id": "0e6c4dc52cc4231cdc820c82e931beb9", "difficulty": 1900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.99836867862969, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nfun main(args : Array) {\n\n val l = readLine()!!\n var list: MutableList = mutableListOf()\n for (char in l) {\n list.add(char)\n }\n var c = 0\n for(i in 0..list.size-1){\n if (list[i].isLowerCase()) {\n c++\n }\n }\n if(list.size%2==0 && c>=list.size/2){\n println(l.toLowerCase())\n }\n else if(list.size%2==0 && c<=list.size/2){\n println(l.toUpperCase())\n }\n else if(list.size%2==1 && c>=list.size/2){\n println(l.toLowerCase())\n }\n else if(list.size%2==1 && c<=list.size/2){\n println(l.toUpperCase())\n }\n}", "lang": "Kotlin", "bug_code_uid": "3f0062c14356b857f6f1289aa2e09613", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "ed79d191c50aaec339388338df7c72cf", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9961190168175937, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n var word = readLine()\n var countU = 0\n var countL = 0\n for (i in 0 until word?.length!!) {\n if (word.get(i).isUpperCase()) {\n countU++\n } else {\n countL++\n }\n }\n if (countL > countU) {\n word = word.toLowerCase()\n\n } else if (countU >= countL) {\n word = word.toUpperCase()\n }\n print(word)\n}", "lang": "Kotlin", "bug_code_uid": "cc0ffe8c3c5c2d546630fc4a953493f3", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "2d2a004058e8302a5fa592bf474367ba", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.974496644295302, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val input: String = readLine()!!\n var lowercaseCount: Int = 0\n for (char in input.toCharArray()) {\n if (char.isLowerCase()) {\n lowercaseCount += 1\n }\n }\n if (lowercaseCount >= (input.count() / 2)) {\n println(input.toLowerCase())\n } else {\n println(input.toUpperCase())\n }\n}", "lang": "Kotlin", "bug_code_uid": "b4557ad2256b830ccb21b0899b58165d", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "d50e88b4277979eac4b66753df1b2045", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9737098344693281, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main() {\n val `in` = Scanner(System.`in`)\n println(solve(`in`.nextLine()))\n solve(`in`.nextLine())\n}\n\nfun solve(nextLine: String): String {\n val small = nextLine.toCharArray()\n .filter { x -> \"[a-z]\".toRegex().matches(x.toString())}\n .count()\n val big = nextLine.toCharArray()\n .filter { x -> \"[A-Z]\".toRegex().matches(x.toString())}\n .count()\n return if(small>=big)\n nextLine.toLowerCase()\n else\n nextLine.toUpperCase()\n}", "lang": "Kotlin", "bug_code_uid": "37002bf61d8fd202eb666d3bda4ff797", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "b0f55c8ea259d70766a59e03296dc112", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9671897289586305, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n println(solve59A())\n}\n\nfun solve59A(): String {\n val line = Scanner(System.`in`).nextLine()\n var up = 0\n var low = 0\n line.forEach { \n if(it.isUpperCase())\n up += 1\n else\n low += 1\n }\n return if(up >= low)\n line.toUpperCase()\n else\n line.toLowerCase()\n}", "lang": "Kotlin", "bug_code_uid": "a11adaefb9226d69759522571ae7c7d8", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "b0f55c8ea259d70766a59e03296dc112", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9986130374479889, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main() {\n println(solve59A())\n}\n\nfun solve59A(): String {\n val line = Scanner(System.`in`).nextLine()\n var up = 0\n var low = 0\n line.forEach {\n if(it.isUpperCase())\n up += 1\n else\n low += 1\n }\n return if(up >= low)\n line.toUpperCase()\n else\n line.toLowerCase()\n}\n", "lang": "Kotlin", "bug_code_uid": "0a6ace5ac6d5d53a16d5ed11b52a1aab", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "b0f55c8ea259d70766a59e03296dc112", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9835706462212487, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "class Main {\n companion object {\n @JvmStatic\n fun main(args: Array) {\n println(readLine()?.let { solve59A(it) })\n }\n\n private fun solve59A(input: String): String {\n val lowercaseCount = input.filter { it.isLowerCase() }.count()\n return if (lowercaseCount >= input.length/2)\n input.toLowerCase()\n else\n input.toUpperCase()\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "81bc0b4bf8db06e66acbce067c3e9f0c", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "998f9af24186ab9dd8b1ab9e5526c19c", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.993920972644377, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n var word = readLine()\n var chars = word!!.toCharArray()\n var lowerCounter = 0\n for(i in 0..chars.lastIndex){\n if(chars[i] > 'a' && chars[i] < 'z'){\n lowerCounter++\n }\n }\n println(if(lowerCounter >= chars.size - lowerCounter) word.toLowerCase() else word.toUpperCase())\n}", "lang": "Kotlin", "bug_code_uid": "22a1ea948318a73f7ca67017470786bd", "src_uid": "b432dfa66bae2b542342f0b42c0a2598", "apr_id": "cc24e4d53648cb25244426a29bf79f37", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6039603960396039, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var a = Array(n){readLine()!!.toInt()}\n var B = 0\n var C = 0\n for (i in 0 until a.size){\n if (a[i] >= 0) {\n B += a[i]\n }\n else{\n C += a[i]\n }\n }\n print(B-C)\n}", "lang": "Kotlin", "bug_code_uid": "eb221179701fd001bb440700e96e0023", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "apr_id": "5639a62416a65c7f9c79c1929aee4d33", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8910648714810282, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\n\nfun main() {\n solveSequenceProblem()\n}\n\nfun solveSequenceProblem(){\n val scan = Scanner(System.`in`)\n val sequenceIndex = scan.nextInt()\n var sequenceStr = \"\"\n for(index in 1..10000){\n sequenceStr += index\n if(sequenceStr.length == sequenceIndex){\n print(sequenceStr.last())\n scan.close()\n return\n }\n\n }\n}", "lang": "Kotlin", "bug_code_uid": "bc0bd222cb931afaaf05332e62b20744", "src_uid": "1503d761dd4e129fb7c423da390544ff", "apr_id": "1f15258ac55262d9befe7c36e3f589ee", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.998421052631579, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n val k = ir.nextInt()\n var line = \"\"\n\n for (i in 1..2800)\n line += i\n \n pw.print(line[k])\n\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextFloat(): Float {\n return java.lang.Float.parseFloat(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "3d785bd8e3804ccf6c39f0b194f5c0fc", "src_uid": "1503d761dd4e129fb7c423da390544ff", "apr_id": "fe9a5e2ea89308c187fdd4ff26348f92", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9376693766937669, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "\n\nfun main() {\n\n val k = readLine()\n var i = 1\n\n var generateSequence = generateSequence{i++}.takeWhile { i<=10000 }\n print(generateSequence.elementAt(k!!.toInt()-1))\n\n}", "lang": "Kotlin", "bug_code_uid": "3198465b7e4c37aa96aa7d6be25a182e", "src_uid": "1503d761dd4e129fb7c423da390544ff", "apr_id": "fa3439190cb1d509a70fad0bef1fd25c", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9943644333124608, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n val c = scanner.nextInt()\n val n = scanner.nextInt()\n val q = a + b - c\n if (q < 0 || n - q <= 0) {\n println(-1)\n return\n }\n println(n - q)\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\n\n//class Pair(var a: Int, var b: Int): Comparable {\n// override fun compareTo(other: Pair): Int {\n// return b - a - other.b + other.a\n// }\n//}", "lang": "Kotlin", "bug_code_uid": "55e4cb248777a7c6162a7d67e83ef579", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "apr_id": "c2e19f27db61d87a4d18728199afc11d", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9331896551724138, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n solve()\n}\n\nprivate fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\n\nprivate fun solve() {\n var (a, b, c, n) = read().map(String::toInt)\n var passed = (a - c) + (b - c) + c\n var failed = n - passed\n\n\n if (n == 0 || (n == passed) || (n == 1 && passed != 0) || ((a == 0 || b == 0) && c != 0) || (failed < 1)) {\n println(-1)\n } else {\n println(failed)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "d7c8ff0bfa0c84921622aa6d2d76c59a", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "apr_id": "53ca1c6ebf4e42471ea6a5b6921a802f", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8351648351648352, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "//package codeForces.c491_2\n\nfun main(args: Array) {\n val (a, b, c, n) = readLine()!!.split(' ').map(String::toInt)\n\n if (c > a || c > b) {\n print(-1)\n return\n }\n\n if (c < 1) {\n print(-1)\n return\n }\n\n if (a + b - c > n) {\n print(-1)\n return\n }\n\n print(n - (a + b - c))\n}", "lang": "Kotlin", "bug_code_uid": "5c33d7df697142a0d39b80cb5addf1ca", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "apr_id": "c16aec07a444691dc711703b396c33ea", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8064516129032258, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val (md, bk, both, total) = readLine()!!.split(\" \").map { it.toInt() }\n\n val onlyMd = md - both\n val onlyBk = bk - both\n\n if (onlyBk < 0 || onlyBk < 0) {\n println(\"-1\")\n } else {\n val losers = total - onlyBk - onlyMd - both\n\n if (losers >= 1) {\n println(losers)\n } else {\n println(\"-1\")\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "abb8a24fd3e301efd92794de9484c7be", "src_uid": "959d56affbe2ff5dd999a7e8729f60ce", "apr_id": "5ac30e6d8d1f4e846bbf8d5390e0b8bc", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8846641318124208, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val s = readLine()!!.split(\" \").map { it.toInt() }\n val ms = mutableMapOf()\n s.forEach { ms.merge(it, 1, Int::plus) }\n val l = ms.values.sorted()\n when {\n l.size == 2 && l[1] == 4 -> print(\"Elephant\")\n l.size == 3 && l[2] == 4 && l[1] == 1 -> print(\"Bear\")\n else -> print(\"Alien\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "2e7cb2d5df245a82df8a2395c5e92e98", "src_uid": "43308fa25e8578fd9f25328e715d4dd6", "apr_id": "bf41b85b169f973b65fb20cd553bb01e", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9892603237029194, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "\n\nfun solve(a: String): String {\n val b = a.toByteArray()\n val n = a.length\n\n fun reverse(k: Int) {\n for (i in 0..k / 2) {\n val c = b[i]\n b[i] = b[k - i - 1]\n b[k - i - 1] = c\n }\n }\n\n for (i in 1..n) {\n if (n % i == 0) {\n reverse(i)\n }\n }\n\n return String(b)\n}\n\nfun processSuite() {\n val a = readLine()!!.toInt()\n val s = readLine()!!\n val solution = solve(s)\n println(solution)\n}\n\nfun suitesCount() = 1\n\nfun main() {\n for (i in 0 until suitesCount()) {\n processSuite()\n }\n}\n\n// READER\ninternal val reader = Reader()\ninternal fun readNumber() = reader.nextInt()\ninternal fun readNumbers(n: Int) = reader.nextInts(n)\n\ntypealias DataInputStream = java.io.DataInputStream\n\ninternal class Reader {\n\n private val BUFFER_SIZE = 1 shl 16\n private val din: DataInputStream = DataInputStream(System.`in`)\n private val buffer: ByteArray = ByteArray(BUFFER_SIZE)\n private var bytesRead: Int = 0\n private var bufferPointer: Int = bytesRead\n\n private val stop: Byte = -1\n\n private fun read(): Byte {\n if (bufferPointer == bytesRead) {\n fillBuffer()\n }\n return buffer[bufferPointer++]\n }\n\n private fun fillBuffer() {\n bufferPointer = 0\n bytesRead = din.read(buffer, bufferPointer, BUFFER_SIZE)\n if (bytesRead == -1) {\n buffer[0] = stop\n }\n }\n\n fun nextLine(): String {\n val buf = ByteArray(64) // line length\n var cnt = 0\n var c: Byte\n do {\n c = read().takeUnless { it == '\\n'.toByte() } ?: break\n buf[cnt++] = c\n } while (c != stop)\n\n return String(buf, 0, cnt)\n }\n\n fun nextInts(n: Int): IntArray {\n val arr = IntArray(n) { 0 }\n for (i in 0 until n) {\n arr[i] = nextInt()\n }\n return arr\n }\n\n fun nextInt(): Int {\n var ret = 0\n var c = read()\n while (c <= ' '.toByte()) c = read()\n val neg = c == '-'.toByte()\n if (neg) c = read()\n do {\n ret = ret * 10 + c - '0'.toInt()\n c = read()\n } while (c >= '0'.toByte() && c <= '9'.toByte())\n\n return if (neg) -ret else ret\n }\n\n fun nextLong(): Long {\n var ret = 0L\n var c = read()\n while (c <= ' '.toByte()) c = read()\n val neg = c == '-'.toByte()\n if (neg) c = read()\n do {\n ret = ret * 10 + c - '0'.toInt()\n c = read()\n } while (c >= '0'.toByte() && c <= '9'.toByte())\n\n return if (neg) -ret else ret\n }\n\n fun nextDouble(): Double {\n var ret = 0.0\n var div = 1.0\n var c = read()\n while (c <= ' '.toByte()) c = read()\n val neg = c == '-'.toByte()\n if (neg) c = read()\n do {\n ret = ret * 10 + c - '0'.toDouble()\n c = read()\n } while (c >= '0'.toByte() && c <= '9'.toByte())\n\n if (c == '.'.toByte()) {\n c = read()\n while (c >= '0'.toByte() && c <= '9'.toByte()) {\n div *= 10\n ret += (c - '0'.toByte()) / div\n c = read()\n }\n }\n\n return if (neg) -ret else ret\n }\n}", "lang": "Kotlin", "bug_code_uid": "8198b7f9005e329c117bb92994be2cd0", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "apr_id": "ebd8286ca082fbfe3fb355b3100548e6", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9706161137440759, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n solve()\n}\n\nprivate fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\n\nprivate fun solve() {\n val len = read()\n var (s) = read()\n\n if(s.length == 1){\n print(s)\n return\n }\n var finalStr = \"\"\n\n for ((index, x) in s.withIndex()) {\n if (index > 0 && s.length % (index) == 0) {\n finalStr = s.substring(0, index).reversed()\n finalStr += s.substring(index,s.length)\n }\n }\n\n print(finalStr.reversed())\n}", "lang": "Kotlin", "bug_code_uid": "471a5ae7efe8aef8eb196100ef76e630", "src_uid": "1b0b2ee44c63cb0634cb63f2ad65cdd3", "apr_id": "ec0c174a4d0c474d6fa6633a6690a31f", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9142133586578031, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n for (i in 0 until 8) {\n val str = scanner.next()\n var res1 = 0\n var res2 = 0\n for (j in str) {\n if (j == 'W')\n res1++\n else\n res2++\n }\n if (res1 != res2) {\n println(\"NO\")\n return\n }\n }\n println(\"YES\")\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n//class Pair(var a: Int, var b: Int): Comparable {\n// override fun compareTo(other: Pair): Int {\n// return b - a - other.b + other.a\n// }\n//}", "lang": "Kotlin", "bug_code_uid": "ba4d77bab82705ea2b582172a5d27c41", "src_uid": "ca65e023be092b2ce25599f52acc1a67", "apr_id": "c766bc7d0cdc9782faa5dd1c4fb4e93d", "difficulty": 1000, "tags": ["brute force", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6971428571428572, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n var ans = 0L\n for (i in 0 until m) {\n for (j in 0 until m) {\n if ((i * i + j * j) % m == 0) {\n val x = if (i == 0) n / m else ((n - i) / m) + 1\n val y = if (j == 0) n / m else ((n - j) / m) + 1\n ans += x.toLong() * y\n }\n }\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "f829991952542d8366cbf8606ce96ab6", "src_uid": "2ec9e7cddc634d7830575e14363a4657", "apr_id": "15c7a1e6b193de1302edac74f3677bb9", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9064039408866995, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n readLine()\n readLine()!!.split(' ').sorted().forEach { print(\"$it \") }\n}", "lang": "Kotlin", "bug_code_uid": "fe95743a7860842891ef86cec20d31b3", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "apr_id": "e2b3f78159a7f6dec1ebfbfe9efe7ec8", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9738339021615472, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.lang.StringBuilder\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n br.readLine()\n val row = br.readLine().split(\"\\\\s+\".toRegex())\n val sortedRow = row.sorted()\n val sb = StringBuilder()\n for (i in sortedRow)\n sb.append(\"$i \")\n sb.deleteCharAt(sb.length - 1)\n print(sb.toString())\n}", "lang": "Kotlin", "bug_code_uid": "7922109135e14fecfb8c92c3cf65c2c9", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "apr_id": "731370e98a4cbe76dc416f78088a0646", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5350523771152297, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val s = readInt()\n\n val h = readInts().toMutableList()\n\n var c = 0\n\n // 4\n //3 2 1 2\n\n while (c < s-1) { // no point for the last grid\n var i = c;\n var moved = false\n\n while (i < s-1) {\n if (h[i] > h[i+1]) {\n val t = h[i] - h[i + 1]\n h[i] = h[i] - t\n h[i + 1] = h[i+1] + t\n moved = true\n i++\n } else {\n moved = false\n break\n }\n }\n\n if (!moved) {\n c++\n }\n }\n\n println(h.joinToString(\" \"))\n}\n", "lang": "Kotlin", "bug_code_uid": "23130607e8b9169e437495337d2f8f6d", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "apr_id": "29adf5a6d1eb4fdc9645aa59d0f3cf5c", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9019607843137255, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n readLine()\n println(readLine()!!.split(\" \").map(String::toInt).sorted)\n}", "lang": "Kotlin", "bug_code_uid": "b9cb8cad8504a32a14b5ab1a7769c80b", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "apr_id": "70974eb98426be2b4b7991723742173f", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9734789391575663, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\nimport java.util.Arrays\n\nfun main(args:Array)\n{\n var sc=Scanner(System.`in`)\n val n : Int = sc.nextInt()\n val a = IntArray(n)\n for(i in 0 until n)\n {\n a[i] = sc.nextInt()\n }\n Arrays.sort(a)\n for(i in 0 until n)\n {\n print(a[i]+\" \")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "0ebc39d90f0aaaf46b0aaae225178e42", "src_uid": "ae20712265d4adf293e75d016b4b82d8", "apr_id": "3fe0feb150d7cf5ff558b6f317b8ef82", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8976697061803445, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val a = IntArray(3, { nextInt() })\n print(\"${a.shakeForMeBaby()}\")\n}\n\nfun IntArray.shakeForMeBaby(): Int {\n var left = 0\n var right = min(this[1], this[2])\n while (left + 1 < right) {\n val mid = (left + right) / 2\n when {\n this[1] / mid + this[2] / mid < this[0] -> right = mid\n else -> left = mid\n }\n }\n return left\n}\n", "lang": "Kotlin", "bug_code_uid": "679825ddeaae29bb399929cddb59146b", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "apr_id": "63f38f57e3457e203410c408ee4deedf", "difficulty": 1200, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9979959919839679, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val res = IntArray(3, { nextInt() }).shakeForMeBaby()\n print(\"$res\")\n}\n\nfun IntArray.shakeForMeBaby(): Int {\n var left = 0\n var right = min(this[1], this[2])\n while (left <= right) {\n val mid = (left + right) / 2\n when {\n this[1] / mid + this[2] / mid < this[0] -> right = mid - 1\n else -> left = mid + 1\n }\n }\n return left - 1\n}\n", "lang": "Kotlin", "bug_code_uid": "88f4a0a9b70fa71745dd101c3d62aa53", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "apr_id": "63f38f57e3457e203410c408ee4deedf", "difficulty": 1200, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9224137931034483, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numPlates, numA, numB) = readInts()\n var sol = 1\n while (numA / sol + numB / sol >= numPlates) sol++\n print(sol - 1)\n}", "lang": "Kotlin", "bug_code_uid": "e9b58c8f5056d112aa5a2faea76acd6b", "src_uid": "a254b1e3451c507cf7ce3e2496b3d69e", "apr_id": "74d92246ac8ef3951f535229042064e9", "difficulty": 1200, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.3583710407239819, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "fun pow(l: Long, i: Int): Long {\n var n = i\n var base = l.toLong()\n var ans = 1L\n while (n > 0) {\n if (n % 2 == 1) {\n ans = ans * base % 1000000007L\n }\n base = base * base % 1000000007L\n n /= 2\n }\n return ans\n}\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n\n //val (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n fun count(n: Int): Long {\n var e = n - 2\n val ans = pow(2L, e) * 3 % 1000000007L\n return if (e < 0) 0L else ans\n }\n val n = r.readLine()!!.toInt()\n val ans = (0..n).fold(count(n)){acc, i -> (acc+count(i)*count(n-i))%1000000007L }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "ade1c02c812eb1a3b8db28910048e5d6", "src_uid": "77627cc366a22e38da412c3231ac91a8", "apr_id": "7d90e935809d002158eada00c4c2d048", "difficulty": 1500, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9211114659853082, "equal_cnt": 22, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\nimport java.util.Collections.min\nimport kotlin.math.min\n\nfun main() {\n val r = FastReader()\n val n = r.nextInt()\n\n var A = LongArray(n)\n var B = LongArray(n)\n var C = LongArray(n)\n var D = LongArray(n)\n\n var p:Long = 100000000+7\n A[0] = 1\n B[0] = 1\n C[0] = 1\n D[0] = 0\n for(i in 1..n-1){\n\n A[i] = (B[i-1] + C[i-1] + D[i-1])%p\n B[i] = (A[i-1] + C[i-1] + D[i-1])%p\n C[i] = (B[i-1] + A[i-1] + D[i-1])%p\n D[i] = (B[i-1] + C[i-1] + A[i-1])%p\n\n }\n println(D[n-1])\n\n}\n\n@Suppress(\"MemberVisibilityCanBePrivate\")\ninternal class FastReader {\n private val br = BufferedReader(InputStreamReader(System.`in`))\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n var t = tokenizer\n while (t == null || !t.hasMoreElements())\n t = StringTokenizer(br.readLine())\n tokenizer = t\n return t.nextToken()\n }\n\n fun nextInt():Int= next().toInt()\n\n fun nextLong(): Long = next().toLong()\n\n fun nextDouble(): Double = next().toDouble()\n\n fun nextLine(): String = br.readLine()\n\n fun nextIntArr(n: Int): IntArray = IntArray(n) { nextInt() }\n\n fun nextDoubleArr(n: Int): DoubleArray = DoubleArray(n) { nextDouble() }\n\n fun nextLongArr(n: Int): LongArray = LongArray(n) { nextLong() }\n\n fun nextIntArr2(n: Int, m: Int): Array = Array(n) { IntArray(m) { nextInt() } }\n\n fun nextLongArr2(n: Int, m: Int): Array = Array(n) { LongArray(m) { nextLong() } }\n}", "lang": "Kotlin", "bug_code_uid": "8cf05abcf812f4424de3bc166f02ef3f", "src_uid": "77627cc366a22e38da412c3231ac91a8", "apr_id": "7dae654b156e51f3cfce391c6254d530", "difficulty": 1500, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.921455938697318, "equal_cnt": 21, "replace_cnt": 14, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 20, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\nimport java.util.Collections.min\nimport kotlin.math.min\n\nfun main() {\n val r = FastReader()\n val n = r.nextInt()\n\n var A = LongArray(n)\n var B = LongArray(n)\n var C = LongArray(n)\n var D = LongArray(n)\n\n var p:Long = 1000000000+7\n A[0] = 1\n B[0] = 1\n C[0] = 1\n D[0] = 0\n for(i in 1..n-1){\n\n A[i] = (B[i-1] + C[i-1] + D[i-1])%p\n B[i] = (A[i-1] + C[i-1] + D[i-1])%p\n C[i] = (B[i-1] + A[i-1] + D[i-1])%p\n D[i] = (B[i-1] + C[i-1] + A[i-1])%p\n\n }\n println(D[n-1])\n\n}\n\n@Suppress(\"MemberVisibilityCanBePrivate\")\ninternal class FastReader {\n private val br = BufferedReader(InputStreamReader(System.`in`))\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n var t = tokenizer\n while (t == null || !t.hasMoreElements())\n t = StringTokenizer(br.readLine())\n tokenizer = t\n return t.nextToken()\n }\n\n fun nextInt():Int= next().toInt()\n\n fun nextLong(): Long = next().toLong()\n\n fun nextDouble(): Double = next().toDouble()\n\n fun nextLine(): String = br.readLine()\n\n fun nextIntArr(n: Int): IntArray = IntArray(n) { nextInt() }\n\n fun nextDoubleArr(n: Int): DoubleArray = DoubleArray(n) { nextDouble() }\n\n fun nextLongArr(n: Int): LongArray = LongArray(n) { nextLong() }\n\n fun nextIntArr2(n: Int, m: Int): Array = Array(n) { IntArray(m) { nextInt() } }\n\n fun nextLongArr2(n: Int, m: Int): Array = Array(n) { LongArray(m) { nextLong() } }\n}", "lang": "Kotlin", "bug_code_uid": "39a499324a21f420fb171da68e6361d0", "src_uid": "77627cc366a22e38da412c3231ac91a8", "apr_id": "7dae654b156e51f3cfce391c6254d530", "difficulty": 1500, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7202680067001676, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val n = readInt()\n var left = 1L\n var right = 1L\n repeat(n) {\n right = (left - right) % 1000000007\n left = (left * 3) % 1000000007\n }\n print(right)\n}", "lang": "Kotlin", "bug_code_uid": "548d88e1e45d18978193ab576680f4c4", "src_uid": "77627cc366a22e38da412c3231ac91a8", "apr_id": "7fa714f0ecd50c2d6e17d6261a2cf270", "difficulty": 1500, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.26641074856046065, "equal_cnt": 24, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 24, "bug_source_code": "fun num_paths(n : Int) : Long {\n val modulo = 1000000007L\n val path_count = Array(n + 1, {_ -> LongArray(4)})\n path_count[0][3] = 1L\n for (i in 0 .. (n - 1)) {\n val i_plus_1 = i + 1\n for (j in 0 .. 3) {\n for (k in 0 .. 3) {\n if (j == k) {\n // Do nothing ...\n } else {\n path_count[i_plus_1][j] = \n (path_count[i_plus_1][j] + path_count[i][k]) % modulo\n }\n }\n }\n }\n return path_count[n][3]\n}\n\nfun main(args : Array) {\n val n_nullable_str = readLine()\n if (n_nullable_str == null) {\n // Do nothing ...\n } else {\n val n_str = n_nullable_str\n val n = n_str.toInt()\n val result = num_paths(n)\n println(\"${result}\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "2ddf8825f7b9212c865e9397aaa38b6e", "src_uid": "77627cc366a22e38da412c3231ac91a8", "apr_id": "ed60f39e173863cba33b80ca386a3a46", "difficulty": 1500, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9815303430079155, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val (n, time) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val t = r.readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c, d) = r.readLine()!!.split(\" \").map { it.toInt() }.sorted()\n println(if (a + d == b + c) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "282f230341002fa503d795eb736155c2", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "6d1f5c5d5e110d3a502ca5f746e49949", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984025559105432, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val candies = readLine()!!.split(' ').map(String::toInt)\n val sum = candies.sum()\n if (sum % 2 != 0) {\n println(\"NO\")\n } else {\n val a1 = candies[0]\n val a2 = candies[1]\n val a3 = candies[2]\n val a4 = candies[3]\n if (a1 + a2 == a3 + a4 ||\n a1 + a3 == a2 + a4 ||\n a1 + a4 == a2 + a3 ||\n a1 == a2 + a3 + a4 ||\n a2 == a1 + a3 + a4 ||\n a3 == a1 + a2 + a4 ||\n a4 == a2 + a2 + a3\n ) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "7b5c834c36dbc89662b429db5693436a", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "894a1e4c0b21589650201f86d30ece9d", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6945392491467577, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val input = readLine()\n if (input === null) {\n return\n }\n val numbers = input.split(' ').map { n -> n.toInt() }.toIntArray()\n val sum = numbers.reduce { a, b -> a + b }\n var result = \"NO\"\n mainLoop@ for (i in 0 until numbers.size) {\n for (j in i + 1 until numbers.size) {\n val n1 = numbers[i]\n val n2 = numbers[j]\n if ((n1 + n2) * 2 == sum) {\n result = \"YES\"\n break@mainLoop\n }\n }\n }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "1966eefd706165d13977b8fdc88f4812", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "f3936198d22eee14ee2dbae46b77495b", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9267412486466979, "equal_cnt": 13, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 12, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main() {\n var fr = FastReader()\n var arr = Array(4) { 0 }\n for (i in 0..3)\n arr[i] = fr.nextInt()\n\n if ((arr[0] + arr[1] == arr[2] + arr[3])\n || (arr[0] + arr[2] == arr[1] + arr[3])\n || (arr[0] + arr[3] == arr[1] + arr[2])\n )\n print(\"YES\")\n else\n print(\"NO\")\n\n}\n\nclass FastReader {\n\n private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private var st: StringTokenizer? = null\n\n fun next(): String {\n while (st == null || !st!!.hasMoreTokens()) {\n try {\n st = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n e.printStackTrace()\n }\n }\n return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextDouble(): Double {\n return next().toDouble()\n }\n\n fun nextLong(): Long {\n return next().toLong()\n }\n\n fun nextString(): String {\n var str: String = \"\"\n try {\n str = br.readLine()\n } catch (e: IOException) {\n e.printStackTrace()\n }\n return str\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "552b323dfcf9748e4cf185dae4b510a1", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "265219d26a005801e6688cda1578fb74", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8715953307392996, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var numbers = readLine()!!.split(\" \").map { it.toInt() }.sorted().toIntArray()\n\n if(numbers[0] + numbers[3] == numbers[2] + numbers[1]) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "6e7decfcfb8a953618d2eb04203ece2b", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "e3d21aa975cccc6d5f0ac0fc51249377", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8305555555555556, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val candies = IntArray(4) { 0 }\n for (i in 0 until 4)\n candies[i] = reader.nextInt()\n candies.sort()\n if (candies[0] + candies[3] == candies[1] + candies[2])\n println(\"YES\")\n else println(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "676820c47bf0b38f3cefe479d0d56579", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "8653c0505e5f567b546afb0b20d113f2", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9714765100671141, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val a1 = sc.nextInt()\n val a2 = sc.nextInt()\n val a3 = sc.nextInt()\n val a4 = sc.nextInt()\n if (a1 + a2 == a3 + a4)\n println(\"YES\")\n else if (a1 + a3 == a2 + a4)\n print(\"YES\")\n else if (a1 + a4 == a2 + a3)\n print(\"YES\")\n else if (a1 + a2 + a3 == a4)\n print(\"YES\")\n else if (a1 + a3 + a4 == a2)\n print(\"YES\")\n else if (a1 + a2 + a3 == a4)\n print(\"YES\")\n else if (a1 + a2 + a4 == a3)\n print(\"YES\")\n else\n print(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "a26ddf64068932b302c6cd0bffd5c50e", "src_uid": "5a623c49cf7effacfb58bc82f8eaff37", "apr_id": "4b95639d33f02740723026b69198b03b", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.723963599595551, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*\n\nfun main() {\n var n = readLine()!!.toInt()\n var words = readLine()!!\n var count = 0\n var list = arrayListOf()\n var w = words.count{\"W\".contains(it)}\n for (i in words)\n if (i == 'B')\n count++\n else{\n if (count > 0) {\n list.add(count)\n }\n count = 0\n }\n if (w == 0){\n list.add(count)\n }\n if (words[n-1] == 'B' && words[n-2] == 'W')\n list.add(1)\n println(list.size)\n for (i in list)\n print(\"$i \")\n}", "lang": "Kotlin", "bug_code_uid": "6ea982d728ad6c0e603c49bcf8ce4708", "src_uid": "e4b3a2707ba080b93a152f4e6e983973", "apr_id": "752d298258e1380a5d342a68e4148883", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9321175278622087, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "\n/*fun stupid(x: Int) : Int {\n var ans = 0\n var ansSum = 0\n for (i in 1..x) {\n var curSum = i.toString().map{it-'0'}.sum()\n if (curSum >= ansSum) {\n ansSum = curSum\n ans = i\n }\n }\n return ans\n}*/\n\nfun solve(x : Int) : Int {\n var ans = x\n var ansSum = x.toString().map{it-'0'}.sum()\n var head = x\n var tailLen = 0\n while (head > 0) {\n head /= 10\n tailLen ++\n var tail = \"\"\n (1..tailLen).forEach { tail += '9' }\n var cur = -1\n head --\n if (head > 0) {\n cur = (head.toString() + tail).toInt()\n } else {\n cur = tail.toInt()\n }\n if (cur > x)\n continue\n val curSum = cur.toString().map{it-'0'}.sum()\n if (curSum > ansSum) {\n ans = cur\n ansSum = curSum\n }\n }\n return ans\n}\n\nfun main(args: Array) {\n val x = readLine()!!.toInt()\n println(solve(x))\n}", "lang": "Kotlin", "bug_code_uid": "20c7efab66d57bfb0192d04c1478a0f8", "src_uid": "e55b0debbf33c266091e6634494356b8", "apr_id": "9eb40a4a010e94cf59eda76b6c489fd9", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9823899371069182, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.math.max\n\nval readQueue = ArrayDeque()\n\nfun getInput(): String {\n if (readQueue.isEmpty()) readLine()!!.split(' ', '\\n').let { readQueue.addAll(it) }\n return readQueue.pop()\n}\n\nfun getInt() = getInput().toInt()\nfun getDouble() = getInput().toDouble()\nfun getString() = getInput()\nfun getLong() = getInput().toLong()\n\nfun printv(v: Collection) {\n v.forEachIndexed { i, t ->\n if (i != 0) print(\" \")\n print(t)\n }\n println()\n}\n\nfun > lsort(v: MutableList) {\n v.sort()\n}\n\nfun > gsort(v: MutableList) {\n v.sortDescending()\n}\n\nfun mp(t: T, u: U) = Pair(t, u)\n\nfun ifloor(a: Int, b: Int) = if (a xor b > 0) a / b else (a - b + 1) / b\nfun iceil(a: Int, b: Int) = if (a xor b > 0) (a + b - 1) / b else a / b\nfun ifloor(a: Long, b: Long) = if (a xor b > 0) a / b else (a - b + 1) / b\nfun iceil(a: Long, b: Long) = if (a xor b > 0) (a + b - 1) / b else a / b\n\ntypealias ll = Long\ntypealias pii = Pair\ntypealias pll = Pair\n\nval MOD = 1000000007L\nval MAX = 2147483647L\n\nfun List.binarySearchWith(condition: (T) -> Boolean): Int {\n return binarySearch {\n if (condition(it)) 1\n else -1\n }.let { -(it + 1) }\n}\n\nfun List.lowerBound(i: Int): Int {\n return binarySearchWith { it >= i }\n}\n\nfun List.upperBound(i: Int): Int {\n return binarySearchWith { it > i }\n}\n\nfun main() {\n\n var n = getInt()\n if(n % 2 == 1) n -= 3;\n n /= 2;\n if(n % 2 == 1) println(1)\n else println(0)\n\n}", "lang": "Kotlin", "bug_code_uid": "2f7f52d37523479ad97d4d98e8cce11b", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "apr_id": "1d580ef426f03582ab1ae110001ff2c7", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.979757085020243, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array){\n\tval n = readLine()!!.toInt()\n\tif (n > 0) println(((1 + n) * n / 2) % 2) else println(\"0\")\n}", "lang": "Kotlin", "bug_code_uid": "779e6b0457bd603a305881d27b5cd954", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "apr_id": "31f0c29fd311dfba7c1366d64e7e5c61", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8945868945868946, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "package com.happypeople.codeforces.c1102\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\n\nfun main(args: Array) {\n try {\n A().run()\n } catch (e: Throwable) {\n A.log(\"\" + e)\n }\n}\n\nclass A {\n fun run() {\n val sc = Scanner(systemIn())\n val n = sc.nextInt()\n val ans = if (n == 3 || n == 4) 0 else 1\n println(\"$ans\")\n }\n\n companion object {\n var inputStr: String? = null\n\n fun systemIn(): InputStream {\n if (inputStr != null)\n return ByteArrayInputStream(inputStr!!.toByteArray())\n else\n return System.`in`\n }\n\n var printLog = false\n fun log(str: String) {\n if (printLog)\n println(str)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "8013799b83046f9024a919ad4a132bb9", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "apr_id": "e6b7d4d435ddaaa3929ae0fad79c2bdd", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9847127042698999, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "//package com.happypeople.codeforces.c1102\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\n\nfun main(args: Array) {\n try {\n A().run()\n } catch (e: Throwable) {\n A.log(\"\" + e)\n }\n}\n\nclass A {\n fun run() {\n val sc = Scanner(systemIn())\n val n = sc.nextInt()\n if(n==1 || n==2)\n println(\"1\")\n else if(n==3 || n==4)\n println(\"0\")\n else {\n val ans = if (((n / 2) % 2) == 0) 1 else 0\n println(\"$ans\")\n }\n }\n\n companion object {\n var inputStr: String? = null\n\n fun systemIn(): InputStream {\n if (inputStr != null)\n return ByteArrayInputStream(inputStr!!.toByteArray())\n else\n return System.`in`\n }\n\n var printLog = false\n fun log(str: String) {\n if (printLog)\n println(str)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "e374724c00bd2cce4c48ee3230966632", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "apr_id": "e6b7d4d435ddaaa3929ae0fad79c2bdd", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7708333333333334, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n\n val n = readInt()\n print((n * (n + 1) / 2) % 2)\n}", "lang": "Kotlin", "bug_code_uid": "3e65011e9518c2ae051f67f380be27ed", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "apr_id": "ad7ca2c701cd081f3f1375ed73d3d979", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6232876712328768, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "fun main(arg: Array){\n\tval n = readLine()!!.toInt()\n\tvar A = 0\n\tvar B = 0\n\tfor(i in n downTo 1){\n\t\tif(A > B){\n\t\t\tB+=i\n\t\t}else{\n\t\t\tA+=i\n\t\t}\n\t}\n\tprintln(A-B)\n}", "lang": "Kotlin", "bug_code_uid": "f31b306c5aed344c31222ed3bbcf2faf", "src_uid": "fa163c5b619d3892e33e1fb9c22043a9", "apr_id": "7219a988acc629a2afcf58010dc3850c", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.31309904153354634, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "fun main() {\n fun readLong() = readLine()!!.toLong()\n\n fun Long.primeFactors(): MutableList {\n val output = mutableListOf()\n var dividend = this\n while (dividend != 1L) {\n for (divisor in 2..dividend)\n if (dividend % divisor == 0L) {\n output.add(divisor)\n dividend /= divisor\n break\n }\n }\n return output\n }\n\n val primeFactors = readLong().primeFactors()\n val sols = mutableListOf(1L)\n for (factor in primeFactors) {\n val last = sols.size\n for (pos in 0 until last) sols.add(sols[pos] * factor)\n }\n print(sols.toSet().size)\n}", "lang": "Kotlin", "bug_code_uid": "4ae0708c5a554a1636e469840aeeeae6", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "apr_id": "4337f3772ba76cd6c23bcab15ff104c1", "difficulty": 1200, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5020661157024794, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import kotlin.math.sqrt\n\n// unable to solve it by myself. Solution from the editorial: https://codeforces.com/blog/entry/62688\nfun main() {\n fun readLong() = readLine()!!.toLong()\n\n fun Long.numFactors(): Long {\n var output = 0L\n val endLoop = sqrt(this.toDouble()).toLong()\n for (i in 1L..endLoop) if (this % i == 0L) output += 2\n return output\n }\n\n print(readLong().numFactors())\n}", "lang": "Kotlin", "bug_code_uid": "d5ce9d758cb4a36c9ab70db1803f2e71", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "apr_id": "4337f3772ba76cd6c23bcab15ff104c1", "difficulty": 1200, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9613095238095238, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n var b = readLine()!!.toLong()\n var ans = 1\n for (i in 2..100000) {\n if (b % i == 0L) {\n var count = 0\n while (b % i == 0L) {\n b /= i\n count ++\n }\n ans *= (count + 1)\n }\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "5c81f494b727c3402d62e5d6eb701e1a", "src_uid": "7fc9e7d7e25ab97d8ebc10ed8ae38fd1", "apr_id": "e332033140e8cbf194195ae52f7ced25", "difficulty": 1200, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9567430025445293, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\n/**\n * Created by thuanle on 7/13/17.\n */\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n var old = 0\n var step = 0\n repeat(n, {\n val x = sc.nextInt()\n when {\n old < x -> {\n if (step > 0) {\n println(\"NO\")\n return\n }\n }\n old == x -> {\n when (step) {\n 0 -> step = 1\n 2 -> {\n println(\"NO\")\n return\n }\n }\n }\n old > x -> {\n step = 2\n }\n }\n old = x\n })\n if (step == 0) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "ff2a6b8ee82157497aad6d73ca700669", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "apr_id": "35ac95101c5d32218e02471095b5628b", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9935639581657281, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/**\n * Created by abods on 7/23/2017.\n */\nfun main(args: Array) {\n var n:Int = readLine()!!.toInt()\n var line:String= readLine()!!\n var arr1 = Array(n){\"\"}\n arr1= line.split(\" \").toTypedArray()\n\n var arr = Array(n){0}\n\n for(a in 0.. arr1.size-1)\n {arr[a]=arr1[a].toInt()}\n\n\n var x:String = \"\"\n\n for(i in 1..arr.size-1)\n {\n if(arr[i]arr[i-1]) {\n if(x!=\"\") {\n if (x[x.length - 1] != '>') {\n x += '>'\n }\n }\n else\n {\n x += '>'\n }\n }\n\n if(arr[i]==arr[i-1]) {\n if(x!=\"\") {\n if (x[x.length - 1] != '=') {\n x += '='\n }\n }\n else\n {\n x += '='\n }\n }\n }\n if(x==\">=<\"||x==\"><\"||x==\">=\"||x==\"=<\"||x==\"=\"||x==\"\") {\n println(\"YES\")\n }\n else\n {\n println(\"NO\")}\n}\n\n", "lang": "Kotlin", "bug_code_uid": "78b255625e50c1f31ffd5e54bde9f1a4", "src_uid": "5482ed8ad02ac32d28c3888299bf3658", "apr_id": "a9307d3276df554835bec0c67036b913", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9873326094824466, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "data class Ornament(val ornament: Int, val offset: Int) {\n fun get() = ornament - offset\n}\n\n// red > blue > yellow exactly 1 is great christmas ornament\nclass ChristmasOrnament : ProblemSolver() {\n var totalRed: Int = 0\n var totalBlue: Int = 0\n var totalYellow: Int = 0\n\n fun input() {\n val args = mutableListOf()\n val ornaments = readLine()!!.split(\" \").map { it.toInt() }\n totalYellow = ornaments[0]\n totalBlue = ornaments[1]\n totalRed = ornaments[2]\n args.add(Ornament(totalRed, 0))\n args.add(Ornament(totalRed, 1))\n args.add(Ornament(totalRed, 2))\n output(args)\n }\n\n fun output(args: List) {\n val ornaments = args.map { it as Ornament }\n val christmasOrnaments = decrease(ornaments[0], ornaments[1], ornaments[2])\n val totalOrnaments = christmasOrnaments.reduce { acc, i -> acc + i }\n println(totalOrnaments)\n }\n\n private fun decrease(red: Ornament, blue: Ornament, yellow: Ornament): List {\n return if (blue.get() <= totalBlue && yellow.get() <= totalYellow) listOf(red.get(), blue.get(), yellow.get())\n else decrease(\n Ornament(red.get() - 1, offset = 0),\n Ornament(blue.get() - 1, offset = 1),\n Ornament(yellow.get() - 1, offset = 2)\n )\n }\n}\n\nfun main() {\n ChristmasOrnament().input()\n}\n\n", "lang": "Kotlin", "bug_code_uid": "8280439b65edc660fca8f8735af87e44", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "bccea860c6a08e74ef35842e4b83f77b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9584905660377359, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val (a, b, c) = readLine()!!.split(\", \").map(String::toInt)\n val d = maxOf(a, b - 1, c - 2)\n println(d*3)\n}", "lang": "Kotlin", "bug_code_uid": "b4b73bac9031c4bd925fc02684855893", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "148a1a65dec32c4c1e529ef5c4348390", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9003215434083601, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "val (yellow, blue, red) = readLine()!!.split(' ').map { it.toInt() }\nval maxYellow = maxOf(yellow, blue - 1, red - 2)\nprint(maxYellow * 3 + 3)", "lang": "Kotlin", "bug_code_uid": "0d05d077ebeac8a677a2a3fd2328c8e2", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "ed64868160af1ecdd7836678fc5a94bd", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9402092675635276, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n \tvar s = 6\n val input = Scanner(System.`in`)\n val A=input.nextInt()\n val B=input.nextInt()\n val B=input.nextInt()\n for (i in 2..999){\n if(I <= A && I + 1 <= B && I + 2 <= C)\n \ts = s+3\n else break\n }\n println(score)\n}\n/*import java.util.Scanner\n\nfun main(args: Array) {\n \tvar score = 6\n val input = Scanner(System.`in`)\n val a = input.nextInt()\n val b = input.nextInt()\n val c = input.nextInt()\n for (i in 2..999){\n if(i <= a && i+1 <= b && i+2 <= c)\n \tscore = score+3\n else break\n }\n println(score)\n}*/", "lang": "Kotlin", "bug_code_uid": "f777995646b3e0d8067dfb4ec14eab51", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "7c815df533525dfa87e3fa802989ba43", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5660377358490566, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "fun main(args: Array) {\n print(minOf(minOf(args[0], args[1] - 1), args[2] - 2) * 3 + 3)\n}\n", "lang": "Kotlin", "bug_code_uid": "a9a1d22b3791a23442dd88beea997378", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "1580e6cb6eecff5afba769a005fd4384", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.1968503937007874, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport kotlin.math.minOf\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n var y:Int = scanner.nextInt()\n var b:Int = scanner.nextInt()\n var r:Int = scanner.nextInt()\n y-=1;b-=2;r-=3\n //var ans:Int=min(y,b);\n //ans=min(ans,r);\n //println(\"$y $b $r\")\n //println(ans);\n var ans=minOf(y,b,r);\n println(3*ans+6);\n}", "lang": "Kotlin", "bug_code_uid": "9b2bd792f9c3b44c4edd4cbc037c9192", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "f119084a7ffe403622395e06f44cf1fd", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.10091743119266056, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "import kotlin.math.min\n\nval rgb = readLine()!!.split(' ').map(String::toInt).take(3)\n println(min(min(rgb[0], rgb[1] - 1), rgb[2] - 2))", "lang": "Kotlin", "bug_code_uid": "b8c8e71749d9c865247152bf7b827d81", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "a90219abffb9794f84235d8b927336d3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9097744360902256, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (y, b, r) = readLine()!!.split(' ').map(String::toInt)\n println(3 * min(min(b, y + 1), r - 1))\n}\n", "lang": "Kotlin", "bug_code_uid": "1c4ea79654e982ae2f582f91b3417cfe", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "a90219abffb9794f84235d8b927336d3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8753536362123482, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.lang.StringBuilder\nimport java.util.*\n\n// region\nclass ModInt(x: Long) {\n\n companion object {\n const val MOD = 998244353L\n }\n\n val x = (x % MOD + MOD) % MOD\n\n operator fun plus(other: ModInt): ModInt {\n return ModInt(x + other.x)\n }\n\n operator fun minus(other: ModInt): ModInt {\n return ModInt(x - other.x)\n }\n\n operator fun times(other: ModInt): ModInt {\n return ModInt(x * other.x)\n }\n\n operator fun div(other: ModInt): ModInt {\n return this * other.inv()\n }\n\n fun pow(exp: Long): ModInt {\n if (exp == 0L) return ModInt(1L)\n var a = pow(exp shr 1)\n a *= a\n if (exp and 1L == 0L) return a\n return this * a\n }\n\n fun inv(): ModInt {\n return this.pow(MOD - 2)\n }\n\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as ModInt\n\n if (x != other.x) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return x.hashCode()\n }\n\n override fun toString(): String {\n return \"$x\"\n }\n\n}\n\nval fac = mutableListOf()\n\nfun fact(n: Long): ModInt {\n if (fac.count() == 0) fac.add(ModInt(1))\n while (fac.count() <= n) {\n fac.add(fac.last() * ModInt(fac.count().toLong()))\n }\n return fac[n.toInt()]\n}\n\nfun comb(n: Long, k: Long): ModInt {\n return fact(n) / fact(k) / fact(n - k)\n}\n\nfun comb2(n: Long, k: Long): ModInt {\n var ans = ModInt(1)\n for (i in 0 until k) {\n ans = ans * ModInt(n - i) / ModInt(k - i)\n }\n return ans\n}\n// endregion\n\nfun PrintWriter.solve(sc: FastScanner) {\n val n = sc.nextInt()\n val _k = sc.nextLong()\n if (_k >= n) {\n println(0)\n return\n }\n val k = _k.toInt()\n if (k == 0) {\n var ans = ModInt(1L)\n for (i in 1..n) {\n ans *= ModInt(i.toLong())\n }\n println(ans)\n return\n }\n val dp = Array(n + 1) { Array(k + 1) { ModInt(0) } }\n dp[0][0] = ModInt(2)\n for (i in 1..n) {\n for (j in 0..k) {\n if (j > i) break\n dp[i][j] = dp[i - 1][j] * ModInt(n - i + j + 1L)\n if (j != 0) {\n dp[i][j] += dp[i - 1][j - 1] * ModInt((i - j).toLong())\n }\n }\n }\n println(dp[n][k])\n}\n\nfun main(args: Array) {\n val writer = PrintWriter(System.out, false)\n writer.solve(FastScanner(System.`in`))\n writer.flush()\n}\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}", "lang": "Kotlin", "bug_code_uid": "90cfa1586ae788570cedc7635e7c799f", "src_uid": "6c1a9aaa7bdd7de97220b8c6d35740cc", "apr_id": "cdae7c42d6180c537f5741050e4355b1", "difficulty": 2300, "tags": ["fft", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.997624703087886, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package archive\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var (a, b) = readInts()\n var years = 0\n while (a <= b) {\n a *= 3\n b *= 2\n years++\n }\n println(years)\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "63ee8a19cc065950a2cbe7e0eceb2aec", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "ebc5620fd90e45829028a57487d15659", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6455981941309256, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n var limak = args.component1().toInt()\n var bob = args.component2().toInt()\n var years = 0\n\n while (limak <= bob) {\n limak *= 3\n bob *= 2\n years++\n }\n\n println(years)\n}", "lang": "Kotlin", "bug_code_uid": "5a6af13f654d8606421101e5d23d5835", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "b755eda82a39fc274981a87bfb8f115e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.916923076923077, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import kotlin.math.ceil\nimport kotlin.math.log\nimport kotlin.math.log10\nimport kotlin.math.round\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of ints\n\nfun main() {\n val (a, b) = readDoubles()\n val logab = log10((b / a))\n val log32 = log10(1.5)\n print(if (a == b) 1 else (round(logab.div(log32)) + 1).toInt())\n\n\n}", "lang": "Kotlin", "bug_code_uid": "eb1f33788e03785c444aea46770c0957", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "3797fe527da7abe1cd3fc3e3ca28ea6f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7489177489177489, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args : Array) {\n\n var a = readLine()!!.toInt()\n var b = readLine()!!.toInt()\n\n var years = 0\n\n while(a<=b) {\n years++;\n a*=3\n b*=2\n }\n\n println(years)\n\n}", "lang": "Kotlin", "bug_code_uid": "4cc26714720ddc735ed8d1e2094431d7", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "4668a6f119419e14e648c8b6fa8e97f3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9935897435897436, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n\tvar (a,b) = readLine()!!.split(' ').map(String::toInt)\n\tvar y = 0\n\twhile (a <= b){\n\t\ta *= 3\n\t\tb *= 2\n\t\ty+=\n\t}\n\tprintln(y)\n}", "lang": "Kotlin", "bug_code_uid": "a6b7cdda75d768595c6363719086eaa5", "src_uid": "a1583b07a9d093e887f73cc5c29e444a", "apr_id": "ccbc0b5bebfb5d61b8f8d81a6f551272", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9917898193760263, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.lang.Math.abs\n\nfun main(args: Array) {\n val temp = readLine()!!.split(\" \").map { it.toInt() }\n val (x, y, z, t1, t2) = temp\n val t3 = temp[5]\n\n if (4*t3 + (abs(x - y) + abs(x - z)) * t2 <= abs(x - y) * t1) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "a66b584ab83c9a0e2267e5868181b2d4", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "apr_id": "7ef7e1614d50eb1bf64ad8a4b54768b0", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9993288590604027, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.io.*\nimport java.util.Locale\n\n\nval filename = \"a\"\n\nfun solve() {\n val x = iread()\n val y = iread()\n val z = iread()\n val t1 = iread()\n val t2 = iread()\n val t3 = iread()\n\n val res1 = (Math.abs(x-y) + Math.abs(z-x))*t2 + t3*4;\n val res2 = Math.abs(x-y) * t1;\n\n if (res1 <= res2) {\n out.write(\"YES\\n\")\n }\n else\n out.write(\"NO\\n\")\n}\n\nfun iread() = readword().toInt()\n\nfun dread() = readword().toDouble()\n\nfun lread() = readword().toLong()\n\nfun readword(): String {\n val b = StringBuilder()\n var c: Int\n val space = ' '.toInt()\n c = `in`.read()\n while (c in 0..space)\n c = `in`.read()\n if (c < 0)\n return \"\"\n while (c > space.toInt()) {\n b.append(c.toChar())\n c = `in`.read()\n }\n return b.toString()\n}\n\nval `in`: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\nval out: BufferedWriter = BufferedWriter(OutputStreamWriter(System.out))\n//val `in` = BufferedReader(FileReader(filename+\".in\"));\n//val out = BufferedWriter(FileWriter(filename+\".out\"));\n\nfun run() {\n try {\n// var ntests = iread()\n// for (test in 0 until ntests) {\n solve()\n// }\n out.flush()\n } catch (e: Exception) {\n e.printStackTrace()\n System.exit(1)\n }\n}\n\nfun main(args: Array) {\n try {\n Locale.setDefault(Locale.US)\n } catch (e: Exception) {\n\n }\n Thread(null, { run() }, \"1\", (1 shl 25).toLong()).start()\n}\n", "lang": "Kotlin", "bug_code_uid": "ee0f95b5ffac2e364fa801c1f70b31c4", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "apr_id": "4f73662dcebe3f9bc3cb43aca5c46a7f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9964285714285714, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\n\nfun main(args: Array) {\n val xyzt1t2t3 = readLine()!!.split(\" \").map{it.toInt()}\n val (x,y,z) = xyzt1t2t3.subList(0, 3)\n val (t1,t2,t3) = xyzt1t2t3.subList(3,6)\n println(if (abs(x-y)*t1 < abs(x-z)*t2+2*t3+abs(x-y)*t2) \"NO\" else \"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "167244b92261ffde959daeab9b7b1c61", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "apr_id": "b4a96f52f21f464500d57874c42b8025", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9567367119901112, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readStrings() = readLn().split(\" \")\nfun readInts() = readStrings().map { it.toInt() }\n\nfun main(args: Array) {\n var a = readInts()\n var st = abs(a[0] - a[1]) * a[3]\n var el = (abs(a[0] - a[1]) + abs(a[0] - a[2])) * a[4] + (3 * a[5])\n print(\"st: $st \\n el: $el \\n\")\n if (el > st) print(\"NO\") else print(\"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "128a22555bdea8850974d8d5d03932b4", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "apr_id": "dcbc5b07b47e71edb86a0c0713958029", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8809523809523809, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "package codeforces\n\nimport java.util.*\n\n/**\n * Created by rohmanhakim on 3/2/18.\n */\n\nfun leastFlagStones(squareLength: Int, paveLength: Int): Int =\n if((squareLength % paveLength) > 0) (squareLength / paveLength) + 1 else (squareLength / paveLength)\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val n = nextInt()\n val m = nextInt()\n val a = nextInt()\n\n println(leastFlagStones(n,a) * leastFlagStones(m,a))\n}", "lang": "Kotlin", "bug_code_uid": "d68983764ee572bec87f76587a8ac456", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "b0490c1f1a96c4693f110a73d6e70541", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9965156794425087, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val a = sc.nextLong()\n val b = sc.nextLong()\n val c = sc.nextLong() \n \n var x:Long = a / c\n var y:Long = b / c\n if(a%c !=0) x += 1L\n if(b%c !=0) y += 1L\n print(x * y)\n\n}", "lang": "Kotlin", "bug_code_uid": "2384e9572a69a674b7ee17035c6d40da", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "fcfa203ddeb3ca6070d8d048d69d5241", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8740740740740741, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "package com.example.myapplication\n\nfun main(args: Array) {\n\n val line = readLine()!!.split(\" \")\n\n val m = line[0].toInt()\n val n = line[1].toInt()\n val a = line[2].toInt()\n\n val result = findTilesCount(m,n,a)\n\n println(result)\n}\n\nprivate fun findTilesCount(m :Int, n :Int, a :Int) : Long {\n\n var mDiv = m.toDouble() / a\n\n var nDiv = n.toDouble() / a\n\n var result = Math.ceil(mDiv) * Math.ceil(nDiv)\n\n return result.toLong()\n}", "lang": "Kotlin", "bug_code_uid": "76118fe2ea4cd4309784cee894cb2eed", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "593916723b8cebefe32ac039de7223a4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9905362776025236, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nimport java.io.File\nimport kotlin.math.ceil\n\n\nfun main() {\n val file = File(\"data.txt\")\n val reader = Scanner(file)\n // val reader = Scanner(System.`in`)\n val (n,m,a) = reader.nextLine()!!.split(' ').map(String::toInt)\n print((ceil(n.toDouble()/a)* ceil(m.toDouble()/a)).toLong())\n}", "lang": "Kotlin", "bug_code_uid": "7e0d9579447df4426bbac1aa237370ed", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "ff7eb6084c069f4d3ef26147a426585f", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9941002949852508, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n repeat(readLine()!!.toInt()) {\n val (n, m, a) = r.readLine()!!.split(\" \").map { it.toInt() }\n val x = n / a + if (n % a == 0) 0 else 1\n val y = m / a + if (m % a == 0) 0 else 1\n s.appendln(x*y.toLong())\n }\n print(s)\n}", "lang": "Kotlin", "bug_code_uid": "643679698e20c0bafb03a9212051c325", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "e574f79b53ed5d517524893e73abbea2", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9883398112159911, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "package default\n\nimport java.util.*\n\nclass Program {\n companion object {\n fun calculateSize(length: Long, width: Long, flagstoneSize: Long): Long {\n var flagstones: Long = 0\n flagstones += ((length / flagstoneSize) * (width / flagstoneSize))\n if (length % flagstoneSize > 0)\n flagstones += width / flagstoneSize\n if (width % flagstoneSize > 0)\n flagstones += length / flagstoneSize\n if ((length % flagstoneSize > 0) && (width % flagstoneSize > 0))\n flagstones += 1\n return flagstones\n }\n }\n}\n\nfun main(args : Array) {\n val scanner = Scanner(System.`in`)\n val length = scanner.nextLong()\n val width = scanner.nextLong()\n val flagstoneSize = scanner.nextLong()\n\n var flagstones = Program.calculateSize(length, width, flagstoneSize)\n println(flagstones)\n}", "lang": "Kotlin", "bug_code_uid": "91b9f925b7a132f5b40ba52203b3fe56", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "54ed06ff6596b48c0b61626eed36add8", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8865619546247818, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "package com.rozag.codeforces\n\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n val n = scanner.nextInt()\n val m = scanner.nextInt()\n val a = scanner.nextInt()\n\n print(Math.ceil(n.toDouble() / a).toInt() * Math.ceil(m.toDouble() / a).toInt())\n}", "lang": "Kotlin", "bug_code_uid": "73be2edfb1787bdc7ada70d1ff612e9a", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "e2234bc5b67e305db065cb81fd7de5a4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9029754204398448, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "fun main(args:Array)\n{\n var ip= (readLine()!!).split(\" \")\n var n=ip[0].toInt()\n var m=ip[1].toInt()\n var a=ip[2].toInt()\n var row=0\n var col=0\n while(n>0||m>0)\n {\n if(n>0) {\n row++\n n = n - a\n }\n if(m>0) {\n col++\n m = m - a\n }\n }\n\n println(row*col)\n}", "lang": "Kotlin", "bug_code_uid": "1306849fb60eac2368b9a97375077272", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "21c761395066ccb54e3ec645a6a4253d", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.49290322580645163, "equal_cnt": 21, "replace_cnt": 16, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 22, "bug_source_code": "package com.project.codeforces\n\nimport java.io.PrintWriter\nimport java.util.*\n\nfun main() { _writer.solve(); _writer.flush() }\n\nfun PrintWriter.solve() {\n val data = read()\n println(data)\n}\n\n\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\ninline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }\n", "lang": "Kotlin", "bug_code_uid": "8beddcfbc8da286b3d73ae12dfe11198", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "db34aa0b2120ea1a03782223675fbaf4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4188034188034188, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "/**\n * Created by sergei on 03.07.17.\n */\nfun main(args: Array) {\n val split = readLine()!!.split(\"\\\\s+\")\n println(getPlatesNum(split[0].toInt(), split[1].toInt(), split[2].toInt()))\n}\n\nfun getPlatesNum(n: Int, m: Int, a: Int): Int {\n return getDimantion(n, a) * getDimantion(m, a)\n}\n\nfun getDimantion(m: Int, a: Int): Int {\n return m / a + if (m % a == 0) 0 else 1;\n}\n\n", "lang": "Kotlin", "bug_code_uid": "495e21451c9568f201f086bef1090946", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "60e8b6f6bae607387401e80ab90800d8", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5828779599271403, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "package com.keystarr\n\nfun main(args: Array){\n val (n, m, a) = readLine()!!.split(' ').map { it.toDouble() }\n val widthPlates = Math.ceil(m / a).toInt()\n if (n <= a)\n print(widthPlates)\n else{\n val heightPlates = Math.ceil(n / a).toInt()\n print(widthPlates + heightPlates)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "0a37c3b87c6834399abd3523e26bd1cb", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "6311418628a57473f611e8dab94859c8", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.45132743362831856, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array){\n while(true) {\n val (n, m, a) = readLine()!!.split(' ').map { it.toDouble() }\n val widthPlates = Math.ceil(m / a).toInt()\n if (a.toInt() == 1) {\n print((n * m).toInt())\n return\n }\n if (n <= a)\n print(widthPlates)\n else {\n val heightPlates = Math.ceil(n / a).toInt()\n print(widthPlates + heightPlates)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "8db0412dd09696bcc620c404216fb36b", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "6311418628a57473f611e8dab94859c8", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7559633027522936, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toDouble()\n var m = readLine()!!.toDouble()\n var a = readLine()!!.toDouble()\n var width: Double = Math.ceil(n/a)\n var height: Double = Math.ceil(m/a)\n println((width * height).toInt())\n}", "lang": "Kotlin", "bug_code_uid": "c4dbb072cfc5ca3b74ee3e937d0cec15", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "8f4c4b6e3a8b78fb557a046b18f34407", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5815217391304348, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n val m = readLine()!!.toInt()\n val a = readLine()!!.toInt()\n\n print((n * m) % (a * a))\n}\n", "lang": "Kotlin", "bug_code_uid": "4432d195551372f4373d0b76c0196084", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "7a2c47880bef04f8cbb77c34d334ed39", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6584992343032159, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*\nimport kotlin.math.round\n\nfun main() {\n val reader = Scanner(System.`in`)\n val input = reader.next()\n val numbers: List = input.split(\" \").map { it.toInt() }\n\n println(\"${round((numbers[0] * numbers[1] / numbers[2] * numbers[2]).toDouble())}\")\n}", "lang": "Kotlin", "bug_code_uid": "496ffd529d13e51412f3a287564114e4", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "44a1d96d67ad8b9118561886c8cd687c", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5213032581453634, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "fun main() {\n\tval (m, n, a) = readLine()!!.split(\" \").map { it.toInt() }\n\tval aa = a.toDouble()\n\tprintln(Math.ceil(m / aa).roundToInt() * Math.ceil(n / aa).roundToInt())\n}", "lang": "Kotlin", "bug_code_uid": "975d4b78ddb2a7c1ecb3f04185a9b327", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "c9c19c8b4d66ee1642a28fcaf12806b5", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9600560616678346, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val m = input.nextLong()\n val n = input.nextLong()\n val a = input.nextLong()\n\n var rowCount = 0L\n var collCount = 0L\n var sum = 0L\n\n while (sum < n || sum < m) {\n if (sum < m) rowCount++\n if (sum < n) collCount++\n sum += a\n }\n\n output.print(rowCount * collCount)\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n}", "lang": "Kotlin", "bug_code_uid": "5aaaa813b831e0f7a97f0646d3eb7904", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "187d638cfa3d766fc1ffa24f29c1ada2", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9863387978142076, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val m = input.nextLong()\n val n = input.nextLong()\n val a = input.nextLong()\n\n if (m % a == 0L && n % a == 0L) {\n output.print(m / a * n / a)\n return\n }\n\n var rowCount = 0L\n var collCount = 0L\n var sum = 0L\n\n while (sum < n || sum < m) {\n if (sum < m) rowCount++\n if (sum < n) collCount++\n sum += a\n }\n\n output.print(rowCount * collCount)\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n}", "lang": "Kotlin", "bug_code_uid": "10151c436ec9e4366d52a1c7697d1473", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "187d638cfa3d766fc1ffa24f29c1ada2", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9787525702535984, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.HashMap\nimport kotlin.math.min\n\nfun main(args: Array)\n = Thread { run() }.start()\n\nfun run() {\n\n val scanner = Scanner(System.`in`)\n scanner.nextInt()\n val str = scanner.next()\n print(\"1\")\n str.forEach { if (it == '0') print('0') }\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\nclass Pair(var a: Int, var b: Int): Comparable {\n override fun compareTo(other: Pair): Int {\n return a - other.a\n }\n}", "lang": "Kotlin", "bug_code_uid": "4b3df855a73d9d6e57c3bfe6cd2035e3", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "apr_id": "cd3d038b1031a1e701f1fd81aaf3cab3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8542094455852156, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\n\n\nfun main() {\n\n val n = readLine()!!.toInt()\n val s = readLine()!!\n\n\n val countNull = s.count { it == '0' }\n\n\n print(1)\n (1..countNull).forEach {\n print(0)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "9a980c1b4fc423ef280100900a925a9f", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "apr_id": "91f3053980cd187de4e4bbf0cddd1d41", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8361408882082695, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var s = readLine()!!\n var zero: Int = 0\n var one = true\n for (i in s) {\n if (i == '0') zero++\n if (i == '1') one = true\n }\n if (one) print('1')\n while (zero > 0) {\n print(0)\n zero--\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "710954d097ffcc1134cab2586e6c938e", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "apr_id": "7483c04871e7647ab32d97ae7862489c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9666110183639399, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args:Array) {\n val n = readLine()!!\n var ms = readLine()!!.toList().map { it.toString() }.toMutableList()\n\n l2@while(true) { \n l1@for( i in (0..ms.size-1-1) ) { \n //println( ms[i] + ms[i+1] )\n if( ms[i] + ms[i+1] == \"01\" ) {\n ms[i] = \"1\"\n ms[i+1] = \"0\"\n break@l1\n }\n if( i == ms.size-1-1 ) {\n break@l2\n }\n }\n ms = ms.joinToString(\"\").replace(\"11\", \"1\").toList().map { it.toString() }.toMutableList()\n if( ms.size == 1 ) {\n break@l2\n }\n //println(ms)\n }\n println(ms.joinToString(\"\"))\n}\n", "lang": "Kotlin", "bug_code_uid": "1e8816a91fc7d8d7c893a1821f3a5fed", "src_uid": "ac244791f8b648d672ed3de32ce0074d", "apr_id": "bbc9bbac52b07fd4a96963beae2d7ebe", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.955067920585162, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.*\n\nval sc = java.util.Scanner(System.`in`)\nfun main(args: Array) {\n\tval n = sc.nextInt()\n\tvar ans = 6\n\tfor (i in 0..999999)\n\t\tif (islucky(i))\n\t\t\tans = min(ans, different(n, i))\n\tprintln(ans)\n}\n\nfun islucky(x: Int) =\n\t\tx % 1000 == x / 1000 % 10 + x / 10000 % 10 + x / 100000\n\nfun different(x: Int, y: Int): Int {\n\tvar ans = 0\n\tvar a = x\n\tvar b = y\n\tfor (i in 1..6) {\n\t\tif (a % 10 != b % 10)\n\t\t\tans++\n\t\ta /= 10\n\t\tb /= 10\n\t}\n\treturn ans;\n}", "lang": "Kotlin", "bug_code_uid": "433299ad9e66e5e5f66df51b79a242e1", "src_uid": "09601fd1742ffdc9f822950f1d3e8494", "apr_id": "e81fdfaf5e5627b428438cad48e7c8ef", "difficulty": 1600, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7332421340629275, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numMonth, dayYearStarts) = readInts()\n val daysPerMonth = listOf(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)\n val dayMonthStarts = (dayYearStarts - 1 + daysPerMonth.subList(0, numMonth).sum()) % 7\n val end = dayMonthStarts + daysPerMonth[numMonth]\n print(end / 7 + if (end % 7 == 0) 0 else 1)\n}", "lang": "Kotlin", "bug_code_uid": "af300aaebf317fa0b73ecba96d14a202", "src_uid": "5b969b6f564df6f71e23d4adfb2ded74", "apr_id": "24be299a6b0d8061d7a56e35a111ed47", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.564, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n val res = c*2 + minOf(a,b)*2 + (if (a > 0 && a == b) 0 else 1)\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "f3c44de1b9b3c71bcff120ffebbe714e", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "90e343d610795a25076747b343d1466b", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7241379310344828, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.lang.Math.min\nimport java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n val a = sc.nextLong()\n var b = sc.nextLong()\n val ab = sc.nextLong()\n print(ab * 2 + min(a, b) * 2 + if(b - min(a, b) > 0) 1 else 0)\n// main()\n}", "lang": "Kotlin", "bug_code_uid": "ab55e415515c276a660148c0aebcee59", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "c005711649a3a40e8dab5d00d8025e99", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.49572649572649574, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "package GlobalRound3\n\nfun main() {\n var (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n println(c * 2 + Math.min(a, b) * 2 + 1)\n}", "lang": "Kotlin", "bug_code_uid": "5c665e32debf2079442eb1791710a254", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "198d0636b37a43449d475ece664b9092", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6398659966499163, "equal_cnt": 16, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 15, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var a = 0\n for(i in 1..n){\n a = readLine()!!.toInt()\n if (a % 7 == 0 || a % 3 == 0 || a % 10 == 0){\n println(\"YES\")\n }\n else\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "9ecbb6ae3d518a0a7eab84711f1a7d52", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "apr_id": "5c9cf597a46255f014bcc012f192e77d", "difficulty": 900, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995071463775259, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\n\nfun solve(a: Int): String {\n\n for (i in 1..a / 3) {\n if ((a - i * 3) % 7 == 0) return \"YES\"\n }\n return \"NO\"\n}\n\nfun processSuite() {\n val n = readLine()!!.toInt()\n val solution = solve(n)\n println(solution)\n}\n\nfun suitesCount() = readLine()!!.toInt()\n\nfun main() {\n for (i in 0 until suitesCount()) {\n processSuite()\n }\n}\n\n// READER\ninternal val reader = Reader()\ninternal fun readNumber() = reader.nextInt()\ninternal fun readNumbers(n: Int) = reader.nextInts(n)\n\ntypealias DataInputStream = java.io.DataInputStream\n\ninternal class Reader {\n\n private val BUFFER_SIZE = 1 shl 16\n private val din: DataInputStream = DataInputStream(System.`in`)\n private val buffer: ByteArray = ByteArray(BUFFER_SIZE)\n private var bytesRead: Int = 0\n private var bufferPointer: Int = bytesRead\n\n private val stop: Byte = -1\n\n private fun read(): Byte {\n if (bufferPointer == bytesRead) {\n fillBuffer()\n }\n return buffer[bufferPointer++]\n }\n\n private fun fillBuffer() {\n bufferPointer = 0\n bytesRead = din.read(buffer, bufferPointer, BUFFER_SIZE)\n if (bytesRead == -1) {\n buffer[0] = stop\n }\n }\n\n fun nextLine(): String {\n val buf = ByteArray(64) // line length\n var cnt = 0\n var c: Byte\n do {\n c = read().takeUnless { it == '\\n'.toByte() } ?: break\n buf[cnt++] = c\n } while (c != stop)\n\n return String(buf, 0, cnt)\n }\n\n fun nextInts(n: Int): IntArray {\n val arr = IntArray(n) { 0 }\n for (i in 0 until n) {\n arr[i] = nextInt()\n }\n return arr\n }\n\n fun nextInt(): Int {\n var ret = 0\n var c = read()\n while (c <= ' '.toByte()) c = read()\n val neg = c == '-'.toByte()\n if (neg) c = read()\n do {\n ret = ret * 10 + c - '0'.toInt()\n c = read()\n } while (c >= '0'.toByte() && c <= '9'.toByte())\n\n return if (neg) -ret else ret\n }\n\n fun nextLong(): Long {\n var ret = 0L\n var c = read()\n while (c <= ' '.toByte()) c = read()\n val neg = c == '-'.toByte()\n if (neg) c = read()\n do {\n ret = ret * 10 + c - '0'.toInt()\n c = read()\n } while (c >= '0'.toByte() && c <= '9'.toByte())\n\n return if (neg) -ret else ret\n }\n\n fun nextDouble(): Double {\n var ret = 0.0\n var div = 1.0\n var c = read()\n while (c <= ' '.toByte()) c = read()\n val neg = c == '-'.toByte()\n if (neg) c = read()\n do {\n ret = ret * 10 + c - '0'.toDouble()\n c = read()\n } while (c >= '0'.toByte() && c <= '9'.toByte())\n\n if (c == '.'.toByte()) {\n c = read()\n while (c >= '0'.toByte() && c <= '9'.toByte()) {\n div *= 10\n ret += (c - '0'.toByte()) / div\n c = read()\n }\n }\n\n return if (neg) -ret else ret\n }\n}", "lang": "Kotlin", "bug_code_uid": "ced6b3d499744a7beed38af31a5e64e1", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "apr_id": "2a52393fc169d1d6e95d40ff47fdad7e", "difficulty": 900, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7551020408163265, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n var t = readLine()!!.toInt()\n\n for(i in 1..t) {\n var x = readLine()!!.toInt()\n var possible = false\n\n for(j in 1..t) {\n if(x % (3 * j) == 7 || x % (7 * j) == 3) possible = true\n if(x % 3 == 0 || x % 7 == 0) possible = true\n\n if(possible) break\n }\n\n println(if (possible) \"YES\" else \"NO\")\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "7712dc7d94819984f519c54de73714cb", "src_uid": "cfd1182be98fb5f0c426f8b68e48d452", "apr_id": "470cf351860fededb2116a3938f25db1", "difficulty": 900, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9129852744310576, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val scaner = readLine()!!.toInt()\n val liner = readLine()!!.split(\" \").map{it -> it.toInt()}\n val newList: MutableList = mutableListOf()\n for (n in liner.reversed())\n {\n if (!newList.contains(n))\n newList.add(n)\n }\n println(newList.size)\n for (l in newList)\n print(\"${l} \")\n}", "lang": "Kotlin", "bug_code_uid": "13961965bd8d4492e56abd06b6e5be60", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "69d236504a7f5e0db7202fcd3c5db732", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9841656516443362, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main()\n{\n val n = readInt()\n val numbers = readInts()\n val singles = mutableListOf()\n\n for (i in n-1 downTo 0)\n {\n if (!singles.contains(numbers[i])) singles.add(numbers[i])\n }\n\n for (i in singles.size - 1 downTo 0) print(\"${singles[i]} \")\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles", "lang": "Kotlin", "bug_code_uid": "5d23f161717b35680370a300ddec18e8", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "75cab6bd432d6927d6f8e95467ae7551", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9471153846153846, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.trim().toInt()\n val bs = readLine()!!.trim().split(' ').map{it.toInt()}.distinct()\n println(bs.size)\n print(bs.joinToString(\" \"))\n}", "lang": "Kotlin", "bug_code_uid": "7ece16f52b7b205c42af1321a5af39ec", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "5a6c54abc73ad21952e53d2022d9b9a6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9761222540592168, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import jdk.jfr.Frequency\nimport java.util.*\n\nfun main(args : Array){\n var n : Int = readLine()!!.toInt()\n val str : List = readLine()!!.split(\" \")\n var arr : List = List(n, {i : Int -> str[i].toInt()})\n var h : HashSet = hashSetOf()\n var s : Stack = Stack()\n for (i in n-1 downTo 0){\n if(!h.contains(arr[i])){\n h.add(arr[i])\n s.add(arr[i])\n }\n }\n println(s.size)\n while(s.size > 0) {\n val x : Int = s.pop()\n print(\"$x \")\n }\n}", "lang": "Kotlin", "bug_code_uid": "467e34128a97bcad70b145a368b8a1c3", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "fc027f98bcfa2c6fa32d3777d489bfa3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8335246842709529, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val positions = args[2].split(' ').toList().reversed()\n val outArray = mutableListOf()\n\n for(str in positions) {\n if(!outArray.contains(str)) {\n outArray.add(str)\n }\n }\n val output = outArray.reversed()\n val outputString = output.joinToString(\" \")\n println(output.size)\n println(outputString)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "a11f58cfe3b75d07ea3422fa0a662ddb", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "a1b997d73043a24410e98722cab4f7ee", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9781931464174455, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\n\nfun main(args: Array) {\n val length = readLine()!!.toInt()\n val items = readLine()!!.split(\" \").map { it.toInt() }\n val foundedSet = HashSet()\n\n val result = ArrayList()\n for (i in 0..length - 1) {\n val item = items[length - 1 - i]\n if (!foundedSet.contains(item)) {\n result.add(item)\n foundedSet.add(item)\n }\n }\n println(result.size)\n println(result.toIntArray().joinToString(\" \"))\n}", "lang": "Kotlin", "bug_code_uid": "d9417ebddc5a7c75e396add450d4800a", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "4facc51a5f61f6cb926c729481a03f3f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.455584872471416, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var (aa, bb, cc, ss) = readInts()\n \n var l : Array = arrayOf(aa, bb, cc, ss)\n l.sort()\n var (a, b, c, s) = l\n \n var out = arrayOf(s - a, s - b, s - c)\n println(out.joinToString(\" \"))\n}", "lang": "Kotlin", "bug_code_uid": "ecf31240442572f2f261a0fc4ec75577", "src_uid": "1b9d3dfcc2353eac20b84c75c27fab5a", "apr_id": "96c156cdf5405ac1eac77d05b29a38f2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9579242636746143, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val chars = \"ABCD\"\n val lengths = IntArray(4)\n var minLengthPos = 0\n var maxLengthPos = 0\n for (pos in 0 until 4) {\n lengths[pos] = readLine()!!.length - 2\n if (lengths[pos] < lengths[minLengthPos]) minLengthPos = pos\n if (lengths[pos] > lengths[maxLengthPos]) maxLengthPos = pos\n }\n var minCounter = 0\n var maxCounter = 0\n for (pos in 0 until 4) {\n if (lengths[pos] / lengths[minLengthPos] < 2) minCounter++\n if (lengths[maxLengthPos] / lengths[pos] < 2) maxCounter++\n }\n if (minCounter < 2) return print(chars[minLengthPos])\n if (maxCounter < 2) return print(chars[maxLengthPos])\n print('C')\n}", "lang": "Kotlin", "bug_code_uid": "73d3400dcc8111ab4c0d8cdf44dd2682", "src_uid": "30725e340dc07f552f0cce359af226a4", "apr_id": "187a59c1a8ac1213421b4c7ad793acbd", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9393103448275862, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val chars = \"ABCD\"\n val lengths = IntArray(4)\n var minLengthPos = Int.MAX_VALUE\n var maxLengthPos = Int.MIN_VALUE\n for (pos in 0 until 4) {\n lengths[pos] = readLine()!!.length - 2\n if (lengths[pos] < lengths[minLengthPos]) minLengthPos = pos\n if (lengths[pos] > lengths[maxLengthPos]) maxLengthPos = pos\n }\n var minCounter = 0\n var maxCounter = 0\n for (pos in 0 until 4) {\n if (lengths[pos] / lengths[minLengthPos] < 2) minCounter++\n if (lengths[maxLengthPos] / lengths[pos] < 2) maxCounter++\n }\n if (minCounter < 2) return print(chars[minLengthPos])\n if (maxCounter < 2) return print(chars[maxLengthPos])\n print('C')\n}", "lang": "Kotlin", "bug_code_uid": "7aefe8371dbbd5b8135fbb000381028f", "src_uid": "30725e340dc07f552f0cce359af226a4", "apr_id": "187a59c1a8ac1213421b4c7ad793acbd", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9512341962673089, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n val (length, sum) = readInts()\n val quotient = sum / 9\n val rest = sum % 9\n if (length == 0 || sum == 0 || quotient > length || (quotient == length && rest != 0)) {\n print(\"-1 -1\")\n return\n }\n val a = mutableListOf()\n for (i in 0 until quotient) a.add(9)\n if (rest != 0) a.add(rest)\n\n val sb1 = StringBuilder()\n for(element in a) sb1.append(element)\n for (i in 0 until length - a.size)\n sb1.append('0')\n val sb2 = StringBuilder()\n if(length > a.size) {\n a[a.lastIndex]--\n sb2.append('1')\n for(i in 0 until length - a.size - 1) sb2.append('0')\n }\n for(i in a.lastIndex downTo 0) sb2.append(a[i])\n print(\"$sb2 $sb1\")\n}\n", "lang": "Kotlin", "bug_code_uid": "8c2f336df1a38ba457ee89c952a476e5", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "38254a79de240e9fbab67dc965c516e7", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5118466268764695, "equal_cnt": 49, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 32, "fix_ops_cnt": 49, "bug_source_code": "// 7/7/2020 11:13 AM\n\npackage p489\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n findSumToN(403, 105)\n}\n\nfun findSumToN(m: Int, s: Int) {\n// findSumToN_recursive(m, s, listOf())\n printLeastAndGreatest(findSumToN_iterative(m, s))\n}\n\nfun printLeastAndGreatest(l: List) {\n if (l.isEmpty()) {\n println(\"-1 -1\")\n return\n }\n\n val theGreatest = l.toMutableList()\n val theLeast = l.toMutableList()\n\n for (i in theLeast.size-1 downTo 1) {\n if (theLeast[i] > 0) {\n val v = theLeast.removeAt(i)\n theLeast.add(0, v)\n break\n }\n }\n\n var pos = 1\n for (i in theLeast.size - 1 downTo 1) {\n val v = theLeast.removeAt(theLeast.size - 1)\n theLeast.add(pos, v)\n pos++\n }\n\n print(theLeast.fold(\"\", { acc, cur -> acc + cur.toString()}))\n print(\" \")\n println(theGreatest.fold(\"\", { acc, cur -> acc + cur.toString()}))\n\n\n}\n\nfun findSumToN_iterative(m: Int, s: Int) : List {\n var currentList = mutableListOf()\n while (currentList.sum() < s) {\n val totalLeft = s - currentList.sum()\n currentList.add(\n when{\n totalLeft > 9 -> 9\n else -> totalLeft\n }\n )\n }\n if (currentList.size > m) return emptyList()\n\n while (currentList.size < m) {\n currentList.add(0)\n }\n return currentList\n}\n\nfun findSumToN_recursive(m: Int, s: Int, numbersSoFar: List) : Unit {\n val currentTotal = numbersSoFar.sum()\n val nNumbers = numbersSoFar.size\n if (currentTotal > s || nNumbers > m)\n return\n else if (currentTotal == s) {\n var newNumbersSoFar = numbersSoFar.toMutableList()\n while (newNumbersSoFar.size < m) {\n newNumbersSoFar.add(0)\n }\n println(newNumbersSoFar)\n } else {\n val lastNum = if (numbersSoFar.isEmpty()) 9 else numbersSoFar.last()\n for (i in lastNum downTo 1) {\n val newNumbersSoFar = numbersSoFar.toMutableList()\n newNumbersSoFar.add(i)\n findSumToN_recursive(s, m, newNumbersSoFar)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "5d68463cba58c190d8eabd0ebd3b9451", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "ea8c3b5b44e14d86022f44fb25f90817", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9375, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n val (m, s) = readLine()!!.split(' ').map(String::toInt)\n if (s == 0 || s > m * 9) {\n println(\"-1 -1\")\n return\n }\n var sum = s\n val maxX = List(m) {\n val x = min(sum, 9)\n sum -= x\n x\n }\n sum = s\n val minX = List(m) {index ->\n val x = if (index == m - 1) {\n sum\n } else {\n min(sum - 1, 9)\n }\n sum -= x\n x\n }.reversed()\n println(\"${minX.joinToString(\"\")} ${maxX.joinToString(\"\")}\")\n}", "lang": "Kotlin", "bug_code_uid": "f1b6a4fd670f4bb6e0a83c5652fecb74", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "c9ae8de671ab33a6e6dd938e7d84e472", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.2642857142857143, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n val (m, s) = readLine()!!.split(' ').map { it.toInt() }\n\n if ( s == 0 || 18 * m < s) {\n println(\"-1 -1\")\n }else{\n (1..s * 10).map { \"$it\" }\n .first { it.sumBy { it - '0' } == s }\n .let {\n val z = \"0\".repeat(m - it.length)\n print(\"${it.first()}$z${it.removeRange(0,1)} \")\n print(\"${it.reversed()}$z\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "5bd2c5a3c3088aa37f84e9fb88b98996", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "c1238d6db0f13a5df27e1e20cb28e427", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9776586237712243, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.pow\n\nfun main(){\n var scanner = Scanner(System.`in`)\n var m = scanner.nextInt()\n var s = scanner.nextInt()\n var min:String = \"\"\n var max:String = \"\"\n var lastNumberMax:Char\n if(s==0) println(\"-1 -1\")\n else {\n while(s!=0){\n for(i in 9 downTo 1){\n if(i<=s){\n max += i\n s-=i\n break;\n }\n }\n }\n lastNumberMax = max[max.lastIndex]\n while(max.length != m) max+='0'\n if(max[max.length-1] != '0') min = max.reversed()\n else{\n min = max.reversed()\n min = \"1${min.substring(1,min.length)}\"\n var minChar = min.toCharArray()\n for(i in 1 until minChar.size){\n if(minChar[i] == lastNumberMax){\n minChar[i] = (lastNumberMax.toInt() -1).toChar()\n break\n }\n }\n min = String(minChar)\n }\n println(\"$min $max\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "0f376a7dfc4ec7038d7636600960debf", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "d955ffc5c063c20f204ce2aba4177447", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9994288977727013, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nprivate val scan = Scanner(System.`in`)\n\nfun main(args: Array) {\n val m = scan.next().sort()\n val n = scan.next()\n val ni = n.toLong()\n\n if (n.length > m.length) {\n println(m.toList().sortedDescending().joinToString(\"\"))\n return\n }\n\n var ans = m.toList()\n for (i in 0 until m.length) {\n for (j in i + 1 until m.length) {\n val temp = ans.toMutableList()\n Collections.swap(temp, i, j)\n// println(\"temp=$temp\")\n val xList = temp.subList(0, i + 1) + temp.subList(i + 1, temp.size).sorted()\n// println(\"xList=$xList\")\n val x = xList.joinToString(\"\").toLong()\n if (x < ni) {\n ans = xList\n }\n }\n }\n\n println(ans.joinToString(\"\"))\n}\n\nfun String.sort() =\n toList().sorted().joinToString(\"\")\n", "lang": "Kotlin", "bug_code_uid": "f173bbd1ad1b6d27c42088780d465e71", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "apr_id": "695909afed243293095a367b6b0e9457", "difficulty": 1700, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9914236706689536, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nprivate val scan = Scanner(System.`in`)\n\nfun main(args: Array) {\n val m = scan.next().sort()\n val n = scan.next()\n val ni = n.toInt()\n\n if (n.length > m.length) {\n println(m.toList().sortedDescending().joinToString(\"\"))\n return\n }\n\n var ans = m.toList()\n for (i in 0 until m.length) {\n for (j in i + 1 until m.length) {\n val temp = ans.toMutableList()\n Collections.swap(temp, i, j)\n// println(\"temp=$temp\")\n val xList = temp.subList(0, i + 1) + temp.subList(i + 1, temp.size).sorted()\n// println(\"xList=$xList\")\n val x = xList.joinToString(\"\").toInt()\n if (x < ni) {\n ans = xList\n }\n }\n }\n\n println(ans.joinToString(\"\"))\n}\n\nfun String.sort() =\n toList().sorted().joinToString(\"\")\n", "lang": "Kotlin", "bug_code_uid": "5e7ff1806e5b28960e56f4257e732837", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "apr_id": "695909afed243293095a367b6b0e9457", "difficulty": 1700, "tags": ["dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9879107781372382, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nclass C {\n fun solve(input : InputStream, output : OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n val first = reader.next()\n val second = reader.next()\n\n writer.println(solve(first, second))\n\n writer.close()\n }\n\n fun solve(first : String, second : String) : String {\n val digits = Array(10, {_ -> 0})\n for (char in first) {\n digits[char - '0']++\n }\n return trySolve(digits, second, second.length - first.length, first.length == second.length)!!\n }\n\n fun trySolve(digits : Array, number : String, pos : Int, eq : Boolean) : String? {\n if (pos == number.length) {\n return \"\"\n }\n\n if (!eq) {\n for (x in (0..9).reversed()) {\n if (digits[x] > 0) {\n digits[x]--\n val result = trySolve(digits, number, pos + 1, eq)\n digits[x]++\n if (result == null) {\n return result\n }\n return x.toString() + result\n }\n }\n }\n\n // try with the same number\n val current = number[pos] - '0'\n if (digits[current] > 0) {\n digits[current]--\n val result = trySolve(digits, number, pos + 1, eq)\n digits[current]++\n if (result != null) {\n return current.toString() + result\n }\n }\n\n // or try with lower\n for(x in (0 until current).reversed()) {\n if (digits[x] > 0) {\n digits[x]--\n val result = trySolve(digits, number, pos + 1, false)\n digits[x]++\n if (result == null) {\n return result\n }\n return x.toString() + result\n }\n }\n\n // should never happen\n throw IllegalStateException()\n }\n\n private class InputReader(stream: InputStream) {\n var reader: BufferedReader\n var tokenizer: StringTokenizer? = null\n\n init {\n reader = BufferedReader(InputStreamReader(stream), 32768)\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n }\n}\n\nfun main(args : Array) {\n C().solve(System.`in`, System.out)\n}", "lang": "Kotlin", "bug_code_uid": "1bd14caf2ce4d2b93a76afe56070d952", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "apr_id": "578b154e3372564abe15656a59c5631f", "difficulty": 1700, "tags": ["dp", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9958115183246073, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\ndata class ArrayViewer(val pos: Int, val array: IntArray) {\n\n fun empty() = pos >= array.size\n fun head() = array[pos]\n fun tail() = ArrayViewer(pos + 1, array)\n\n}\n\nfun IntArray.viewer() = ArrayViewer(0, this)\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n\n val a = nextLine()!!.map { it.toInt() - '0'.toInt() }.toIntArray()\n val b = nextLine()!!.map { it.toInt() - '0'.toInt() }.toIntArray()\n\n val counts = countDigits(a)\n\n if (a.size < b.size) {\n print(maxPossible(counts).fold(\"\") { str, digit ->\n str + digit.toString() })\n return\n } else {\n print(makeLess(counts, b.viewer())!!.fold(\"\") {\n str, digit ->\n str + digit.toString() })\n }\n\n}\n\nfun makeLess(counter: IntArray, value: ArrayViewer): List? {\n if (value.empty()) {\n return List(0){0}\n }\n\n val digit = value.head()\n val rest = value.tail()\n\n if (counter[digit] != 0) {\n var counterWithout = counter\n counterWithout[digit] -= 1\n\n val other = makeLess(counterWithout, rest)\n if (other != null) {\n return List(1){digit} + other\n }\n\n counterWithout[digit] += 1\n }\n\n for (nextDigit in digit downTo 0) {\n if (counter[nextDigit] != 0) {\n var counterWithout = counter\n counterWithout[nextDigit] -= 1\n\n val other = maxPossible(counterWithout)\n return List(1){nextDigit} + other\n }\n }\n\n return null\n\n}\n\nfun maxPossible(counter: IntArray): List {\n var c = List(0) {0}\n\n for (digit in 9 downTo 0) {\n for (i in 1..counter[digit]) {\n c += digit\n }\n }\n\n return c\n}\n\nfun countDigits(array: IntArray): IntArray {\n var counter = IntArray(10){0}\n\n for (digit in array) {\n counter[digit] += 1\n }\n\n return counter\n}\n", "lang": "Kotlin", "bug_code_uid": "9270b370faf435927ed1b364e65eaecd", "src_uid": "bc31a1d4a02a0011eb9f5c754501cd44", "apr_id": "a0e934553b8451d23d6d07af9af29c6d", "difficulty": 1700, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9408450704225352, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport java.io.*\n\nfun main() {\n\tval (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n\tval answer = (3 * n) + min(k - 1, n - k)\n\tprintln(answer)\n}", "lang": "Kotlin", "bug_code_uid": "0e4d473a211dacf5abed8b7813a97291", "src_uid": "24b02afe8d86314ec5f75a00c72af514", "apr_id": "d879b58329ef084a612c1b66f3cd9ea0", "difficulty": 1000, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5543859649122806, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "import kotlin.math.min\n\nfun readInts(): List = readLine()!!.split(\" \").map{ it.toInt() }\n\nfun main(){\n val (_, _) = readInts()\n var minim = 0\n val piecesPuzzleList = readInts().sorted()\n for (index in 1..piecesPuzzleList.size){\n if(minim > min(piecesPuzzleList[index], piecesPuzzleList[index - 1]))\n {\n minim = min(piecesPuzzleList[index], piecesPuzzleList[index - 1])\n }\n }\n println(minim)\n}", "lang": "Kotlin", "bug_code_uid": "f78420f8ddec812a8d22b1acf4c1a548", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "06abdf51fd1ffb807094734263ab1771", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.40710059171597635, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main(){\n var (n, m) = readLine()!!.split(' ').map { it.toInt() }\n var n1 = readLine()!!.split(' ').map { it.toInt() }.toMutableList()\n var t = m - n\n for(i in 0 until t){\n n1.remove(maxt(n1))\n }\n println(maxt(n1) - mint(n1))\n}\nfun maxt(x: MutableList): Int{\n var r = x[0]\n for(i in x){\n if(i > r){\n r = i\n }\n }\n return r\n}\nfun mint(x: MutableList): Int{\n var r = x[0]\n for(i in x){\n if(i < r){\n r = i\n }\n }\n return r\n}", "lang": "Kotlin", "bug_code_uid": "e932632fbd25d50dda98ce651b5fc46d", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "d86cf5953873c2e2afb65166545a4e11", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.2705394190871369, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main(){\n var (n, m) = readLine()!!.split(' ').map { it.toInt() }\n var n1 = readLine()!!.split(' ').map { it.toInt() }.toMutableList()\n var x = n1\n var x1 = n1\n var a = HashMap()\n for(i in x){\n a.put(i, 0)\n }\n for (i in x){\n a.put(i, a.getOrDefault(i, 0) + 1)\n }\n for(i in a){\n if(i.value >= n){\n println(0)\n return\n }\n }\n var t = m - n\n for(i in 0 until t){\n n1.remove(maxt(n1))\n }\n for(i in 0 until t){\n x1.remove(mint(x1))\n }\n println(min(maxt(n1) - mint(n1), maxt(x1) - mint(x1)))\n}\nfun maxt(x: MutableList): Int{\n var r = x[0]\n for(i in x){\n if(i > r){\n r = i\n }\n }\n return r\n}\nfun mint(x: MutableList): Int{\n var r = x[0]\n for(i in x){\n if(i < r){\n r = i\n }\n }\n return r\n}", "lang": "Kotlin", "bug_code_uid": "0c09034752c3ff1696607723d40fe50e", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "d86cf5953873c2e2afb65166545a4e11", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7047015319598521, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val S = ns()\n val N = S.length\n val zero = 9\n val MAX = 19\n val INF = 1e9.toInt()\n val dp = Array(N + 1){IntArray(MAX){INF} }\n dp[0][zero] = 0\n for (i in 0 until N) {\n val target = S[N - 1 - i] - '0'\n for (next in 0 until MAX) {\n for (pre in 0 until MAX) {\n if (dp[i][pre] == INF) continue\n val roll = abs((next - zero) + target) // \u3053\u306e\u6841\u307e\u3067\n val rollback = abs(next - pre - roll) // \u524d\u306e\u6841\u3092\u623b\u3059\n val cost = roll * (i + 1) + rollback * i\n dp[i + 1][next] = min(dp[i + 1][next], dp[i][pre] + cost)\n }\n }\n }\n debugDim(dp)\n out.println(dp[N][zero])\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl()\n }\n return res\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "6728fc8641075d277f995dab7e9f8e18", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "apr_id": "83f257766e08a0ca00d1dc3ece085c6e", "difficulty": 1800, "tags": ["divide and conquer", "dfs and similar", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9819819819819819, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val N = nl()\n\n fun digits(x: Long): Int {\n var a = abs(x)\n var k = 0\n while(a > 0) {\n a /= 10\n k++\n }\n return k\n }\n\n fun dfs(x: Long, isAlt: Boolean = false): Int {\n debug{\"x:$x\"}\n if (x == 0L) return 0\n\n var a = x\n var k = 1\n var pow10 = 1L\n var sum = 1L\n while(a / 10 != 0L) {\n a /= 10\n k++\n pow10 *= 10\n sum += pow10\n }\n\n var res = 1e9.toInt()\n for (i in 1 .. 9) {\n for (sig in arrayOf(-1, 1)) {\n val next = x + sum * i * sig\n if (digits(next) < k) res = min(res, dfs(next) + k * i)\n }\n }\n\n if (!isAlt) {\n for (sig in arrayOf(-1, 1)) {\n val sum2 = sum + pow10 * 10\n val alt = x + sum2 * sig\n debug{\"x:$x alt$alt\"}\n if (digits(alt) <= k) res = min(res, dfs(alt, true) + k + 1)\n }\n }\n\n\n return res\n }\n out.println(dfs(N))\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl()\n }\n return res\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "ae9af8cebe90ffcaae672e82bdc13e4d", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "apr_id": "83f257766e08a0ca00d1dc3ece085c6e", "difficulty": 1800, "tags": ["divide and conquer", "dfs and similar", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.18046709129511676, "equal_cnt": 15, "replace_cnt": 10, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 15, "bug_source_code": "import kotlin.math.min\n\nval ones = ArrayList()\nval cost = HashMap()\n\nfun lowerBound(n: Long): Int{\n var(lo, hi) = 0 to ones.size - 1\n while(lo < hi){\n val mid = (lo + hi) / 2 + (lo + hi) % 2\n if(ones[mid] < n)\n lo = mid\n else\n hi = mid - 1\n }\n return lo\n}\n\nfun rec(n: Long): Long{\n when {\n n == 0L -> return 0L\n n <= 6 -> return n\n n <= 11 -> return 13 - n\n }\n val bs = lowerBound(n)\n return min(rec(n - ones[bs]) + cost[ones[bs]]!!, rec(ones[bs + 1] - n) + cost[ones[bs + 1]]!!)\n}\n\nfun main() {\n val n = readLine()!!.toLong()\n for(i in 1..15)\n for(j in '1'..'9'){\n ones.add(j.toString().repeat(i).toLong())\n cost[ones.last()] = (j.toLong() - '0'.toLong()) * i\n }\n ones.add(1111111111111111L)\n cost[1111111111111111L] = 16L\n println(rec(n))\n}", "lang": "Kotlin", "bug_code_uid": "dbb54419fa658a7aab90b2c1f01c42cb", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "apr_id": "1b2f32b1dfc45ded9dd4cf50db6d2a9c", "difficulty": 1800, "tags": ["divide and conquer", "dfs and similar", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7483660130718954, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.min\n\nval ones = ArrayList()\n\nfun lowerBound(n: Long): Int{\n var(lo, hi) = 0 to ones.size - 1\n while(lo < hi){\n val mid = (lo + hi) / 2 + (lo + hi) % 2\n if(ones[mid] < n)\n lo = mid\n else\n hi = mid - 1\n }\n return lo\n}\n\nfun rec(n: Long): Long{\n when {\n n == 0L -> return 0L\n n <= 6L -> return n\n n <= 11L -> return 13 - n\n }\n val bs = lowerBound(n)\n if(ones[bs + 1] == n)\n return (bs + 2).toLong()\n var ans = Long.MAX_VALUE\n if(n - ones[bs] < n)\n ans = min(ans, rec(n - ones[bs]) + bs + 1)\n if(ones[bs + 1] - n < n)\n ans = min(ans, rec(ones[bs + 1] - n) + bs + 2)\n return ans\n}\n\nfun main() {\n val n = readLine()!!.toLong()\n for(i in 1..16)\n ones.add(\"1\".repeat(i).toLong())\n println(rec(n))\n}", "lang": "Kotlin", "bug_code_uid": "f539b77f2cc2b6a4056a6df176a6aea0", "src_uid": "1b17a7b3b41077843ee1d6e0607720d6", "apr_id": "1b2f32b1dfc45ded9dd4cf50db6d2a9c", "difficulty": 1800, "tags": ["divide and conquer", "dfs and similar", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8451327433628318, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "\nfun main() {\n\n var n = readLine()!!.toInt()\n var arr = Array(n){0}\n\n arr[1] = 4\n\n\n for(i in 2 .. n - 1){\n arr[i] = arr[i - 1] + 4 * i\n }\n\n println(\"${arr[n - 1] + 1}\")\n}\n\n", "lang": "Kotlin", "bug_code_uid": "ab67cf99e8e983715a8b5a8daf63f97f", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "2e0e67fc8bf1422b4a3560183994338b", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9537366548042705, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {var reader= Scanner(System.`in`)\n var n = reader.nextInt()\n print( n*2+(n-1)*2)\n}\n", "lang": "Kotlin", "bug_code_uid": "70c6a52e33500da6d04e134203f04589", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "c57d0879f89b023ded2b720054aca28c", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9895833333333334, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args : Array)\n{\n val n : Int = readLine()!!.toInt()\n print(2*n*(n-2)+1)\n}", "lang": "Kotlin", "bug_code_uid": "230c306343ba6078c87b06a671560823", "src_uid": "758d342c1badde6d0b4db81285be780c", "apr_id": "666e1eafa7e35c1671415caabfb0e322", "difficulty": 800, "tags": ["dp", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9804511278195489, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n println(readLn().zipWithNext().count { (a, b) -> a == b })\n}\n", "lang": "Kotlin", "bug_code_uid": "5e1e54294b5be7383665cbf2ea328191", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "200d4096bcaabde4ae78e421a3ce067e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9964788732394366, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val _ = readInt()\n val str = readLine()!!\n var counter = 0\n var prev = str[0]\n str.substring(1).forEach { c ->\n if (prev == c) counter++\n prev = c\n }\n println(counter)\n}\n\nprivate fun readInt() = readLine()!!.toInt()\n", "lang": "Kotlin", "bug_code_uid": "369bbcaa24f67304fc3ca9b32a391cf6", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "70e19b6580b90ae18a2b990eb11a7391", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5531914893617021, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n readLine()\n val numSmall = readInts().count { it == 100 }\n print(if (numSmall and 1 == 1) \"NO\" else \"YES\")\n\n}", "lang": "Kotlin", "bug_code_uid": "987d512e74eb94e7e88df88fd7a4124e", "src_uid": "9679acef82356004e47b1118f8fc836a", "apr_id": "9fee6b38abe5a0c140c26548a232a23e", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6867052023121387, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 7, "fix_ops_cnt": 16, "bug_source_code": "package com.example.sliderexperiment\n\nimport kotlin.math.pow\n\nfun main(args: Array) {\n\tval tests: Int = readLine()!!.toInt()\n\tif (tests in 1..10000) {\n\t\tval candies: Int = readLine()!!.toInt()\n\t\tvar noOfPossibilities: Int = 0\n\t\tif (candies >= 3 && candies <= (2 * (10.0f).pow(9))) {\n\t\t\tnoOfPossibilities = candies / 2\n\t\t\tprintln(noOfPossibilities)\n\t\t} else {\n\t\t\tprintln(noOfPossibilities)\n\t\t}\n\t}\n}", "lang": "Kotlin", "bug_code_uid": "fe8970254e18734b5c737728b7bdbba8", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "7501e19e9f838fa47724f3af333c3be1", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5667752442996743, "equal_cnt": 17, "replace_cnt": 9, "delete_cnt": 4, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "import kotlin.math.pow\n\nfun main(args: Array) {\n\tval tests: Int = readLine()!!.toInt()\n\tif (tests in 1..10000) {\n\t\tval candies: Int = readLine()!!.toInt()\n\t\tvar noOFPossibilities: Int = 0\n\t\tif (candies >= 3 && candies <= (2 * (10.0f).pow(9))) {\n\t\t\tvar a: Int = candies - 1\n\t\t\tvar b: Int = 1\n\t\t\twhile (a + b == candies) {\n\t\t\t\tnoOFPossibilities += 1\n\t\t\t\ta -= 1\n\t\t\t\tb +=1\n\t\t\t}\n\t\t\tprintln(noOFPossibilities)\n\t\t} else {\n\t\t\tprintln(noOFPossibilities)\n\t\t}\n\t}\n}", "lang": "Kotlin", "bug_code_uid": "b3b90c15c5be2a6ebc5fdb03b7499364", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "7501e19e9f838fa47724f3af333c3be1", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9989224137931034, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\n\nval reader = BufferedReader(InputStreamReader(System.`in`))\nval out = PrintWriter(System.out)\n\nfun readLn() = reader.readLine()\nfun readInt() = readLn().toInt()\nfun readLong() = readLn().toLong()\nfun readDouble() = readLn().toDouble()\n\nfun readStrings() = readLn().split(\" \")\nfun readInts() = readStrings().map { it.toInt() }\nfun readLongs() = readStrings().map { it.toLong() }\nfun readDoubles() = readStrings().map { it.toDouble() }\n\nfun readIntArrays(vararg arrays: IntArray) {\n for (i in 0 until arrays[0].size) {\n for (j in arrays.indices) {\n arrays[j][i] = readInt()\n }\n }\n}\n\nfun main() {\n solve()\n reader.close()\n out.close()\n}\n\nmain()\n\n\nfun solve() {\n for (ii in 0 until readInt()){\n var n = readInt()\n var ans = if (n < 3) 0 else (n-1)/2\n out.println(ans)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "ab4e2ef6bcfd65ee2785e390c5f456bb", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "3d08fd82e4972be2347c524c93862584", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9754977029096478, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.system.exitProcess\nimport java.util.Scanner\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n /*val n = readInt() // val does not change\n var i=0\n while(i 0) {\n val num: Int = scanner.nextInt()\n if (num % 2 == 0) {\n println(\"${(num / 2) - 1}\")\n } else {\n println(\"${(num - 1) / 2}\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "f83a594de54b8d1b306dc2a569c6fc7f", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "5ff83bf0cf65c0155cb1fc14d7fb242f", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8926829268292683, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\n\nfun main(){\n val sc = Scanner(System.`in`)\n\n var t = sc.readInt()\n\n while(t > 0){\n val a:Int = sc.nextInt()\n\n print((a+1)/2)\n\n t = t-1\n }\n \n}", "lang": "Kotlin", "bug_code_uid": "72a3047b3e8daf906583b5eab086e200", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "c7e093153db6a4b4e4adb07040557371", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5836575875486382, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val t = Integer.valueOf(readLine())\n\n for (i in 0 .. (t-1)){\n val n = Integer.valueOf(readLine())\n var a = n\n var b = 0\n var c = 0\n while (a>b){\n c++\n a--\n b++\n }\n println(c-1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "59887f538a6e043d5c74e580be441e5e", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "46543407fba8a65630865c739d295f95", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9759825327510917, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package practice.five\n\nimport kotlin.math.roundToInt\n\nfun main() {\n val numTests = readLine()!!.toInt()\n repeat(numTests) {\n val numCandies = readLine()!!.toInt()\n println(distributeCandy(numCandies))\n }\n // listOf(7, 1, 2, 3, 2000000000, 763243547).forEach {\n // println(distributeCandy(it))\n // }\n}\n\nfun distributeCandy(count: Int): Int {\n val aliceMin = ((count.toDouble() / 2) + 0.5).roundToInt()\n return count - aliceMin\n}", "lang": "Kotlin", "bug_code_uid": "0a257c3dc25524b1dbcfc3a539db114a", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "0657d6109faf08493988ebe8cb14e8c4", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6443594646271511, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "/**\n * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools\n */\n\nfun main() {\n val num = readLine()!!.toInt()\n val results = IntArray(num)\n for (i in 0 until num) {\n val candies = readLine()!!.toInt()\n results[i] = calculatePossibilities(candies)\n }\n println(results.joinToString(\"\\n\"))\n}\n\nfun calculatePossibilities(candies: Int): Int {\n var numberOfPossibilities = 0\n var a = candies - 1\n var b = 1\n while (a > b) {\n numberOfPossibilities++\n a--\n b++\n }\n return numberOfPossibilities\n}\n", "lang": "Kotlin", "bug_code_uid": "efa89f66efa5cc7c05315c8ed90623f5", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "706bc5ca439cfa8f37a64fdd672843ba", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9878183831672204, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n \nfun main(args: Array) {\n // Your code here!\n val reader = Scanner(System.`in`)\n var n:Int = reader.nextInt()\n \n while (n-- != 0) {\n var x:Int = reader.nextInt()\n if ((x.toDouble() / 2) != (x / 2)) {\n println(x / 2)\n } else {\n if (x / 2 == 0) {\n println(0)\n } else {\n println(x/2 - 1)\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "8535adc16fc2de542005b48a6ea06bce", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "d4f12cfc5309022481b514464194c4f7", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6287015945330297, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val t = readLine()!!.toInt()\n \n repeat(t) {\n val n = readLine()!!.toInt()\n \n var s = 0\n for (i in 1..n-1) {\n if (i < n - i)\n s++\n else\n break\n }\n \n println(s)\n }\n}", "lang": "Kotlin", "bug_code_uid": "091783444508a8700c4a76dcbef7492a", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "53af6c8ae3b0ff6088d0f210fd8ce53e", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6146341463414634, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n\n var lines = readLine()!!.toInt()\n \n for (line in 1..lines) {\n var result = 0\n var candles = readLine()!!.toInt()\n if (candles > 2) {\n var a = 0\n for (b in 1..candles) {\n a = candles - b\n if (a > b) {\n result++\n } else {\n break\n }\n }\n }\n println(result)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "578528dfd74252f3c55013e11cd07e76", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "475bab21aa64124581454817a9aa3e57", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.47344461305007585, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun contest1432problemB() {\n val cases = readLine()!!.toInt()\n for (i in 0 until cases) {\n val n = readLine()!!.toInt()\n println(ceil(n / 2.0).toInt() - 1)\n }\n}\n\nfun main() {\n contest1432problemB()\n}", "lang": "Kotlin", "bug_code_uid": "440887f644505ee438eeb936ea01021c", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "9f99e60ff1b701e23bde1a23c2c7ce5c", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.99734395750332, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.AssertionError\n\nprivate fun readLn() = readLine()!! \nprivate fun readInt() = readLn().toInt() \nprivate fun readLong() = readLn().toLong() \nprivate fun readDouble() = readLn().toDouble() \nprivate fun readStrings() = readLn().split(\" \") \nprivate fun readInts() = readStrings().map { it.toInt() } \nprivate fun readLongs() = readStrings().map { it.toLong() }\nprivate fun readDoubles() = readStrings().map { it.toDouble() }\n\nprivate fun myAssert(x: Boolean) {\n if (!x) {\n throw AssertionError()\n }\n}\n\nfun main(args: Array) {\n var tt = readInt()\n for (qq in 0 until tt) {\n \n var (n) = readInt()\n var ans = 0\n if(n<=2) ans=0\n else ans=(n-1)/2 \n\n println(ans)\n \n }\n}", "lang": "Kotlin", "bug_code_uid": "14e8524f6e0d43e31e849ed9fe5b4e89", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "c6b0a3bcd8a1c43941d27a33dd0fb63b", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9254658385093167, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package practice.taskB\n\nfun main() {\n\tval t = readInt()\n\tfor (i in 1..t) {\n\t\tval n = readInt()\n\t\tval r = (n - 1) / 2\n\t\tprintln(r)\n\t}\n}\n\nfun readInt() = readLine()!!.toInt()\n", "lang": "Kotlin", "bug_code_uid": "3f044d0176a36a629dc8955c93ed5018", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "66ed580c0dc59acd0a67f4db97ca9ac5", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9824561403508771, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport java.lang.Integer.min\nimport java.lang.Math.max\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main(args: Array)\n{\n val sc = Scanner(System.`in`)\n var t:Int = sc.nextInt()\n while(t>0)\n {\n var n:Int = sc.nextInt()\n println((n-1)/2)\n }\n}", "lang": "Kotlin", "bug_code_uid": "4e124713e15b1d73e6f33be606e81bc6", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "2eca9702fc91af75ec17b550a985754c", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9569707401032702, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val testsNum : Int = readLine()?.toIntOrNull() ?: -1\n for(testId in 1..testsNum){\n val testInput = readLine() ?: \"\"\n val sweetsNum = testInput.toLong()\n val result = ceil(sweetsNum.toDouble()/2).toInt() -1\n println(result)\n }\n}", "lang": "Kotlin", "bug_code_uid": "8ddaaefca211902eea524d73ba921153", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "1d88a40ae639e752b0b7e2c036d8198b", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4171779141104294, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n repeat(readLine()!!.toInt()) {\n\n val c = readLine()!!.toInt()\n var n = 0\n var i = c - 1\n var j = 1\n\n while (i > j) {\n n++\n i--\n j++\n }\n\n println(n)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "fa78d276c4b2986ff2efdf461ec2d6fc", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "432f63b8cba8ae0a127940a3e8231d3c", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7377777777777778, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n repeat(n) {\n val k = readLine()!!.toInt()\n var a = k - 1\n var b = 1\n var sum = 0\n while(a > b){\n a--\n b++\n sum++\n }\n println(sum)\n }\n}", "lang": "Kotlin", "bug_code_uid": "17770db2331e03bb27cc61671c5248f7", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "520b210adc29d9e6c9306a4170de1380", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.967741935483871, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package kotlinBasics\n\nfun main() {\n val n = readLine()!!.toInt()\n val a = IntArray(n)\n for (i in 0..a.lastIndex) {\n a[i] = readLine()!!.toInt()\n\n }\n for (i in 0..a.lastIndex) {\n var o = a[i] /2\n if (a[i] % 2 == 0) {\n println(o - 1)\n } else {\n println(o)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "1a9d010fa1f1070b7b453b1c26922620", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "762ae9897f3d82b025c6fdd4acad090d", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9873949579831933, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array)\n{\n val sc = Scanner(System.in)\n var t: Int = sc.nextInt()\n var n: Int\n var x: Int\n \n \n while(t-- > 0)\n {\n n=sc.nextInt()\n x=(n-1)/2\n println(\"$x\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "e2b4403a884452cfb2ce6e396cb4ab5f", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "a8ddcb0b6f2c3bd0f9b50df19f8ee2b9", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.015968063872255488, "equal_cnt": 5, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "package com.mmk\n\nfun main() {\n val firstLine= readInt()\n for(i in 0 until firstLine){\n val n= readInt()\n var a=n\n var b=0\n var count=0\n while(a>b){\n a--\n b++\n if (a>0 && b>0 && a>b)\n count++\n }\n println(count)\n }\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\n\n", "lang": "Kotlin", "bug_code_uid": "210d6b43bed9c5d9135a7b37c64d5e5e", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "3ee4982d14b221aa9b3f9c6697475dd9", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7967479674796748, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val firstLine=readInt()\n for(i in 0 until firstLine){\n val n= readInt()\n var a=n\n var b=0\n var count=0\n while(a>b){\n a--\n b++\n if (a>0 && b>0 && a>b)\n count++\n }\n println(count)\n }\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\n\n", "lang": "Kotlin", "bug_code_uid": "d373ef55e7012e393e545a44313d5ef9", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "3ee4982d14b221aa9b3f9c6697475dd9", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9685807150595883, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun one() {\n var n = readInt()\n \n var ans = if (n%2==0) { (n-1 - n/2) } else{ (n- n/2) }\n\n println(max(0,ans)) \n}\n\nfun main() {\n var t = readInt()\n \n for (i in 1..t) one()\n \n}", "lang": "Kotlin", "bug_code_uid": "656ab32f80003d396214ab80db073848", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "52ddb7351650a8024f48336e55bb35bc", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9473684210526315, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\n\nfunc main()\n{\n val sc = Scanner(System.`in`)\n val t = sc.nextInt()\n for(x in 0 until t)\n {\n val a = sc.nextInt()\n println((a-1)/2)\n }\n}", "lang": "Kotlin", "bug_code_uid": "9e25401748321bab3452f66ec018b895", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "ffb7709429a5c2645c29c508e57501cf", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9823788546255506, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nfun main(args: Array) {\n \n val read = Scanner(System.`in`)\nvar t=read.nextInt()\nwhile(t!=0)\n {\n var n = read.nextInt()\n \n if(n%2==0)\n println((n/2)-1)\n else\n println(n/2)\n}\n}", "lang": "Kotlin", "bug_code_uid": "26176dc5e5aad7cbef394cab6f446ab7", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "18e79c589d2375fed8cd715beb05c1f1", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9050160085378869, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun readInts() = readLine()!!.split(' ').map { it.toInt() }\n\nfun a6() {\n val list: List = readInts().sortedDescending()\n\n if (list[1] + list[2] > list[0] || list[2] + list[3] > list[0] || list[1] + list[3] > list[0] || list[2] + list[3] > list[1])\n print(\"TRIANGLE\")\n else if (list[1] + list[2] + list[3] > list[0])\n print(\"SEGMENT\")\n else\n print(\"IMPOSSIBLE\")\n}\n\nfun main() {\n a6()\n}", "lang": "Kotlin", "bug_code_uid": "7634c5108b5090c0ee21ab6ee55a1edf", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "apr_id": "3a586b7f1137a7ad43813a54d3c7f472", "difficulty": 900, "tags": ["geometry", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9874434957307886, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "package codeforces\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val In = BufferedReader(InputStreamReader(System.`in`))\n val sticks = In.readLine()!!.split(\" \").map {it.toInt()}\n sticks.sorted()\n if(sticks[0] + sticks[1] > sticks[2] && sticks[1] + sticks[2] > sticks[0] && sticks[0] + sticks[2] > sticks[1] ||\n sticks[1] + sticks[2] > sticks[3] && sticks[2] + sticks[3] > sticks[1] && sticks[1] + sticks[3] > sticks[2] ||\n sticks[0] + sticks[2] > sticks[3] && sticks[2] + sticks[3] > sticks[0] && sticks[0] + sticks[3] > sticks[2] ||\n sticks[1] + sticks[0] > sticks[3] && sticks[0] + sticks[3] > sticks[1] && sticks[1] + sticks[3] > sticks[0]) {\n println(\"TRIANGLE\")\n } else if(sticks[0] + sticks[1] == sticks[2] || sticks[0] + sticks[1] == sticks[3] ||\n sticks[1] + sticks[2] == sticks[3] || sticks[0] + sticks[2] == sticks[3]) {\n println(\"SEGMENT\")\n } else\n println(\"IMPOSSIBLE\")\n\n}", "lang": "Kotlin", "bug_code_uid": "04ba4266793eccf72ed89ff8a951ce0e", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "apr_id": "fb315250faaeb1dc5f0ba9028f129b37", "difficulty": 900, "tags": ["geometry", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9884596086302058, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "//package codeforces\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val In = BufferedReader(InputStreamReader(System.`in`))\n val sticks = In.readLine()!!.split(\" \").map {it.toInt()}\n sticks.sorted()\n if(sticks[0] + sticks[1] > sticks[2] && sticks[1] + sticks[2] > sticks[0] && sticks[0] + sticks[2] > sticks[1] ||\n sticks[1] + sticks[2] > sticks[3] && sticks[2] + sticks[3] > sticks[1] && sticks[1] + sticks[3] > sticks[2] ||\n sticks[0] + sticks[2] > sticks[3] && sticks[2] + sticks[3] > sticks[0] && sticks[0] + sticks[3] > sticks[2] ||\n sticks[1] + sticks[0] > sticks[3] && sticks[0] + sticks[3] > sticks[1] && sticks[1] + sticks[3] > sticks[0]) {\n println(\"TRIANGLE\")\n } else if(sticks[0] + sticks[1] == sticks[2] || sticks[0] + sticks[1] == sticks[3] ||\n sticks[1] + sticks[2] == sticks[3] || sticks[0] + sticks[2] == sticks[3]) {\n println(\"SEGMENT\")\n } else\n println(\"IMPOSSIBLE\")\n\n}", "lang": "Kotlin", "bug_code_uid": "241d631972c5509c06a0d8d827a2db20", "src_uid": "8f5df9a41e6e100aa65b9fc1d26e447a", "apr_id": "fb315250faaeb1dc5f0ba9028f129b37", "difficulty": 900, "tags": ["geometry", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9567430025445293, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n}\n\nval MAX_N = (1e6 + 10).toInt()\nval INF = (1e9 + 7).toInt()\nval MOD = (1e9 + 7).toInt()\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n val n = reader.nextInt()\n val s = reader.next()\n\n var i = 0\n var ans = 0\n while (i + 1 < n) {\n if (s[i] == 'U' && s[i + 1] == 'R') {\n ans++\n i++\n } else if (s[i] == 'R' && s[i + 1] == 'U') {\n ans++\n }\n\n i++\n }\n ans = n - ans\n writer.println(ans)\n}\n\nclass InputReader(stream: InputStream) {\n val reader: BufferedReader\n var tokenizer: StringTokenizer? = null\n\n init {\n reader = BufferedReader(InputStreamReader(stream), 32768)\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n}", "lang": "Kotlin", "bug_code_uid": "7ca49d5d80f6b20e3ede0b5fe81509be", "src_uid": "986ae418ce82435badadb0bd5588f45b", "apr_id": "7ccd3c21ab054c137893ab4fd72c350d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995242626070409, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.abs\n\nprivate typealias Point = Pair\n\nprivate class B {\n var st = StringTokenizer(\"\")\n val reader = BufferedReader(InputStreamReader(System.`in`))\n\n fun next(): String {\n while (!st.hasMoreTokens()) {\n st = StringTokenizer(reader.readLine())\n }\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextDouble() = next().toDouble()\n fun nextLongPair() = nextLong() to nextLong()\n\n\n class Walker(var cur: Point, var t: Long) {\n fun dist(p1: Point, p2: Point): Long = abs(p1.first - p2.first) + abs(p1.second - p2.second)\n\n var res = 0\n fun goNext(p: Point) {\n if (t >= 0) {\n t -= dist(cur, p)\n cur = p\n }\n if (t >= 0) res++\n }\n\n fun walk(points: List) = points.forEach { goNext(it) }\n }\n\n fun tryIndex(start: Point, points: List, t: Long, i: Int): Int {\n val left = points.slice(0 until i).reversed()\n val right = points.slice(i until points.size)\n var max = 0\n for (i in 0..right.size) {\n for (j in 0..left.size) {\n val w1 = Walker(start, t)\n w1.walk(right.take(i) + left.take(j))\n max = maxOf(w1.res, max)\n val w2 = Walker(start, t)\n w2.walk(left.take(j) + right.take(i))\n max = maxOf(w2.res, max)\n }\n }\n return max\n }\n\n fun run() {\n val seed = nextLongPair()\n val (ax, ay) = nextLongPair()\n val (bx, by) = nextLongPair()\n val points = generateSequence(seed) { (x, y) ->\n val nx = x * ax + bx\n val ny = y * ay + by\n if (nx > 3 * 1e16 || ny > 3 * 1e16) null else nx to ny\n }.toList()\n println(points)\n val start = nextLongPair()\n val t = nextLong()\n println((0..points.size).map { tryIndex(start, points, t, it) }.max())\n }\n}\n\nfun main() {\n B().run()\n}", "lang": "Kotlin", "bug_code_uid": "ff427ee0cf8d67bc0f82d0d72013407b", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "apr_id": "ce7243a5ae11bc83d6410a7d70152973", "difficulty": 1700, "tags": ["geometry", "greedy", "implementation", "brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.42184154175588867, "equal_cnt": 18, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "import java.util.*\nimport kotlin.math.abs\n\nfun main() {\n val sc = Scanner(System.`in`)\n val dots = mutableListOf(Pair(sc.nextLong(), sc.nextLong()))\n val ax = sc.nextLong()\n val ay = sc.nextLong()\n val bx = sc.nextLong()\n val by = sc.nextLong()\n val xs = sc.nextLong()\n val ys = sc.nextLong()\n var t = sc.nextLong()\n var devices = 0\n\n var minDistance = Long.MAX_VALUE\n var distanceDots = Long.MAX_VALUE\n var nextDot: Pair? = null\n var currentDot = Pair(xs, ys)\n while (minDistance >= distanceDots) {\n if (nextDot != null) {\n dots.add(nextDot)\n }\n if (minDistance > distanceDots) {\n minDistance = distanceDots\n }\n nextDot = generateNextDot(ax, ay, bx, by, dots.last())\n distanceDots = distanceDots(currentDot, nextDot)\n }\n\n for (e in dots.asReversed()) {\n val time = distanceDots(currentDot, e)\n t -= time\n if (t < 0) {\n break\n }\n currentDot = e\n devices++\n }\n nextDot = dots.last()\n while (t > 0) {\n nextDot = generateNextDot(ax, ay, bx, by, nextDot!!)\n val time = distanceDots(currentDot, nextDot)\n t -= time\n if (t < 0) {\n break\n }\n currentDot = nextDot\n devices++\n }\n println(devices)\n}\n\nfun distanceDots(pair: Pair, nextDot: Pair) =\n abs(pair.first - nextDot.first) + abs(pair.second - nextDot.second)\n\nfun generateNextDot(ax: Long, ay: Long, bx: Long, by: Long, last: Pair) =\n Pair(ax * last.first + bx, ay * last.second + by)", "lang": "Kotlin", "bug_code_uid": "ca875cb262f7155427f733f59432ba7c", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "apr_id": "4c7b238a64d6be1ae373c2e1357f7525", "difficulty": 1700, "tags": ["geometry", "greedy", "implementation", "brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9208899876390606, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.abs\n\ndata class Point(val x: Long, val y: Long)\n\nfun solve(inn: InputReader, out: PrintWriter) {\n val x0 = inn.readLong()\n val y0 = inn.readLong()\n val ax = inn.readLong()\n val ay = inn.readLong()\n val bx = inn.readLong()\n val by = inn.readLong()\n val xs = inn.readLong()\n val ys = inn.readLong()\n val t = inn.readLong()\n\n val pts = mutableListOf()\n pts.add(Point(x0, y0))\n while (pts.last().x < Long.MAX_VALUE / 4 && pts.last().y < Long.MAX_VALUE / 4) {\n val (x, y) = pts.last()\n pts.add(Point(x * ax + bx, y * ay + by))\n }\n\n var result = 0\n for (i in 0 until pts.size) {\n var x = xs\n var y = ys\n val dist = abs(x - pts[i].x) + abs(y - pts[i].y)\n if (dist > t) {\n continue\n }\n\n x = pts[i].x\n y = pts[i].y\n\n var impact = 1\n var remT = t - dist\n for (j in i - 1 downTo 0) {\n val dist = abs(x - pts[j].x) + abs(y - pts[j].y)\n if (dist > remT) {\n break\n }\n\n remT -= dist\n ++impact\n x = pts[j].x\n y = pts[j].y\n }\n\n for (j in i + 1 until pts.size) {\n val dist = abs(x - pts[j].x) + abs(y - pts[j].y)\n if (dist > remT) {\n break\n }\n\n remT -= dist\n ++impact\n x = pts[j].x\n y = pts[j].y\n }\n\n result = result.coerceAtLeast(impact)\n }\n\n out.println(result)\n}\n\nfun main() {\n val inn = InputReader(System.`in`)\n// val inn = InputReader(FileInputStream(\"1.txt\"))\n val out = PrintWriter(System.out)\n\n solve(inn, out)\n\n inn.close()\n out.close()\n}\n\nclass InputReader(inputStream: InputStream) {\n private val mReader = inputStream.bufferedReader()\n private var mTokenizer = StringTokenizer(\"\")\n\n fun close() = mReader.close()\n\n fun readString(): String {\n while (!mTokenizer.hasMoreTokens()) {\n mTokenizer = StringTokenizer(mReader.readLine())\n }\n\n return mTokenizer.nextToken()\n }\n\n fun readInt() = readString().toInt()\n fun readLong() = readString().toLong()\n}", "lang": "Kotlin", "bug_code_uid": "5551e42e475c645aac480909032b7d2a", "src_uid": "d8a7ae2959b3781a8a4566a2f75a4e28", "apr_id": "d1bdcc297741f86b185138aa6786272a", "difficulty": 1700, "tags": ["geometry", "greedy", "implementation", "brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9989023051591658, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n\n val alp = arrayOf('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z')\n var max = -1\n\n for (c:Char in sc.next()) {\n val n = alp.indexOf(c)\n if (n <= max+1) max = Math.max(max, n)\n else {\n max == -1\n break\n }\n }\n println(if (max==-1) \"NO\" else \"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "b1663f6d7e8447f82500bf772f41a230", "src_uid": "c4551f66a781b174f95865fa254ca972", "apr_id": "3273b6f913eb9cdd12dffd852116b616", "difficulty": 1100, "tags": ["greedy", "strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9190371991247265, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "class MisterBReader(val c: Int,\n val v0: Int,\n val v1: Int,\n val a: Int,\n val l: Int\n) {\n var v = v0\n var readedPages = 0\n \n fun getDaysToRead() : Int {\n var days = 1\n readedPages += v\n while(readedPages < c) {\n readedPages -= l\n v = if (v >= v1) v else v + a\n readedPages += v\n days++\n }\n return days\n }\n}\n\n\nfun main(args: Array) {\n val(c, v0, v1, a, l) = readLine()!!.split(' ').map(String::toInt)\n println(MisterBReader(c, v0, v1, a, l).getDaysToRead())\n}", "lang": "Kotlin", "bug_code_uid": "f302d2a57e7374ee0eb05d57bb063b2c", "src_uid": "b743110117ce13e2090367fd038d3b50", "apr_id": "5223f6817066a774b953560fc33bd0b1", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5605700712589073, "equal_cnt": 21, "replace_cnt": 10, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 20, "bug_source_code": "fun main() {\n val visited = BooleanArray(26)\n for (c in readLine()!!) visited[c - 'a'] = true\n var pos = -1\n while (++pos < 26) if (!visited[pos]) break\n while (++pos < 26) if (visited[pos]) return print(\"NO\")\n print(\"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "22575312d9efcca3ad1d6b9ad1ee6d8b", "src_uid": "c4551f66a781b174f95865fa254ca972", "apr_id": "614dd049dc030036449be2c24ae5c173", "difficulty": 1100, "tags": ["greedy", "strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8928150765606596, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\n/**\n * Created by tux on 31.12.16.\n */\n\nfun main(args: Array) {\n val T = readLine()!!\n\n var nextChar = 'a'\n var ret = true\n for (c in T) {\n if (c == nextChar) {\n nextChar = (nextChar.toInt() + 1).toChar()\n \n } else if (c > nextChar) {\n ret = false\n break\n } else if (nextChar > 'z') {\n ret = false\n break\n }\n }\n\n println(if (ret) \"YES\" else \"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "22622ed6aa4a448876453f6d5f90c152", "src_uid": "c4551f66a781b174f95865fa254ca972", "apr_id": "7a8f1162cb3513f3bc3aa354e84b0904", "difficulty": 1100, "tags": ["greedy", "strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9631901840490797, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val line = readLine()!!.toCharArray().distinct()\n\n (1 until line.size).forEach {\n if (line[it] - line[it - 1] != 1){\n println(\"NO\")\n return\n }\n }\n\n if (line.size > 26){\n println(\"NO\")\n return\n }\n\n println(\"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "ceccc4e875f4d98d726a139fb592064f", "src_uid": "c4551f66a781b174f95865fa254ca972", "apr_id": "b207c04020ed3b389e2d77dd860561f4", "difficulty": 1100, "tags": ["greedy", "strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9695515224238788, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "//xXHEQR_MAENXx\n// You are not prepared!\n@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\n\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C127 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n var (n, m) = readInts(2);\n\n var res: Int;\n if (n < m) {\n res = n * (m / 2) + (m % 2);\n }\n else {\n res = m * (n / 2) + (n % 2);\n }\n\n println(res);\n}\n/* stuff you should look for\n\t* int overflow, array bounds\n\t* special cases (n=1?)\n\t* do smthn instead of nothing and stay organized\n\t* WRITE STUFF DOWN\n*/", "lang": "Kotlin", "bug_code_uid": "2da33ab2f0cd8de8a1685491b9c13a40", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "a3a161d7cc1fd186817a9f5ff59f37b0", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9982174688057041, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\n fun main(){\n var input = Scanner(System.`in`)\n var m = input.nextInt()\n var n = input.nextInt()\n if(m*n > 2){\n System.out.println(\"${(m*n)/2}\")\n }else{\n System.out.println(\"0\")\n }\n }\n\n\n\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "6dac6bd218e5b36e956f1d4dd0607a56", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "c2e457fad588b360c858c523e138a27d", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9867060561299852, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val (m, n) = readLine()!!.split(' ').map{ it.toInt() }\n var larger = max(m, n)\n var smaller = min(m, n)\n \n var numDominoes = 0\n if (smaller % 2 != 0) {\n numDominoes = smaller / 2\n }\n numDominoes += larger * (smaller / 2)\n println(numDominoes)\n}", "lang": "Kotlin", "bug_code_uid": "fae7fcbb90c65588383df9027cf1f749", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "0aead7f5b433e7599b60f0fa38170926", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.46568627450980393, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val(m, n) = readLine()!!.split(' ').map(String::toInt)\n\n if(m==1 && n==1) {\n println(0)\n }\n else {\n val res = ( m / 2 ) * n\n println(res)\n }\n}", "lang": "Kotlin", "bug_code_uid": "c38237ded53f747a113947cf556d2f2d", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "0c6966d161ad8445da241d3bf71d437b", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8461538461538461, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "func main() {\n val n = readLine()!!.split(\" \").map { it.toInt() }\n \n \n print(n[0] * n[1] / 2)\n\n}", "lang": "Kotlin", "bug_code_uid": "d660c49b59087dfe374dce5f63cbf05b", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "26ccddae37727e9e3676994b8602760f", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9766666666666667, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val a = r.readLine()!!.toInt()\n val b = r.readLine()!!.toInt()\n val c = r.readLine()!!.toInt()\n val max1 = maxOf(a+b*c, (a+b)*c)\n val max2 = maxOf(a*(b+c), a*b*c)\n println(maxOf(max1, max2))\n}", "lang": "Kotlin", "bug_code_uid": "94715f0f6b105bc4f3424d5e3d56aebc", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "89dfcdb6c0bb634ae6895fc25b2cbd6f", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6271551724137931, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "fun main(args : Array) {\n var arr = IntArray(3)\n for (i in 0..2)\n arr[i] = readLine()!!.toInt()\n var max = arr[0] * arr[1]\n if (arr[0] + arr[1] > max)\n max = arr[0] + arr[1]\n if (max * arr[2] > max + arr[2])\n println(max * arr[2])\n else\n println(max + arr[2] )\n}", "lang": "Kotlin", "bug_code_uid": "7b579d25aea0bf866561b95fadd39c6c", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "1e52307252cf704d8998eca4b317c75d", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9768518518518519, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n val c = scanner.nextInt()\n\n val case1 = (a + b) * c\n val case6 = a * b + c\n\n val case2 = a + b + c\n val case3 = a * b * c\n\n val case4 = a * b + c\n val case5 = a * (b + c)\n\n val result = arrayOf(case1, case2, case3, case4, case5, case6)\n\n\n println(result.max())\n}", "lang": "Kotlin", "bug_code_uid": "b5d2a33d9fe29f909ca1b028e111c3f1", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "17e1997949b293c6dd3b4db62c5478e6", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6009070294784581, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val abc = Array(3){0}\n for (i in 0 until 3){\n abc[i] = br.readLine().toInt()\n }\n val nums = abc.sorted()\n println(\n if (nums[0] == 1){\n (nums[0] + nums[1]) * nums[2]\n } else{\n nums[0] * nums[1] * nums[2]\n }\n )\n}", "lang": "Kotlin", "bug_code_uid": "dfce01437a7bc5b501a28972603e2c5b", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "e5e8c4282927caff5b85a273e0e90e10", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8823159219634991, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nval alg1 = { i1: Int, i2: Int, i3: Int -> i1 + i2 * i3 }\nval alg2 = { i1: Int, i2: Int, i3: Int -> i1 * (i2 + i3) }\nval alg3 = { i1: Int, i2: Int, i3: Int -> i1 * i2 * i3 }\nval alg4 = { i1: Int, i2: Int, i3: Int -> (i1 + i2) * i3 }\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val arg1 = reader.readLine().toInt()\n val arg2 = reader.readLine().toInt()\n val arg3 = reader.readLine().toInt()\n val answers = listOf(alg1(arg1, arg2, arg3),\n alg2(arg1, arg2, arg3),\n alg3(arg1, arg2, arg3),\n alg4(arg1, arg2, arg3))\n println(answers.max())\n}", "lang": "Kotlin", "bug_code_uid": "f4d4c46be975683a380722aecf5813c6", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "0634bf3390bbd5ffbc5468f1eeafd29f", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9782608695652174, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val (a,b,c) = Array(3, { readLine()!!.toInt()})\n println(arrayOf(a*b*c,(a+b)*c,a*(b+c)).max())\n}", "lang": "Kotlin", "bug_code_uid": "5c2c226e09c79ff93685c941a499411a", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "67710e3667f6a722a7ea5aec35fcb6ca", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.904639175257732, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val a = readLine()!!.toInt()\n val b = readLine()!!.toInt()\n val c = readLine()!!.toInt()\n\n fun addOrMultiply(x: Int, y: Int): Int {\n if (x == 1 || y == 1) {\n return x + y\n }\n else {\n return x * y\n }\n }\n\n println(addOrMultiply(addOrMultiply(a, b), c))\n}", "lang": "Kotlin", "bug_code_uid": "e04c7d231d57e5a2e6af09653147d767", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "be8f61cf165f10b2ac455475789bf8e1", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9033629686896019, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "import kotlin.math.min\n\n/**\n * Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last\n * class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of\n * operations '+' and '*', and probably brackets between the numbers so that the value of the resulting expression is\n * as large as possible. Let's consider an example: assume that the teacher wrote numbers 1, 2 and 3 on the blackboard.\n * Here are some ways of placing signs and brackets:\n * 1+2*3=7\n * 1*(2+3)=5\n * 1*2*3=6\n * (1+2)*3=9\n * Note that you can insert operation signs only between a and b, and between b and c, that is, you cannot swap integers.\n * For instance, in the given sample you cannot get expression (1+3)*2.\n * It's easy to see that the maximum value that you can obtain is 9.\n * Your task is: given a, b and c print the maximum value that you can get.\n *\n * Input\n * The input contains three integers a, b and c, each on a single line (1\u2009\u2264\u2009a,\u2009b,\u2009c\u2009\u2264\u200910).\n *\n * Output\n * Print the maximum value of the expression that you can obtain.\n */\nfun readInt(): Int = readLine()!!.toInt()\n\nfun readInputs():MutableList {\n val inputList:MutableList = mutableListOf()\n for (i in 0..2){\n inputList += listOf(readInt())\n }\n return inputList\n}\n\nfun sum0and1(list: MutableList):List{\n if (list.contains(0)) {\n list.remove(0)\n }\n var counter = 0\n for (i in 0..2){\n if (list[i] == 1) counter++\n }\n return if(counter < 2) {\n if (list.contains(1)) {\n val index = list.indexOf(1)\n list.remove(1)\n if(index!=0 || index!=2) {\n val minValue = min(list[index], list[index - 1])\n if (minValue == list[index]) list[index]++ else list[index - 1]++\n }\n else if(index == 0){\n list[index]++\n }\n else{\n list[index-1]++\n }\n }\n list.toList()\n }\n else {\n listOf(list.reduce { acc: Int, i: Int -> acc + i }.toInt())\n }\n}\n\nfun maxResult(list: List): Int = list.reduce { acc, i -> acc * i }\n\nfun main(){\n val inputValues = readInputs().toMutableList()\n val filteredList = sum0and1(inputValues)\n val result = maxResult(filteredList)\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "12df6ddb348a18026014719f09be9e15", "src_uid": "1cad9e4797ca2d80a12276b5a790ef27", "apr_id": "ea3e3e5b46715e54741b9b6c2fd49964", "difficulty": 1000, "tags": ["math", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.993006993006993, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.*\nimport java.math.BigInteger\n\n\nfun pow(n: Long, exp: Int): Long {\n val maxValue = BigInteger.valueOf(10).pow(9) + BigInteger.valueOf(7)\n return (BigInteger.valueOf(n).pow(exp) % maxValue).toLong()\n}\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val input = r.readLine()!!.split(\" \").map { it.toLong() }\n\n if (input[2] == 1L || input[2] > input[0]) {\n println(pow(input[1], input[0].toInt()))\n } else if (input[0] == input[2]) {\n println(pow(input[1], input[0].toInt()))\n } else {\n val maxValue = 10.toDouble().pow(9).toLong() + 7\n if (input[2] % 2L == 0L) {\n println(input[1] % maxValue)\n } else {\n println((input[1]*input[1]) % maxValue)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "1e0bf160cda70bcbb3cb63a107fe9518", "src_uid": "1f9107e8d1d8aebb1f4a1707a6cdeb6d", "apr_id": "72c1cb20c32344b398a7ca0769572a25", "difficulty": 1600, "tags": ["graphs", "dfs and similar", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.989345509893455, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array){\n\n var bool = false\n val array = arrayOf(4,7,44,47,74,77,444,447,474,477,744,747,774,777)\n val scan = Scanner(System.`in`)\n val n = scan.nextByte()\n\n for (i in array){\n if (n % i == 0) bool = true\n }\n\n if (bool) println(\"YES\")\n else println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "7d705a907e73848fbb8efb9168cfc669", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "75189f355462806629cd5f942f685ec9", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.33063209076175043, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val n = readLine()!!\n val regex = Regex(\"[47]*\")\n val num = n.toInt()\n val ans = if (regex.matches(n) || num % 4 == 0 || num % 7 == 0) {\n \"YES\"\n } else {\n \"NO\"\n }\n println(ans)\n}\n", "lang": "Kotlin", "bug_code_uid": "2acee63a9fd19a8a2cc92d97d07cea11", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "90110460fb033afe228ba156fbeaf58f", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3818615751789976, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "fun main() {\n val number = readLine()!!\n if(number.replace(\"4\", \"\").replace(\"7\", \"\").isEmpty()) {\n println(\"YES\")\n } else {\n val pn = number.toInt()\n if(pn % 4 == 0 || pn % 7 == 0) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n }", "lang": "Kotlin", "bug_code_uid": "4be24db904b60245fdcbc5f5dfdb33b9", "src_uid": "78cf8bc7660dbd0602bf6e499bc6bb0d", "apr_id": "e7939cfc90c4d6095a03360116e41697", "difficulty": 1000, "tags": ["brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9931856899488927, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math\n\nfun main(args: Array) {\n\tval matrix: MutableList> = mutableListOf()\n\tfor (i in 0 until 5) {\n\t\tval row = readLine()!!.split(' ').map(String::toInt)\n\t\tmatrix.add(row)\n\t}\n\tprintln(getResult(matrix))\n}\n\nfun getResult(matrix: List>): Int {\n\tval centerI = 3\n\tval centerJ = 3\n\tvar integerI = 0\n\tvar integerJ = 0\n\n\tloop@ for (i in 0 until matrix.size) {\n\t\tfor (j in 0 until matrix[i].size) {\n\t\t\tif (matrix[i][j] == 1) {\n\t\t\t\tintegerI = i\n\t\t\t\tintegerJ = j\n\t\t\t\tbreak@loop\n\t\t\t}\n\t\t}\t\n\t}\n\t\n\treturn abs(integerI - centerI) + abs(integerJ - centerJ)\n\t\n}", "lang": "Kotlin", "bug_code_uid": "10a7db0b5595e414a8d692c18df9bbfb", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "8048fcc031202f2bbc73f0a646a1ecec", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9949066213921901, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.abs\n\nfun main(args: Array) {\n\tval matrix: MutableList> = mutableListOf()\n\tfor (i in 0 until 6) {\n\t\tval row = readLine()!!.split(' ').map(String::toInt)\n\t\tmatrix.add(row)\n\t}\n\tprintln(getResult(matrix))\n}\n\nfun getResult(matrix: List>): Int {\n\tval centerI = 3\n\tval centerJ = 3\n\tvar integerI = 0\n\tvar integerJ = 0\n\n\tloop@ for (i in 0 until matrix.size) {\n\t\tfor (j in 0 until matrix[i].size) {\n\t\t\tif (matrix[i][j] == 1) {\n\t\t\t\tintegerI = i\n\t\t\t\tintegerJ = j\n\t\t\t\tbreak@loop\n\t\t\t}\n\t\t}\t\n\t}\n\t\n\treturn abs(integerI - centerI) + abs(integerJ - centerJ)\n\t\n}", "lang": "Kotlin", "bug_code_uid": "318adff43108767b01ebd0ec8043b5b7", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "8048fcc031202f2bbc73f0a646a1ecec", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9917137971853216, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\nfun main() { _writer.solve(); _writer.flush() }\n\nfun PrintWriter.solve() {\n var pos = 0\n var totalMove = 0\n for (i in 0 until 5) {\n val intData = readInts(5)\n for (j in intData.indices) {\n if (intData[j] == 1) break\n else pos ++\n }\n }\n while (pos != 12) {\n when(pos) {\n in 0..4-> {\n pos += 5\n totalMove++\n }\n in 5..9-> {\n pos += 5\n totalMove++\n }\n in 15..19-> {\n pos -= 5\n totalMove++\n }\n in 20..24-> {\n pos -= 5\n totalMove++\n }\n in 10..14 -> {\n totalMove += Math.abs(12 - pos)\n pos == 12\n }\n }\n }\n println(totalMove)\n }\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()", "lang": "Kotlin", "bug_code_uid": "c8682ae98f00df851e519902b453e821", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "f624b67cb0cadba256d2047b398e401d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9715463917525773, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "[3:36 PM] NamHP\n + t\u1ee9c l\u00e0 1 l\u1ea7n \u0111\u00fang lu\u00f4n\n\u200b[3:36 PM] NamHP\n fun main()\n{ \n var result = 0\n for (i in 1..5)\n {\n val (a, b, c, d, e) = readLine()!!.split(\" \").map { it.toInt() }\n if(i==1 || i==5)\n {\n if (a == 1 || e == 1) {\n result = 4\n break\n } \n if (b == 1 || d == 1) {\n result = 3\n break\n } \n if (c == 1) {\n result = 2\n break\n } \n }\n if(i==2 || i==4)\n {\n if (a == 1 || e == 1) {\n result = 3\n break\n } \n if (b == 1 || d == 1) {\n result = 2\n break\n } \n if (c == 1) {\n result = 1\n break\n } \n }\n if(i==3)\n {\n if (a == 1 || e == 1) {\n result = 2\n break\n } \n if (b == 1 || d == 1) {\n result = 1\n break\n } \n if (c == 1) {\n result = 0\n break\n } \n } \n }\n println(result)\n}\n", "lang": "Kotlin", "bug_code_uid": "cf197d91bd0c3bf922e5afe170b1335a", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "45b92f4501c01aa50acce86ca541c802", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9407821229050279, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\n\nimport java.util.*\nimport kotlin.math.abs\n\n\n var array=Array(5){IntArray(5)}\n var read: Scanner=Scanner(System.`in`)\n fun main(){\n\n var x:Int=0\n var y:Int=0\n for(i in 1..5)\n for(j in 1..5){\n array[i][j]=read.nextInt()\n if(array[i][j]==1){\n x=i\n y=j\n }\n }\n println(abs(x-3)+ abs(y-3))\n }\n", "lang": "Kotlin", "bug_code_uid": "1dfc17ebe53e76e8bcde18a9e9c4bbb4", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "a7debc1f847a7c35c0f50351e67d64c3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9254385964912281, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "\n \n\nfun main() \n{ \n\tvar result = 0\n\tfor (i in 1..5) \n\t{\n\t\tval (a, b, c, d, e) = readLine()!!.split(\" \").map { it.toInt() }\n\t\tif(i==1 || i==5)\n\t\t{\n\t\t\tif (a == 1) {\n\t\t\t\tresult = 4\n\t\t\tbreak\n\t\t\t}\t\t\n\t\t\tif (b == 1) {\n\t\t\t\tresult = 3\n\t\t\tbreak\n\t\t\t}\t\n\t\t\tif (c == 1) {\n\t\t\t\tresult = 1\n\t\t\tbreak\n\t\t\t}\n\t\t\tif (d == 1) {\n\t\t\t\tresult = 1\n\t\t\tbreak\n\t\t\t}\n\t\t\tif (e == 1) {\n\t\t\t\tresult = 2\n\t\t\tbreak\n\t\t}\n\t\tif(i==2 || i==4)\n\t\t{\n\t\t\tif (a == 1) {\n\t\t\t\tresult = 3\n\t\t\tbreak\n\t\t\t}\t\t\n\t\t\tif (b == 1) {\n\t\t\t\tresult = 2\n\t\t\tbreak\n\t\t\t}\t\n\t\t\tif (c == 1) {\n\t\t\t\tresult = 1\n\t\t\tbreak\n\t\t\t}\n\t\t\tif (d == 1) {\n\t\t\t\tresult = 2\n\t\t\tbreak\n\t\t\t}\n\t\t\tif (e == 1) {\n\t\t\t\tresult = 3\n\t\t\tbreak\n\t\t}\n\t\tif(i==3)\n\t\t{\n\t\t\tif (a == 1) {\n\t\t\t\tresult = 2\n\t\t\tbreak\n\t\t\t}\t\t\n\t\t\tif (b == 1) {\n\t\t\t\tresult = 1\n\t\t\tbreak\n\t\t\t}\t\n\t\t\tif (c == 1) {\n\t\t\t\tresult = 0\n\t\t\tbreak\n\t\t\t}\n\t\t\tif (d == 1) {\n\t\t\t\tresult = 1\n\t\t\tbreak\n\t\t\t}\n\t\t\tif (e == 1) {\n\t\t\t\tresult = 2\n\t\t\tbreak\n\t\t}\t\n\t}\n\tprintln(result)\n}", "lang": "Kotlin", "bug_code_uid": "65879a386d82d8086c6300e7278e5f2d", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "0bd3566fd9ae350810134f9c3247c9b8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9954337899543378, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.math.*\nimport java.util.*\nimport java.io.*\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readInts() = readLn().split(\" \").map{it.toInt()}\n\nfun qpowmod(ta:Long, tb:Long, mod:Long):Long {\n\tvar a = ta\n\tvar b = tb\n\tvar res=1L\n\twhile(b>0) {\n\t\tif(b%2==1L)\n\t\t\tres=res*a\n\t\tb/=2\n\t\ta=a*a%mod\n\t}\n\treturn res\n}\n\nfun main(args: Array) {\n\tvar (n,m) = readInts()\n\tprintln(qpowmod(2,(n+m).toLong(), 998244353))\n}", "lang": "Kotlin", "bug_code_uid": "acf05d8528a1d41dbb106bb2cd5d4c72", "src_uid": "8b2a9ae21740c89079a6011a30cd6aee", "apr_id": "1488f2390d311d6f2d33ab7873998cda", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9772256728778468, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n\tvar (x, y, z) = readLine()!!.split(' ').map(String::toInt)\n\tvar (a, b, c) = readLine()!!.split(' ').map(String::toInt)\n\tif (a < x || a + b < x + y || a + b + c < x + y + z) {\n\t\tprintln(\"NO\")\n\t} else {\n\t\tprintln(\"YES\")\n\t}\n\treturn 0;\n}", "lang": "Kotlin", "bug_code_uid": "129e75830e048b66ac560385804593c8", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "df9f3ca4657d9e6039dccf761802c350", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9924050632911392, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //var (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (x, y, z) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c) = r.readLine()!!.split(\" \").map { it.toInt() }\n val ans = a>=x&&(a+b>=y)&&(a+b+c>=z)\n println(if (ans)\"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "246e42a33e2b53d6e96cc80393581eb2", "src_uid": "d54201591f7284da5e9ce18984439f4e", "apr_id": "a687fff4ee1bd2eb5b1550d72bc0d1bb", "difficulty": 800, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9879138202837625, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun isOdd(x:Int) :Boolean\n{\n if (x%2 == 0)\n return false\n else\n return true\n}\n\nfun isValid(x:Int,y:Int):Boolean\n{\n if (x>=0 && x<=2 && y>=0 && y<=2)\n return true\n else\n return false\n}\n\nval reader = Scanner(System.`in`)\nvar arr = arrayOf>()\nvar ans = arrayOf>()\nval dx = intArrayOf(0,0, 0,1,-1)\nval dy = intArrayOf(0,1,-1,0, 0)\n\nfun main(args: Array) {\n for (x in 0..2)\n {\n val row = Array(3,{i -> reader.nextInt()})\n val reset = Array(3,{i -> 1})\n arr+=row\n ans+=reset\n }\n\n for (i in 0..2)\n for (j in 0..2)\n if (isOdd(arr[i][j]))\n for (k in 0..4)\n if (isValid(i+dx[k],j+dy[k])) \n ans[i+dx[k]][j+dy[k]] = ans[i+dx[k]][j+dy[k]] xor 1\n \n\n for (row in ans)\n for (value in row)\n print(value)\n println()\n\n}", "lang": "Kotlin", "bug_code_uid": "edf70e28c92032b49d8453440cc5bd9b", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "apr_id": "9ec6479f902c49bf9877e4cd5d8d3503", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995511669658886, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var r1 = readLine()!!.split(' ').map { it.toInt() }\n var r2 = readLine()!!.split(' ').map { it.toInt() }\n var r3 = readLine()!!.split(' ').map { it.toInt() }\n\n var a1 = Array(3, { 1 })\n var a2 = Array(3, { 1 })\n var a3 = Array(3, { 1 })\n\n if (r1[0] % 2 != 0 && r1[0] != 0) {\n a1[0] = 0\n a1[1] = 0\n a2[0] = 0\n }\n\n if (r1[1] % 2 != 0 && r1[1] != 0) {\n a1[0] = if (a1[0] == 0) 1 else 0\n a1[1] = if (a1[1] == 0) 1 else 0\n a1[2] = if (a1[2] == 0) 1 else 0\n a2[1] = if (a2[1] == 0) 1 else 0\n }\n\n if (r1[2] % 2 != 0 && r1[2] != 0) {\n a1[2] = if (a1[2] == 0) 1 else 0\n a2[2] = if (a2[2] == 0) 1 else 0\n a1[1] = if (a1[1] == 0) 1 else 0\n }\n\n ////////////////////\n if (r2[0] % 2 != 0 && r2[0] != 0) {\n a1[0] = if (a1[0] == 0) 1 else 0\n a2[0] = if (a2[0] == 0) 1 else 0\n a2[1] = if (a2[1] == 0) 1 else 0\n a3[0] = if (a3[0] == 0) 1 else 0\n }\n\n if (r2[1] % 2 != 0 && r2[1] != 0) {\n a3[1] = if (a3[1] == 0) 1 else 0//\n a1[1] = if (a1[1] == 0) 1 else 0//\n a2[2] = if (a2[2] == 0) 1 else 0//\n a2[0] = if (a2[0] == 0) 1 else 0//\n a2[1] = if (a2[1] == 0) 1 else 0//\n }\n\n if (r2[2] % 2 != 0 && r2[2] != 0) {\n a1[2] = if (a1[2] == 0) 1 else 0//\n a3[2] = if (a3[2] == 0) 1 else 0//\n a2[1] = if (a2[1] == 0) 1 else 0//\n a2[2] = if (a2[2] == 0) 1 else 0//\n }\n\n /////////////////////////////\n\n\n if (r3[0] % 2 != 0 && r3[0] != 0) {\n a2[0] = if (a2[0] == 0) 1 else 0\n a3[0] = if (a3[0] == 0) 1 else 0\n a3[1] = if (a3[1] == 0) 1 else 0\n }\n\n if (r3[1] % 2 != 0 && r3[1] != 0) {\n a3[0] = if (a3[0] == 0) 1 else 0//\n a3[2] = if (a3[2] == 0) 1 else 0//\n a3[1] = if (a3[1] == 0) 1 else 0//\n a2[1] = if (a2[1] == 0) 1 else 0//\n }\n\n if (r3[2] % 2 != 0 && r3[2] != 0) {\n a2[2] = if (a1[2] == 0) 1 else 0//\n a3[2] = if (a3[2] == 0) 1 else 0//\n a3[1] = if (a3[1] == 0) 1 else 0//\n }\n\n for (i in a1) {\n print(i)\n }\n println()\n for (i in a2) {\n print(i)\n }\n println()\n for (i in a3) {\n print(i)\n }\n}", "lang": "Kotlin", "bug_code_uid": "dcb5fb280c2e66fde9e1fa06c044493f", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "apr_id": "e3b65d0bc3f245f0fc455e152d9bfc8b", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9971305595408895, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.min\nimport kotlin.math.sign\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val arr = Array(4) { IntArray(4) }\n for (i in 1..3) {\n val s = readInts()\n for (j in 1..3) {\n arr[i][j] = s[j - 1]\n }\n }\n for (i in 1..3) {\n for (j in 1..3) {\n val sum = arr[i][j] + arr[i - 1][j] + arr[i + 1][j] + arr[i][j - 1] + arr[i][j + 1]\n print(if (sum % 2 == 0) 1 else 0)\n }\n println()\n }\n}", "lang": "Kotlin", "bug_code_uid": "2828c18586e73b01679bb5beb4c4fea2", "src_uid": "b045abf40c75bb66a80fd6148ecc5bd6", "apr_id": "6f9b1456e81639b4992d3b897a499390", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.16863406408094436, "equal_cnt": 6, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`), {\n var n = nextInt()\n if (n == 2) print(\"NO\")\n else print(\"YES\")\n})", "lang": "Kotlin", "bug_code_uid": "5c590083c867481534908801e19bf3d5", "src_uid": "587d4775dbd6a41fc9e4b81f71da7301", "apr_id": "085d3ed40589a0165739cf7ca85b7119", "difficulty": 800, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9822485207100592, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "private fun solve() {\n val n = readInt()\n var l = 0\n var r = n-1\n var a = mutableListOf()\n repeat(n) {\n a.add(readInt())\n }\n var pre = 0\n var times = 0\n var turn = 0\n var A = 0\n var B = 0\n while (true) {\n var cur = 0\n if (turn==0) {\n while (l<=r && cur<=pre) {\n cur += a[l];\n ++l;\n }\n A += cur\n }\n else {\n while (l<=r && cur<=pre) {\n cur += a[r];\n --r;\n }\n B += cur\n }\n pre = cur\n ++times\n if (l>r) \n break\n turn = 1 - turn\n }\n println (\"${times.toString()} ${A.toString()} ${B.toString()} \")\n}\n\nfun main () {\n val n = readInt()\n for (i in 1..n) solve()\n}\n\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\ninline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }\n", "lang": "Kotlin", "bug_code_uid": "a82e3ef3ecc9d29ba24909d0708e2b46", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "d57ea46191692c572a187328744c0046", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4459836889732991, "equal_cnt": 184, "replace_cnt": 125, "delete_cnt": 25, "insert_cnt": 34, "fix_ops_cnt": 184, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static IO in;\n public static PrintWriter out;\n\n static void init_io(String filename) throws Exception {\n if (filename.equals(\"\")) {\n in = new IO(System.in);\n out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n } else {\n in = new IO(new FileInputStream(filename + \".in\"));\n out = new PrintWriter(new BufferedWriter(new FileWriter(filename + \".out\")), true);\n }\n }\n\n final static long mod = 998244353;\n\n/*\nfun main(args: Array) {\n Main.main(args);\n}\n*/\n\n static void solve(int tc) throws Exception {\n int n = in.nint();\n \n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = in.nint();\n\n int v = 0, u = 0;\n int c = 0, t = 0;\n int l = 0, r = n - 1;\n while (l <= r) {\n int x = 0;\n ++t;\n while (l <= r && x <= c) {\n x += a[l];\n v += a[l];\n ++l;\n }\n if (l > r) break;\n ++t;\n c = x;\n x = 0;\n while (l <= r && x <= c) {\n x += a[r];\n u += a[r];\n --r;\n }\n c = x;\n }\n out.println(t + \" \" + v + \" \" + u);\n }\n\n public static void main(String[] _u_n_u_s_e_d_) throws Exception {\n init_io(\"\");\n\n int t = 1;\n t = in.nint();\n for (int tc = 0; tc < t; tc++) {\n solve(tc);\n }\n }\n\n static long minv(long v) {\n return mpow(v, mod - 2);\n }\n\n static long mpow(long base, long exp) {\n long res = 1;\n\n while (exp > 0) {\n if ((exp & 1) == 1) {\n res = (res * base) % mod;\n }\n base = (base * base) % mod;\n exp >>= 1;\n }\n\n return res;\n }\n\n static long gcd(long x, long y) {\n if (x == 0) return y;\n return gcd(y % x, x);\n }\n\n static void rsort(long[] arr) {\n Random r = new Random();\n for (int i = 0; i < arr.length; i++) {\n int j = i + r.nextInt(arr.length - i);\n long t = arr[i];\n arr[i] = arr[j];\n arr[j] = t;\n }\n Arrays.sort(arr);\n }\n\n static void rsort(int[] arr) {\n Random r = new Random();\n for (int i = 0; i < arr.length; i++) {\n int j = i + r.nextInt(arr.length - i);\n int t = arr[i];\n arr[i] = arr[j];\n arr[j] = t;\n }\n Arrays.sort(arr);\n }\n\n /* static void qsort(long[] arr) {\n Long[] oarr = new Long[arr.length];\n for (int i = 0; i < arr.length; i++) {\n oarr[i] = arr[i];\n }\n\n ArrayList alist = new ArrayList(Arrays.asList(oarr));\n Collections.sort(alist);\n\n for (int i = 0; i < arr.length; i++) {\n arr[i] = (long)alist.get(i);\n }\n } */\n\n static void reverse(long[] arr) {\n for (int i = 0; i < arr.length / 2; i++) {\n long temp = arr[i];\n arr[i] = arr[arr.length - 1 - i];\n arr[arr.length - 1 - i] = temp;\n }\n }\n\n static String atos(long[] arr) {\n String s = Arrays.toString(arr);\n s = s.substring(1, s.length() - 1);\n return s.replace(\",\", \"\");\n }\n\n static class IO {\n public BufferedReader in;\n public StringTokenizer tokens;\n\n public IO(InputStream x) throws Exception {\n in = new BufferedReader(new InputStreamReader(x));\n tokens = new StringTokenizer(in.readLine());\n }\n\n int nint() throws Exception {\n return Integer.parseInt(nstr());\n }\n\n long nlong() throws Exception {\n return Long.parseLong(nstr());\n }\n\n double ndouble() throws Exception {\n return Double.parseDouble(nstr());\n }\n\n String nstr() throws Exception {\n if (!tokens.hasMoreTokens()) tokens = new StringTokenizer(in.readLine());\n return tokens.nextToken();\n }\n \n long[] nla(int n) throws Exception {\n long[] arr = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nlong();\n }\n return arr;\n }\n }\n\n static class Pair, B extends Comparable> implements Comparable> {\n public A f;\n public B s;\n\n public Pair(A a, B b) {\n f = a;\n s = b;\n }\n\n public int compareTo(Pair other) {\n int v = f.compareTo(other.f);\n if (v != 0) return v;\n return s.compareTo(other.s);\n }\n\n public String toString() {\n return \"(\" + f.toString() + \", \" + s.toString() + \")\";\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "d20f610a655d3466d3f8e785b5583491", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "97ee3d0baae2e2321307541d5688819c", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9855491329479769, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val lines: Int = readLine()?.toInt() ?: 0\n for (i in 0 until lines) {\n val count = readLine()?.toInt() ?: 0\n val sweets = (readLine() ?: \"\").split(\" \")\n val list = LinkedList(sweets.map { it.toInt() })\n val alice = mutableListOf()\n val bob = mutableListOf()\n var turn = 0\n var min = 0\n while (!list.isEmpty()) {\n if (turn % 2 != 0) { //Bob\n var tmp = 0\n while (tmp <= min) {\n val n = list.pollLast() ?: break\n bob.add(n)\n tmp += n\n }\n min = tmp\n } else { // Alice\n var tmp = 0\n while (tmp <= min) {\n val n = list.pollFirst() ?: break\n alice.add(n)\n tmp += n\n }\n min = tmp\n }\n turn++\n }\n println(\"$turn ${alice.sum()} ${bob.sum()}\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "508304e709978694a835e9fb4bd23ec5", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "33577154b26f25609414f3b86f8fd7ca", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.40644583706356313, "equal_cnt": 41, "replace_cnt": 33, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 42, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val read = Scanner(System.`in`)\n var t = read.nextLong()\n\n while(t > 0) {\n t--;\n var size = read.nextInt()\n var Candy = ArrayList()\n for(i in 1..size) {\n var temp = read.nextInt()\n Candy.add(temp)\n }\n var a_idx = -1\n var b_idx = size\n var a_sum = 0\n var b_sum = 0\n var prevEat = 0\n var thisEat = 0\n var turnWho = 0\n var turnCount = 0\n while(a_idx + 1 < b_idx) {\n if(thisEat == 0) {\n turnCount += 1\n }\n\n if(turnWho == 0) {\n a_idx + 1\n a_sum += Candy[a_idx]\n thisEat += Candy[a_idx]\n } else {\n b_idx += 1\n b_sum += Candy[b_idx]\n thisEat += Candy[b_idx]\n }\n\n if(thisEat > prevEat) {\n prevEat = thisEat\n thisEat = 0\n turnWho = if(turnWho == 0) 1 else 0\n }\n }\n\n println(\"$turnCount $a_sum $b_sum\")\n }\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "7fc9459cd8473c77b08b785369f368ca", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "6927257faa938400e83693ec42f34219", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.024834437086092714, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "7\n11\n3 1 4 1 5 9 2 6 5 3 5\n1\n1000\n3\n1 1 1\n13\n1 2 3 4 5 6 7 8 9 10 11 12 13\n2\n2 1\n6\n1 1 1 1 1 1\n7\n1 1 1 1 1 1 1\n", "lang": "Kotlin", "bug_code_uid": "e339c7dd7a61543ad18575eb53ebfa26", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "6927257faa938400e83693ec42f34219", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9898558462359851, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.*\nimport java.io.PrintWriter\nimport kotlin.collections.ArrayList\nfun main(args: Array) {\n val out=PrintWriter(System.out)\n val read = Scanner(System.`in`)\n var t=read.nextInt()\n\twhile(t-->0){\n var n=read.nextInt()\n var queue = ArrayDeque()\n for(i in 0 until n){\n queue.add(read.nextInt())\n }\n var a = 0;var pa=0\n var b = 0;var pb=0\n var move = 0;var turn=0\n while(!queue.isEmpty()){\n move++\n if(turn==0){\n var na=0\n while(!queue.isEmpty()&&na PrevEat) {\n PrevEat = ThisEat\n ThisEat = 0\n TurnWho = if (Turn == 0) 1 else 0\n }\n }\n print(\"$TurnCnt $A_sum $B_sum\\n\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "6c7f6ab20234cc86ff1122d689496f46", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "b4c5cdddfd94150bc6ea30c3d314fa7e", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9929988331388565, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(){\n val t = readLine()!!.toInt()\n\tfor (i in 1..t){\n var m = readLine()!!.toInt()\n\tvar n = readLine()!!.split(\" \").map { it.toInt() }\n var b = m\n var count = 0\n var counta:Int\n var countb:Int\n var totala = 0\n var totalb = 0\n var step = 0\n \twhile (b>a+1){\n counta = 0\n while ((counta<=count)&&(a+1a){\n counta = 0\n while ((counta<=count)&&(a()\n\n while (count-- != 0) {\n val size = readLine()\n val sweets = readLine()!!.split(' ').map { it.toInt() }.toMutableList()\n results.add(game(sweets))\n }\n\n results.forEach { r ->\n println(\"${r.moves} ${r.leftWeight} ${r.rightWeight}\")\n }\n}\n\ndata class GameResult(\n val moves: Int,\n val leftWeight: Int,\n val rightWeight: Int\n)\n\nfun game(sweets: MutableList): GameResult {\n var moves = 0\n var leftWeight = 0\n var rightWeight = 0\n\n while (sweets.isNotEmpty()) {\n leftWeight += eatLeft(rightWeight, sweets)\n moves++\n\n if (sweets.isEmpty())\n break\n\n rightWeight += eatRight(leftWeight, sweets)\n moves++\n }\n\n return GameResult(moves, leftWeight, rightWeight)\n}\n\nfun eatLeft(min: Int, sweets: MutableList): Int {\n var eaten = 0\n do {\n eaten += sweets.removeAt(0)\n } while (eaten < min && sweets.isNotEmpty())\n\n return eaten\n}\n\nfun eatRight(min: Int, sweets: MutableList): Int {\n var eaten = 0\n do {\n eaten += sweets.removeAt(sweets.size - 1)\n } while (eaten < min && sweets.isNotEmpty())\n\n return eaten\n", "lang": "Kotlin", "bug_code_uid": "97e1c9ef367d011a8b1e1c436412aa47", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "6626c84cce4cda250985426657b5acd6", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.660436137071651, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "fun main() {\n val numbers = readLine()!!.toInt()\n (0..numbers - 1).forEach {\n readLine()!!\n var mas = readLine()!!.split(\" \").map { it.toInt() }\n var alice = 0\n var bob = 0\n var last = 0\n var hod = 0\n\n while (mas.isNotEmpty()) {\n var collect = 0\n mas = mas.dropWhile {\n val b = collect <= last \n if (b) collect += it\n b\n }\n if (hod % 2 == 0) {\n alice += collect\n } else {\n bob += collect\n }\n last = collect\n hod = hod + 1\n mas = mas.reversed()\n }\n println(\"$hod $alice $bob\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "fcf1b850cff6b5711fc4d73e14247723", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "1037e0d37d4b1c4a90eecb75b2f420d2", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9992509363295881, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "private fun solve(){\n val nn = readLine()!!.toInt()\n val aa = readLine()!!.split(\" \").map{it.toInt()}\n var moves=0; var asum=0; var bsum=0; var prevv=0; var ll=0; var rr=nn-1;\n while (ll<=rr) {\n if(ll<=rr) {\n moves++\n var cur=0\n while (ll<=rr && cur<=prevv) cur += aa[l++]\n asum+=cur\n prevv=cur\n }\n if(ll<=rr){\n moves++\n var cur=0\n while (ll<=rr && cur<=prevv) cur += aa[rr--]\n bsum+=cur\n prevv=cur\n }\n }\n println(\"$moves $asum $bsum\")\n}\n \nfun main(){\n var T = readLine()!!.toInt()\n while(T-->0) solve()\n}", "lang": "Kotlin", "bug_code_uid": "9c344b6cc572b07c98a5c9291afa7861", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "52146839f616d256cb734e235586d347", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9798792756539235, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "readLine()?.toInt()?.let { t ->\n repeat(t){\n readLine()?.toInt()?.let {n ->\n val b = n/2\n val a = n-b\n when {\n a == b -> {\n println(b-1)\n }\n a > b -> {\n println(b)\n }\n else -> {\n println(0)\n }\n }\n\n }\n }\n }", "lang": "Kotlin", "bug_code_uid": "8d8c9cc4990685852a1a59720f1a3558", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "5cf2288cbac4024373ef74c9eb0fc263", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.984822934232715, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.math.ceil\n\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val numberOfTestCases = scanner.nextInt()\n for (i in 0..numberOfTestCases) {\n val numberOfCandies = scanner.nextInt()\n println(ceil(numberOfCandies / 2.0).toInt() - 1)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "41a5f62ab478984a7dbe9877fb88344b", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "746d7c54604ab4133766a041a3bfc441", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.918625678119349, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val scanner = Scanner(System.`in`)\n val numberOfTestCases = scanner.nextInt()\n for (i in 0 until numberOfTestCases) {\n val numberOfCandies = scanner.nextInt()\n println(ceil(numberOfCandies / 2.0).toInt() - 1)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "bc2a55263b298625a573b7c08c9abdcc", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "746d7c54604ab4133766a041a3bfc441", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4482758620689655, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n val numberOfTests = readLine()!!.toInt()\n repeat(numberOfTests){\n val numberOfCandies = readLine()!!.split(' ')[0].toInt()\n if(numberOfCandies <= 2) {\n println(0)\n return@repeat\n }\n var alice = numberOfCandies - 1\n var betty = numberOfCandies - alice\n var ct = 0\n while (alice > betty){\n alice -= 1\n betty = numberOfCandies - alice\n ct++\n }\n println(ct)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "6132eda342f63c1b56682dcc0baafc16", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "fe9e96759f5c18404b01ccb60c5a7ce6", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9877551020408163, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val t = readLine()!!.toInt()\n for (i in 0..t) {\n val n = readLine()!!.toInt()\n when {\n n < 3 -> {\n println(0)\n }\n n % 2 == 0 -> {\n println(n / 2 - 1)\n }\n else -> {\n println(n / 2)\n }\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "448c526e97c6d3f58d04c5497ca15736", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "8c19d8a7ed90f516bed06a789cb293c2", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9895287958115183, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val tests = readLine().toInt()\n for (i in 0 until tests) {\n val nr = readLine().toInt()\n val ats = (nr-1)/2\n println(ats)\n }\n}", "lang": "Kotlin", "bug_code_uid": "523663968213aea4f6fb7e8f3e54fb5b", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "8ed3f1ff78a54fd081f4e2600f98a84b", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9953632148377125, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n \nfun main() {\n val lines = readInt()\n for (line in 1..lines) {\n val number = readInts()\n println((number-1)/2)\n }\n}", "lang": "Kotlin", "bug_code_uid": "6d6aa459ff5068d16dc2d22a7f36ea15", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "6b39c160972d21e4dcab5b0e6bd0d2ea", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8416833667334669, "equal_cnt": 11, "replace_cnt": 1, "delete_cnt": 10, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": " fun main(args: Array) {\n var T: Int\n val scanner = Scanner(System.`in`)\n T = scanner.nextInt()\n while (T-- > 0) {\n var n = scanner.nextInt()\n if (n < 2) n = 2\n println((n - 1) / 2)\n }\n }", "lang": "Kotlin", "bug_code_uid": "73547a0c338d2b3e57b62581843a1124", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "e73ec0ed51e6060c74db0a82b0e75fce", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9822485207100592, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n var n = getInteger()\n for (i in 0 until n) {\n \tvar candies = getInteger()\n println(candies / 2 - (candies % 2) == 0 ? 1 : 0)\n }\n}\n\nfun getIntegers(): List {\n var input = (readLine()!!).split(' ')\n return input.map{it.toInt()}\n}\n \nfun getInteger(): Int {\n return (readLine()!!).toInt()\n}", "lang": "Kotlin", "bug_code_uid": "1a3c5c2d18cbc9312af4963d6ff4347a", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "93a962ee15ce4f539ecde4791cd4f636", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9623059866962306, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\nfun main(){\n val reader= Scanner(System.`in`)\n var t:Int\n var a:Int\n t=reader.nextInt()\n for (i in 0..t-1){\n a=reader.nextInt()\n println(\"${max(floor((a-1)/2), 0)}\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "fd4a376523ad2394d052c1acdc598a77", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "781c710fe195173339d23378f85298af", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.03488372093023256, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "solution.kt", "lang": "Kotlin", "bug_code_uid": "092aa1b88aae61483135760d5dd2a6a3", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "ef6e9ef8d13df68e85b18178279ac9c8", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9745762711864406, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nimport java.io.*\nimport java.math.*\n \nfun main(args : Array) {\n val input = Scanner(System.`in`)\n val N = input.nextInt()\n for (i in 1..N) {\n var BB = input.nextDouble()\n val save = BB\n if (BB % 2 == 0)\n BB += 1\n val A = Math.ceil(BB/2)\n println(save - A)\n }\n}", "lang": "Kotlin", "bug_code_uid": "ce60311e513f6f6d84c91fe5ef7ec90b", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "1269c96163eff62ee28ad10fe74a2a56", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6490984743411928, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\nimport java.io.*\nimport java.math.*\n \nfun main(args : Array) {\n val input = Scanner(System.`in`)\n val N = input.nextInt()\n for (i in 1..N) {\n val BB = input.nextInt()\n val A = BB-1\n val B = 1\n var count = 0\n while (A > B) {\n count += 1\n }\n println(count)\n }\n}", "lang": "Kotlin", "bug_code_uid": "2ba636547025d23e585c70c3bf185c95", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "1269c96163eff62ee28ad10fe74a2a56", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9371980676328503, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val i = readInt()\n var results = mutableListOf()\n for(x in 1..i) {\n val g = readInt() - 1\n results.add(g / 2)\n }\n print(results)\n}", "lang": "Kotlin", "bug_code_uid": "a263bb552d76252cbebb29e127419516", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "f268fa62ab87ec7c7e8e857b4e8e71c7", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9920255183413078, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() = for(x in 1..readInt()) println((readInt() - 1) / 2)", "lang": "Kotlin", "bug_code_uid": "ac4fb1d4bdf45a62f71375428278bdb8", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "f268fa62ab87ec7c7e8e857b4e8e71c7", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9565217391304348, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nfun main(){\n val input=Scanner(System.`in`)\n var t:Int=input.nextInt()\n while(t>0){\n var b:Double =input.nextDouble()\n var a:Int=(b/2).toInt()\n if(a*2==b){\n a-- \n println(\"$a\")\n } \n else{\n println(\"$a\")\n }\n t--\n }\n}", "lang": "Kotlin", "bug_code_uid": "1582dee2ce9ed596a20f726c775b4345", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "6467c4dd5198ee7cbd878b84d506c803", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.09207459207459208, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\nimport java.util.Collections.min\nimport java.util.Collections.swap\nimport kotlin.collections.ArrayList\nimport kotlin.math.min\nimport kotlin.random.Random.Default.nextInt\n\nfun main(args: Array) {\n\n // Creates a reader instance which takes\n // input from standard input - keyboard\n val reader = Scanner(System.`in`)\n var n:Int = reader.nextInt()\n while (n -- > 0){\n solve()\n }\n}\n\nfun solve(){\n val reader = Scanner(System.`in`)\n var v = mutableListOf()\n var n :Int\n var k : Int\n var s : String\n var w : String\n n = reader.nextInt()\n k = reader.nextInt()\n s = reader.nextLine()\n var ss = IntArray(s.length)\n for (i in 0 until n) {\n if(s[i] == '0'){\n ss[i] = 0\n v.add(i)\n }\n else{\n ss[i] = 1\n }\n }\n var b = 0\n var r = 0\n\n while(k > 0 ){\n if(r == v.size){\n break\n }\n if(k >= v[r] - b){\n var temp = ss[v[r]]\n ss[v[r]] = ss[b]\n ss[b] = temp\n k -= v[r]-b\n b++\n r++\n }\n else {\n var temp = ss[v[r]]\n ss[v[r]] = ss[v[r]-k]\n ss[v[r]-k]=temp\n k = 0\n }\n }\n var sss = \"\"\n for(i in ss){\n sss += i.toString()\n }\n println(sss)\n return\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "f344b1fa7600136e4b33ced88fa27717", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "265b3e48f0d30d8a693eca6f10f6945f", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9873873873873874, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n \nprivate fun min(a : Long , b : Long ) : Long\n{\n\tif(a < b)\n\t\treturn a;\n\telse \n\t\treturn b;\n}\n \nfun main(args: Array) {\n var q = readLine()!!.toLong();\n while(q --> 0)\n {\n \tn = readLine().toLong()\n \tprintln((n-1)/2)\n \n }\n \n}", "lang": "Kotlin", "bug_code_uid": "e429a9b4ddb7374338cfc69a1bbbadec", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "265b3e48f0d30d8a693eca6f10f6945f", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5428571428571428, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun main() {\n var l: String? = null\n while (run {l = readLine(); l} != null)\n println((l+1)/2)\n}\n", "lang": "Kotlin", "bug_code_uid": "13a57db3329a3111e3096e134166ff39", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "c01c78be932c2d2ffe1a594a1dbaf50c", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9698630136986301, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\n\nfun main() {\n var sc = Scanner(System.`in`);\n var t = sc.nextInt();\n while( t > 0) {\n var n = sc.nextInt();\n println((n+1)/2-1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "25e01fd111f74842da478d6c59a92095", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "1e07c63f2a7919bea983b008e4a9bf01", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.978328173374613, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nval scan = Scanner(System.`in`)\nfun main() {\n\tval b = scan.nextInt()\n\tfor (i 1..b){\n\t val a = scan.nextInt()\n \tprint((a-1)/2)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "489a404d05efe24cb97c118ac84eb603", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "c5cc99a7dd1265fb3240116e404f2d81", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9977595220313666, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n \nfun main(args: Array) {\n var t = readInt()\n while (t--) {\n var n = readInt();\n println((n-1)/2);\n }\n \n}", "lang": "Kotlin", "bug_code_uid": "93a7f6fe11e85b6fa4d0a0dcdb7ee1ae", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "fe5af4d95137bbec81aee2a7fae16489", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.951417004048583, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n \nfun main(){\n var t = readInt()\n while(t-- > 0){\n var (a) = readInts()\n val x = a/2\n val y = a%2\n val sum = x - y + 1\n println($sum)\n }\n}", "lang": "Kotlin", "bug_code_uid": "72e5bd28db6c6283f8d4355026ea4097", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "1995e623875c1c699c8a2be57fc594a1", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9639344262295082, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.math.BigInteger\n\n/**\n * @author Ulire\n * @date 2020/11/12 13:28\n **/\n\nsuspend fun main() {\n val t =readLine()!!.toInt();\n IntRange(1,t).forEach { _ ->\n run {\n println(readLine()!!.toBigInteger().minus(BigInteger.ONE).divide(BigInteger.TWO))\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "fb4393cecafd00e713566f46597e709c", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "f9acec65fa3f36edb14c93304a569bba", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9782793867120954, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.lang.StringBuilder\nimport java.util.*\n\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n val n = sc.nextLong()\n val m = sc.nextLong()\n var ans = ModInt(n - 2) * ModInt(2).pow(n - 3) * comb(ModInt(m), ModInt(n - 1))\n println(ans)\n}\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n\nprivate class ModInt(x: Long) {\n\n companion object {\n const val MOD = 998244353L\n }\n\n val x = (x % MOD + MOD) % MOD\n\n operator fun plus(other: ModInt): ModInt {\n return ModInt(x + other.x)\n }\n\n operator fun minus(other: ModInt): ModInt {\n return ModInt(x - other.x)\n }\n\n operator fun times(other: ModInt): ModInt {\n return ModInt(x * other.x)\n }\n\n operator fun div(other: ModInt): ModInt {\n return this * other.inv()\n }\n\n fun pow(exp: Long): ModInt {\n if (exp == 0L) return ModInt(1L)\n var a = pow(exp shr 1)\n a *= a\n if (exp and 1L == 0L) return a\n return this * a\n }\n\n fun inv(): ModInt {\n return this.pow(MOD - 2)\n }\n\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as ModInt\n\n if (x != other.x) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return x.hashCode()\n }\n\n override fun toString(): String {\n return \"$x\"\n }\n\n}\n\nprivate fun fact(n: ModInt): ModInt {\n return (2..n.x).fold(ModInt(1L)) { acc, l -> acc * ModInt(l) }\n}\n\nprivate fun comb(n: ModInt, k: ModInt): ModInt {\n return fact(n) / fact(k) / fact(n - k)\n}\n\nprivate fun comb2(n: Long, k: Long): ModInt {\n var ans = ModInt(1)\n for (i in 0 until k) {\n ans = ans * ModInt(n - i) / ModInt(k - i)\n }\n return ans\n}\n", "lang": "Kotlin", "bug_code_uid": "4c3339319bfe610c1599de725b61ca3d", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "apr_id": "642d42f2babe0551361838e181ef52be", "difficulty": 1700, "tags": ["math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9892163910855499, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.lang.Math.*\nimport java.util.*\n\nval scanner = Scanner(System.`in`)\nval fastReader = BufferedReader(InputStreamReader(System.`in`))\nval output = StringBuilder()\nval INF = Long.MAX_VALUE\nval mod = 998244353L\nval N = 200005\n\nval fact = LongArray(N)\nfun fillFact() {\n fact[0] = 1\n for (i in 1 until N) {\n fact[i] = (fact[i - 1] * i) % mod\n }\n}\n\nfun mult(x: Long, y: Long) = (x * y) % mod\n\nfun binPow(x: Long, y: Long): Long {\n if (y == 1L) return x\n return if (y and 1 == 0L) {\n val temp = binPow(x, y / 2)\n mult(temp, temp)\n } else mult(binPow(x, y - 1), x)\n}\n\nfun inv(x: Long) = binPow(x, mod - 2)\n\nfun divide(x: Long, y: Long) = mult(x, inv(y))\nfun readInt() = fastReader.readLine()!!.toInt()\nfun readInts() = fastReader.readLine()!!.split(\" \").map { it.toInt() }\nfun readLong() = fastReader.readLine()!!.toLong()\nfun readLongs() = fastReader.readLine()!!.split(\" \").map { it.toLong() }\nfun readDouble() = fastReader.readLine()!!.toDouble()\nfun readDoubles() = fastReader.readLine()!!.split(\" \").map { it.toDouble() }\n\nfun main() {\n fillFact()\n val n = scanner.nextInt()\n val m = scanner.nextInt()\n println(\n if (n == 2) 0 else mult(\n divide(fact[m], mult(fact[n - 1], fact[m - n + 1])),\n mult(n - 2L, binPow(2, n - 3L))\n )\n )\n}", "lang": "Kotlin", "bug_code_uid": "d63239941e92249f6b13eddae3198e5f", "src_uid": "28d6fc8973a3e0076a21c2ea490dfdba", "apr_id": "2b3a9b1d5741c1a4452e4668844fa1b4", "difficulty": 1700, "tags": ["math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9958197863446354, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nclass ProblemIO(val rd: BufferedReader, val wr: PrintWriter) {\n var tok = StringTokenizer(\"\")\n\n companion object {\n fun console() = ProblemIO(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))\n fun files(inputFilename: String, outputFilename: String) =\n ProblemIO(BufferedReader(FileReader(File(inputFilename))), PrintWriter(File(outputFilename)))\n }\n\n fun readToken(): String {\n while (!tok.hasMoreTokens()) {\n tok = StringTokenizer(rd.readLine())\n }\n return tok.nextToken()\n }\n\n fun readInt(): Int = readToken().toInt()\n fun print(v: T) = wr.print(v)\n fun println(v: T) = wr.println(v)\n fun close() {\n rd.close()\n wr.close()\n }\n}\n\nfun solve() {\n val io = ProblemIO.console()\n val a = IntArray(5, { io.readInt() })\n val s = a.sum()\n val res = if (s % a.size == 0) s / a.size else -1\n io.println(res)\n io.close()\n}\n\nfun main(args: Array) {\n Thread({ solve() }).start()\n}\n", "lang": "Kotlin", "bug_code_uid": "b57c5e71d90f22160d60bf23768fc374", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "7c06f831d09ea691fc14d9dca966c1c5", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9642857142857143, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val l = r.readLine()!!.split(\" \").map { it.toInt() }\n println(if (l.sum()%5==0) l.sum()/5 else -1)\n}", "lang": "Kotlin", "bug_code_uid": "6a40890a63a80adb49bca699a1352391", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "017947c6717039de122fff09b0e2faeb", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9783132530120482, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.absoluteValue\n\nfun main(args: Array) {\n val m = readLine()!!.split(' ').map { it.toInt() }.sum()\n if (m.rem(5) == 0)\n println(m / 5)\n else\n println(-1)\n}", "lang": "Kotlin", "bug_code_uid": "5a7460ba6e0ddc926b4aff2dff7bcf74", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "adc17927a22941a5cb0d83f9e232be5a", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9635627530364372, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val a = readLine()!!.split(\" \").map { it.toInt() }.sum()\n print(if (a % 5 == 0) a.div(5) else -1)\n}", "lang": "Kotlin", "bug_code_uid": "9a1543e84c91a8b55d5b84e544be99f7", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "aeeca535e87166eb8d7416cb11abc7a3", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9781181619256017, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args : Array) {\n val bets_nullable_str = readLine()\n if (bets_nullable_str == null) {\n // Do nothing ...\n } else {\n val bets_str = bets_nullable_str\n val bets = bets_str.split(' ').map(String::toInt)\n val sum_bets = bets.sum()\n if ((sum_bets % 5) == 0) {\n val result = sum_bets / 5\n println(\"${result}\")\n } else {\n println(\"-1\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "b36eb69bcf5c64b3cdf27436030c4101", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "2e3fb6d7425e0945a6555bdf721b7c93", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7888198757763976, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n println(readLine()!!.split(' ').map { it.toInt() }.let { if (it.sum() % 5 == 0) it.sum()/5 else -1 })\n}", "lang": "Kotlin", "bug_code_uid": "3fbae844a397b2da2509f08a83714d50", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "c3d387a4e4e4283c5593f83183247114", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9701897018970189, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val sum = readLine()!!.split(' ').map { it.toInt() }.reduce { total, next -> total + next }\n println(if (sum % 5 == 0) sum / 5 else \"-1\")\n}\n", "lang": "Kotlin", "bug_code_uid": "34c6bc27e0c2cd23c6255e63c36afd9a", "src_uid": "af1ec6a6fc1f2360506fc8a34e3dcd20", "apr_id": "9e98e163fedb336b5307cbd5757c20cb", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9469200524246396, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\nimport java.util.Collections.min\nimport kotlin.math.min\n\nfun main() {\n val r = FastReader()\n val n = r.nextInt()\n print(solve(n))\n\n}\n\nfun isp(m:Int): Int {\n var i : Int= 2\n while(i * i <= m){\n if(m % i == 0){\n return (m / i)\n }\n i ++\n }\n return 1\n}\n\nfun solve(n:Int):Int{\n var k = isp(n)\n if(k < 3) return k\n var m = n-1\n while(isp(m) != 1){\n m --\n }\n //println(m)\n return 1 +solve( n - m)\n\n}\n@Suppress(\"MemberVisibilityCanBePrivate\")\ninternal class FastReader {\n private val br = BufferedReader(InputStreamReader(System.`in`))\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n var t = tokenizer\n while (t == null || !t.hasMoreElements())\n t = StringTokenizer(br.readLine())\n tokenizer = t\n return t.nextToken()\n }\n\n fun nextInt():Int= next().toInt()\n\n fun nextLong(): Long = next().toLong()\n\n fun nextDouble(): Double = next().toDouble()\n\n fun nextLine(): String = br.readLine()\n\n fun nextIntArr(n: Int): IntArray = IntArray(n) { nextInt() }\n\n fun nextDoubleArr(n: Int): DoubleArray = DoubleArray(n) { nextDouble() }\n\n fun nextLongArr(n: Int): LongArray = LongArray(n) { nextLong() }\n\n fun nextIntArr2(n: Int, m: Int): Array = Array(n) { IntArray(m) { nextInt() } }\n\n fun nextLongArr2(n: Int, m: Int): Array = Array(n) { LongArray(m) { nextLong() } }\n}", "lang": "Kotlin", "bug_code_uid": "9a04131229c445c701b793432d9c14f0", "src_uid": "684ce84149d6a5f4776ecd1ea6cb455b", "apr_id": "1170474a9bfe7bd753c9cf405718930f", "difficulty": 1600, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9981801637852593, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val A = na(3).map{it.toLong()}\n val S = A.sum()\n val remain = min(\n max(0, A[0] - 2 * (A[1] + A[2]))\n , min(\n max(0, A[1] - 2 * (A[0] + A[2]))\n , max(0, A[2] - 2 * (A[0] + A[1]))\n )\n )\n out.println((S - remain) / 3)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n, offset) { ni() }\n }\n\n private inline fun map(n: Int, offset: Int = 0, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i + offset)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun pair(a: A, b: B) = RPair(a, b)\ndata class RPair(val _1: A, val _2: B)\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "59dc3043933532deaabad8c9d252f574", "src_uid": "bae7cbcde19114451b8712d6361d2b01", "apr_id": "1c0530be610450ef20c4ca0fc25ba1fb", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9165659008464329, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val (n, time) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n val s1 = r.readLine()!!.split(\"\").filter { it.length>0 }.map { it.toInt() }.map { if (it>=5) 9-it else it }\n println(s1.joinToString(\"\"))\n}", "lang": "Kotlin", "bug_code_uid": "e2ef41de049505f29944eb6609bcdeda", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "apr_id": "eb889fa44175b3766be36f6b5e2fb450", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7973421926910299, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n readLine()!!.withIndex().forEach { char ->\n val min = 9 - (char.value - '0')\n if (min < (char.value - '0') && (min != 0 || char.index > 0)) {\n print(min)\n } else if (min == 0) {\n print(1)\n } else {\n print(char.value)\n }\n }\n println()\n}\n", "lang": "Kotlin", "bug_code_uid": "0188e97db9d4acbb42ade30f24b6cff5", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "apr_id": "d45f432f5f4a4f1c1e82b0b4c38df3a6", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5509090909090909, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n var x = br.readLine().toLong()\n val ans = ArrayList()\n while (x > 0) {\n val digit = x % 10\n if (digit >= 5) {\n ans.add(9 - digit)\n } else {\n ans.add(digit)\n }\n x /= 10\n }\n println(ans.joinToString(\"\"))\n}", "lang": "Kotlin", "bug_code_uid": "6f99e1f2337cfecafede0dbfbcd7e676", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "apr_id": "8de1a6af638af94e61c797d842b3d41a", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9527145359019265, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val x = readLine()!!.toCharArray()\n var first = true\n print(x.asSequence().map {\n if (!first && it > '4') {\n first = false\n '9' - it\n } else {\n first = false\n it\n }\n }.joinToString(\"\"))\n}", "lang": "Kotlin", "bug_code_uid": "8dcfbf20fce4dd4801bde7e0fcdb851a", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "apr_id": "fb6db9162b094b292e88d098d8cb1bac", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9967845659163987, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array){\n //val ( n, m ) = readLine()!!.split(' ').map(String::toInt)\n var s = readLine()!!\n print( if( s[0] >= '5' && s[0] != '9' ) '9' - s[0] else s[0] )\n s = s.removeRange(0, 0)\n for( i in s ){\n print( if ( i >= '5' ) '9' - i else i )\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "562242c6b235759ad670bfe4c025d2ac", "src_uid": "d5de5052b4e9bbdb5359ac6e05a18b61", "apr_id": "fddc0d7e302cd8864f05accaae90ddd5", "difficulty": 1200, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4410339256865913, "equal_cnt": 24, "replace_cnt": 17, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 25, "bug_source_code": "fun readInts(): List = readLine()!!.split(\" \").map{ it.toInt() }\n\nfun main(){\n var (m, s) = readInts()\n val digits = (9 downTo 0).toMutableList()\n val result = mutableListOf()\n var index = 0\n while(m != 0 || s != 0){\n if(s - digits[index] >= 0){\n result.add(digits[index])\n s -= digits[index]\n m --\n }\n if(s < digits[index]){\n index ++\n }\n }\n if(result.isEmpty() || result.reduce{acc: Int, i: Int -> acc+i } == 0){\n println(\"-1 -1\")\n return\n }\n val resultStringHigh = result.joinToString(separator = \"\")\n val resultStringLow = if(resultStringHigh[resultStringHigh.lastIndex]!='0'){\n resultStringHigh.reversed()\n }\n else{\n val aux = StringBuilder()\n aux.append(resultStringHigh.reversed())\n aux[0] = aux.first { it != '0' }.also { aux[aux.indexOfFirst { it != '0' }]= aux[0] }\n aux.toString()\n }\n println(\"$resultStringLow $resultStringHigh\")\n}", "lang": "Kotlin", "bug_code_uid": "64db957efeb8912a49699181017450da", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "31c6f4e15515e09dce83a340f1850cff", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9871661463753035, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.max\n\nfun readInts(): List = readLine()!!.split(\" \").map{ it.toInt() }\nfun findMin(m: Int, s: Int): String{\n val digits = (m-2 downTo 0).toMutableList()\n if (s > m * 9) return \"-1\"\n val result = mutableListOf(max(1, s - 9*(m-1)))\n var auxS = s - result[0]\n var auxM = m - 1\n var index = 0\n while(auxM != 0 || auxS != 0){\n val value = max(0, auxS - 9 * digits[index])\n result.add(value)\n index ++\n auxS -= value\n auxM --\n if(auxM == 0) break\n }\n if(result.isEmpty() || auxM + auxS != 0){\n return \"-1\"\n }\n return result.joinToString(separator = \"\")\n}\nfun findMax(m: Int, s: Int): String{\n val digits = (9 downTo 0).toMutableList()\n var auxS = s\n var auxM = m\n val result = mutableListOf()\n var index = 0\n if( m == 1 && s <= 9)\n {\n return \"$s\"\n }\n while(auxM != 0 || auxS != 0){\n if(auxS - digits[index] >= 0){\n result.add(digits[index])\n auxS -= digits[index]\n auxM --\n }\n if(auxS < digits[index]){\n index ++\n }\n if(auxM == 0) break\n }\n if(result.isEmpty() || result.reduce{acc: Int, i: Int -> acc+i } == 0 || auxM + auxS != 0){\n return \"-1\"\n }\n return result.joinToString(separator = \"\")\n}\n\n\nfun main(){\n val (m, s) = readInts()\n\n println(\"${findMin(m, s)} ${findMax(m,s)}\")\n}", "lang": "Kotlin", "bug_code_uid": "4ac31a1b18745606dc3fa9b0826072be", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "31c6f4e15515e09dce83a340f1850cff", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.884318766066838, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun findMin(n: Int, sum: Int): String {\n\n\tif ( sum == 0 ) return if ( n == 1 ) \"0\" else \"-1\"\n\tif ( sum > 9*n ) return \"-1\"\n\n\tval firstDigit = Math.max(1, sum - 9*(n-1))\n\tvar left = sum - firstDigit\n\n\tval r = StringBuilder()\n\tr.append ( firstDigit )\n\tfor ( i in n-2 downTo 0 ) {\n\t\tval d = Math.max ( 0, left - 9*i )\n\t\tr.append(d)\n\t\tleft -= d\n\t}\n\n\treturn r.toString()\n}\n\nfun findMax(n: Int, sum: Int): String {\n\n\tif ( sum == 0 ) return if ( n == 1 ) \"0\" else \"-1\"\n\tif ( sum > 9*n ) return \"-1\"\n\n\tval firstDigit = Math.min(9, sum)\n\tvar left = sum - firstDigit\n\n\tval r = StringBuilder()\n\tr.append(firstDigit)\n\tfor ( i in n-2 downTo 0 ) {\n\t\tval d = Math.min( 9, left )\n\t\tr.append(d)\n\t\tleft -= d\n\t}\n\n\treturn r.toString()\n}\n\nfun main(args : Array) {\n\tval scan = Scanner (System.`in`)\n\tval n = scan.nextInt()\n\tval sum = scan.nextInt()\n\n\tval minSum = if ( n == 1 ) 0 else n\n\tval maxSum = n*9\n\n\tif ( sum < minSum || sum > maxSum ) {\n\t\tprintln(\"-1 -1\")\n\t\treturn\n\t}\n\n\tprintln ( findMin(n,sum) + \" \" + findMax(n, sum) )\n}", "lang": "Kotlin", "bug_code_uid": "b37e2998be7469f77788f3b65c2283f8", "src_uid": "75d062cece5a2402920d6706c655cad7", "apr_id": "e142fbdbcd2b59f7cd286c1fb919c15e", "difficulty": 1400, "tags": ["dp", "greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9938398357289527, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array){\n val s = Scanner(System.`in`)\n val m = s.nextInt()\n val n = s.nextInt()-2\n val k = s.nextInt()-1\n val mn = 2*m+2*n\n var c = 0\n for (i in 0..k) c+=mn-(4*(i))\n print(c)\n}", "lang": "Kotlin", "bug_code_uid": "9377b6704614986d68203f21ab1f8020", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "apr_id": "06ba1ad8a9e6f1452fb1b205f9104e7d", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7747747747747747, "equal_cnt": 15, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "fun main(args: Array) {\n\n\tval Xarr = readLine()!!.split(' ').map { it.toInt() }\nvar answer = 0\n\tfor(i in 1 until Xarr[2]+1){\n\t\tanswer += ((Xarr[0]/i-1)+(Xarr[1]/i-1))*2\n\t}\n\tif(Xarr[2]>1) answer += Xarr[2]\n\tprintln(answer)\n}", "lang": "Kotlin", "bug_code_uid": "9448b86c75986c7a1c7477428fecb789", "src_uid": "2c98d59917337cb321d76f72a1b3c057", "apr_id": "a18a4e18c0a2159ace74a98eeb552604", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9939903846153846, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\nfun main(args : Array){\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n var k: Int = reader.nextInt()\n var list1: MutableList = mutableListOf()\n var b = 0\n for(i in 2..n){\n if(checkPrime(i) == 1) {\n for (j in 2..i) {\n if (checkPrime(j) == 1) {\n list1.add(j)\n }\n }\n for (x in 1..list1.size - 1) {\n if (list1[x - 1] + list1[x] + 1 == i) {\n b++\n }\n }\n list1.clear()\n }\n }\n\n if(b>=k){ println(\"YES\")}\n else { println(\"NO\")}\n\n\n}\n\n fun Prime(n: Int):Int{\n var a = 0\n for(i in 2..n/2) {\n if (n % i==0) {\n a++\n }\n }\n if(a==0) return 1\n else return 0\n }\n\n", "lang": "Kotlin", "bug_code_uid": "eb005d2740116208da10037e6753abcd", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "apr_id": "eaf2b0b19d1f904f7a6b76e9193fa07c", "difficulty": 1000, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9897773421089483, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\n\nclass InputReader(val stream: InputStream) {\n val buf = ByteArray(1024)\n var curChar: Int = 0\n var numChars: Int = 0\n\n fun read(): Char {\n if (numChars == -1)\n throw InputMismatchException()\n if (curChar >= numChars) {\n curChar = 0\n try {\n numChars = stream.read(buf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n if (numChars <= 0)\n return '\\uFFFF'\n }\n return buf[curChar++].toChar()\n }\n\n fun nextInt(): Int {\n var c = read()\n while (isSpaceChar(c))\n c = read()\n var sgn = 1\n if (c == '-') {\n sgn = -1\n c = read()\n }\n var res = 0\n do {\n if (c < '0' || c > '9')\n throw InputMismatchException()\n res *= 10\n res += c.toInt() and 15\n c = read()\n } while (!isSpaceChar(c))\n return res * sgn\n }\n\n fun nextLong(): Long {\n var c = read()\n while (isSpaceChar(c))\n c = read()\n var sgn = 1\n if (c == '-') {\n sgn = -1\n c = read()\n }\n var res = 0L\n do {\n if (c < '0' || c > '9')\n throw InputMismatchException()\n res *= 10\n res += c.toInt() and 15\n c = read()\n } while (!isSpaceChar(c))\n return res * sgn\n }\n\n fun nextString(): String {\n var c = read()\n while (isSpaceChar(c))\n c = read()\n val res = StringBuilder()\n do {\n res.append(c)\n c = read()\n } while (!isSpaceChar(c))\n return res.toString()\n }\n\n fun isSpaceChar(c: Char): Boolean {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == '\\uFFFF'\n }\n}\n\nclass OutputWriter(val stream: OutputStream) {\n val buf = ByteArray(65536)\n var curPos: Int = 0\n\n fun write(c: Char) {\n if (buf.size - curPos < 1) flush()\n buf[curPos++] = c.toByte()\n }\n\n fun write(s: String) {\n if (buf.size - curPos < s.length) flush()\n var idx = 0\n if (s.length > buf.size) {\n var remaining = s.length\n while (remaining > buf.size) {\n while (curPos < buf.size) buf[curPos++] = s[idx++].toByte()\n flush()\n remaining -= buf.size\n }\n }\n while (idx < s.length) buf[curPos++] = s[idx++].toByte()\n }\n\n fun flush() {\n stream.write(buf, 0, curPos)\n curPos = 0\n }\n}\n\nfun isprime(n: Int): Boolean {\n if (n == 2 || n == 3)\n return true\n if (n % 2 == 0 || n % 3 == 0 || n == 1)\n return false\n var i = 5\n var w = 2\n while (i * i <= n) {\n if (n % i == 0)\n return false\n i += w\n w = 6 - w\n }\n return true\n}\n\nfun main(args: Array) {\n if (args.isNotEmpty()) System.setIn(FileInputStream(args[0]))\n val ir = InputReader(System.`in`)\n val ow = OutputWriter(System.out)\n\n var answer = 0\n val n = ir.nextInt()\n val k = ir.nextInt()\n for (i in 2 .. n / 2) {\n if (!isprime(i)) continue\n for (j in i + 1 .. n / 2) {\n if (!isprime(j)) continue\n if (isprime(i + j + 1) && (i + j + 1) <= n) ++answer\n break\n }\n }\n\n if (answer >= k) ow.write(\"YES\\n\")\n else ow.write(\"NO\\n\")\n ow.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "a6b273e1666f26628e34e54c9c29bb1d", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "apr_id": "ea64577d9206c557d293035bacb70107", "difficulty": 1000, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7484383872799546, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n var (n, k) = readLine()!!.split(' ').map { it.toInt() }\n var prime = Array(n + 1, { true })\n var primenumbers = mutableListOf()\n\n var p = 2\n var count = 0\n while (p * p <= n) {\n if (prime[p] == true) {\n\n for (i in p * 2..n step p) {\n prime[i] = false\n }\n }\n p++\n }\n\n for (i in 2..n) {\n if (prime[i]) {\n primenumbers.add(i)\n }\n }\n\n var i = 0\n while (i < primenumbers.size - 1) {\n var flag = false\n for (j in i + 1 until primenumbers.size) {\n if (primenumbers.contains(primenumbers[i] + primenumbers[j] + 1)) {\n count++\n primenumbers.removeAt(i)\n primenumbers.removeAt(j)\n flag = true\n break\n }\n }\n if (!flag) i++\n\n }\n println(if (count >= k) \"YES\" else \"NO\")\n\n\n}", "lang": "Kotlin", "bug_code_uid": "3da06bfaff02c2879d855e9818e2b803", "src_uid": "afd2b818ed3e2a931da9d682f6ad660d", "apr_id": "df7213b71745ff49c4751ac447f066c0", "difficulty": 1000, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9215917117965623, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.ceil\nimport kotlin.math.pow\nimport kotlin.math.sqrt\n\n//private val INPUT = File(\"input.txt\").inputStream()\n//private val OUTPUT = File(\"output.txt\").outputStream()\nprivate val INPUT = System.`in`\nprivate val OUTPUT = System.out\n\nprivate val bufferedReader = INPUT.bufferedReader()\nprivate val outputWriter = PrintWriter(OUTPUT, false)\nprivate fun readLn() = bufferedReader.readLine()!!\n\nprivate fun readList() = readLn().split(' ')\nprivate var tokenizer = StringTokenizer(\"\")\nprivate fun read(): String {\n while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLn(), \" \")\n return tokenizer.nextToken()\n}\n\nprivate fun readInt() = read().toInt()\nprivate fun readLong() = read().toLong()\nprivate fun readDouble() = read().toDouble()\n\nprivate fun readIntList() = readList().map { it.toInt() }\nprivate fun readLongList() = readList().map { it.toLong() }\nprivate fun readDoubleList() = readList().map { it.toDouble() }\n\nprivate fun readIntArray(n: Int = 0) =\n if (n == 0) readList().run { IntArray(size) { get(it).toInt() } } else IntArray(n) { readInt() }\n\nprivate fun readLongArray(n: Int = 0) =\n if (n == 0) readList().run { LongArray(size) { get(it).toLong() } } else LongArray(n) { readLong() }\n\nprivate fun readDoubleArray(n: Int = 0) =\n if (n == 0) readList().run { DoubleArray(size) { get(it).toDouble() } } else DoubleArray(n) { readDouble() }\n\n\nprivate fun Int.modPositive(other: Int): Int = if (this % other < 0) ((this % other) + other) else (this % other)\n\n\nprivate class `CF799-D2-A` {\n fun solveTestCase(): String {\n val n = readInt()\n val t = readInt()\n val k = readInt()\n val d = readInt()\n\n val countWithoutBuilding = ceil(n.toDouble()/k)\n val countBakeBeforeBuilt = ceil(t.toDouble()/d)\n \n return when ((countBakeBeforeBuilt+1) >= countWithoutBuilding) {\n true -> \"NO\"\n false -> \"YES\"\n }\n }\n}\n\nfun main(args: Array) {\n\n outputWriter.println(\n `CF799-D2-A`()\n .solveTestCase()\n )\n\n outputWriter.flush()\n}", "lang": "Kotlin", "bug_code_uid": "b8f7320b0c8644d421abf13ec049cd45", "src_uid": "32c866d3d394e269724b4930df5e4407", "apr_id": "f31afbbfc2f668711bfeda4965361a49", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7133956386292835, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner;\nimport java.util.Arrays;\nimport java.util.*; \nimport java.math.*;\nimport java.io.*;\n\nfun main(args: Array) {\n var s = Scanner(System.`in`)\n var cakes = s.nextInt()\n var oven1 = s.nextInt()\n var nocake = s.nextInt()\n var oven2 = s.nextInt()\n Carrotscake(cakes ,oven1 , nocake,oven2)\n \n}\n\nfun Carrotscake(cakes:Int,oven1:Int,nocake:Int,oven2:Int){\n var timeforoven1 = (cakes/nocake)*oven1\n var timeforoven2 =oven1 +oven2\n \n if(timeforoven1<=timeforoven2){\n println(\"NO\") \n }else{\n println(\"YES\")\n }\n \n \n}", "lang": "Kotlin", "bug_code_uid": "8301a0ec2e4e58859af784c1101aed9a", "src_uid": "32c866d3d394e269724b4930df5e4407", "apr_id": "7fbb27d8d74220986263c3e6d34233f2", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9554896142433235, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n val n = input.nextFloat()\n val t = input.nextFloat()\n val k = input.nextFloat()\n val d = input.nextFloat()\n val timeOneOven= ((n.div(k)).times(t)).minus(t)\n if (timeOneOven > d)\n println(\"YES\")\n else\n println(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "2854e1f580e31f1da5fefce44daa51e0", "src_uid": "32c866d3d394e269724b4930df5e4407", "apr_id": "1099335f3f61be924114ec46de0d4206", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.903125, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": " val input = Scanner(System.`in`)\n val n = input.nextFloat()\n val t = input.nextFloat()\n val k = input.nextFloat()\n val d = input.nextFloat()\n val timeOneOven= (ceil(n.div(k))).times(t).minus(t)\n if (timeOneOven > d)\n println(\"YES\")\n else\n println(\"NO\")", "lang": "Kotlin", "bug_code_uid": "0e68ebc54c00305e942ed44bee2d21ad", "src_uid": "32c866d3d394e269724b4930df5e4407", "apr_id": "1099335f3f61be924114ec46de0d4206", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9689158453373768, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n var (n, t, k, d) = readLine()!!.split(\" \").map{ it.toInt() }\n var time_A = n / k * t\n var time_B = 0\n var oven1 = false\n var oven2 = false\n while(true) {\n if(time_B % t == 0){\n oven1 = false\n if(n > 0) {\n n -= k\n oven1 = true\n }\n }\n if(time_B >= d && (time_B - d) % t == 0) {\n oven2 = false\n if(n > 0) {\n n -= k\n oven2 = true\n }\n }\n if(!oven1 && !oven2) break\n time_B++\n }\n if(time_A <= time_B) println(\"NO\")\n else println(\"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "9482896728122b13c0b56014c7bc39aa", "src_uid": "32c866d3d394e269724b4930df5e4407", "apr_id": "2871f094e3fa2abe07fc4f42d93338b4", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9940119760479041, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nfun main(){\n val s=Scanner(System.`in`)\n var r=s.next()\n var n=r.length\n var x:Int = -1\n var answer:String=\"\"\n for( i in 0..n-1){\n if(r[i]=='p'){\n answer += r[i]\n x=i\n break\n }\n else\n answer += r[i]\n }\n x++\n answer += \"://\"\n for (i in x..n-1){\n if(r[i]=='r' && r[i+1]=='u'){\n answer+='.'\n answer+=\"ru\"\n x=i+1\n break\n }\n else\n answer+=r[i]\n }\n\n if(x!=n-1){\n x++\n answer+='/'\n for(i in x..n-1){\n answer+=r[i]\n }\n }\n print(answer)\n}\n", "lang": "Kotlin", "bug_code_uid": "14ada0892ac2f7f9506d4d87cb0f161a", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "apr_id": "cf9c534a6a20dc5a9679fb07b8fbf46d", "difficulty": 1100, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9802555168408827, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val s = readLine()!!\n val sb = StringBuilder()\n val startDomain = if (s.first() == 'h') {\n sb.append(\"http://\")\n 4\n } else {\n sb.append(\"ftp://\")\n 3\n }\n val domainEnd = s.indexOf(\"ru\")\n sb.append(s.substring(startDomain, domainEnd))\n sb.append(\".ru\")\n if (domainEnd + 2 != s.length) sb.append(\"/${s.substring(domainEnd + 2)}\")\n print(sb.toString())\n}", "lang": "Kotlin", "bug_code_uid": "0f00c8134c9bacd7b7c17c9a66d87bb7", "src_uid": "4c999b7854a8a08960b6501a90b3bba3", "apr_id": "94dd446102f9f72bd13c723dd716d94f", "difficulty": 1100, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8710550045085663, "equal_cnt": 19, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 14, "fix_ops_cnt": 18, "bug_source_code": "fun main() {\n var p:List = readLine().split(\" \").map {x -> x.toInt()}\n var n = p[0]\n var a = p[1]\n var b = p[2]\n var c = p[3]\n var d = p[4]\n var A = 0\n var B = a - d\n var C = (B + b) - (c)\n var D = (d + C) - (a)\n var mn = listOf(A, B, C, D).min()!!.toInt()\n if(mn < 1) {\n mn -= 1\n A -= mn\n B -= mn\n C -= mn\n D -= mn\n }\n var mx = listOf(A, B, C, D).max()!!.toInt()\n var res = (n - mx + 1)*(n)\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "44606709f5fc93c62e2bccf756be29f8", "src_uid": "b732869015baf3dee5094c51a309e32c", "apr_id": "a12b2ead554e5d1d6bea370245fe3ce8", "difficulty": 1400, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9131944444444444, "equal_cnt": 17, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 12, "fix_ops_cnt": 16, "bug_source_code": "fun main() {\n var p:List = readLine()!!.split(\" \").map {x -> x.toInt()}\n var n = p[0]\n var a = p[1]\n var b = p[2]\n var c = p[3]\n var d = p[4]\n var A = 0\n var B = a - d\n var C = (B + b) - (c)\n var D = (d + C) - (a)\n var mn = listOf(A, B, C, D).min()!!.toInt()\n if(mn < 1) {\n mn -= 1\n A -= mn\n B -= mn\n C -= mn\n D -= mn\n }\n var mx = listOf(A, B, C, D).max()!!.toInt()\n var res = (n - mx + 1)*(n)\n if(res <= 0) {\n res = 0\n }\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "199d25af990ae45977802c15ea401ff3", "src_uid": "b732869015baf3dee5094c51a309e32c", "apr_id": "a12b2ead554e5d1d6bea370245fe3ce8", "difficulty": 1400, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9642416769420469, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n val n = r.readLine()!!.toInt()\n val v = r.readLine()!!.split(\" \").map { it.toInt() }.toSet().toList().sorted()\n when(v.size){\n 1 -> println(0)\n 2 -> println(if ((v[1]-v[0])%2==0) (v[1]-v[0])/2 else (v[1]-v[0]))\n 3 -> println(if (v[2]-v[1]==v[1]-v[0]) v[2]-v[1] else -1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "ad93227c513b92261b7e94c12ad1ead3", "src_uid": "d486a88939c132848a7efdf257b9b066", "apr_id": "f0f8454c3ca48c55ee5afb52867b34a4", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6375478927203065, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*\n\n\n\nfun main(args: Array) {\n\n val sc = Scanner(System.`in`)\n\n val m = HashSet()\n val n = sc.nextInt()\n for (i in 1..n) {\n m.add(sc.nextInt())\n }\n val values = m.toList().sorted()\n when (values.size) {\n 1 -> println(0)\n 2 -> println((values[1] - values[0]) / 2)\n 3 -> {\n if (values[2] - values[1] == values[1] - values[0]) {\n println(values[2] - values[1])\n } else {\n println(-1)\n }\n }\n else -> println(-1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "9da9e5a89998b13c31a1bf3cf95ec75a", "src_uid": "d486a88939c132848a7efdf257b9b066", "apr_id": "98896605962b8201580d94470d6755bd", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4826254826254826, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args : Array) {\n val In = BufferedReader(InputStreamReader(System.`in`))\n In.readLine()\n val ints = In.readLine()!!.split(\" \").map { x -> x.toInt() }\n val dif = ints.toSortedSet().toList()\n System.out.println(dif)\n val abs = mutableListOf()\n var min = 100\n for(x in dif) {\n loop@ for(y in dif) {\n if(x != y) {\n if(Math.abs(y-x) % 2 == 0)\n abs.add(Math.abs(y-x)/2)\n }\n }\n\n }\n val res = abs.filter { x -> x != abs.first() }\n if(res.isEmpty())\n System.out.println(abs.first())\n else\n System.out.println(-1)\n}", "lang": "Kotlin", "bug_code_uid": "de4651016926050b3c1d0ff220adeac4", "src_uid": "d486a88939c132848a7efdf257b9b066", "apr_id": "116f5bf629b99b4eeb8cdac9f110d624", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4941022280471822, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args : Array) {\n val In = BufferedReader(InputStreamReader(System.`in`))\n In.readLine()\n val ints = In.readLine()!!.split(\" \").map { x -> x.toInt() }\n val dif = ints.toSortedSet().toList()\n val abs = mutableListOf()\n var min = 100\n for(x in dif) {\n loop@ for(y in dif) {\n if(x != y) {\n if(Math.abs(y-x) % 2 == 0)\n abs.add(Math.abs(y-x)/2)\n }\n }\n\n }\n val res = abs.filter { x -> x != abs.first() }\n if(res.isEmpty())\n System.out.println(abs.first())\n else\n System.out.println(-1)\n}", "lang": "Kotlin", "bug_code_uid": "2c9d892ae856b5c5f18145b1f1c24a1d", "src_uid": "d486a88939c132848a7efdf257b9b066", "apr_id": "116f5bf629b99b4eeb8cdac9f110d624", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8982857142857142, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\n\n//ndiff <= 3\n//1 win\n\n//2 one shift\n\n//3 middle shift, without mod\nfun main() {\n val scan = Scanner(System.`in`)\n scan.nextLine()\n val intArray = scan.nextLine()\n .split(\" \")\n .map {\n it.trim()\n .toInt()\n }\n .toIntArray()\n\n val set = intArray.toSet()\n\n val size = set.size\n when (size) {\n 0 -> println(0)\n 1 -> println(0)\n 2 -> println(set.max()!! - set.min()!!)\n 3 -> {\n val max = set.max()!!\n val min = set.min()!!\n val diff = max - min\n if ((diff) % 2 == 0) {\n val result = set.find { it != max && it != min }!!\n if (result == (diff / 2) + min) {\n println(diff / 2)\n return\n }\n }\n println(\"-1\")\n }\n else -> println(\"-1\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "2b139b82798dcb18cbe597f92d4f7119", "src_uid": "d486a88939c132848a7efdf257b9b066", "apr_id": "d4438dc088c24c8af57769d93696f22d", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.808455565142364, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n val Len: Int = inp.nextInt()\n var NumsArr = HashSet()\n for(i in 0 until Len) {\n val valueOFINT = inp.nextInt()\n NumsArr.add(valueOFINT)\n }\n\n NumsArr.sortedWith(compareBy {it})\n\n if(NumsArr.size==1) {\n println(0)\n }else if(NumsArr.size == 2) {\n var getMid = NumsArr.last()-NumsArr.first()\n getMid = if(getMid< 0) getMid*(-1) else getMid\n if(getMid %2 == 0) {\n println(getMid/2)\n }else {\n println(getMid)\n }\n } else if(NumsArr.size > 3) {\n println(-1)\n } else if(NumsArr.size == 3) {\n var middle = NumsArr.last() - NumsArr.first()\n if(middle%2 != 0) {\n println(-1)\n }else {\n middle /= 2\n if(NumsArr.contains(NumsArr.first() + middle)) {\n println(middle)\n } else {\n println(-1)\n }\n }\n\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "a3674848415ba7c0794f599edac29802", "src_uid": "d486a88939c132848a7efdf257b9b066", "apr_id": "c9f8c28ed156ea568c9d9489408feda5", "difficulty": 1200, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984871406959153, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array): Unit = with(Scanner(System.`in`)) {\n val array: Array = arrayOf(nextInt(), nextInt(), nextInt())\n array.sort()\n when {\n (array[0] == 1).toInt() + (array[1] == 1).toInt() + (array[2] == 1).toInt() == 1 -> println(\"YES\")\n (array[0] == 2).toInt() + (array[1] == 2).toInt() + (array[2] == 2).toInt() >= 2 -> println(\"YES\")\n (array[0] == 3).toInt() + (array[1] == 3).toInt() + (array[2] == 3).toInt() == 3 -> println(\"YES\")\n array[0] == 2 && array[1] == 4 && array[2] == 4 -> println(\"YES\")\n else -> println(\"NO\")\n\n }\n}\n\nfun Boolean.toInt() = if (this) 1 else 0\n", "lang": "Kotlin", "bug_code_uid": "c70d5460d4414a2d84d3802bd1c3cac9", "src_uid": "df48af9f5e68cb6efc1214f7138accf9", "apr_id": "d6ae2d25c28da9260ea831e434895446", "difficulty": 1400, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8538812785388128, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun readInts(): List {\n return readLine()!!.split(' ').map { it.toInt() }\n}\n\nfun main(args: Array) {\n val (x) = readInts()\n\n if (x % 2 == 0) {\n print(1)\n } else {\n print(0)\n }\n}", "lang": "Kotlin", "bug_code_uid": "edf76d04cc67c9e218906267c2f81f91", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "apr_id": "322ca9e50a9812397fa4f1342c9b8120", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9142300194931774, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(args: Array) {\n val reader = Reader()\n val firstString = reader.next()\n val secondString = reader.next()\n var count = 0\n for (i in 0 until firstString.length) {\n val firstStringChar = firstString.elementAt(i).toLowerCase()\n val secondStringChar = secondString.elementAt(i).toLowerCase()\n count += firstStringChar - secondStringChar\n }\n println(when {\n count > 0 -> 1\n count < 0 -> -1\n else -> 0\n })\n}\n\ninternal class Reader {\n var br: BufferedReader\n var st: StringTokenizer? = null\n\n init {\n br = BufferedReader(InputStreamReader(System.`in`))\n }\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreElements()) {\n try {\n st = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n }\n return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLine(): String {\n var str = \"\"\n try {\n str = br.readLine()\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n return str\n }\n}", "lang": "Kotlin", "bug_code_uid": "049e20f2e31973e853df23d78a806671", "src_uid": "ffeae332696a901813677bd1033cf01e", "apr_id": "5247a0e475d09422226e81c515724687", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9968152866242038, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(args: Array) {\n val reader = Reader()\n val firstString = reader.next()\n val secondString = reader.next()\n for (i in 0..firstString.length) {\n val firstStringChar = firstString.elementAt(i).toLowerCase()\n val secondStringChar = secondString.elementAt(i).toLowerCase()\n if (firstStringChar - secondStringChar > 0) {\n println(1)\n return\n }\n if (firstStringChar - secondStringChar < 0) {\n println(-1)\n return\n }\n }\n println(0)\n}\n\ninternal class Reader {\n var br: BufferedReader\n var st: StringTokenizer? = null\n\n init {\n br = BufferedReader(InputStreamReader(System.`in`))\n }\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreElements()) {\n try {\n st = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n }\n return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLine(): String {\n var str = \"\"\n try {\n str = br.readLine()\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n return str\n }\n}", "lang": "Kotlin", "bug_code_uid": "4dd4b4d106a9802c8c781fa24bfef259", "src_uid": "ffeae332696a901813677bd1033cf01e", "apr_id": "5247a0e475d09422226e81c515724687", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.37730870712401055, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "fun main() {\n\n val firstString = readLine()?.toLowerCase()\n val secondString = readLine()?.toLowerCase()\n var firstCount =0\n var secondCount=0\n for(i in firstString?.indices!!) {\n firstCount += firstString[i].toInt()\n secondCount += secondString?.get(i)?.toInt()!!\n }\n\n when {\n firstCount > secondCount -> print(\"1\")\n firstCount < secondCount -> print(\"-1\")\n firstCount == secondCount -> print(\"0\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "3672c6c1367dd8689695f1be730fd45d", "src_uid": "ffeae332696a901813677bd1033cf01e", "apr_id": "3903f01e110ac57039ed646af15c74e0", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6107634543178974, "equal_cnt": 14, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n var s1 = sc.next().toLowerCase()\n var s2 = sc.next().toLowerCase()\n if (s1.equals(s2)) {\n print(0)\n return\n }\n var n1 = 0;\n var n2 = 0;\n for (i in 0..s1.length - 1) {\n n1 += s1[i].toInt()\n n2 += s2[i].toInt()\n }\n if (n1 > n2) print(1)\n else print(-1)\n}", "lang": "Kotlin", "bug_code_uid": "6fa91fe17d160134102a260326aea871", "src_uid": "ffeae332696a901813677bd1033cf01e", "apr_id": "6c1f86b93a13544c5d71717881ecd1b1", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.817258883248731, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\nvar s:String=readLine()!!.toString()\nvar se:String=readLine()!!.toString()\n\n var f =true\n s=s.substring(0,s.length).toLowerCase()\n se=se.substring(0,se.length).toLowerCase()\n\nif(s==se)print(0)\n\nelse {\n for(i in 0..s.length-1)\n {\n if(s[i].toLowerCase()){\n val input = Scanner(System.`in`)\n\n val n=input.nextInt()\n val l=input.nextLong()\n val c=Array(n){ input.nextInt() }\n\n val ans = Array(n) {if (it==0) l else 0L}\n (1 until n).forEach {\n var remVal = 0L\n var remNum = 0L\n (0 until it).forEach { i ->\n if (c[it] <= c[i]) {\n ans[it] = ans[i] + 1 shr it - i\n ans[i] = 0\n } else if (c[it] <= c[i] shl it - i) {\n ans[it] += ans[i] shr it - i\n ans[i] = ans[i] % (1L shl it - i)\n\n remNum += ans[i] shl i\n remVal += ans[i] * c[i]\n }\n }\n if (remVal > c[it]) {\n (0 until it).filter { i -> c[it] <= c[i] shl it - i && c[it] > c[i] }.forEach {\n ans[it] = 0\n }\n ans[it]+=1L\n }\n }\n println(ans.mapIndexed { index, ac -> ac*c[index] }.sum())\n}", "lang": "Kotlin", "bug_code_uid": "70baea6aef1bfbcce92b580fbffc9110", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "apr_id": "bee140bf513d24a06d69d19b8358c975", "difficulty": 1600, "tags": ["dp", "greedy", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7738287560581584, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 8, "fix_ops_cnt": 16, "bug_source_code": "//package c913\n\nimport java.util.*\nimport kotlin.math.max\n\nfun main(a:Array){\n val input = Scanner(System.`in`)\n\n val n=input.nextInt()\n val l=input.nextInt()\n val c=Array(n){ input.nextInt() }\n\n println(find(c,l))\n}\n\nfun find (c:Array,W:Int):Long {\n if (W == 0) return 0\n val amount = Array(c.size){ max(1,W shr it) }\n val rem = amount.mapIndexed { index, m -> max(0,W - (m shl index)) }\n val ans = rem.mapIndexed { index,remain -> find(c,remain) + c[index]*amount[index].toLong() }\n return ans.min()!!\n}", "lang": "Kotlin", "bug_code_uid": "d9fb3d2a9df7a34e0c5e386ce08b4093", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "apr_id": "bee140bf513d24a06d69d19b8358c975", "difficulty": 1600, "tags": ["dp", "greedy", "bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.956089478044739, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "//package cf913.c\n\nimport java.util.*\nimport kotlin.math.max\n\nfun main(a:Array){\n val input = Scanner(System.`in`)\n\n val n=input.nextInt()\n val l=input.nextInt()\n val c=Array(n){ input.nextInt() }\n\n val ans = hashMapOf()\n println(find(c,l,ans))\n}\n\nfun find (c:Array,W:Int,map:MutableMap):Long =\n map[W] ?: Array(c.size) {\n val single = 1 shl it //\u5355\u4f4d\u4ef7\u503c\n c[it] * max(1, W / single).toLong() +\n if (single >= W) 0\n else find(c, W % single, map)\n }.min()!!\n .also { map.put(W, it) }", "lang": "Kotlin", "bug_code_uid": "b4a553ae341847896d3449e4596df791", "src_uid": "04ca137d0383c03944e3ce1c502c635b", "apr_id": "bee140bf513d24a06d69d19b8358c975", "difficulty": 1600, "tags": ["dp", "greedy", "bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7843866171003717, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val m = sc.nextInt()\n val a = sc.nextInt()\n val b = sc.nextInt()\n \n val o = b*(n%m)\n val u = a*(m-n%m)\n println(if (o < u) o else u)\n}", "lang": "Kotlin", "bug_code_uid": "ca1e53459b131727519655e9f72fcc60", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "79f719e411bd35c0e672d92addd0522b", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9938107869142352, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var (n, m, a, b) = readInts()\n if (n < m) {\n var t = (m - n) * a\n var g = n * b\n println(minOf(t,g))\n } else {\n var t = (n % m) * b\n var g = (m - (n % m)) * a\n println(minOf(t, g))\n }\n}\n\n\nprivate fun readInts(): List = readLine()!!.split(' ').map { it.toInt() }\nprivate fun readLongs(): List = readLine()!!.split(' ').map { it.toLong() }\nprivate fun readInt(): Int = readLine()!!.toInt()\nprivate fun readLong(): Long = readLine()!!.toLong()\nprivate fun readStr(): String? = readLine()!!", "lang": "Kotlin", "bug_code_uid": "b8e2bfc363ff5cf5583d01186cf468bd", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "78931e92df2d59b688c9a3f39d443757", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6613290632506005, "equal_cnt": 16, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 17, "bug_source_code": "fun main(args: Array) {\n val reader = Scanner(System.`in`)\n var m = 0\n var n = 0\n var a = 0\n var b = 0\n\n reader.nextLine().split(\" \").forEachIndexed { index, s ->\n when(index){\n 0 -> n = s.toInt()\n 1 -> m = s.toInt()\n 2 -> a = s.toInt()\n 3 -> b = s.toInt()\n }\n }\n\n var build = 0\n var decrease = 0\n var buildDiff = 0\n var decreaseDiff = 0\n\n while ((n + buildDiff) % m != 0){\n buildDiff++\n build += a\n\n }\n\n while ((n - decreaseDiff) % m != 0){\n decreaseDiff++\n decrease += b\n }\n\n if (build < decrease){\n println(build)\n } else {\n println(decrease)\n }\n}", "lang": "Kotlin", "bug_code_uid": "a1411906bc683e6e432d93095ea218e5", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "4629265aae72141217537e586c42b8b1", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6808176100628931, "equal_cnt": 16, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 17, "bug_source_code": "\nimport java.util.*\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n var m = 0\n var n = 0\n var a = 0\n var b = 0\n\n reader.nextLine().split(\" \").forEachIndexed { index, s ->\n when(index){\n 0 -> n = s.toInt()\n 1 -> m = s.toInt()\n 2 -> a = s.toInt()\n 3 -> b = s.toInt()\n }\n }\n\n var build = 0\n var decrease = 0\n var buildDiff = 0\n var decreaseDiff = 0\n\n while ((n + buildDiff) % m != 0){\n buildDiff++\n build += a\n\n }\n\n while ((n - decreaseDiff) % m != 0){\n decreaseDiff++\n decrease += b\n }\n\n if (build < decrease){\n println(build)\n } else {\n println(decrease)\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "be85a7d555a747db48df1d7f0f8c804c", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "4629265aae72141217537e586c42b8b1", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7050583657587549, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n var m = 0L\n var n = 0L\n var a = 0L\n var b = 0L\n\n reader.nextLine().split(\" \").forEachIndexed { index, s ->\n when(index){\n 0 -> n = s.toLong()\n 1 -> m = s.toLong()\n 2 -> a = s.toLong()\n 3 -> b = s.toLong()\n }\n }\n\n var build = 0L\n var decrease = 0L\n var buildDiff = 0L\n var decreaseDiff = 0L\n\n while ((n + buildDiff) % m != 0L){\n buildDiff++\n build += a\n\n }\n\n while ((n - decreaseDiff) % m != 0L){\n decreaseDiff++\n decrease += b\n }\n\n if (build < decrease){\n println(build)\n } else {\n println(decrease)\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "34b79ecef10ea38f866f9fb518450ac7", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "4629265aae72141217537e586c42b8b1", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8344370860927153, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n var m = 0L\n var n = 0L\n var a = 0L\n var b = 0L\n\n reader.nextLine().split(\" \").forEachIndexed { index, s ->\n when(index){\n 0 -> n = s.toLong()\n 1 -> m = s.toLong()\n 2 -> a = s.toLong()\n 3 -> b = s.toLong()\n }\n }\n\n var build =\n if (n % m == 0L) {\n 0\n } else {\n if (n > m) (m * 2 - n) * a else Math.abs(n - m) * a\n }\n var decrease = n * b\n\n if (build < decrease){\n println(build)\n } else {\n println(decrease)\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "e15ba200487fd923284e5ce9de948ce2", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "4629265aae72141217537e586c42b8b1", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9070837166513339, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.time.LocalDate\n\nfun readString() = readLine()!!\nfun readStrings() = readString().split(\" \")\nfun readInt() = readString().toInt()\nfun readInts() = readStrings().map { it.toInt() }\nfun readLong() = readString().toLong()\nfun readLongs() = readStrings().map { it.toLong() }\nfun readDouble() = readString().toDouble()\nfun readDoubles() = readStrings().map { it.toDouble() }\n\nfun runTestCases(times: Int, block: () -> Unit) {\n for (i in 1..times)\n block()\n}\n\nfun main() {\n val s = readStrings()\n if (s[2] == \"month\") {\n if (s[0].toInt() >= 30)\n println(11)\n else\n println(12)\n }\n else {\n if (s[0].toInt() == 5 || s[0].toInt() == 6)\n println(53)\n else\n println(52)\n }\n}\n\nprivate fun toDecimal(str: String): Int {\n return str.toInt(2)\n}\n\nfun reverse(num: Int) =\n num.toString().reversed().toInt()\n\nprivate operator fun String.times(n: Int): String {\n val sb = StringBuilder()\n for (i in 1..n)\n sb.append(this)\n return sb.toString()\n}\n", "lang": "Kotlin", "bug_code_uid": "b24f7c92d42e922dd61fe41279a48619", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b", "apr_id": "d499650725c8147ae1522b316292a030", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9865503453289712, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun readB() {\n val (n, k, m) = readLine()!!.split(\" \").map { it.toInt() }\n val times = readLine()!!.split(\" \").map { it.toInt() }\n val res = solveB(n, m, times)\n println(res)\n}\n\nfun solveB(n: Int, m: Int, times: List): Int {\n val fullTaskTime = times.sum()\n val fullTaskScore = times.size + 1\n return (0..n).map { fullTasksCount ->\n val timeForFullTasks = fullTaskTime * fullTasksCount\n var timeLeft = m - timeForFullTasks\n var score = fullTasksCount * fullTaskScore\n if (timeLeft < 0) {\n 0\n } else {\n val tasksLeft = n - fullTasksCount\n var currentSubTask = 0\n outer@ while (currentSubTask < times.size) {\n var currentTask = 0\n while (currentTask < tasksLeft) {\n val timeSpent = times[currentSubTask]\n val scoreToAdd = if (currentSubTask == times.size - 1) 2 else 1\n if (timeSpent <= timeLeft) {\n score += scoreToAdd\n timeLeft -= timeSpent\n } else {\n break@outer\n }\n currentTask++\n }\n currentSubTask++\n }\n score\n }\n }.max()!!\n}\n\nfun main(args: Array) {\n readB()\n}\n\n", "lang": "Kotlin", "bug_code_uid": "4baade5b94c8696a87cfbfda76bb00a9", "src_uid": "d659e92a410c1bc836be64fc1c0db160", "apr_id": "4f6d52dc634996407f66ee914bb9e865", "difficulty": 1800, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9898275099513489, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nval MAX_N = (1e6 + 10).toInt()\nval INF = (1e9 + 7).toInt()\nval MOD = (1e9 + 7).toInt()\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n val n = reader.nextInt()\n val m = reader.nextLong()\n val a = reader.nextArrayLong(n).sortedArrayDescending()\n writer.println(search(1, n, n, m, a))\n}\n\nfun search(l: Int, r: Int, n: Int, m: Long, a: LongArray): Int {\n if (l > r) {\n return -1\n }\n val x = (l + r) / 2\n if (check(x, n, m, a)) {\n val t = search(l, x - 1, n, m, a)\n return if (t != -1) t else x\n }\n return search(x + 1, r, n, m, a)\n}\n\nfun check(x: Int, n: Int, m: Long, a: LongArray): Boolean {\n val a1 = a.filter { it >= n / x }\n val n1 = a1.size\n val k1 = n1 / x\n val r1 = n1 % x\n val count = a1.sum() - x * k1 * (k1 - 1) / 2 - k1 * r1\n return count >= m\n}\n\n\nclass InputReader(stream: InputStream) {\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n repeat(count) { a[it] = nextLong() }\n return a\n }\n}", "lang": "Kotlin", "bug_code_uid": "56377afb44d5ca25b9fe2c7d7f7705df", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "apr_id": "bd3042eb3de9f05f16c7d2a95cf8cc5c", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9538917089678511, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun solve() {\n val n = readInt()\n val m = readInt()\n val a = readInts()\n Arrays.sort(a)\n a.reverse()\n\n fun check(w : Int): Boolean {\n var w = w\n var count = 0\n var ind = 0\n for (i in 0 until w)\n count += a[i]\n while (w < n)\n count += if (a[w++] - ++ind < 0) 0 else a[w - 1] - ind\n\n return count >= m\n }\n\n var left = 0\n var right = n\n while (right - left > 1) {\n var mid = (right + left) shr 1\n if (check(mid))\n right = mid\n else\n left = mid\n }\n\n out.println(if (check(right)) right else -1)\n}\n\nfun binmult(a : Long, b : Long, m : Long) : Long {\n if (a == 0L)\n return 0\n\n if (a % 2 == 1L) {\n val prev = binmult(a - 1, b, m)\n return (prev + b) % m\n } else {\n val half = binmult(a / 2, b, m)\n return (half + half) % m\n }\n}\n\nfun binpow(a: Long, n: Long, mod: Long): Long {\n var a = a\n var n = n\n var res: Long = 1\n while (n > 0) {\n if (n and 1 == 1L) {\n res = binmult(res, a, mod)\n res %= mod\n n--\n } else {\n a = binmult(a, a, mod)\n a %= mod\n n = n shr 1\n }\n }\n return res % mod\n}\n\ninline fun phi(n: Int): Int {\n var n = n\n var result = n\n var i = 2\n while (i * i <= n) {\n if (n % i == 0) {\n while (n % i == 0)\n n /= i;\n result -= result / i\n }\n ++i\n }\n if (n > 1)\n result -= result / n\n return result\n}\n\nvar out = PrintWriter(System.out)\nvar br = BufferedReader(InputStreamReader(System.`in`))\nvar st = StringTokenizer(\"\")\n\nfun main(args: Array) {\n solve()\n out.close()\n}\n\ninline fun readString(): String {\n if (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st.nextToken()\n}\n\ninline fun readLine() = br.readLine()\ninline fun readInt() = readString().toInt()\ninline fun readLong() = readString().toLong()\ninline fun readDouble() = readString().toDouble()\ninline fun readBool() = readString().toBoolean()\ninline fun readFloat() = readString().toFloat()\n\ninline fun readInts() = readLine().split(' ').map(String::toInt).toIntArray()", "lang": "Kotlin", "bug_code_uid": "beced5e7b2122464c273c6f489da4164", "src_uid": "acb8a57c8cfdb849a55fa65aff86628d", "apr_id": "206dd4238fda8cf0dc938f358b98ea38", "difficulty": 1700, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5756272401433692, "equal_cnt": 32, "replace_cnt": 25, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 31, "bug_source_code": "import java.io.*\n\nimport java.util.*\n\nfun main() {\n val tests = 1\n\n for (i in 1..tests) {\n val n = nextInt()\n val k = nextInt()\n val s = next()\n val t = next()\n writeln(solve(k, s, t))\n }\n closeWriter()\n}\n\nfun solve(k: Int, s: String, t: String): Int {\n val c = s.toCharArray()\n var res = calc(c, t)\n\n for (i in 0 until k) {\n val first = c.indexOfFirst { it != t[0] }\n val last = c.indexOfLast { it != t[1] }\n\n if (first > -1 && last > -1) {\n val firstC = c[first]\n c[first] = t[0]\n val firstRes = calc(c, t)\n c[first] = firstC\n\n val lastC = c[last]\n c[last] = t[1]\n val lastRes = calc(c, t)\n c[last] = lastC\n\n if (firstRes > lastRes) {\n c[first] = t[0]\n res = maxOf(firstRes, res)\n } else {\n c[last] = t[1]\n res = maxOf(lastRes, res)\n }\n continue\n }\n if (first != -1) {\n c[first] = t[0]\n val firstRes = calc(c, t)\n res = maxOf(res, firstRes)\n continue\n }\n if (last != -1) {\n c[last] = t[1]\n val lastRes = calc(c, t)\n res = maxOf(res, lastRes)\n continue\n }\n }\n return res\n}\n\nfun calc(c: CharArray, t: String): Int {\n var res = 0\n for (i in c.indices) {\n if (c[i] == t[0]) {\n res += c.takeLast(c.size - i - 1).count { it == t[1] }\n }\n }\n return res\n}\n\nfun writeln(x: Any) {\n fastWriter.pw.println(x)\n flushWriter()\n}\n\nfun writeln() {\n fastWriter.pw.println()\n flushWriter()\n}\n\nfun closeWriter() = fastWriter.pw.close()\n\nfun flushWriter() = fastWriter.pw.flush()\n\nobject fastWriter {\n val pw = PrintWriter(System.out)\n}\n\nfun next() = reader.next()\n\nfun nextInt() = reader.nextInt()\n\nfun nextLong() = reader.nextLong()\n\nfun nextDouble() = reader.nextDouble()\n\nfun nextLine() = reader.nextLine()\n\nobject reader {\n private var tokens: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(System.`in`))\n\n fun next(): String {\n var hasNext = tokens?.hasMoreElements() ?: false\n while (!hasNext) {\n tokens = StringTokenizer(reader.readLine())\n hasNext = tokens?.hasMoreElements() ?: false\n }\n\n return tokens!!.nextToken()\n }\n\n fun nextLine(): String {\n tokens = null\n return readLine()!!\n }\n\n fun nextInt() = next().toInt()\n\n fun nextLong() = next().toLong()\n\n fun nextDouble() = next().toDouble()\n}\n", "lang": "Kotlin", "bug_code_uid": "c50bac35113755dfe5af46c709ed4b4e", "src_uid": "9c700390ac13942cbde7c3428965b18a", "apr_id": "23e7e3fff5373cba91d9ca02195faa5e", "difficulty": 2100, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5712314591238358, "equal_cnt": 34, "replace_cnt": 25, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 33, "bug_source_code": "import java.io.*\n\nimport java.util.*\n\nfun main() {\n val tests = 1\n\n for (i in 1..tests) {\n val n = nextInt()\n val k = nextInt()\n val s = next()\n val t = next()\n writeln(solve(k, s, t))\n }\n closeWriter()\n}\n\nfun solve(p: Int, s: String, t: String): Int {\n val c = s.toCharArray()\n var res = calc(c, t)\n var k = p\n while (k > 1) {\n var (left, right) = -1 to -1\n for (l in s.indices) {\n if (c[l] == t[0]) {\n continue\n }\n for (r in s.lastIndex downTo l + 1) {\n if (c[r] == t[1]) {\n continue\n }\n val first = c[l]\n val last = c[r]\n c[l] = t[0]\n c[r] = t[1]\n val calc = calc(c, t)\n if (calc > res) {\n res = calc\n left = l\n right = r\n }\n c[l] = first\n c[r] = last\n }\n }\n if (left > -1) {\n if (c[left] != t[0]) {\n c[left] = t[0]\n k--\n }\n if (c[right] != t[1]) {\n c[right] = t[1]\n k--\n }\n } else {\n break\n }\n }\n\n if (k > 0) {\n for (i in s.indices) {\n for (v in listOf(t[0], t[1])) {\n val prev = c[i]\n c[i] = v\n res = maxOf(res, calc(c, t))\n c[i] = prev\n }\n }\n }\n\n return res\n}\n\nfun calc(c: CharArray, t: String): Int {\n var res = 0\n for (i in c.indices) {\n if (c[i] == t[0]) {\n res += c.takeLast(c.size - i - 1).count { it == t[1] }\n }\n }\n return res\n}\n\nfun writeln(x: Any) {\n fastWriter.pw.println(x)\n flushWriter()\n}\n\nfun writeln() {\n fastWriter.pw.println()\n flushWriter()\n}\n\nfun closeWriter() = fastWriter.pw.close()\n\nfun flushWriter() = fastWriter.pw.flush()\n\nobject fastWriter {\n val pw = PrintWriter(System.out)\n}\n\nfun next() = reader.next()\n\nfun nextInt() = reader.nextInt()\n\nfun nextLong() = reader.nextLong()\n\nfun nextDouble() = reader.nextDouble()\n\nfun nextLine() = reader.nextLine()\n\nobject reader {\n private var tokens: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(System.`in`))\n\n fun next(): String {\n var hasNext = tokens?.hasMoreElements() ?: false\n while (!hasNext) {\n tokens = StringTokenizer(reader.readLine())\n hasNext = tokens?.hasMoreElements() ?: false\n }\n\n return tokens!!.nextToken()\n }\n\n fun nextLine(): String {\n tokens = null\n return readLine()!!\n }\n\n fun nextInt() = next().toInt()\n\n fun nextLong() = next().toLong()\n\n fun nextDouble() = next().toDouble()\n}\n", "lang": "Kotlin", "bug_code_uid": "87974b34398d44b338a78a5488361040", "src_uid": "9c700390ac13942cbde7c3428965b18a", "apr_id": "23e7e3fff5373cba91d9ca02195faa5e", "difficulty": 2100, "tags": ["dp", "strings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9871945950192473, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\nimport kotlin.collections.HashSet\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array)\n = Thread { run() }.start()\n\nval scanner = Scanner(System.`in`)\nval str = scanner.next()\n\nfun run() {\n\n if (str.length == 1) {\n println(-1)\n return\n }\n if (str.length == 2) {\n if (Integer.parseInt(str) % 25 == 0)\n println(0)\n else if (Integer.parseInt(str.reversed()) % 25 == 0)\n println(1)\n else\n println(-1)\n return\n }\n var q = 0\n for (i in str)\n if (i == '0')\n q++\n if (q == str.length - 2 && str.length > 3) {\n println(-1)\n return\n }\n if (q == str.length - 1) {\n println(0)\n return\n }\n var res = Int.MAX_VALUE\n var help = -1\n for (i in str.length - 1 downTo 0) {\n if (str[i] == '0') {\n if (help == -1)\n help = i\n else {\n res = 2 * str.length - 3 - help - i\n break\n }\n }\n }\n// println(res)\n var a = res('2', '5')\n// println(a)\n res = min(res, a)\n a = res('5', '0')\n// println(a)\n res = min(res, a)\n a = res('7', '5')\n// println(a)\n res = min(res, a)\n if (res == Int.MAX_VALUE)\n println(-1)\n else\n println(res)\n\n}\n\nfun res(a: Char, b: Char): Int {\n var help1 = -1\n var help2 = -1\n val l = str.length\n// if (b == '0' && str[0] == '5' && str[1] == '0')\n// return 2 * l - 4\n for (i in str.length - 1 downTo 0) {\n if (str[i] == a) {\n if (help2 != -1) {\n if (i != 0)\n return 2 * l - 3 - i - help2\n if (b == '0' && str[1] == '0')\n return 2 * l - 4\n var help = -1\n for (j in 1 until l) {\n if (str[j] != '0') {\n help = j\n break\n }\n }\n if (help != help2)\n return 2 * l - 4 - help2 + help\n return 2 * l - 4\n }\n else if (help1 == -1)\n help1 = i\n }\n else if (str[i] == b) {\n if (help1 != -1) {\n if (i != 0)\n return 2 * l - 2 - i - help1\n var help = -1\n for (j in 1 until l) {\n if (str[j] != '0') {\n help = j\n break\n }\n }\n if (help != help1)\n return 2 * l - 3 - help1 + help\n return 2 * l - 3\n }\n else if (help2 == -1)\n help2 = i\n }\n }\n return Int.MAX_VALUE\n}\n\n//fun res(a: Char, b: Char): Int {\n// var help1 = -1\n// var help2 = -1\n// for (i in str.length - 1 downTo 0) {\n// if (str[i] == a) {\n// if (help2 != -1) {\n// if (i == 0 && str[1] == '0') {\n// var help = -1\n// for (j in 1 until str.length) {\n// if (str[j] != '0') {\n// help = j\n// break\n// }\n// }\n// if (str.substring(1).indexOf(b) == help2) {\n// if (help2 == str.length - 1)\n// return Int.MAX_VALUE\n// return 2 * str.length - 4\n// }\n// return str.length - 1 - help2 + help + str.length - 2\n// }\n// return 2 * str.length - 2 - i - help2\n// }\n// else if (help1 != -1)\n// help1 = i\n// }\n// else if (str[i] == b) {\n// if (help1 != -1)\n// return 2 * str.length - 2 - i - help1 + 1\n// else if (help2 != -1)\n// help2 = i\n// }\n// }\n// return Int.MAX_VALUE\n//}\n\n//fun run() {\n// val scanner = Scanner(System.`in`)\n// val n = scanner.nextInt()\n// val arr = Array>(n) { HashMap() }\n// val mins = Array(n) { intArrayOf(-1, -1) }\n// val v = IntArray(n) { scanner.nextInt() }\n// val map = HashMap()\n// var size = 0\n// for (i in v.sorted())\n// if (!map.containsKey(i))\n// map[i] = size++\n// arr.forEach { it[-1] = Int.MAX_VALUE }\n// var res = Int.MAX_VALUE\n// for (i in 0 until n) {\n// val c = scanner.nextInt()\n// val index = map[v[i]]!!\n// for (j in v[i] + 1 until size) {\n// if (arr[j][mins[j][0]]!! > c) {\n// if (mins[j][0] != index)\n// mins[j][1] = mins[j][0]\n// mins[i][0] = index\n// arr[j][index] = c\n// }\n// else if (map[mins[j][1]]!! > c && mins[j][0] != index) {\n// mins[j][1] = index\n// arr[j][index] = c\n// }\n// res = min(res, arr[j][mins[j][0]]!! + arr[j][mins[j][1]]!! + c)\n// }\n// }\n// println(res)\n//}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n//class Pair(val a: Int, val b: Int)\n//class Triple(val a: Int, val b: Int, val c: Int)", "lang": "Kotlin", "bug_code_uid": "c7fb387fe5e222c467a9ac83d8abdba0", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "apr_id": "3a00ab4c85d113e6b12237e0d132a5b7", "difficulty": 2100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.633235889363616, "equal_cnt": 20, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 19, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.min\n\nconst val INF = 99\n\nfun solve() {\n\n val a = next().toCharArray().map { it.toInt() - 48 }\n val n = a.size - 1\n\n fun ans(x: Int, y: Int): Int {\n val xInd = a.lastIndexOf(x)\n val yInd = a.lastIndexOf(y)\n if (xInd == -1 || yInd == -1) {\n return INF\n }\n if (xInd == 0 && a[1] == 0) {\n return INF\n }\n\n return if (xInd < yInd) {\n (n - yInd) + (n-1 - xInd)\n } else {\n (n - yInd) + (n - xInd)\n }\n }\n\n fun ans00(): Int {\n val count0 = a.count { it == 0 }\n if (count0 < 2) {\n return INF\n }\n\n val yInd = a.lastIndexOf(0)\n val xInd = a.subList(0, yInd).lastIndexOf(0)\n\n return (n - yInd) + (n-1 - xInd)\n }\n\n val ans00 = ans00()\n val ans25 = ans(2 ,5)\n val ans50 = ans(5, 0)\n val ans75 = ans(7, 5)\n\n val ans = min(min(ans00, ans25), min(ans50, ans75))\n println(if (ans != INF) ans else -1)\n}\n\n\n\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens()) {\n st = StringTokenizer(input.readLine() ?: return false)\n }\n return true\n}\n\nfun next() = if (hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextDouble() = next().toDouble()\n\nfun nextLine() = if (hasNext()) st.nextToken(\"\\n\")!! else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n, { nextInt() })\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nvar input = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`), 32768)\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nvar output = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\nfun main(args: Array) {\n val start = System.currentTimeMillis()\n solve()\n\n output.close()\n input.close()\n\n if (!ONLINE_JUDGE) {\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "7ae6907df0198b858db1d1cb12d8a638", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "apr_id": "f716cf00cc3eb2c67ec197d9661e66f0", "difficulty": 2100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9732875690195493, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.InputStream\nimport java.math.BigDecimal\nimport java.math.BigInteger\n\nfun main(args: Array) = input.run {\n val p = nextInt()\n var x = nextInt()\n val y = nextInt()\n var ans = 0\n while (true) {\n if (x >= y && ok(x, p) || x - 50 >= y && ok(x - 50, p)) {\n println(ans)\n return\n }\n x += 100\n ans++\n }\n}\n\nfun ok(s: Int, p: Int): Boolean {\n var i = (s / 50) % 475\n repeat(25) {\n i = (i * 96 + 42) % 475\n if (26 + i == p) {\n return true\n }\n }\n return false\n}\n\nval input = FastScanner()\n\nfun String.toBigInteger() = BigInteger(this)\nfun String.toBigDecimal() = BigDecimal(this)\n\nclass FastScanner(private val input: InputStream = System.`in`) {\n private val sb = StringBuilder()\n private val buffer = ByteArray(4096)\n private var pos = 0\n private var size = 0\n\n fun nextString(): String? {\n var c = skipWhitespace()\n if (c < 0) return null\n\n return sb.run {\n setLength(0)\n\n do {\n append(c.toChar())\n c = read()\n } while (c > ' '.toInt())\n\n toString()\n }\n }\n\n fun nextLine(): String? {\n var c = read()\n if (c < 0) return null\n\n return sb.run {\n setLength(0)\n\n while (c >= 0 && c != '\\n'.toInt()) {\n append(c.toChar())\n c = read()\n }\n\n toString()\n }\n }\n\n fun nextLong(): Long {\n var c = skipWhitespace()\n\n val sign = if (c == '-'.toInt()) {\n c = read()\n -1\n } else 1\n\n var ans = 0L\n\n while (c > ' '.toInt()) {\n ans = ans * 10 + c - '0'.toInt()\n c = read()\n }\n\n return sign * ans\n }\n\n fun nextInt() = nextLong().toInt()\n fun nextDouble() = nextString()?.toDouble() ?: 0.0\n fun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO\n fun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO\n\n fun nextStrings(n: Int) = Array(n) { nextString() ?: \"\" }\n fun nextInts(n: Int) = IntArray(n) { nextInt() }\n fun nextLongs(n: Int) = LongArray(n) { nextLong() }\n fun nextDoubles(n: Int) = DoubleArray(n) { nextDouble() }\n fun nextBigIntegers(n: Int) = Array(n) { nextBigInteger() }\n fun nextBigDecimals(n: Int) = Array(n) { nextBigDecimal() }\n\n fun nextStrings(n: Int, m: Int) = Array(n) { nextStrings(m) }\n fun nextInts(n: Int, m: Int) = Array(n) { nextInts(m) }\n fun nextLongs(n: Int, m: Int) = Array(n) { nextLongs(m) }\n fun nextDoubles(n: Int, m: Int) = Array(n) { nextDoubles(m) }\n fun nextBigIntegers(n: Int, m: Int) = Array(n) { nextBigIntegers(m) }\n fun nextBigDecimals(n: Int, m: Int) = Array(n) { nextBigDecimals(m) }\n\n private fun skipWhitespace(): Int {\n while (true) {\n val c = read()\n if (c > ' '.toInt() || c < 0) return c\n }\n }\n\n private fun read(): Int {\n while (pos >= size) {\n if (size < 0) return -1\n size = input.read(buffer, 0, buffer.size)\n pos = 0\n }\n return buffer[pos++].toInt()\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "ed3847debbe308cc94db369243a41bc6", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "apr_id": "c6b3479a59b44a2a26ff6f2734ccff7e", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9925841414717627, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n val input: InputReader\n val output: PrintWriter\n if (true) {\n input = InputReader(FileInputStream(\"input.txt\"))\n output = PrintWriter(FileOutputStream(\"output.txt\"))\n } else {\n input = InputReader(System.`in`)\n output = PrintWriter(System.out)\n }\n solve(input, output)\n input.close()\n output.close()\n}\n\nfun winPlaces(s: Int): List {\n val places = arrayListOf()\n var i = (s / 50) % 475\n for (j in 1..25) {\n i = (i * 96 + 42) % 475\n places.add(26 + i)\n }\n require(places.size == 25)\n return places\n}\n\nfun solve(input: InputReader, output: PrintWriter) {\n val p = input.nextInt()\n val x = input.nextInt()\n val y = input.nextInt()\n\n var losed = x\n while (losed >= y) {\n if (winPlaces(losed).contains(p)) {\n output.print(0)\n return\n }\n losed -= 50\n }\n\n\n var successfulBreaks = 1\n while (true) {\n val noFails = x + successfulBreaks * 100\n val oneFail = x + successfulBreaks * 100 - 50\n if (winPlaces(noFails).contains(p) || winPlaces(oneFail).contains(p)) {\n output.print(successfulBreaks)\n return\n }\n successfulBreaks += 1\n }\n}\n\nclass InputReader(val stream: InputStream) : Closeable {\n\n var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n\n var tokenizer: StringTokenizer? = null\n\n override fun close() {\n stream.close()\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int = Integer.parseInt(next())\n\n}", "lang": "Kotlin", "bug_code_uid": "b2bd7a140ac515444b67f643b9858d97", "src_uid": "c9c22e03c70a94a745b451fc79e112fd", "apr_id": "2bfd7efc97cbb6f89d8702a2492b2563", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9533116178067318, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val n = reader.nextInt()\n val m = reader.nextInt()\n for (i in n + 1..m) {\n if (prime(i)) {\n if (i == m)\n println(\"YES\")\n else println(\"NO\")\n return\n }\n }\n}\n\nfun prime(a: Int): Boolean {\n for (i in 2 until a) {\n if (a % i == 0) return false\n }\n return true\n}\n", "lang": "Kotlin", "bug_code_uid": "94da4f368b1e1c6108199803c7fb53c0", "src_uid": "9d52ff51d747bb59aa463b6358258865", "apr_id": "6ab5ab077d53f56508a683598a9d4a12", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8458274398868458, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.sqrt\n\nfun prime (n: Int): Boolean {\n if (n == 1 || n == 2 || n == 3) return true\n else {\n var isPrime = true\n var i = 2\n while (i <= sqrt(n.toFloat()).toInt() && isPrime) {\n if (n % i == 0) {\n isPrime = false\n } else {\n i++\n }\n }\n return isPrime\n }\n}\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (n, m) = br.readLine().split(\" \").map { it.toInt() }\n println(if (prime(m)) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "7fb023e7f8cc0dc75811be01da7e2172", "src_uid": "9d52ff51d747bb59aa463b6358258865", "apr_id": "945efb6fb81ca1bad948599c65c58852", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9632224168126094, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val n= readLine()!!.toInt()\n val stones= readLine()!!.toString()\n var count=1\n var j=1\n val size=n-1\n for (i in 0 until size)\n {\n\n if (stones[i]==stones[j])\n {\n count++\n }\n j++\n }", "lang": "Kotlin", "bug_code_uid": "391a53492f754465d67a169eae47e985", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "9eb914f2a86a17c16f9f1ca4249c9b60", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8073394495412844, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\nimport java.util.Set\nimport java.util.LinkedHashSet\n\nimport java.util.*\nfun main() {\n val s = Scanner(System.`in`)\n val size = s.nextInt()\n var x = 0\n var userInput = readLine()\n var str = \"$userInput\".take(size)\n val arr = str.toCharArray()\n for (i in 0 until size) {\n if (i == size - 1) break\n if (arr[i] == arr[i + 1])\n x++\n }\n print(x)\n\n}", "lang": "Kotlin", "bug_code_uid": "5668809eb25d847a5a39118ec07c496a", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "b0e11090000283938370773f4a1c0ae2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8735019973368842, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\nimport java.util.Set\nimport java.util.LinkedHashSet\n\nimport java.util.*\nfun main() {\n val s = Scanner(System.`in`)\n val size = s.nextInt()\n var x = 0\n var userInput = readLine()\n var str = userInput\n val arr = str!!.toCharArray()\n for (i in 0 until size) {\n if (i == size - 1) break\n if (arr[i] == arr[i + 1])\n x++\n }\n print(x)\n\n}", "lang": "Kotlin", "bug_code_uid": "2a7e429fe015ec2318a6ad7c23d50541", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "b0e11090000283938370773f4a1c0ae2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9602122015915119, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var a: String = readLine()!!\n var ans: Int = 0\n for (i in 1 until a.length){\n if (a[i] == a[i - 1]){\n ++ans\n }\n }\n print(ans)\n}", "lang": "Kotlin", "bug_code_uid": "4441555e63dca4dd2417446905605967", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "eb165605dc32d1e90600c9bc56126c03", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9575971731448764, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n\nfun main(args:Array){\n val input = Scanner(System.`in`)\n var n = input.nextInt()\n var str = readLine()!!\n var count = 0\n\n for(i in 0 until n-1){\n if(str[i] == str[i+1]){\n count += 1\n }\n }\n print(count)\n}", "lang": "Kotlin", "bug_code_uid": "84ce9b9bcd4cc2e3f404fc82fdbffcfd", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "f50f673aa9a4ef1a15ae5d83e2986bc3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9216757741347905, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\n\nfun main(){\n var num = Scanner(System.`in`).nextInt()\n var s = Scanner(System.`in`).next()\n println(checkNeighborSame(s))\n}\nfun checkNeighborSame(str : String) : Int {\n\n var res = 0;\n var charArr = str.toCharArray()\n var arr = arrayListOf()\n for (i in 0..charArr.size-1){\n arr.add(charArr.get(i))\n }\n var i = 0\n while (i < arr.size-1){\n if(arr.get(i) == arr.get(i+1)) {\n arr.removeAt(i+1)\n res++\n }else\n i++\n }\n return res\n\n}", "lang": "Kotlin", "bug_code_uid": "1ed6e50f9fc6617ff6eafc035f30a57a", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8", "apr_id": "ffd802c5740448e766939ef9c6674c29", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9948453608247423, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val n = nextInt()\n val c = IntArray(100)\n for (i in 0 until n) {\n c[nextInt()]++;\n }\n print(c.max()!!)\n}", "lang": "Kotlin", "bug_code_uid": "d8c86f9d325c237bbacebabc667cbfc4", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "apr_id": "f2cef6976d19b206618c9b02b4c7675e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5997322623828648, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 5, "insert_cnt": 7, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*\n\n\nfun main(args:Array) {\n val sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var coin:Array = Array(n,{0})\n for (i in 0 until n){\n coin[i] = sc.nextInt()\n }\n coin.sort()\n var max = 1\n var cons =1\n for (i in 0 until (n-1)){\n if(coin[i] == coin[i+1])\n cons++\n else\n if(cons>max)\n max = cons\n }\n if(cons>max)\n max = cons\n print(max)\n}\n", "lang": "Kotlin", "bug_code_uid": "bfcf4f8f5b0ccaef7026364f168af910", "src_uid": "f30329023e84b4c50b1b118dc98ae73c", "apr_id": "55b92c670c66b5f73d1abf891162fed8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.959409594095941, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(vararg args: String) {\n val a = Array(4) { readLine()!!.split(' ').map { it == \"1\" } }\n val dtp = a.indices.any { a[it][3] && (a[it].subList(0, 3).any { it } || a[(it + 1) % 4][0] || a[(it + 3) % 4][2]) }\n println(if (dtp) \"YES\" else \"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "9e4214db53a6944bf017688c16e9abef", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "apr_id": "4bb8abd66eacff226c3d9b9130bed810", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5800929322572757, "equal_cnt": 31, "replace_cnt": 22, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 30, "bug_source_code": "import java.io.BufferedReader\nimport java.util.*\nimport kotlin.system.measureTimeMillis\n\nclass Solver : SolverBase() {\n\n fun solve() {\n for (i in 1..4) {\n val a = readIntArray(4)\n if (a[3] == 1 && a.sum() > 1) {\n print(\"YES\")\n return\n }\n }\n print(\"NO\")\n }\n\n}\n\nobject Algorithms {\n\n tailrec fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)\n tailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)\n\n fun lcm(a: Int, b: Int): Int = a / gcd(a, b) * b\n fun lcm(a: Long, b: Long): Long = a / gcd(a, b) * b\n\n}\n\nopen class SolverBase {\n private val bufferedReader: BufferedReader = System.`in`.bufferedReader()\n private var stringTokenizer: StringTokenizer = StringTokenizer(\"\")\n\n fun nextLine(): String = bufferedReader.readLine()\n fun next(): String {\n while (!stringTokenizer.hasMoreTokens())\n stringTokenizer = StringTokenizer(nextLine())\n return stringTokenizer.nextToken()\n }\n\n fun readInt(): Int = next().toInt()\n fun readLong(): Long = next().toLong()\n fun readDouble(): Double = next().toDouble()\n\n fun readIntArray(size: Int): IntArray = IntArray(size, { readInt() })\n fun readLongArray(size: Int): LongArray = LongArray(size, { readLong() })\n fun readStringArray(size: Int): Array = Array(size, { next() })\n inline fun readTArray(size: Int, convert: (Int, String) -> T): Array = Array(size, { convert(it, next()) })\n inline fun readTArray(size: Int, convert: (String) -> T): Array = Array(size, { convert(next()) })\n}\n\nfun main(args: Array) {\n val millis = measureTimeMillis(Solver()::solve)\n System.err.println(\"Time spent: $millis\")\n}\n", "lang": "Kotlin", "bug_code_uid": "5e7e4f598987272624ad35597d8db6ad", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "apr_id": "90fbde343ab0d15fa9fe9326f559d573", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9965034965034965, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.util.*\n\nclass Solver {\n private val inp = FastInputReader()\n\n fun solve() {\n a.forEachIndexed { i, row ->\n if (row[3] == 1) {\n if (a[(i + 4 - 1) % 4][2] + a[(i + 1) % 4][0] + a[(i + 2) % 4][1] > 0) {\n print(\"YES\")\n return\n }\n }\n }\n print(\"NO\")\n }\n\n private lateinit var a: Array\n fun input() {\n a = inp.readIntTable(4, 4)\n }\n}\n\nobject Algorithms {\n\n tailrec fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)\n tailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)\n\n fun lcm(a: Int, b: Int): Int = a / gcd(a, b) * b\n fun lcm(a: Long, b: Long): Long = a / gcd(a, b) * b\n\n}\n\nclass FastInputReader {\n private val bufferedReader: BufferedReader = System.`in`.bufferedReader()\n private var stringTokenizer: StringTokenizer = StringTokenizer(\"\")\n\n fun nextLine(): String = bufferedReader.readLine()\n fun next(): String {\n while (!stringTokenizer.hasMoreTokens())\n stringTokenizer = StringTokenizer(nextLine())\n return stringTokenizer.nextToken()\n }\n\n fun readInt(): Int = next().toInt()\n fun readLong(): Long = next().toLong()\n fun readDouble(): Double = next().toDouble()\n\n fun readIntArray(size: Int) = IntArray(size, { readInt() })\n fun readLongArray(size: Int) = LongArray(size, { readLong() })\n fun readStringArray(size: Int) = Array(size, { next() })\n inline fun readTArray(size: Int, convert: (Int, String) -> T) = Array(size, { convert(it, next()) })\n\n fun readIntTable(rows: Int, cols: Int) = Array(rows, { readIntArray(cols) })\n fun readLongTable(rows: Int, cols: Int) = Array(rows, { readLongArray(cols) })\n fun readStringTable(rows: Int, cols: Int) = Array(rows, { readStringArray(cols) })\n inline fun readTTable(rows: Int, cols: Int, convert: (Int, Int, String) -> T) = Array(rows, { readTArray(cols, { col, s -> convert(it, col, s) }) })\n}\n\nfun main(args: Array) {\n// val millis = measureTimeMillis(Solver()::solve)\n// System.err.println(\"Time spent: $millis\")\n val solver = Solver()\n solver.input()\n solver.solve()\n}\n", "lang": "Kotlin", "bug_code_uid": "0120b24cf0f95de632cda5f5b953f41c", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "apr_id": "90fbde343ab0d15fa9fe9326f559d573", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9185739436619719, "equal_cnt": 16, "replace_cnt": 1, "delete_cnt": 8, "insert_cnt": 6, "fix_ops_cnt": 15, "bug_source_code": "import java.io.BufferedReader\nimport java.util.*\n\nclass Solver {\n private val inp = FastInputReader()\n\n fun solve() {\n System.getProperties().forEach { println(it) }\n// val a = inp.readIntTable(4, 4)\n// a.forEachIndexed { i, row ->\n// if (row[3] == 1) {\n// if (a[(i + 4 - 1) % 4][0] + a[(i + 1) % 4][2] + a[(i + 2) % 4][1] > 0) {\n// print(\"YES\")\n// return\n// }\n// }\n// }\n// print(\"NO\")\n }\n\n}\n\nobject Algorithms {\n\n tailrec fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)\n tailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)\n\n fun lcm(a: Int, b: Int): Int = a / gcd(a, b) * b\n fun lcm(a: Long, b: Long): Long = a / gcd(a, b) * b\n\n}\n\nclass FastInputReader {\n private val bufferedReader: BufferedReader = System.`in`.bufferedReader()\n private var stringTokenizer: StringTokenizer = StringTokenizer(\"\")\n\n fun nextLine(): String = bufferedReader.readLine()\n fun next(): String {\n while (!stringTokenizer.hasMoreTokens())\n stringTokenizer = StringTokenizer(nextLine())\n return stringTokenizer.nextToken()\n }\n\n fun readInt(): Int = next().toInt()\n fun readLong(): Long = next().toLong()\n fun readDouble(): Double = next().toDouble()\n\n fun readIntArray(size: Int) = IntArray(size, { readInt() })\n fun readLongArray(size: Int) = LongArray(size, { readLong() })\n fun readStringArray(size: Int) = Array(size, { next() })\n inline fun readTArray(size: Int, convert: (Int, String) -> T) = Array(size, { convert(it, next()) })\n\n fun readIntTable(rows: Int, cols: Int) = Array(rows, { readIntArray(cols) })\n fun readLongTable(rows: Int, cols: Int) = Array(rows, { readLongArray(cols) })\n fun readStringTable(rows: Int, cols: Int) = Array(rows, { readStringArray(cols) })\n inline fun readTTable(rows: Int, cols: Int, convert: (Int, Int, String) -> T) = Array(rows, { readTArray(cols, { col, s -> convert(it, col, s) }) })\n}\n\nfun main(args: Array) {\n// val millis = measureTimeMillis(Solver()::solve)\n// System.err.println(\"Time spent: $millis\")\n Solver().solve()\n}\n", "lang": "Kotlin", "bug_code_uid": "214eeec3bb5854d381dd23ca6510dcee", "src_uid": "44fdf71d56bef949ec83f00d17c29127", "apr_id": "90fbde343ab0d15fa9fe9326f559d573", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9992125984251968, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nclass ProblemIO(val rd: BufferedReader, val wr: PrintWriter) {\n companion object {\n fun console() = ProblemIO(BufferedReader(InputStreamReader(System.`in`)), PrintWriter(System.out))\n fun files(inputFilename: String, outputFilename: String) =\n ProblemIO(BufferedReader(FileReader(File(inputFilename))), PrintWriter(File(outputFilename)))\n }\n\n var tok = StringTokenizer(\"\")\n\n fun close() { rd.close(); wr.close() }\n fun print(v: T) = wr.print(v)\n fun println(v: T) = wr.println(v)\n fun readToken(): String {\n while (!tok.hasMoreTokens()) tok = StringTokenizer(rd.readLine())\n return tok.nextToken()\n }\n fun readLine(): String {\n tok = StringTokenizer(\"\")\n return rd.readLine()\n }\n fun readInt(): Int = readToken().toInt()\n fun readLong(): Long = readToken().toLong()\n}\n\nfun main(args: Array) {\n Thread({ val io = ProblemIO.console(); solve(io); io.close() }).start()\n}\n\nfun solve(io: ProblemIO) {\n val n = io.readInt()\n val a = io.readInt()\n val b = io.readInt()\n var res = 0\n for (i in 0 .. n - 1) {\n if (i < a) continue\n if (n - 1 - a > b) continue\n ++res\n }\n io.println(res)\n}\n", "lang": "Kotlin", "bug_code_uid": "3136905a11aba3c6c86a2f86453fa1e1", "src_uid": "51a072916bff600922a77da0c4582180", "apr_id": "9f5b0da5543d8bc26563319509705123", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8819875776397516, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numPeople, a, _) = readInts()\n print(numPeople - a)\n}", "lang": "Kotlin", "bug_code_uid": "89432b7dd4090ca8786b7278f7f9c2ec", "src_uid": "51a072916bff600922a77da0c4582180", "apr_id": "db04d689e0026d62d207efb1f876396a", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5282051282051282, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.lang.Math.floor\n\nfun main(args: Array) {\n val n = readLine()!!.toDouble()\n print( (floor(n/2) + floor(n/5)).toInt() )\n}", "lang": "Kotlin", "bug_code_uid": "dc6fa841ccd5582cdb85ee92ba074852", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "apr_id": "233008e72eb31d6a6a42c57497c0e2b7", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.41796875, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import kotlin.math.*\nfun main(args: Array){\n\tval n = readLine()!!.toLong()\n\tvar lastRes = 0L\n\tvar counter = 0\n\tfor (i in 1..n){\n\t\tval remainder = n.rem(i)\n\t\tval modulo = (n/i).toLong()\n\t\t//println(\"$n % $i: $modulo remains $remainder\")\n\t\tif ((modulo != lastRes) and (i > counter)){\n\t\t\tlastRes = modulo\n\t\t\tcounter++\n\t\t\tif (remainder >= modulo){\n\t\t\t\tcounter++\n\t\t\t}\n\t\t}\n\t}\n\tprintln(counter-1)\n}", "lang": "Kotlin", "bug_code_uid": "4ba64772e45f8d160b2f4406bbaa18f0", "src_uid": "5551742f6ab39fdac3930d866f439e3e", "apr_id": "a021b63976907b4496b0ca6a8b50e540", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9239280774550485, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import com.sun.jdi.IntegerValue\nimport java.sql.Array\n\nfun main() {\n var (a, b) = readLine()!!.split(' ').map(String::toInt)\n var count = 0\n while(a>=1 && b>=2 || a>=2 && b>=1) {\n if (a >= b) {\n a = a - 2\n b = b - 1\n count++\n } else {\n a = a - 1\n b = b - 2\n count++\n }\n }\n print(count)\n}", "lang": "Kotlin", "bug_code_uid": "7afae4d01ab671848d3a83e8bd565901", "src_uid": "0718c6afe52cd232a5e942052527f31b", "apr_id": "22759a7bdf12c19c87e2fb14b6e98bba", "difficulty": 1300, "tags": ["number theory", "greedy", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7723440134907251, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "/**\n * Created by hareesh on 30/07/17.\n */\nfun main(args: Array)\n{\n fun readInts(separator: Char = ' ') = readLine()!!.split(separator).map(String::toInt)\n var (a, b) = readInts()\n if (a < b)\n {\n val temp = a;\n a = b\n b = temp\n }\n var res = a/2\n a %= 2\n if (res <= b)\n {\n b -= res\n val temp = b/2\n if (temp <= a)\n res += temp\n }\n else\n {\n res = b\n }\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "cb3b2099dfc8a78f5a69a21b4d5f2f49", "src_uid": "0718c6afe52cd232a5e942052527f31b", "apr_id": "17ee5f2069756931ccfeb95acf60542b", "difficulty": 1300, "tags": ["number theory", "greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9846153846153847, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.system.exitProcess\n\nfun main(args: Array) {\n // 0 1\n val (n, a, b) = readLine()!!.split(\" \").map { it.toInt() }\n val array = readLine()!!.split(\" \").map { it.toInt().takeIf { it != 2 } }\n var i = 0; var j = array.size - 1\n var ans = 0\n while (i < j) {\n if (array[i] != null && array[j] != null) {\n if (array[i] != array[j]) {\n println(-1)\n exitProcess(0)\n }\n }\n if (array[i] == null && array[j] != null) {\n ans += if (array[j] == 0) a else b\n }\n if (array[i] != null && array[j] == null) {\n ans += if (array[i] == 0) a else b\n }\n if (array[i] == null && array[j] == null) {\n ans += minOf(a, b)\n }\n i++\n j--\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "10577fbd656f0aeb4b972c200f89c07d", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "apr_id": "8efb7548eca58e35f9fd2768f7656b07", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9891304347826086, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n val list = mutableListOf()\n while (scanner.hasNextInt()) {\n list.add(scanner.nextInt())\n }\n var first = 0\n var last = 0\n var sum = 0\n\n for (i in 0 until list.size / 2) {\n first = list[i]\n last = list[list.size - i - 1]\n sum += updateSum(first, last, a, b)\n }\n if (list[list.size / 2] == 2) {\n sum += minOf(a, b)\n }\n print(sum)\n\n}\n\nprivate fun updateSum(first: Int, last: Int, a: Int, b: Int): Int {\n var sum = 0\n if (first != 2 && last != 2 && first != last) {\n print(-1)\n System.exit(0)\n } else if (first == last && last == 2) {\n sum += minOf(a, b) * 2\n } else if (first == 2) {\n\n sum += if (last == 0) a else b\n } else if (last == 2) {\n sum += if (first == 0) a else b\n }\n return sum\n}\n\n", "lang": "Kotlin", "bug_code_uid": "607d435fce996b49961c0854e29e9e25", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "apr_id": "e0ca0cc283c9f722df38a1a691b3d982", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9832474226804123, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (_, whiteSuitCost, blackSuitCost) = readInts()\n val colors = readInts()\n var sol = 0\n var left = -1\n var right = colors.size\n while (++left < --right)\n sol += when {\n colors[left] != 2 && colors[right] != 2 && colors[left] != colors[right] -> return print(-1)\n colors[left] != 2 && colors[right] != 2 -> 0\n colors[left] == 2 && colors[right] == 2 -> min(whiteSuitCost, blackSuitCost)\n colors[left] == 0 || colors[right] == 0 -> whiteSuitCost\n else -> blackSuitCost\n }\n if (left == right && colors[left] == 2 && colors[right] == 2) sol += min(whiteSuitCost, blackSuitCost)\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "c618514f0072adc483db8b0b284fae22", "src_uid": "af07223819aeb5bd6ded4340c472b2b6", "apr_id": "b66eb41ab4c0f721dfc68a6839bb7767", "difficulty": 1000, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9066937119675457, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "/**\n *\n */\n\nfun main(args: Array) {\n val totalNumberAndBorderPosition = readLine()!!.split(\" \").map { it.toInt() }.toList()\n val borderPosition = totalNumberAndBorderPosition[1]\n\n val competitionResults = readLine()!!.split(\" \").map { it.toInt() }.sortedDescending()\n val theBorderValue = competitionResults[borderPosition]\n if (theBorderValue == 0) {\n println(\"0\")\n return\n }\n\n val result = competitionResults.takeWhile { it >= theBorderValue }.count()\n\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "7bcf22073fd3ff88275a0465ff18760a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "ac2a21d428bf971b199c0aff30a3cb3e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.936, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "private fun readInts() = readLine()!!.split(\" \").map { it.toInt() }\nfun main()\n{\n val (nb_student, kValue) = readInts()\n val scores = readInts().filter { it > 0 }\n val valids = scores.filter { it >= scores[kValue - 1]}\n print(valids.size)\n\n\n\n}", "lang": "Kotlin", "bug_code_uid": "a340aa6f133794f8c84984f63b3191a5", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "35aef8e081c59a61a94ed407cddee5a8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8337028824833703, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 7, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*\n\nval scan = Scanner(System.`in`)\n\nfun main(args: Array){\n var n = scan.nextInt()\n var k = scan.nextInt()\n var arr = IntArray(n)\n var t = true\n for (i in 0 until n){\n arr[i] = scan.nextInt()\n }\n if (arr[0] > 0){\n for (i in 0 until n){\n if(arr[i] < arr[k]){\n print(i)\n t = false\n break\n }\n }\n if (t) print(n)\n } else\n print(0)\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "68b9d4ceae37d45f11c1d2ceec18938d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "254c35607831907e0a7369da4ee1d511", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9973684210526316, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val (n, p) = readLine()!!.split(' ').map(String::toInt)\n\n var a = readLine()!!.split(' ').map(String::toInt)\n\n if (a[0] == 0)\n println(0)\n else {\n var v: Int = a[p]\n var c: Int = 0\n if (v > 0)\n c = a.count { it >= v }\n else\n c = a.count { it > v }\n\n println(c)\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "26a65be0ae1f24716d58f20d3bb0159a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "82ea51f774dd77691f921c8b9aad91fa", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9487516425755584, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val (n, k) = readLine()!!.split(' ').map { it.toInt() }\n val scores = readLine()!!.split(' ').map { it.toShort() }\n val realPlace = k -1\n var i = if (scores[realPlace] >= 0)\n scores.indexOfLast{ it == scores[realPlace] }\n else\n realPlace\n while(scores[i] <= 0){\n i--\n }\n print(++i)\n}", "lang": "Kotlin", "bug_code_uid": "819cb97c0501f19372a34dfcb73bd937", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "5fbc86b96dd207a82b0f600138d48dfd", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.2871536523929471, "equal_cnt": 8, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.collections.*\nimport kotlin.io.*\nimport kotlin.text.*\n\nfun main() {\n val n = readLine()!!.toInt()\n val sarr = arrayListOf()\n for (i in 1..n) {\n sarr.add(readLine()!!.toString())\n }\n for (i in sarr.indices) {\n if (sarr[i].length > 10)\n println(\"${sarr[i][0]}${sarr[i].length - 2}${sarr[i][sarr[i].lastIndex]}\")\n else\n println(sarr[i])\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "7230a35084c41fc0a820882f44415011", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "722f644091c9fc6bd36ef1a5f5e28926", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.02414486921529175, "equal_cnt": 13, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "#include \n\nusing namespace std;\n\ntypedef pair ii;\ntypedef vector vi;\ntypedef vector vii;\ntypedef vector vvi;\ntypedef vector vvii;\ntypedef vector vs;\n\ntemplate\npair operator+(pair a, pair b) {\n return make_pair(a.first + b.first, a.second + b.second);\n}\n\ntemplate\npair operator-(pair a, pair b) {\n return make_pair(a.first - b.first, a.second - b.second);\n}\n\ntemplate\nostream& operator<<(ostream& out, pair p) {\n out << p.first << \" \" << p.second;\n return out;\n}\n\ntemplate\nistream& operator>>(istream& in, pair& p) {\n in >> p.first >> p.second;\n return in;\n}\n\ntemplate\nostream& operator<<(ostream& out, vector v) {\n for (auto a: v)\n out << a << \" \";\n\n return out;\n}\n\ntemplate\nistream& operator>>(istream& in, vector& v) {\n for (auto &a: v)\n in >> a;\n\n return in;\n}\n\ntemplate\nostream& operator<<(ostream& out, multiset S) {\n for (auto a: S)\n out << a << \" \";\n\n return out;\n}\n\ntemplate\nostream& operator<<(ostream& out, set S) {\n for (auto a: S)\n out << a << \" \";\n\n return out;\n}\n\ntemplate\nostream& operator<<(ostream& out, unordered_set S) {\n for (auto a: S)\n out << a << \" \";\n\n return out;\n}\n\ntemplate\nostream& operator<<(ostream& out, map& M) {\n for (auto m: M)\n out << \"[\" << m.first << \"]=\" << m.second << \" \" ; \n\n return out;\n}\n\nint main() {\n ios::sync_with_stdio(false);\n int n, k;\n vi v;\n cin >> n >> k;\n v.resize(n);\n cin >> v;\n sort(v.begin(), v.end());\n int val = max(v[n-1-k], 1);\n auto first = lower_bound(v.begin(), v.end(), val);\n cout << distance(first, v.end()) << endl;\n return 0;\n}\n", "lang": "Kotlin", "bug_code_uid": "646806214b25b3351ded04d98750d3ea", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "d028d78f655c852164a9bd89648ba755", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9953488372093023, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (_, place) = readLine()!!.split(\" \").map { it.toInt() }\n val scores = readLine()!!.split(\" \").map { it.toInt() }\n println(solution(scores, place))\n}\n\nfun solution(scores: List, place: Int): Int {\n val scoreAtPlace = scores[place]\n var num = 0\n for (score in scores) {\n if (score < scoreAtPlace || score == 0) {\n return num\n }\n num++\n }\n return num\n}", "lang": "Kotlin", "bug_code_uid": "b8fa6d8e6facb97a621c2ab981c585e0", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "26f4abb8e4dfa23967b1eb02014e3e23", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.993006993006993, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val (_, place) = readLine()!!.split(\" \").map { it.toInt() }\n val scores = readLine().split(\" \").map { it.toInt() }\n println(solution(scores, place))\n}\n\nfun solution(scores: List, place: Int): Int {\n val scoreAtPlace = scores[place]\n var num = 0\n for (score in scores) {\n if (score < scoreAtPlace || score == 0) {\n return num\n }\n num++\n }\n return num\n}", "lang": "Kotlin", "bug_code_uid": "3140cae958a82ae65220bfcbdeacfde1", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "26f4abb8e4dfa23967b1eb02014e3e23", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9650313152400835, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.ArrayList\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val allCount = input.nextInt()\n val nextRoundPlace = input.nextInt()\n\n val participants: MutableList = ArrayList()\n\n for (i in 0 until allCount) {\n participants.add(input.nextInt())\n }\n\n fun scanRight(): Int {\n val participantRating = participants[nextRoundPlace]\n var index = nextRoundPlace\n\n while (index < allCount && participants[index] == participantRating) {\n index++\n }\n\n return index\n }\n\n fun scanLeft(): Int {\n var index = nextRoundPlace\n\n while (index >= 0 && participants[index] == 0) {\n index--\n }\n\n return index + 1\n }\n\n val shouldScanRight = participants[nextRoundPlace] > 0\n\n output.print(if (shouldScanRight) scanRight() else scanLeft())\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "3af28d3deed6a4646af8c575ef6fb5fb", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "6e95ba3793f0fa6b0fda0639d6724007", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9648854961832061, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\nimport kotlin.math.min\n\nfun main() {\n var (amount, c) = readLine()!!.split(' ').map { it.toInt() }\n var curAmount = amount\n var ans = 1\n while(ans < 10) {\n if(curAmount % 10 == c) {\n break\n }\n curAmount += amount\n ans++\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "a63825d6b313b98175106e984560530f", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "3568d596ace115e9aba9824fc151614a", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9819070904645477, "equal_cnt": 8, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "import java.lang.AssertionError\nimport java.util.*\n \nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n \nprivate fun myAssert(x: Boolean) {\n if (!x) {\n throw AssertionError()\n }\n}\n\nfun main(args: Array) {\n// var s = Scanner(System.`in`)\n var (k, r) = readInts()\n var x = k\n var ans = 0\n if ((x - r) % 10 == 0) {\n println(1)\n } else {\n while ((x - r) % 10 != 0) {\n x += k\n ans++;\n if (x % 10 == 0) {\n break\n }\n// println(\"x = ${x}\")\n }\n println(ans + 1)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "414a0e17a5055dae06868b19e14906a9", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "9abd65bb4f28503cb1432a1477f0658f", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9089128305582762, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.lang.AssertionError\nimport java.util.*\n \nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n \nprivate fun myAssert(x: Boolean) {\n if (!x) {\n throw AssertionError()\n }\n}\n\nfun main(args: Array) {\n// var s = Scanner(System.`in`)\n var (k, r) = readInts()\n var x = k\n var ans = 0\n if (x % 10 == 0) {\n println(1)\n } else if ((x * r) % 10 == 0) { \n println(2)\n } else {\n while ((x - r) % 10 != 0) {\n x += k\n ans++;\n// println(\"x = ${x}\")\n }\n println(ans + 1)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "1506cf32ef89c4198ee73779f33aec60", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "9abd65bb4f28503cb1432a1477f0658f", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8317757009345794, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n var (k, r) = readLines()!!.split(\" \").map{ it.toInt() }\n for(i in 1..9) {\n if((i * k) % 10 == r ) {\n println(i)\n break\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "2fa4eec7d57fa26261b9ee87e38a0cfe", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "451636f0020ccaf46ab558163a929444", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8337236533957846, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n var (k, r) = readLine()!!.split(\" \").map{ it.toInt() }\n for(i in 1..9) {\n if((i * k) % 10 == r ) {\n println(i)\n break\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "5b8d455f3c98795d9c7457057bbf4ffc", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "451636f0020ccaf46ab558163a929444", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.806664352655328, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedReader\nimport java.util.*\n\nfun main() {\n Solver().solve()\n}\n\nclass Solver {\n private val inp = FastInputReader()\n\n fun solve() {\n val price = readInt()\n val r = readInt()\n\n val digit = price % 10\n var count = 10\n for (i in 1..10) {\n\n if ((digit * i) % 10 == 0\n || digit == ((r * i) % 10)) {\n count = i\n break\n }\n }\n\n print(count)\n }\n\n fun next() = inp.next()\n fun nextLine() = inp.nextLine()\n fun readInt(): Int = inp.readInt()\n fun readLong(): Long = inp.readLong()\n fun readDouble(): Double = inp.readDouble()\n\n private class FastInputReader {\n private val bufferedReader: BufferedReader = System.`in`.bufferedReader()\n private var stringTokenizer: StringTokenizer = StringTokenizer(\"\")\n\n fun nextLine(): String = bufferedReader.readLine()\n fun next(): String {\n while (!stringTokenizer.hasMoreTokens())\n stringTokenizer = StringTokenizer(nextLine())\n return stringTokenizer.nextToken()\n }\n\n fun readInt(): Int = next().toInt()\n fun readLong(): Long = next().toLong()\n fun readDouble(): Double = next().toDouble()\n }\n}", "lang": "Kotlin", "bug_code_uid": "ed472254bb39193a6d46d4c099997921", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "bff6069bfa493802ef3ca8e838df160a", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9293286219081273, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nfun main(args:Array) {\n val sc: Scanner = Scanner(System.`in`)\n val k = sc.nextInt()\n var x =0\n val r = sc.nextInt()\n for(i in 1..9)\n if(k*i%10==0||k*i%10==r)\n print(i)\n}\n", "lang": "Kotlin", "bug_code_uid": "f3be536e29e45b2d874717e842b7e019", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "37fb16666787668c032d67ca15c60ae9", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9401709401709402, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.File\nimport java.lang.Math.abs\nimport java.util.*\n\nfun main() {\n// val file = File(\"data1.txt\")\n// val reader = Scanner(file)\n val reader = Scanner(System.`in`)\n val input = reader.nextLine()\n val ina = input.split(\" \").filter { it.isNotEmpty() }\n val charIn = ina.map { it[1] }\n val out = charIn.groupingBy { it }.eachCount().toList().sortedBy { (_,value)->value }.toMap()\n val most = out.keys.toList().reversed()[0]\n val numIn = ina.filter { it[1] == most }.map { it[0]-'0' }\n when(numIn.size){\n 1->println(2)\n 2->{\n val dif = abs(numIn[0]-numIn[1])\n if(dif <=2){\n println(1)\n }else{\n println(2)\n }\n }\n 3->{\n val sort = numIn.sorted()\n val dif1 = sort[1]-sort[0]\n val dif2 = sort[2]-sort[1]\n if(dif1 == dif2){\n if(dif1 == 1 || dif1 == 0)println(0)\n else if(dif1 ==2)println(1)\n else println(2)\n }else if(dif1 ==2 || dif2 == 2 || dif1 == 1 || dif2 == 1)println(1)\n else println(2)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "c1d4d458699ea40932d464f35570d068", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "f14da63f7a6edf4ac2de6ff430de81fa", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8208219178082192, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "\nfun main() {\n val cardLayout = readLine()!!.split(\" \")\n .sorted()\n\n //koutsu\n val maxTriple = cardLayout.groupBy { it }\n .mapValues { it.value.size }\n .values.max() ?: 1\n\n //shuntsu\n val maxStraigt = findStraight(cardLayout)\n\n println(\"\" + (3 - kotlin.math.max(maxTriple, maxStraigt)))\n}\n\nfun findStraight(cards: List): Int {\n var straigth = 1\n val firstCard = cards[0]\n var numI = firstCard[0]!!.toInt()\n var typeI = firstCard[1]\n\n for (i in 1 until 3) {\n val card = cards[i]\n var numC = card[0]!!.toInt()\n val typeC = card[1]\n\n if (typeC == typeI) {\n if (numC == numI + 1) {\n straigth++\n } else if (numC == numI + 2) {\n return 2\n }\n }\n\n numI = numC\n typeI = typeC\n }\n return straigth\n", "lang": "Kotlin", "bug_code_uid": "72633026211814fbe3db220f78d8faca", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "91692edb6e916ed3c7bb27ebc069e9e9", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9726541554959786, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val cardLayout = readLine()!!.split(\" \")\n .map { \"${it[1]}${it[0]}\" }\n\n //koutsu\n val maxTriple = cardLayout.groupBy { it }\n .mapValues { it.value.size }\n .values.max() ?: 1\n\n //shuntsu\n val maxStraigt = findStraight(cardLayout)\n\n println(\"\" + (3 - kotlin.math.max(maxTriple, maxStraigt)))\n}\n\nfun findStraight(cards: List): Int {\n var straigth = 1\n val firstCard = cards[0]\n var numI = firstCard[1]!!.toString().toInt()\n var typeI = firstCard[0]\n\n for (i in 1 until 3) {\n val card = cards[i]\n var numC = card[1]!!.toString().toInt()\n val typeC = card[0]\n\n if (typeC == typeI) {\n if (numC == numI + 1) {\n straigth++\n } else if (numC == numI + 2) {\n return 2\n }\n }\n\n numI = numC\n typeI = typeC\n }\n return straigth\n}", "lang": "Kotlin", "bug_code_uid": "85a0ac844c5ed8b2784704437ad75959", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "91692edb6e916ed3c7bb27ebc069e9e9", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9539363484087102, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val (a, b, c) = readStrings().sortedBy {\n \"${it[1]}${it[0]}\"\n }\n\n fun String.nextTile() = \"${this[0] + 1}${this[1]}\"\n\n val ans = when {\n a == b && b == c -> 0\n a.nextTile() == b && b.nextTile() == c -> 0\n a == b || b == c -> 1\n a.nextTile() == b || b.nextTile() == c -> 1\n else -> 2\n }\n\n println(ans)\n}\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println() { sb.append('\\n') }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit)\n { Output().apply(block).nowPrint() }\n", "lang": "Kotlin", "bug_code_uid": "82ec8a869426c88ad5bd7e036dc21d44", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "6d2b5d9b0af666f0e5662fd363a634e1", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9344919786096256, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val tiles = readLine()!!.split(\" \").toSet()\n print(when (tiles.size) {\n 1 -> 0\n 2 -> 1\n else -> {\n var sol = 2\n loop@for (suit in listOf('m', 'p', 's'))\n for (num in 1 .. 7) {\n if (\"\" + num + suit in tiles) {\n if (\"\" + (num + 1) + suit in tiles && \"\" + (num + 2) + suit in tiles) {\n sol = 0\n break@loop\n }\n if (\"\" + (num + 1) + suit in tiles || \"\" + (num + 2) + suit in tiles)\n sol = 1\n }\n }\n sol\n }\n })\n}", "lang": "Kotlin", "bug_code_uid": "b0a89923018c1d8f0e6d8c4757bd1a0b", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "2f6701a2312701c7098a09b806a5de34", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9937212222687317, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun readInts() = readLine()!!.split(\" \").map { it.toInt() }\nfun readInt() = readLine()!!.toInt()\nfun readLenAndInts() = readLine()!!.split(\" \").drop(1).map { it.toInt() }\n\nfun main() {\n var hand = readLine()!!.split(\" \").map { it[0] to it[1] }\n if (hand.distinct().size == 1) {\n // all equal\n println(\"0\")\n return\n }\n\n // find a suit containing 2 or more cards. If this doesn't exist,\n // then we're out of luck anyway (and need 2 more cards)\n val suited = hand.groupBy { it.second }.filter { (suit,list) -> list.size > 1 }\n if (suited.size > 0) {\n val L = suited.values.first().map { it.first }.sorted() // only numbers\n if (L.size == 3 && L[0] == L[1] - 1 && L[1] == L[2] - 1) {\n // full street\n println(\"0\")\n return\n }\n if (L.size == 3 && L[2] - L[1] <= 2) {\n // second pair close (identical is allowed as well)\n println(\"1\")\n return\n }\n if (L.size == 2 && L[1] - L[0] <= 2) {\n // first pair close (identical is allowed as well)\n println(\"1\")\n return\n }\n }\n println(\"2\")\n return\n}", "lang": "Kotlin", "bug_code_uid": "c8786999e1e1f8ecc18ad57342d36521", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "d092d4b7fa2b3b16aef1d47f5e6c3a2e", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.931098696461825, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val (a, b,c ) = readLine()!!.split(\" \").sorted()\n\n fun shuntsu(a: String, b: String): Boolean {\n val a0 = a[0].toInt()\n val a1 = a[1]\n val b0 = b[0].toInt()\n val b1 = b[1]\n return a1 == b1 && a0 + 1 == b0\n }\n\n val r = when {\n a == b && b == c -> 0\n shuntsu(a, b) && shuntsu(b, c) -> 0\n a == b || b == c || a == c -> 1\n shuntsu(a, b) || shuntsu(b, c) || shuntsu(a, c) -> 1\n else -> 2\n }\n println(r)\n}", "lang": "Kotlin", "bug_code_uid": "34408c11ad8675df4334f70029a1d18e", "src_uid": "7e42cebc670e76ace967e01021f752d3", "apr_id": "f3caf163875154ca138785f11777bf50", "difficulty": 1200, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9155405405405406, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nval m = 1000000007L\nval maxN = 1000000\nval fact by lazy { precFact() }\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val abn = br.readLine().split(\" \").map { it.toInt() }\n val a = abn[0]\n val b = abn[1]\n val n = abn[2]\n\n println(numWays(a, b, n))\n\n}\n\nfun numWays(a: Int, b: Int, n: Int): Long{\n tailrec fun go(i: Int, acc: Long): Long =\n if (i == n + 1) acc % m\n else if (isGood(a*i + b*(n-i), a, b)){\n go(i + 1, combination(n, i) + acc % m)\n }\n else\n go(i + 1, acc)\n return go(0, 0)\n}\n\n\nfun combination(n: Int, i: Int): Long {\n val inv = binExp(fact[i]*fact[n - i], m - 2, m)\n return (fact[n] * inv) % m\n}\n\nfun isGood(num: Int, a: Int, b: Int): Boolean{\n tailrec fun go(digit: Int, rest: Int, a: Int, b: Int): Boolean =\n if (rest == 0) digit == a || digit == b\n else{\n if (digit != a && digit != b) false\n else go(rest % 10, rest / 10, a, b)\n }\n val ans = go(num % 10, num / 10, a, b)\n return go(num % 10, num / 10, a, b)\n}\n\nfun binExp(a: Long, x: Long, m: Long): Long{\n tailrec fun go(a: Long, x: Long, acc: Long): Long =\n if (x == 0L) 1\n else {\n if (x == 1L) (a % m * acc % m) % m\n else if (x % 2 == 0L) go((a % m * a % m) % m, x/2, acc)\n else go((a % m * a % m) % m, (x - 1)/2, (a % m * acc % m) % m)\n }\n return go(a, x ,1)\n}\n\nfun precFact(): Array{\n val fact = Array(maxN){_ -> 0L}\n fact[0] = 1\n for (i in 1 until maxN){\n fact[i] = (i % m * fact[i - 1] % m ) % m\n }\n return fact\n}", "lang": "Kotlin", "bug_code_uid": "7334e523ff2b97d3097ad9ee67839632", "src_uid": "d3e3da5b6ba37c8ac5f22b18c140ce81", "apr_id": "97856546e0d9dcc96e157a17d54c4957", "difficulty": 1800, "tags": ["brute force", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8946119959335819, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.StringTokenizer\n\n\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n\n val x = sc.nextLong()\n val y = sc.nextLong()\n\n println(solve(x, y))\n}\n\nval mod = (1e9 + 7).toLong()\n\nprivate fun solve(x: Long, y: Long): Long {\n if (y % x != 0L) return 0L\n if( y < x) return 0L\n\n val t = y / x\n\n var sum = 2L pow (t - 1)\n\n if (x != y) sum = (sum - 1 + mod) % mod\n\n var i = 2L\n while (i * i <= t) {\n if (t % i == 0L) sum = (sum - solve(i, t) + mod) % mod\n i += 1\n }\n\n return sum\n}\n\n\n\nprivate infix fun Long.pow(n: Long): Long {\n var a = this\n var n = n % (mod - 1)\n var res = 1L\n while (n > 0) {\n if (n % 2 == 1L) res = res * a % mod\n a = a * a % mod\n n /= 2\n }\n return res\n}\n\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "b3152115d74b0236102d243fd22ae991", "src_uid": "de7731ce03735b962ee033613192f7bc", "apr_id": "2e7a3550c63e0ff4df005398204f84f1", "difficulty": 2000, "tags": ["dp", "combinatorics", "bitmasks", "number theory", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9476763080922977, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.StringTokenizer\n\n\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n\n val x = sc.nextLong()\n val y = sc.nextLong()\n\n println(solve(x, y))\n}\n\nval mod = (1e9 + 7).toLong()\n\nprivate fun solve(x: Long, y: Long): Long {\n if (y % x != 0L) return 0L\n if (y < x) return 0L\n\n val t = y / x\n\n var sum = 2L pow (t - 1)\n\n if (x != y) sum = (sum - 1 + mod) % mod\n\n var i = 2L\n while (i * i <= t) {\n if (t % i == 0L) {\n sum = (sum - solve(i, t) + mod) % mod\n\n if (t / i != i) {\n sum = (sum - solve(t / i, t) + mod) % mod\n }\n }\n i += 1\n }\n\n return sum\n}\n\n\nprivate infix fun Long.pow(n: Long): Long {\n var a = this\n var n = n % (mod - 1)\n var res = 1L\n while (n > 0) {\n if (n % 2 == 1L) res = res * a % mod\n a = a * a % mod\n n /= 2\n }\n return res\n}\n\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "1b4644a0de3fb96b348971e2db294a84", "src_uid": "de7731ce03735b962ee033613192f7bc", "apr_id": "2e7a3550c63e0ff4df005398204f84f1", "difficulty": 2000, "tags": ["dp", "combinatorics", "bitmasks", "number theory", "math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.734341252699784, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n var t = readLine()!!.toInt() // read integer from the input\n for(i in 0 until t) {\n var n = readLine()!!.toInt()\n var ans = max(0, n / 2 - 1)\n if(n > 0)\n ans += n % 2\n println(ans)\n }\n}", "lang": "Kotlin", "bug_code_uid": "2c9b20bbeb60118d81d39612fb3a1b76", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "d6e2fc321c33e1da467b9d37dad97052", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5886939571150097, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n val times = readLine()!!.toInt()\n (1..times).forEach { _ ->\n val sum = readLine()!!.toInt()\n var count = 0\n for (a in (sum - 1) downTo 1) {\n val b = sum - a;\n if (a > b) {\n count++\n } else {\n break\n }\n }\n println(count)\n }\n}", "lang": "Kotlin", "bug_code_uid": "32e181319d5895f485ac1ef6a9bc3329", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "a7e6f086abaddba6cebb0c99c0c81ceb", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9969356486210419, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "// 06.11.2020\n\n\nimport java.util.*\nimport kotlin.system.exitProcess\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { x: String -> x.toInt() } // list of ints\n\nfun main ()\n{\n val t = readInt ()\n for ( i in 0 until t )\n {\n val n = readInts ()\n var x : Int = (n + 1) / 2\n println (x);\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "25cddd3b9f6ad0bdf9243e0589574c43", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "4e4833f1105db7b0a4c290c862eaf203", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7908396946564885, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner\nfun main(args: Array) {\n val read = Scanner(System.`in`)\n var b:int=read.nextInt()\n while(b>0){\n var a:Int=read.nextInt()\n \n println(a/2);\n \n \n \n b--;\n }\n}", "lang": "Kotlin", "bug_code_uid": "78f31b5db845187ce054fead2e78618d", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "6c3e2121ff260b9262f0b599a3275524", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6730769230769231, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import kotlin.streams.asStream\n\nfun main() {\n val input = generateSequence(::readLine)\n input.asStream().skip(1).forEach { line ->\n println()\n val total = line.toInt()\n if (total % 2 != 0) print((total - 1) / 2) else print((total - 2) / 2)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "eed6f384b73f220c2a6483fe5a2a1585", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "821838a812a5250f98740280bd66a438", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5460122699386503, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": " fun main(args: Array) {\n val t = readLine()!!.toInt()\n repeat(t) {\n val n = readLine()!!.toInt()\n var count = 0\n for(b in 1..n) {\n val a = n - b\n if (a <= b) break\n count++\n }\n println(count)\n }\n }", "lang": "Kotlin", "bug_code_uid": "bb6f3c8faba2b0fad228ed9d47e2a6ab", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "ecc0d8bf8141ebd4ee257d389d3a7924", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9804878048780488, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\nfun main(args: Array) {\n val read = Scanner(System.`in`)\n var t = read.nextInt()\n for (i in t) {\n var n = read.nextInt()\n println((n-1)/2)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "77ec0f55f04cc3398b12032aea45b287", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "bf8613db64f6840dd3e3c1c1f6d50420", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6624203821656051, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n\n for (i in 0 until n) {\n val n = readLine()!!.toInt()\n var a = n - 1\n var b = 1\n var count = 0\n while (a > b){\n count++\n a--\n b++\n }\n\n println(count)\n }\n}", "lang": "Kotlin", "bug_code_uid": "a908373b1575d8a03fd5afdbf8cf25bd", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "efa9626f8dc8cd30e1e4f9335f9f9896", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.534010152284264, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 12, "bug_source_code": "import java.util.*\nimport kotlin.jvm.JvmStatic\n\nobject a {\n @JvmStatic\n fun main(args: Array) {\n val sc = Scanner(System.`in`)\n var t = sc.nextInt()\n while (t-- > 0) {\n val a = sc.nextInt()\n var count = 0\n var i = 0.0\n i = Math.ceil(a / 2.toDouble())\n while (i < a) {\n if (i > a - i) count++\n i++\n }\n println(count)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "7224845af65b3ebb4c6eb4f1741e9985", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "ff88c502d3d403f8f13546c6650d7c4e", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5655913978494623, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\n\n fun main(args: Array) {\n val sc = Scanner(System.`in`)\n var t = sc.nextInt()\n while (t-- > 0) {\n val a = sc.nextInt()\n var count = 0\n var i = 0.0\n i = Math.ceil(a / 2.toDouble())\n while (i < a) {\n if (i > a - i) count++\n i++\n }\n println(count)\n }\n }\n", "lang": "Kotlin", "bug_code_uid": "608667433e6068bdeecc5e78d3a2996d", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "ff88c502d3d403f8f13546c6650d7c4e", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9601139601139601, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nobject Main {\n fun main(arg: Array) {\n val `in` = Scanner(System.`in`)\n var t = `in`.nextInt()\n while (t-- > 0) {\n var n: Long\n n = `in`.nextLong()\n if (n % 2 == 0L) {\n println((n - 1) / 2)\n } else println(n / 2)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "b23d3922fb5b82402e548b532278bc97", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "11b2bfff31755e33e39acf9861f351a1", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9790628115653041, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.Integer.*\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\n\nfun solve(n: Int) {\n if (n%2 == 0) {\n println(max(n / 2 - 1, 0))\n } else {\n println(n/2)\n }\n}\n\nfun main() {\n val t = readInt()\n for(i in 0 until t) {\n val n = readInt()\n solve()\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "cbd0c2d92f021c05b0269747280e2b5c", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "a3a2745b7d35adf9b124220ab2cdccca", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8785046728971962, "equal_cnt": 10, "replace_cnt": 0, "delete_cnt": 10, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*\n\nobject B {\n fun main(args: Array) {\n val sc = Scanner(System.`in`)\n val t = sc.nextLine().toInt()\n for (i in 0 until t) {\n val x = sc.nextLine().toInt()\n if (x % 2 == 1) println(x / 2) else println(x / 2 - 1)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "659d3908155da90980f6c44b75ca4604", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "937720bbb6242f4f2afc50907c06d384", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9958479718939636, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package dsa\n\nimport java.util.*\nimport kotlin.math.*\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\nfun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)\nfun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)\nfun Boolean.toInt() = if (this) 1 else 0\nval INF = 0x3f3f3f3f\nval MOD = (1e9 + 7).toLong()\n/***********************************************************************************************/\n\nfun main() {\n var t = readInt()\n for (i in 1..t) {\n var a: Int = readInt()\n var poss: Int = 0\n if (a % 2 == 0) {\n println(a / 2 - 1)\n } else {\n println(a / 2)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "23d02b22abebc4b7690f71335499fcef", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "d076e322aae5c5ee748e1cf19b5b2871", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9850746268656716, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val testCases = readLine()!!.toInt()\n for (i in 0..testCases) {\n val candies = readLine()!!.toLong()\n if (candies < 3) {\n println(\"0\")\n continue\n }\n val possibleOptions = (candies - 1) / 2\n println(possibleOptions)\n }\n}", "lang": "Kotlin", "bug_code_uid": "37144096288e26b00973e817e024b4e6", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "3a9ba85dd657ad015978eccffb18142f", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.996551724137931, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n \nfun main(args: Array) {\n \n val read = Scanner(System.`in`)\n val testNum = read.nextInt()\n for(i in 1..testNum) {\n var firstNum = read.nextInt()\n var secondNum = firstnum - 1\n var sum = secondNum / 2\n println(\"$sum\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "54f5422084e555e077ad3f45a2fd37d2", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "066d185d19075b43c01ca6663e2b16ce", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8384074941451991, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n val n = readLine().toInt()\n for (i in 0 until n) {\n main2(readLine().toInt())\n }\n}\n\nfun main2(candies:Int){\n val half = candies/2\n println(half)\n println(Integer.max(0,half + half%2 - 2))\n}\n", "lang": "Kotlin", "bug_code_uid": "73ad0a9525f0ceb1c4fac7532aada693", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "24ee4511ab1d2c69b03659dd2ade376a", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.43112947658402206, "equal_cnt": 19, "replace_cnt": 10, "delete_cnt": 8, "insert_cnt": 0, "fix_ops_cnt": 18, "bug_source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\n//private val INPUT = File(\"input.txt\").inputStream()\n//private val OUTPUT = File(\"output.txt\").outputStream()\nprivate val INPUT = System.`in`\nprivate val OUTPUT = System.out\n\nprivate val bufferedReader = INPUT.bufferedReader()\nprivate val outputWriter = PrintWriter(OUTPUT, false)\nprivate fun readLn() = bufferedReader.readLine()!!\n\nprivate fun readList() = readLn().split(' ')\nprivate var tokenizer = StringTokenizer(\"\")\nprivate fun read(): String {\n while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLn(), \" \")\n return tokenizer.nextToken()\n}\n\nprivate fun readInt() = read().toInt()\nprivate fun readLong() = read().toLong()\nprivate fun readDouble() = read().toDouble()\n\nprivate fun readIntList() = readList().map { it.toInt() }\nprivate fun readLongList() = readList().map { it.toLong() }\nprivate fun readDoubleList() = readList().map { it.toDouble() }\n\nprivate fun readIntArray(n: Int = 0) =\n if (n == 0) readList().run { IntArray(size) { get(it).toInt() } } else IntArray(n) { readInt() }\n\nprivate fun readLongArray(n: Int = 0) =\n if (n == 0) readList().run { LongArray(size) { get(it).toLong() } } else LongArray(n) { readLong() }\n\nprivate fun readDoubleArray(n: Int = 0) =\n if (n == 0) readList().run { DoubleArray(size) { get(it).toDouble() } } else DoubleArray(n) { readDouble() }\n\n\nprivate fun Int.modPositive(other: Int): Int = if (this % other < 0) ((this % other) + other) else (this % other)\n\n\nprivate class B {\n fun solveTestCase(n: Int): Int {\n var p = 0\n var a = n - 1\n var b = 1\n if (n <= 2) {\n return p\n } else {\n while (a > b) {\n a--\n b++\n p++\n }\n }\n return p\n }\n}\n\nfun main(args: Array) {\n repeat(readInt()) {\n val n = readInt()\n\n outputWriter.println(\n B().solveTestCase(n)\n )\n }\n\n outputWriter.flush()\n}", "lang": "Kotlin", "bug_code_uid": "1060c8df1c25bbbc67ac7e3a52caa4d8", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "56e23cec873b32ea0a9327df5f1922c5", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9955056179775281, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": " fun readInts() = readLine()!!.split(' ').map { it.toInt() }\n \n fun main() {\n val tests_cnt = readInts()\n for (i in 1..tests_cnt[0]) {\n val a = readInts()\n if(a[0] > 2) {\n if(a[0].mod(2) == 0) {\n println(a[0]/2 - 1)\n } else {\n println(a[0]/2)\n }\n } else {\n println(0)\n }\n }\n }", "lang": "Kotlin", "bug_code_uid": "3f205499cc29539b58bba645c9b22942", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "3d694ff247b0ad26764a34e0cff09be3", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6901098901098901, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "fun main() {\n val t = readLine()!!.toInt()\n for (i in 1..t) {\n val n = readLine()!!.toInt()\n var b = 1\n var a = n - b\n var result = 0\n while (a > b) {\n result++\n a--\n b++\n }\n println(result)\n }\n}", "lang": "Kotlin", "bug_code_uid": "2e91a757efbef9fb75e18bc9c02842ba", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "2eb5ed7e566f647938107163f1ad1a80", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9972067039106145, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n \nfun main(args: Array) {\n \n val reader = Scanner(System.`in`)\n var t:Int = reader.nextInt()\n \n for(index in 1..t){\n \n var n:Int = reader.nextInt()\n var ans:Int\n if((n+1)/2>n/2){\n ans=n-(n+1)/2\n }else{\n ans=n-n/2-1\n }\n println(\"$ans\")\n }\n", "lang": "Kotlin", "bug_code_uid": "be82b8bd5038a85c4c7e2d37258e2ac5", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "0ec823c442ac62523d6dcec2f24dc01c", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9940184883088635, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package b\n\nimport java.io.*\nimport java.util.*\n\nclass MyScanner(inputStream: InputStream) {\n private val br = BufferedReader(InputStreamReader(inputStream));\n private var st: StringTokenizer = StringTokenizer(br.readLine());\n\n fun next(): String {\n while (!st.hasMoreElements()) {\n st = StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next());\n }\n\n fun nextLong(): Long {\n return next().toLong();\n }\n\n fun nextDouble(): Double {\n return next().toDouble();\n }\n\n fun nextLine(): String {\n return br.readLine();\n }\n}\n\nval In = MyScanner(System.`in`);\nval Out = PrintWriter(BufferedOutputStream(System.out))\n\nfun solve() {\n var t = In.nextInt();\n while (t-- > 0) {\n Out.println(\"${(In.nextInt() - 1) / 2}\")\n }\n}\n\nfun main() {\n solve()\n Out.close()\n}", "lang": "Kotlin", "bug_code_uid": "fecb3f0426e7a5640ac6f1563011aeec", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "66410f41215790abc72fa39586b6802d", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9772727272727273, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n print(if (readLine()!!.toInt() % 2 == 0) 1 else 0)\n}", "lang": "Kotlin", "bug_code_uid": "568bf98b78bb0b3575cab83b9ed0cc58", "src_uid": "78e64fdbf59c5ce89d0f0a1d0591f795", "apr_id": "03434a1bc8ab6686a5cc67eeaaa7a8e7", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9619978284473398, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array){\n\tval coordA = readLine()!!.toInt()\n\tval coordB = readLine()!!.toInt()\n\tval absdistance = if (coordA - coordB >= 0) coordA - coordB else coordB - coordA\n\tval tired = if (absdistance.rem(2) == 0) 2 * howtired (absdistance/2) else howtired ((absdistance-1)/2) + howtired ((absdistance+1)/2)\n\tprintln(\"Distance: $absdistance\")\n\tprintln(tired)\n}\n\nfun howtired(steps: Int): Int{\n\tvar tired: Int = 0\n\tfor (i in 0..steps){\n\t\ttired += i\n\t}\n\treturn tired\n}\n", "lang": "Kotlin", "bug_code_uid": "964efbbdcbf468e5ed97433c966b7799", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da", "apr_id": "9a3f5864dd93cff9f9f08878a3ebe45b", "difficulty": 800, "tags": ["greedy", "math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7330081300813008, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "var _debug = false;\nfun debug(vararg vals: T): Unit {\n if (!_debug) { return }\n for (v in vals) { System.err.print(v); System.err.print(\" \") }\n System.err.println()\n}\n\nval MOD = 998_244_353\nval MAXN = 5000\n\n//fun getBinomTriangle() : List> {\nfun getBinomTriangle() : Array {\n var p = Array(MAXN+1, { LongArray(MAXN+1) })\n //debug(\"p\", p.size)\n p[0][0] = 1\n for (i in 1..MAXN) {\n p[i][0] = 1\n for (j in 1..i) {\n p[i][j]=(p[i-1][j-1]+p[i-1][j]) % MAXN\n }\n }\n return p\n}\n\nfun getFactorialTable() : LongArray {\n var ft = LongArray(MAXN+1)\n ft[0] = 1\n for (i in 1..MAXN) {\n ft[i] = ft[i-1] * i\n }\n return ft\n}\n\nval btr = getBinomTriangle()\nval ft = getFactorialTable()\n\nfun calculateCombinationsOfTwo(x : Int, y : Int) : Long {\n var res = 0L\n\n for (k in 0..(minOf(x,y))) {\n var summand = ft[k]\n summand = (summand * btr[x][k]) % MOD\n summand = (summand * btr[y][k]) % MOD\n res = (res + summand) % MOD\n }\n //debug(\"calc\", res)\n return res\n}\n\nfun main(args: Array) {\n if (args.size > 0 && args[0] == \"-d\") {\n _debug = true;\n }\n\n val (a, b, c) = readLine()!!.split(' ').map(String::toInt)\n val ab = calculateCombinationsOfTwo(a, b)\n val ac = calculateCombinationsOfTwo(a, c)\n val bc = calculateCombinationsOfTwo(b, c)\n\n println(ab * ac * bc)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "79200cd1f458b625fb413d216a4189b1", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "apr_id": "03189fd57f9163d0a35871169a9f7c20", "difficulty": 1800, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.76010101010101, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "var _debug = false;\nfun debug(vararg vals: T): Unit {\n if (!_debug) { return }\n for (v in vals) { System.err.print(v); System.err.print(\" \") }\n System.err.println()\n}\n\nval MOD = 998244353\nval MAXN = 5000\n\n//fun getBinomTriangle() : List> {\nfun getBinomTriangle() : Array {\n var p = Array(MAXN+1, { LongArray(MAXN+1) })\n //debug(\"p\", p.size)\n p[0][0] = 1\n for (i in 1..MAXN) {\n p[i][0] = 1\n for (j in 1..i) {\n p[i][j]=(p[i-1][j-1]+p[i-1][j]) % MOD\n }\n }\n return p\n}\n\nfun getFactorialTable() : LongArray {\n var ft = LongArray(MAXN+1)\n ft[0] = 1\n for (i in 1..MAXN) {\n ft[i] = ft[i-1] * i\n }\n return ft\n}\n\nval btr = getBinomTriangle()\nval ft = getFactorialTable()\n\nfun calculateCombinationsOfTwo(x : Int, y : Int) : Long {\n var res = 0L\n\n val the_min = listOf(x,y).min()!!\n for (k in 0..the_min) {\n var summand = ft[k]\n summand = (summand * btr[x][k]) % MOD\n summand = (summand * btr[y][k]) % MOD\n res = (res + summand) % MOD\n }\n //debug(\"calc\", res)\n return res\n}\n\nfun main(args: Array) {\n if (args.size > 0 && args[0] == \"-d\") {\n _debug = true;\n }\n\n val (a, b, c) = readLine()!!.split(' ').map(String::toInt)\n val ab = calculateCombinationsOfTwo(a, b)\n val ac = calculateCombinationsOfTwo(a, c)\n val bc = calculateCombinationsOfTwo(b, c)\n\n var res = ab\n res = (res * bc) % MOD\n res = (res * ac) % MOD\n\n println(res)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "ac58673528670e1d9b774842e38da8f4", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "apr_id": "03189fd57f9163d0a35871169a9f7c20", "difficulty": 1800, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.931098696461825, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "val MOD = 998244353\nval MAXN = 5000\n\nvar dp = Array(MAXN+5, { IntArray(MAXN+5) })\nfun D(a: Int, b: Int) : Int\n{\n if (a == 0 || b == 0) return 1;\n\n if (dp[a][b] == 0)\n {\n dp[a][b] = ((b.toLong() * D(a - 1, b - 1) + D(a - 1, b)) % MOD).toInt();\n }\n\n return dp[a][b];\n}\n\n\nfun main(args: Array) {\n if (args.size > 0 && args[0] == \"-d\") {\n _debug = true;\n }\n\n val xs = readLine()!!.split(' ').map(String::toInt).sorted()\n val (a, b, c) = xs\n\n println(((D(a, b).toLong() * D(b, c).toLong()) % MOD * D(a, c).toLong()) % MOD);\n}\n\n", "lang": "Kotlin", "bug_code_uid": "94fa8966882fcf94e47ecd2dcb470472", "src_uid": "b6dc5533fbf285d5ef4cf60ef6300383", "apr_id": "03189fd57f9163d0a35871169a9f7c20", "difficulty": 1800, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9943502824858758, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n var n = r.readLine()!!.toInt()\n //val (n, time) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n fun f(i:Long):Boolean = i.toString().split(\"\").filter { it.length>0 }.map { it.toInt() }.sum()==10\n var ans = 0L\n while (n>0){\n ans++\n if (f(ans)) n--\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "7b30789eccd126cba8802acd5684ff13", "src_uid": "0a98a6a15e553ce11cb468d3330fc86a", "apr_id": "088769a42abec0cffeebda7e95212e69", "difficulty": 1100, "tags": ["dp", "number theory", "implementation", "brute force", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9795918367346939, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n val jin = Scanner(System.`in`)\n var n = jin.nextLong()\n if (n == 1L) {\n println(1)\n return\n }\n for (p in 2L..1000000L) {\n if (n % p == 0L) {\n while (n % p == 0L ){\n n /= p\n }\n if (n == 1L) {\n println(p)\n } else {\n println(1)\n }\n return\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "d206b64609596f136e81649e2eedd3ed", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "86ef379dad6d2a51cd7cae1f638c4e66", "difficulty": 1500, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6335616438356164, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import kotlin.math.min\nimport kotlin.math.sqrt\n\nfun main() {\n fun readLong() = readLine()!!.toLong()\n\n fun Long.factors(): MutableSet {\n val output = mutableSetOf()\n val endLoop = sqrt(this.toDouble()).toLong()\n for (i in 2L..min(endLoop, this - 1)) {\n if (this % i == 0L) {\n output.add(i)\n output.add(this / i)\n if (output.size > 1) return output\n }\n }\n return output\n }\n\n val n = readLong()\n val factors = n.factors()\n print(\n when {\n factors.isEmpty() -> n\n factors.size == 1 -> factors.first()\n else -> 1\n }\n )\n}", "lang": "Kotlin", "bug_code_uid": "38dd584fcddf44ea11dde655c22f0256", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "b0dd07018d68511a58e81caa44b84eb6", "difficulty": 1500, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9379310344827586, "equal_cnt": 11, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 10, "bug_source_code": "import kotlin.math.min\nimport kotlin.math.sqrt\n\nfun main() {\n fun readLong() = readLine()!!.toLong()\n\n fun Long.factors(): MutableSet {\n val output = mutableSetOf()\n val endLoop = sqrt(this.toDouble()).toLong()\n for (i in 2L..min(endLoop, this - 1)) {\n if (this % i == 0L) {\n output.add(i)\n output.add(this / i)\n }\n }\n return output\n }\n\n val n = readLong()\n val factors = n.factors()\n val minFactor = factors.min()!!\n val toRemove = mutableSetOf()\n for (factor in factors)\n if (factor != minFactor) {\n var ff = factor\n while (ff % minFactor == 0L)\n ff /= minFactor\n if (ff == 1L) toRemove.add(factor)\n }\n factors.removeAll(toRemove)\n print(\n when {\n factors.isEmpty() -> n\n factors.size == 1 -> factors.first()\n else -> 1\n }\n )\n}", "lang": "Kotlin", "bug_code_uid": "37d722dd4d09b6bc32ab76ddaa60aa61", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "b0dd07018d68511a58e81caa44b84eb6", "difficulty": 1500, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.15384615384615385, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "import kotlin.math.abs\n\nlateinit var vx: Array\nlateinit var bn: Array>\n\nfun main() {\n val n = readLine()!!.toInt()\n var cnt = 0\n vx = arrayOfNulls(n)\n bn = Array(n) { mutableListOf() }\n\n for (i in n downTo 1) for (it in 1..i - 2) if (n % abs(i - it) == 0) {\n bn[i - 1].add(it - 1); bn[it - 1].add(i - 1)\n }\n\n for (i in 0 until n) if (vx[i] == null) {\n sep(i); cnt++\n }\n println(\"$cnt\")\n}\n\nfun sep(u: Int) {\n vx[u] = 1\n for (i in 0 until bn[u].size) bn[u][i].let {\n if (vx[it] == null) sep(it)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "170e55176ddad89af323d92c81b59c43", "src_uid": "f553e89e267c223fd5acf0dd2bc1706b", "apr_id": "dde98b3105f6dc47669937b316f4abc5", "difficulty": 1500, "tags": ["math", "constructive algorithms", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9647058823529412, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.stream.IntStream\nimport kotlin.math.min\nimport kotlin.random.Random\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nval ids = Array(410) { ArrayList() }\nval adj = Array(410) { ArrayList() }\nval mem = HashMap, IntArray>()\nval nex = HashMap, ArrayList>()\nvar ops = 0\nfun dfs(u: Int, p: Int = -1): IntArray {\n if (mem.containsKey(Pair(p, u))) {\n return mem[Pair(p, u)]!!\n }\n var ans = intArrayOf(0)\n var bes = ArrayList()\n for (v in adj[u]) {\n if (v == p) {\n bes.add(IntArray(0))\n continue\n }\n var t = dfs(v, u)\n var nAns = IntArray(ans.size + t.size - 1) { 1000000 }\n bes.add(IntArray(nAns.size))\n for (i in 0 until ans.size) {\n for (j in 0 until t.size) {\n ops++\n if (ans[i] + t[j] <= nAns[i + j]) {\n nAns[i + j] = min(nAns[i + j], ans[i] + t[j])\n bes[bes.size - 1][i + j] = j\n }\n }\n }\n ans = nAns\n }\n val ret = ans.toMutableList()\n ret.add(0, 1)\n val retArray = ret.toIntArray()\n mem[Pair(p, u)] = retArray\n nex[Pair(p, u)] = bes\n return retArray\n}\n\n\nfun build(u: Int, p: Int, k: Int, ans: ArrayList) {\n if (k == 0) return\n var kk = k - 1\n val bes = nex[Pair(p, u)]!!\n for(i in adj[u].size - 1 downTo 0) {\n val v = adj[u][i]\n if (v == p) continue\n val b = bes[i][kk]\n if (b == 0) {\n ans.add(ids[u][i])\n } else {\n build(v, u, b, ans)\n kk -= b\n }\n }\n}\n\nfun main() {\n val r = Random.Default\n val (N, K) = readInts()\n for (i in 0 until N - 1) {\n var (u, v) = readInts()\n// var (u, v) = intArrayOf(r.nextInt(i + 1) + 1, i + 2)\n// var (u, v) = intArrayOf(i + 1, i + 2)\n u--\n v--\n ids[u].add(i)\n ids[v].add(i)\n adj[u].add(v)\n adj[v].add(u)\n }\n for (i in 0 until N) {\n dfs(i)\n }\n val bn = (IntStream.range(0, N).boxed().min { a, b -> dfs(a)[K].compareTo(dfs(b)[K]) }).get()\n val ans = ArrayList()\n build(bn, -1, K, ans)\n ans.sort()\n println(ans.size)\n for (i in ans) {\n print(i + 1)\n print(\" \")\n }\n println()\n\n}", "lang": "Kotlin", "bug_code_uid": "c5aa25c68929f78324204904bac9c8db", "src_uid": "56168b28f9ab4830b3d3c5eeb7fc0d3c", "apr_id": "1c1788e6af127da290b84b92d283fc12", "difficulty": 2200, "tags": ["trees", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9771739130434782, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.lang.AssertionError\nimport java.util.*\nimport java.lang.Math.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\n\nvar stok = StringTokenizer(\"\")\nvar br = BufferedReader(InputStreamReader(System.`in`))\n\nfun nextToken(): String? {\n while (!stok.hasMoreTokens()) {\n val s = br.readLine() ?: return null\n stok = StringTokenizer(s)\n }\n return stok.nextToken()\n}\n\nfun nextInt() = nextToken()!!.toInt()\nfun nextDouble() = nextToken()!!.toDouble()\nfun nextLong() = nextToken()!!.toLong()\n\nfun main(args: Array) {\n if (args.isNotEmpty()) br = BufferedReader(FileReader(\"input.txt\"))\n PrintWriter(System.out, false).use { it.solve() }\n}\n\nfun PrintWriter.solve() {\n val t1 = System.currentTimeMillis()\n\n val n = nextInt()\n val k = nextInt()\n\n if (n == k) {\n println(0)\n return\n }\n\n\n data class Edge(val f: Int, val to: Int): Comparable {\n override fun compareTo(other: Edge): Int {\n val c = f.compareTo(other.f)\n if (c != 0) {\n return c\n }\n return to.compareTo(other.to)\n }\n }\n\n val eToId = TreeMap()\n var g = Array>(n, { ArrayList() })\n\n for (i in 1 until n) {\n val x = nextInt() - 1\n val y = nextInt() - 1\n g[x].add(y)\n g[y].add(x)\n eToId[Edge(x, y)] = i\n eToId[Edge(y, x)] = i\n }\n\n val dp = Array(n, { IntArray(k + 1, { 1e9.toInt() }) })\n val sz = IntArray(n)\n\n fun dfs(v: Int, p: Int) {\n dp[v].fill(1e9.toInt())\n dp[v][1] = g[v].size\n sz[v] = 1\n if (p != -1) {\n dp[v][1]--\n }\n for (u in g[v]) {\n if (u == p) {\n continue\n }\n dfs(u, v)\n// for (i in sz[v] + 1 .. min(k, sz[v] + sz[u])) {\n// dp[v][i] = 1e9.toInt()\n// }\n sz[v] += sz[u]\n for (i in min(k, sz[v]) downTo 2) {\n for (j in min(i - 1, sz[u]) downTo 1) {\n dp[v][i] = min(dp[v][i], dp[v][i - j] + dp[u][j] - 1)\n }\n }\n }\n }\n\n dfs(0, -1)\n\n val t2 = System.currentTimeMillis()\n\n var av = -1\n var aa = 1e9.toInt()\n for (i in 0 until n) {\n val a = if (i == 0) 0 else 1\n if (dp[i][k] + a < aa) {\n aa = dp[i][k] + a\n av = i\n }\n }\n\n dfs(av, -1)\n\n var ng = Array>(n, { ArrayList() })\n\n fun ndfs(v: Int, p: Int) {\n for (u in g[v]) {\n if (u != p) {\n ng[v].add(u)\n ndfs(u, v)\n }\n }\n }\n\n ndfs(av, -1)\n g = ng\n\n val gg = Array(n, { i -> IntArray(ng[i].size, { j -> ng[i][j] }) })\n val ggsz = IntArray(n, { i -> ng[i].size })\n\n fun ggremove(i: Int, x: Int) {\n var p = 0\n while (p < ggsz[i]) {\n if (gg[i][p] == x) {\n break\n }\n p++\n }\n --ggsz[i]\n val t = gg[i][p]\n gg[i][p] = gg[i][ggsz[i]]\n gg[i][ggsz[i]] = t\n }\n\n fun ggrestore(i: Int) {\n ++ggsz[i]\n }\n\n fun dfs2(v: Int) {\n dp[v].fill(1e9.toInt())\n dp[v][1] = ggsz[v]\n sz[v] = 1\n// if (p != -1) {\n// dp[v][1]--\n// }\n// for (u in g[v]) {\n for (i in 0 until ggsz[v]) {\n val u = gg[v][i]\n dfs2(u)\n sz[v] += sz[u]\n for (i in min(k, sz[v]) downTo 2) {\n for (j in min(i - 1, sz[u]) downTo 1) {\n dp[v][i] = min(dp[v][i], dp[v][i - j] + dp[u][j] - 1)\n }\n }\n }\n }\n\n val ans = ArrayList()\n\n for (v in 0 until n) {\n val ves = IntArray(ggsz[v], { i -> gg[v][i] })\n for (u in ves) {\n// g[v].remove(u)\n ggremove(v, u)\n// g[u].remove(v)\n dfs2(av)\n if (dp[av][k] == aa - 1) {\n ans.add(eToId[Edge(v, u)]!!)\n aa--\n } else {\n// g[v].add(u)\n ggrestore(v)\n// g[u].add(v)\n }\n }\n }\n\n val t3 = System.currentTimeMillis()\n System.err.println(t2 - t1)\n System.err.println(t3 - t2)\n\n println(ans.size)\n for (i in ans) {\n print(i)\n print(\" \")\n }\n\n val t4 = System.currentTimeMillis()\n System.err.println(t4 - t1)\n}", "lang": "Kotlin", "bug_code_uid": "7c9767821aaf430c3d2abf1c81e13f4b", "src_uid": "56168b28f9ab4830b3d3c5eeb7fc0d3c", "apr_id": "853e4fea9dc2fd6b0b88f95bb2a17e47", "difficulty": 2200, "tags": ["trees", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9679730756703941, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.lang.AssertionError\nimport java.util.*\nimport java.lang.Math.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\n\nvar stok = StringTokenizer(\"\")\nvar br = BufferedReader(InputStreamReader(System.`in`))\n\nfun nextToken(): String? {\n while (!stok.hasMoreTokens()) {\n val s = br.readLine() ?: return null\n stok = StringTokenizer(s)\n }\n return stok.nextToken()\n}\n\nfun nextInt() = nextToken()!!.toInt()\nfun nextDouble() = nextToken()!!.toDouble()\nfun nextLong() = nextToken()!!.toLong()\n\nfun main(args: Array) {\n if (args.isNotEmpty()) br = BufferedReader(FileReader(\"input.txt\"))\n PrintWriter(System.out, false).use { it.solve() }\n}\n\nfun PrintWriter.solve() {\n val t1 = System.currentTimeMillis()\n\n val n = nextInt()\n val k = nextInt()\n\n if (n == 400 && k >= 350) {\n throw AssertionError()\n }\n\n\n data class Edge(val f: Int, val to: Int): Comparable {\n override fun compareTo(other: Edge): Int {\n val c = f.compareTo(other.f)\n if (c != 0) {\n return c\n }\n return to.compareTo(other.to)\n }\n }\n\n val eToId = TreeMap()\n var g = Array>(n, { ArrayList() })\n\n for (i in 1 until n) {\n val x = nextInt() - 1\n val y = nextInt() - 1\n g[x].add(y)\n g[y].add(x)\n eToId[Edge(x, y)] = i\n eToId[Edge(y, x)] = i\n }\n\n val dp = Array(n, { IntArray(k + 1, { 1e9.toInt() }) })\n val sz = IntArray(n)\n\n fun dfs(v: Int, p: Int) {\n dp[v].fill(1e9.toInt())\n dp[v][1] = g[v].size\n sz[v] = 1\n if (p != -1) {\n dp[v][1]--\n }\n for (u in g[v]) {\n if (u == p) {\n continue\n }\n dfs(u, v)\n// for (i in sz[v] + 1 .. min(k, sz[v] + sz[u])) {\n// dp[v][i] = 1e9.toInt()\n// }\n sz[v] += sz[u]\n for (i in min(k, sz[v]) downTo 2) {\n for (j in min(i - 1, sz[u]) downTo 1) {\n dp[v][i] = min(dp[v][i], dp[v][i - j] + dp[u][j] - 1)\n }\n }\n }\n }\n\n dfs(0, -1)\n\n val t2 = System.currentTimeMillis()\n\n var av = -1\n var aa = 1e9.toInt()\n for (i in 0 until n) {\n val a = if (i == 0) 0 else 1\n if (dp[i][k] + a < aa) {\n aa = dp[i][k] + a\n av = i\n }\n }\n\n dfs(av, -1)\n\n var ng = Array>(n, { ArrayList() })\n\n fun ndfs(v: Int, p: Int) {\n for (u in g[v]) {\n if (u != p) {\n ng[v].add(u)\n ndfs(u, v)\n }\n }\n }\n\n ndfs(av, -1)\n g = ng\n\n val gg = Array(n, { i -> IntArray(ng[i].size, { j -> ng[i][j] }) })\n val ggsz = IntArray(n, { i -> ng[i].size })\n\n fun ggremove(i: Int, x: Int) {\n var p = 0\n while (p < ggsz[i]) {\n if (gg[i][p] == x) {\n break\n }\n p++\n }\n --ggsz[i]\n val t = gg[i][p]\n gg[i][p] = gg[i][ggsz[i]]\n gg[i][ggsz[i]] = t\n }\n\n fun ggrestore(i: Int) {\n ++ggsz[i]\n }\n\n fun dfs2(v: Int) {\n dp[v].fill(1e9.toInt())\n dp[v][1] = ggsz[v]\n sz[v] = 1\n// if (p != -1) {\n// dp[v][1]--\n// }\n// for (u in g[v]) {\n for (i in 0 until ggsz[v]) {\n val u = gg[v][i]\n dfs2(u)\n sz[v] += sz[u]\n for (i in min(k, sz[v]) downTo 2) {\n for (j in min(i - 1, sz[u]) downTo 1) {\n dp[v][i] = min(dp[v][i], dp[v][i - j] + dp[u][j] - 1)\n }\n }\n }\n }\n\n val ans = ArrayList()\n\n for (v in 0 until n) {\n val ves = IntArray(ggsz[v], { i -> gg[v][i] })\n for (u in ves) {\n// g[v].remove(u)\n ggremove(v, u)\n// g[u].remove(v)\n dfs2(av)\n if (dp[av][k] == aa - 1) {\n ans.add(eToId[Edge(v, u)]!!)\n aa--\n } else {\n// g[v].add(u)\n ggrestore(v)\n// g[u].add(v)\n }\n }\n }\n\n val t3 = System.currentTimeMillis()\n System.err.println(t2 - t1)\n System.err.println(t3 - t2)\n\n println(ans.size)\n for (i in ans) {\n print(i)\n print(\" \")\n }\n\n val t4 = System.currentTimeMillis()\n System.err.println(t4 - t1)\n}", "lang": "Kotlin", "bug_code_uid": "4f24022a911045bdbc28a0c638d2ef96", "src_uid": "56168b28f9ab4830b3d3c5eeb7fc0d3c", "apr_id": "853e4fea9dc2fd6b0b88f95bb2a17e47", "difficulty": 2200, "tags": ["trees", "dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9909132212630622, "equal_cnt": 33, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 33, "fix_ops_cnt": 33, "bug_source_code": "import java.lang.Integer.parseInt\nimport java.lang.Long.parseLong\nimport java.lang.Math.max\nimport java.lang.Math.min\nimport java.lang.System.arraycopy\nimport java.lang.System.exit\nimport java.util.Arrays.copyOf\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.NoSuchElementException\nimport java.util.StringTokenizer\n\nobject H {\n\n internal var n: Int = 0\n internal var k: Int = 0\n internal var edges: Array\n internal var ans: IntList? = null\n\n internal var `in`: BufferedReader? = null\n internal var out: PrintWriter? = null\n internal var tok: StringTokenizer? = null\n\n internal class IntList {\n\n var data = IntArray(3)\n var size = 0\n\n val isEmpty: Boolean\n get() = size == 0\n\n fun size(): Int {\n return size\n }\n\n operator fun get(index: Int): Int {\n if (index < 0 || index >= size) {\n throw IndexOutOfBoundsException()\n }\n return data[index]\n }\n\n fun clear() {\n size = 0\n }\n\n operator fun set(index: Int, value: Int) {\n if (index < 0 || index >= size) {\n throw IndexOutOfBoundsException()\n }\n data[index] = value\n }\n\n fun expand() {\n if (size >= data.size) {\n data = copyOf(data, (data.size shl 1) + 1)\n }\n }\n\n fun insert(index: Int, value: Int) {\n if (index < 0 || index > size) {\n throw IndexOutOfBoundsException()\n }\n expand()\n arraycopy(data, index, data, index + 1, size++ - index)\n data[index] = value\n }\n\n fun delete(index: Int): Int {\n if (index < 0 || index >= size) {\n throw IndexOutOfBoundsException()\n }\n val value = data[index]\n arraycopy(data, index + 1, data, index, --size - index)\n return value\n }\n\n fun push(value: Int) {\n expand()\n data[size++] = value\n }\n\n fun pop(): Int {\n if (size == 0) {\n throw NoSuchElementException()\n }\n return data[--size]\n }\n\n fun unshift(value: Int) {\n expand()\n arraycopy(data, 0, data, 1, size++)\n data[0] = value\n }\n\n fun shift(): Int {\n if (size == 0) {\n throw NoSuchElementException()\n }\n val value = data[0]\n arraycopy(data, 1, data, 0, --size)\n return value\n }\n }\n\n @Throws(Exception::class)\n internal fun solve() {\n n = scanInt()\n k = scanInt()\n edges = arrayOfNulls(n)\n for (i in 0 until n) {\n edges[i] = IntList()\n }\n for (i in 0 until n - 1) {\n val a = scanInt() - 1\n val b = scanInt() - 1\n edges[a].push(b)\n edges[a].push(i)\n edges[b].push(a)\n edges[b].push(i)\n }\n ans = null\n dfs(0, -1, -1)\n out!!.println(ans!!.size)\n for (i in 0 until ans!!.size) {\n out!!.print((ans!!.data[i] + 1).toString() + \" \")\n }\n }\n\n internal fun dfs(cur: Int, prev: Int, upEdgeId: Int): Array? {\n var cans = arrayOfNulls(1)\n cans[0] = IntList()\n run {\n var i = 0\n while (i < edges[cur].size) {\n val next = edges[cur].data[i]\n if (next == prev) {\n i += 2\n continue\n }\n val nans = dfs(next, cur, edges[cur].data[i + 1])\n val merged = arrayOfNulls(cans.size + nans!!.size - 1)\n for (j in merged.indices) {\n var best = Integer.MAX_VALUE\n val from = max(0, j - nans.size + 1)\n val to = min(cans.size - 1, j)\n for (k in from..to) {\n best = min(best, cans[k].size + nans[j - k].size)\n }\n for (k in from..to) {\n if (best == cans[k].size + nans[j - k].size) {\n merged[j] = IntList()\n for (ii in 0 until cans[k].size) {\n merged[j].push(cans[k].data[ii])\n }\n for (ii in 0 until nans[j - k].size) {\n merged[j].push(nans[j - k].data[ii])\n }\n break\n }\n }\n }\n cans = merged\n i += 2\n }\n }\n if (cans.size >= k) {\n var mySize = cans[k - 1].size\n if (upEdgeId >= 0) {\n ++mySize\n }\n if (ans == null || ans!!.size > mySize) {\n if (ans == null) {\n ans = IntList()\n } else {\n ans!!.size = 0\n }\n for (i in 0 until cans[k - 1].size) {\n ans!!.push(cans[k - 1].data[i])\n }\n if (upEdgeId >= 0) {\n ans!!.push(upEdgeId)\n }\n }\n }\n if (upEdgeId >= 0) {\n val nans = arrayOfNulls(cans.size + 1)\n arraycopy(cans, 0, nans, 1, cans.size)\n nans[0] = IntList()\n nans[0].push(upEdgeId)\n return nans\n } else {\n return null\n }\n }\n\n @Throws(IOException::class)\n internal fun scanInt(): Int {\n return parseInt(scanString())\n }\n\n @Throws(IOException::class)\n internal fun scanLong(): Long {\n return parseLong(scanString())\n }\n\n @Throws(IOException::class)\n internal fun scanString(): String {\n while (tok == null || !tok!!.hasMoreTokens()) {\n tok = StringTokenizer(`in`!!.readLine())\n }\n return tok!!.nextToken()\n }\n\n @JvmStatic\n fun main(args: Array) {\n try {\n `in` = BufferedReader(InputStreamReader(System.`in`))\n out = PrintWriter(System.out)\n solve()\n `in`!!.close()\n out!!.close()\n } catch (e: Throwable) {\n e.printStackTrace()\n exit(1)\n }\n\n }\n}", "lang": "Kotlin", "bug_code_uid": "7405637039f1f53d84b29ceaae4ae0e1", "src_uid": "56168b28f9ab4830b3d3c5eeb7fc0d3c", "apr_id": "fe51286e41eb4e538c2ebbabd7e3a495", "difficulty": 2200, "tags": ["trees", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9987461938026151, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007L\n\ninline fun findMin(mn: Long, mx: Long, f: (Long) -> Boolean): Long {\n var low = mn - 1\n var high = mx\n while(high - low > 1) {\n val m = (low + high) / 2\n if (f(m)) high = m\n else low = m\n }\n return high\n}\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val N = nl()\n val M = nl()\n val K = nl()\n\n fun test(x: Long): Boolean {\n var sum = 0L\n for (i in 1 .. N) {\n sum += x / i\n }\n\n return sum >= K\n }\n\n val ans = findMin(0, N * M, ::test)\n out.println(ans)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "41ee84702e4ceb78163a91fffacea1af", "src_uid": "13a918eca30799b240ceb9de47507a26", "apr_id": "5e31b7ba81fe55c442c4d4a4af10404a", "difficulty": 1800, "tags": ["brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9279538904899135, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n print((n * n * (n - 1)) / 2 - (n * (n - 1) * (2 * n - 1)) / 6 + n)\n}", "lang": "Kotlin", "bug_code_uid": "d79e0b673f7bb60e8bb174dce7d03fb8", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "4fc30c5298afa6ae14c9cc9635eb6f99", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9863760217983651, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n print((n * n * (n - 1)) / 2 - (n * (n - 1) * (2 * n - 1)) / 6 + n)\n}", "lang": "Kotlin", "bug_code_uid": "df537fc3854e692f35f95fda77e7a3b3", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "4fc30c5298afa6ae14c9cc9635eb6f99", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9707112970711297, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val n= readLine()!!.toInt()\n val result=(n-1)*(n*(n+1)/6)+n\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "85c0e2e4ae8ec7a95f0b31a53745ea37", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "5b9cdbb94908710c8663e8d616d611c5", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7032258064516129, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n var ans = 1\n for (i in 2..n){\n ans*=i\n }\n print(ans+1)\n}\n", "lang": "Kotlin", "bug_code_uid": "29a47f48d534ebf730990b9046f982c7", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "745fedbfadc467fbffda4190bea6fc81", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7129629629629629, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n println(n * (n + 1) / 2)\n}", "lang": "Kotlin", "bug_code_uid": "4122aa93c283c1c1b410e45bc223b6e5", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "3df73bd4ee2e92200b20c31de717642c", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.996742671009772, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val n = readLine().toInt()\n var answer = 0\n var buttons = n\n for (i in 1..n) {\n val errors = buttons - 1\n val correct = 1\n val totalPresses = errors * i + correct\n answer += totalPresses\n buttons--\n }\n\n println(answer)\n}", "lang": "Kotlin", "bug_code_uid": "b409ab7617b5ab55430767c02a8df70a", "src_uid": "6df251ac8bf27427a24bc23d64cb9884", "apr_id": "2845a2564345deb5d42ae5e909193626", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9967948717948718, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val k = sc.nextLong()\n\n println(\"${minRoom(n, k)} + ${maxRoom(n, k)}\")\n}\n\nfun maxRoom(n: Long, k: Long) = Math.min(2 * k, n - k)\n\nfun minRoom(n: Long, k: Long) = if (k == 0L || k == n) 0 else 1\n", "lang": "Kotlin", "bug_code_uid": "5f27dc93ed19370f5da3c9a178d61af6", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "c60b20ee0a8765580b14430772dcaa4b", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9703225806451613, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val data = readLine()?.split(\" \")?.map { it.toLong() } ?: return\n\n val flatCount = data[0]\n val neighborCount = data[1]\n\n val min = if (flatCount == neighborCount) 0 else 1\n val max = when {\n flatCount <= neighborCount * 3 -> flatCount - neighborCount\n else -> (neighborCount) * 2\n }\n\n println(\"$min $max\")\n}", "lang": "Kotlin", "bug_code_uid": "0ca51b222280e23a8aacdd36af7372f8", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "f4d5c9b74d0e226d1e9886bee73ba67d", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9752066115702479, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n, k) = readInts()\n val minimum = if (n == k) 0 else 1\n val maximum = min(n - k, k * 2)\n print(\"$minimum $maximum\")\n}", "lang": "Kotlin", "bug_code_uid": "eae67697844b2cfa2ff4014124dc34bf", "src_uid": "bdccf34b5a5ae13238c89a60814b9f86", "apr_id": "4b0aacb96271453cc315d75e7cb96efa", "difficulty": 1200, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9864864864864865, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var r = readLine().toString()\n for(e in 0..r.length - 1){\n if(r[e] == 'H' || r[e] == 'Q' || r[e] == '9'){\n print(\"yes\")\n return\n }\n }\n print(\"NO\")\n return\n}\n", "lang": "Kotlin", "bug_code_uid": "a0b009b4d06ff4e0b0820280a88296b1", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "13dd9ecd831fc4edc4b5d7426bf43025", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8560311284046692, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n var list: MutableList = mutableListOf()\n\n for(i in 0..6){\n list.add(reader.nextInt())\n }\n var c = 0\n\n var j = 0\n while(n>0){\n n = n - list[j]\n j++\n if(j>6){\n j=0\n }\n c++\n }\n\n\n if(c>7) {\n println(c % 7)\n }\n else{\n println(c)\n }\n}", "lang": "Kotlin", "bug_code_uid": "9711f8f7155df0885aecb9b4e1ed8706", "src_uid": "007a779d966e2e9219789d6d9da7002c", "apr_id": "a3563d2ae1ade30dff3a2a05dd35fe37", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9348958333333334, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.abs\n\nfun main() {\n var (x, y) = readLine()!!.split(' ').map { it.toInt() }\n var sum = abs(x) + abs(y)\n if (x > 0 && y > 0) {\n println(\"0 $sum $sum 0\")\n } else if (x < 0 && y > 0) {\n println(\"${-sum} 0 0 $sum\")\n } else if (x > 0 && y < 0) {\n println(\"$sum 0 0 ${-sum}\")\n }else{\n println(\"${-sum} 0 0 ${-sum}\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "292b3984ed6e28259e32e0c6fd46f330", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "apr_id": "66aedab7ea98650de27d420280718f41", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9918845807033363, "equal_cnt": 9, "replace_cnt": 0, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.abs\n\nfun main() {\n val reader = InputReader(try{File(\"D:/repos/a/input.txt\").inputStream()} catch(e: Exception){System.`in`})\n val writer = PrintWriter(try{File(\"D:/repos/a/output.txt\").outputStream()} catch(e: Exception){System.out})\n\n val x = reader.int()\n val y = reader.int()\n val z = abs(x) + abs(y)\n val ans = when {\n x > 0 && y > 0 -> \"0 $z $z 0\"\n x < 0 && y < 0 -> \"0 -$z -$z 0\"\n x < 0 && y > 0 -> \"0 -$z $z 0\"\n else -> \"0 $z -$z 0\"\n }\n writer.println(ans)\n\n writer.close()\n}\n\nclass InputReader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer?\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = try { StringTokenizer(reader.readLine()) }\n catch (e: IOException) { throw RuntimeException(e) }\n }\n return tokenizer!!.nextToken()\n }\n fun ll(): Long { return next().toLong() }\n fun int(): Int { return next().toInt() }\n init { tokenizer = null }\n}", "lang": "Kotlin", "bug_code_uid": "c356aa0541432d5f24ae380cffd3b148", "src_uid": "e2f15a9d9593eec2e19be3140a847712", "apr_id": "a12d2342be3a2d823aac2b83486e944b", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9947089947089947, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var x = readLine()!!.toInt()\n for(i in x until 9000){\n var flag = 0; x++;\n val y = x.toString().toList().sorted()\n for(j in 0 until y.size-1){\n if (y[j] == y[j+1]){\n flag = 1\n break\n }\n }\n if(flag == 0){\n print(x.toString())\n break\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "1401edd1b45f8bf22cae620bf7059cdd", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "d440dd829bdfcde102d488bf4278f547", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9699769053117783, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val s = readLine()!!\n var n = s.toInt()\n while (n <= 9000) {\n n++\n if (n.toString().toSet().size == 4) {\n println(n)\n break\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "7d4d3535fbbd03d2ac90abba38d7508a", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "e4ee75935c3af5d4521c78e99dd7ae32", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9967845659163987, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.system.exitProcess\n\nfun main(args: Array) {\n val input = readLine()\n var n = 1000\n if (input != null) {\n n = input.toInt()\n }\n val digits = HashSet()\n for (i in n+1 .. 9000) {\n digits.clear()\n var temp = i\n while (temp != 0) {\n digits.add(temp % 10)\n temp /= 10\n }\n if (digits.size == 4) {\n println(i)\n exitProcess(0)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "e9e253f7446a64f4a05eef42d9ce2e1c", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "8b736129640eb756edc559d8cdb768da", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.2523461939520334, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\n\nfun main() {\n val y = readLine()!!.toInt() + 1\n for(i in y..9000) {\n var bitset = BitSet(10)\n var tmp = i\n var beautiful = true\n for(d in 1..4) {\n if(!bitset.get(tmp % 10))\n bitset.set(tmp%10)\n else {\n beautiful = false\n break\n }\n tmp /= 10\n }\n if(beautiful) {\n println(i)\n break\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "e251fd737adbd2dce4e376c3cfecfaa9", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "c2419de7aaa601b1e76872871ad7df03", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9899799599198397, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val prev = readLine()!!.toInt()\n val reg = \"^(?:([0-9])(?!.*\\\\1))*\\$\".toRegex()\n for(i in prev+1 .. 9000){\n if (reg.matches(i.toString())) {\n println(i)\n return\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "f9c1fd0a58d7e0812f67e5bca2f5697b", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "68631bae364b8408504abbcfeb4dedda", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9414758269720102, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var x = readLine()!!.toInt()\n while (x++ < 0x2329) {\n if (x.toString().split(\"\").distinct().count() == 5) {\n print(x)\n break\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "e1541eebd8338e9c4e1f1da0c162a3b4", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "7460ac3e6910f98010ec25e61fd01b45", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.995085995085995, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n\tval input: Int = readLine()!!.toInt()\n\tprintln(findNextDistinct(input))\n}\n\nfun findNextDistinct(input: Int): Int{\n\tvar no = input +1;\n\twhile(true){\n\t\tno+=1\n\t\tif(isDistinct(no)){\n\t\t\treturn no\n\t\t}\n\t}\n}\n\nfun isDistinct(no: Int): Boolean{\n\tval set = hashSetOf()\n\tset.add(no % 10)\n\tset.add((no/10) % 10)\n\tset.add((no/100) % 10)\n\tset.add((no/1000) % 10)\n\treturn set.size == 4\n}", "lang": "Kotlin", "bug_code_uid": "f4c78e875c68054a0a100fd38f60f211", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "55489931cc962c52269f14636f24b9bb", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9464285714285714, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n\tval (n,m) = readLine()!!.split(' ').map { it.toInt() }\n\n\tval Xarr = readLine()!!.split(' ').map { it.toInt() }\n\tval Yarr = readLine()!!.split(' ').map { it.toInt() }\n\n\tval password = Xarr.intersect(Yarr)\n\tpassword.forEach { print(it) }\n\t\n}", "lang": "Kotlin", "bug_code_uid": "14cf4b8a442803b8619cbe713449dcd3", "src_uid": "f9044a4b4c3a0c2751217d9b31cd0c72", "apr_id": "5a46e0564e63149f54218fdad2b1aba5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9895366218236173, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package p371\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.math.BigInteger\n\n\nfun main(vararg params: String) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n\n val inputs = br.readLine().split(\" \").take(5).map { BigInteger(it) }\n\n val l1 = inputs[0]\n val r1 = inputs[1]\n val l2 = inputs[2]\n val r2 = inputs[3]\n val k = inputs[4]\n\n\n val lowLimit = l1.max(l2)\n val highLimit = r1.min(r2)\n val minutes = highLimit - lowLimit + BigInteger.ONE\n if (minutes <= BigInteger.ZERO)\n println(0)\n else\n if (k <= highLimit && k >= lowLimit) println(minutes - BigInteger.ONE) else println(minutes)\n}\n", "lang": "Kotlin", "bug_code_uid": "65cd6f0a8be8f29d464e1332e1693cbe", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "apr_id": "0880f530f0ef0486ac40c49e86a59bee", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9209302325581395, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(vararg args: String) {\n // val input = Scanner(System.`in`)\n val (l1, r1, l2, r2, k) = readLine()!!.split(' ').map { it.toInt() }\n val l = Math.max(l1, l2)\n val r = Math.min(r1, r2)\n if (l > r) {\n println(0)\n } else {\n var o = r - l + 1\n if (l <= k && k <=r) o -= 1\n println(o)\n }\n}", "lang": "Kotlin", "bug_code_uid": "51ab876c44b867d593c58250c8fe6aa8", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "apr_id": "b33ec80eea3435e08138fc87efed218e", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.985594237695078, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.File\nimport java.io.PrintWriter\n\nfun main(args: Array) {\n val onlineJudge = System.getProperty(\"ONLINE_JUDGE\") == \"true\"\n val input = if (onlineJudge) System.`in`.bufferedReader() else File(\"input.txt\").bufferedReader()\n val output = if (onlineJudge) PrintWriter(System.out.writer(), true) else PrintWriter(File(\"output.txt\"))\n\n solve(input, output)\n\n output.flush()\n output.close()\n}\n\nprivate fun solve(input: BufferedReader, output: PrintWriter) {\n val (l1, r1, l2, r2, k) = input.readLine().split(\" \").map { it.toInt() }\n\n val start = Math.max(l1, l2)\n val end = Math.min(r1, r2)\n\n val answer = when {\n start > end -> 0\n else -> (end - start + 1).let { if (k in start..end) it - 1 else it }\n }\n\n output.println(answer)\n}", "lang": "Kotlin", "bug_code_uid": "7025fd4d91dc4fc5958d508b3b2a5488", "src_uid": "9a74b3b0e9f3a351f2136842e9565a82", "apr_id": "0361e4c218c7ca3f210cecaa6f61596c", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9976076555023924, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n var n = readLine()!!.toInt()\n\n var list = mutableListOf()\n\n for (i:Char in '0'..'9')\n for (j:Char in '0'..'9')if(j != i)\n for (k:Char in '0'..'9')if(k != i && k!= j)\n for (l:Char in '0'..'9')if(l!=i && l!=j && l!= k){\n var arr = CharArray(4){i}\n arr[1] = j\n arr[2] = k\n arr[3] = l\n\n var num = String(arr)\n\n list.add(num)\n }\n\n\n \n\n repeat(n){\n var (num,bulls, cows) = readLine()!!.split(\" \")\n var tmp = mutableListOf()\n for (s in list){\n var b = 0\n var c = 0\n\n var seto = setOf(num[0],num[1],num[2],num[3])\n var sett = setOf(s[0],s[1],s[2],s[3])\n\n var finSet = seto.intersect(sett);\n\n for (i in 0..3){\n if (s[i] == num[i])b++\n }\n\n c = finSet.size - b\n\n if(b == bulls.toInt() && c == cows.toInt())\n tmp.add(s)\n }\n\n list = tmp\n }\n\n if (list.size == 1)\n println(list[0])\n else if(list.isEmpty())\n println(\"Incorrect Data\")\n else\n println(\"Need more data\")\n}", "lang": "Kotlin", "bug_code_uid": "0c5983c2e57adcb927f30bf9cd4ef8f4", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "apr_id": "bfc67cca05605063709c4cd226f62d4a", "difficulty": 1700, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9760034904013961, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "var n:Int=0\nvar arr=Array(5){tuple(0,0,0)}\nfun main(args: Array){\n n= readLine()!!.toInt()\n for (i:Int in 0 until n){\n val inp=readLine()!!.split(' ')\n arr[i]=tuple(inp[0].toInt() , inp[1].toInt() , inp[2].toInt())\n }\n var ans=0\n var num_of_ans=0\n for(i:Int in 123..9876){\n if(!distinct(i)){\n continue\n }\n if(check(i)){\n ans=i\n num_of_ans++\n }\n }\n if(num_of_ans == 0){\n println(\"Incorrect data\")\n }else if(num_of_ans > 1){\n println(\"Need more data\")\n }else{\n print(ans)\n }\n}\nfun distinct(x:Int):Boolean{\n var firstX:Int=x%10\n var secondX:Int=(x%100)/10\n var thirdX:Int=(x%1000)/100\n var fourthX:Int=x/1000\n if(firstX == secondX || firstX == thirdX || firstX == fourthX\n || secondX == thirdX || secondX == fourthX || thirdX == fourthX){\n return false\n }\n return true\n}\n\nfun check(num: Int):Boolean{\n for(i:Int in 0 until n){//bulls the same pos\n if(Bulls(arr[i].x , num) != arr[i].y ||\n Cows(arr[i].x , num) != arr[i].z){\n return false\n }\n }\n return true\n}\nfun Bulls(x:Int , y:Int):Int{\n var ans:Int=0\n if(x%10 == y%10){\n ans++\n }\n if ((x%100)/10 == (y%100)/10){\n ans++\n }\n if ((x%1000)/100 == (y%1000)/100){\n ans++\n }\n if(x/1000 == y/1000){\n ans++\n }\n return ans\n}\nfun Cows(x:Int , y:Int):Int{\n var ans=0\n var firstX:Int=x%10\n var secondX:Int=(x%100)/10\n var thirdX:Int=(x%1000)/100\n var fourthX:Int=x/1000\n\n var firstY:Int=y%10\n var secondY:Int=(y%100)/10\n var thirdY:Int=(y%1000)/100\n var fourthY:Int=y/1000\n if(firstX == secondY || firstX == thirdY || firstX == fourthY){\n ans++\n }\n if(secondX == firstY || secondX == thirdY || secondX == fourthY){\n ans++\n }\n if(thirdX == secondY || thirdX == firstY || thirdX == fourthY){\n ans++\n }\n if(fourthX == secondY || fourthX == thirdY || fourthX == firstY){\n ans++\n }\n return ans\n}\nclass tuple(x:Int , y:Int , z:Int){\n var x:Int=0\n var y:Int=0\n var z:Int=0\n init{\n this.x=x\n this.y=y\n this.z=z\n }\n}", "lang": "Kotlin", "bug_code_uid": "006d6e3cd7105f34d8a2aebc5064ee71", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "apr_id": "df451e56640d21f36a746c45555124a7", "difficulty": 1700, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.976226826608506, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "var n:Int=0\nvar arr=Array(15){tuple(0,0,0)}\nfun main(args: Array){\n n= readLine()!!.toInt()\n for (i:Int in 0 until n){\n val inp=readLine()!!.split(' ')\n arr[i]=tuple(inp[0].toInt() , inp[1].toInt() , inp[2].toInt())\n }\n var ans=0\n var num_of_ans=0\n for(i:Int in 123..9876){\n if(!distinct(i)){\n continue\n }\n if(check(i)){\n ans=i\n num_of_ans++\n }\n }\n if(num_of_ans == 0){\n println(\"Incorrect data\")\n }else if(num_of_ans > 1){\n println(\"Need more data\")\n }else{\n print(ans)\n }\n}\nfun distinct(x:Int):Boolean{\n var firstX:Int=x%10\n var secondX:Int=(x%100)/10\n var thirdX:Int=(x%1000)/100\n var fourthX:Int=x/1000\n if(firstX == secondX || firstX == thirdX || firstX == fourthX\n || secondX == thirdX || secondX == fourthX || thirdX == fourthX){\n return false\n }\n return true\n}\n\nfun check(num: Int):Boolean{\n for(i:Int in 0 until n){//bulls the same pos\n if(Bulls(arr[i].x , num) != arr[i].y ||\n Cows(arr[i].x , num) != arr[i].z){\n return false\n }\n }\n return true\n}\nfun Bulls(x:Int , y:Int):Int{\n var ans:Int=0\n if(x%10 == y%10){\n ans++\n }\n if ((x%100)/10 == (y%100)/10){\n ans++\n }\n if ((x%1000)/100 == (y%1000)/100){\n ans++\n }\n if(x/1000 == y/1000){\n ans++\n }\n return ans\n}\nfun Cows(x:Int , y:Int):Int{\n var ans=0\n var firstX:Int=x%10\n var secondX:Int=(x%100)/10\n var thirdX:Int=(x%1000)/100\n var fourthX:Int=x/1000\n\n var firstY:Int=y%10\n var secondY:Int=(y%100)/10\n var thirdY:Int=(y%1000)/100\n var fourthY:Int=y/1000\n if(firstX == secondY || firstX == thirdY || firstX == fourthY){\n ans++\n }\n if(secondX == firstY || secondX == thirdY || secondX == fourthY){\n ans++\n }\n if(thirdX == secondY || thirdX == firstY || thirdX == fourthY){\n ans++\n }\n if(fourthX == secondY || fourthX == thirdY || fourthX == firstY){\n ans++\n }\n return ans\n}\nclass tuple(x:Int , y:Int , z:Int){\n var x:Int=0\n var y:Int=0\n var z:Int=0\n init{\n this.x=x\n this.y=y\n this.z=z\n }\n}", "lang": "Kotlin", "bug_code_uid": "ab00cf5a904db3552f417a8e550150e2", "src_uid": "142e5f2f08724e53c234fc2379216b4c", "apr_id": "df451e56640d21f36a746c45555124a7", "difficulty": 1700, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984709480122325, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n var n :Int = readLine()!!.toInt()\n var s :String = readLine()!!.toString()\n var f :Boolean = false\n for(jm in 0..n) {\n for(ps in 0..(n - 1)) {\n var cnt:Int = 0\n for(i in ps..(n - 1) step (jm + 1)) {\n if(s[i] == '*') {\n cnt += 1\n }else{\n if(cnt >= 4) {\n f = true\n }\n cnt = 0\n }\n }\n if(cnt >= 4) {\n f = true\n }\n }\n }\n if(f == true) {\n println(\"yes\")\n }else{\n println(\"no\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "5ce695991f317865b4da8098ca490a18", "src_uid": "12d451eb1b401a8f426287c4c6909e4b", "apr_id": "9d7b1aa0a626b8786174fe8c2c69a8cc", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6255707762557078, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val (n, k) = readInts()\n println(15 * n / k + 1)\n}\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }", "lang": "Kotlin", "bug_code_uid": "1ca96b2b539b26bde30ea2c8339c2ff9", "src_uid": "d259a3a5c38af34b2a15d61157cc0a39", "apr_id": "761526a89d53741c465d2ac9ef40c8a0", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9301611665387567, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\n\n\nfun main(args : Array) {\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n val s = readLine()!!\n var a = 0\n var sum1 = 0\n var sum2 = 0\n for (i in 0..s.length - 1) {\n if (s[i] == '4' || s[i] == '7') {\n a++\n }\n }\n\n if(a==s.length){\n for(i in 0..n/2-1){\n sum1= sum1+s[i].toInt()\n }\n for(j in n/2..n-1){\n sum2= sum2+s[j].toInt()\n }\n if(sum1==sum2){\n println(\"YES\")\n }\n else{\n println(\"NO\")\n }\n }\n else{\n println(\"NO\")\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "7d091825099bd56fa1c18e448544ba77", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "apr_id": "bb5a80256acee78d6936fd14908dc290", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8603603603603603, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n print(if (s.substring(0, n / 2).count { it == '4' } == s.substring(n / 2, n).count { it == '4' }) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "b3879b593e54cb5d1bedc32ad6f00148", "src_uid": "435b6d48f99d90caab828049a2c9e2a7", "apr_id": "bd047024aeee89b2ec1ad8c77637cbc2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9851446442533229, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/**\n * We declare a package-level function main which returns Unit and takes\n * an Array of strings as a parameter. Note that semicolons are optional.\n */\nfun main(args: Array) {\n//\tval (l,r) = readLine()!!.split(' ').map(String::toInt)\t\n\tvar str = args[0]\n var c = \"aoyuie\";\n str = str.toLowerCase()\n var newStr = StringBuilder()\n for ( s in str ) {\n var a = 0\n\t\tfor (ch in c ) {\n if (!s.equals(ch)) {\n a+=1\n }\n }\n if (a==6) {\n newStr.append(\".\")\n newStr.append(s)\n \n }\n \n }\n println(newStr.toString())\n}\n", "lang": "Kotlin", "bug_code_uid": "da5edfce7dae03958c78b4ff1fffc635", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "810bd572c6f4774d3270f2b7bc79a363", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9132791327913279, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "class Main {\n companion object {\n @JvmStatic\n fun main(args: Array) {\n val vowels = \"aAoOyYeEuUiI\"\n val str = readLine()!!\n var newStr = \"\"\n for (c: Char in str) {\n if (!(c in vowels)) {\n newStr += \".\" + c.toLowerCase()\n }\n }\n println(newStr)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "8fabc237ccbff8a5925bb97be8568036", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "bd4820d64d0fe16c4aab061d33aca623", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.17204301075268819, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n var (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n val a = readLine()!!.split(\" \").map { it.toInt() }\n if (a[k - 1] <= 0)\n while (k > 0 && a[k - 1] <= 0) k--\n else\n while (k < n && a[k] == a[k - 1]) k++\n println(k)\n}", "lang": "Kotlin", "bug_code_uid": "e06225a9ac4935938104bcb9ecbbb5e9", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "9a3e60f1924a70f96ca047420d5ce5c2", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5095238095238095, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.lang.StringBuilder\n\nobject TaskManager {\n\n val vowels: String = \"AOYEUI\"\n\n fun stringTask(input: String) : String {\n\n val result: StringBuilder = StringBuilder()\n\n input.forEach {\n\n if (vowels.contains(it, ignoreCase = true)) {\n return@forEach\n } else {\n result.append(\".\" + it.toLowerCase())\n }\n }\n\n return result.toString()\n\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "62a544a6094a8a153d9cc271805cde0b", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "14409cea20ee061bb65ee1c4079d2d5a", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8351063829787234, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.lang.StringBuilder\n\nfun main(args: Array) {\n\n val vowels: String = \"AOYEUI\"\n\n val input = args[0]\n\n val result: StringBuilder = StringBuilder()\n\n input.forEach {\n\n if (vowels.contains(it, ignoreCase = true) == false) {\n result.append(\".\" + it.toLowerCase())\n }\n }\n\n println(result.toString())\n\n}", "lang": "Kotlin", "bug_code_uid": "a6f141e0687d76c42ebcf6d620b7f101", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "14409cea20ee061bb65ee1c4079d2d5a", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.859504132231405, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val x = readLine()!!.toLowerCase()\n println(x.replaceAll(\"[aoyeui]+\".toRegex(), \".\"))\n}", "lang": "Kotlin", "bug_code_uid": "c931baa7fa21136ec72b837ae4189f86", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "6e4eccdac49a50adbea48dacb324af66", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9925373134328358, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val x = readLine()!!.toLowerCase()\n println(x.replace(\"[aoyeui]+\".toRegex(), \"\").replace(\".\".toRegex(), \".$1\"))\n}", "lang": "Kotlin", "bug_code_uid": "ad3373bea439ac88a42aaa62c0a6aa7f", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "6e4eccdac49a50adbea48dacb324af66", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9563318777292577, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "var x = readLine()\n x = x!!.toLowerCase()\n var a : String = \"\"\n for (c in x)\n {\n if (c!='o' && c!='i' && c!='u'&&c!='e'&&c!='y' && c!='a')\n {\n a+=\".$c\"\n }\n }\n println(a)", "lang": "Kotlin", "bug_code_uid": "900b0f2ae9f258829d86465df80ba18a", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "88409d2914f3cc718c32575ca36ba2c1", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9634464751958225, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n var scanner = Scanner(System.`in`)\n var a = scanner.next()\n a = a.toLowerCase()\n for(i in a.length-1 downTo 0){\n if(a[i] == 'a' || a[i]=='o'|| a[i]=='y'|| a[i]=='e'|| a[i]=='u'|| a[i]=='i') a = a.replace(\"${a[i]}\",\"\")\n }\n var b:String =\"\"\n for(c in a){\n b=b.plus('.').plus(c)\n }\n println(b)\n}\n", "lang": "Kotlin", "bug_code_uid": "99e04b5bdbfdd854171f8de74d9cfcf4", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b", "apr_id": "6fc11e2f1db5d90f2cfa5cfc0e971972", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9877049180327869, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(){\nvar (n,m,k)=readLine()!!.split(' ').map(String::toInt)\nvar a=readLine()!!.split(' ').map(String::toInt)\nvar d:Int\nvar e:Int\ne=10000\nfor(i in 0..n-1){\nif(a[i]>0&&a[i]<=k){\nd=i-m\nif(d<0) d=d*(-1)\nif(d=1) {\n println(a - k * 6 - n)\n }\n else{\n print(0)\n }\n}", "lang": "Kotlin", "bug_code_uid": "d2607de0ec081534a88bd1a31595cf71", "src_uid": "e87d9798107734a885fd8263e1431347", "apr_id": "09d862356d185768644a9f900557c3bf", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9106628242074928, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "fun main() {\n val arr = readLine()!!.split(\" \").map { it.toInt() }\n val sumn = ((arr[1] + arr[1]*arr[3])/2) * arr[3]\n println(sumn - arr[2])\n }", "lang": "Kotlin", "bug_code_uid": "b967a149bbfa3d4af155ac71cba1a533", "src_uid": "e87d9798107734a885fd8263e1431347", "apr_id": "0fffb994a03b53ee759f77ee74ec0d57", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9589403973509933, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": " val input = readLine()!!\n val splitInput = input.split(\" \")\n\n val price = splitInput[0].toInt()\n val solderMoney = splitInput[1].toInt()\n val count = splitInput[2].toInt()\n\n var sum = 0\n\n for(i in 1..count){\n sum += i*price\n }\n\n if (solderMoney - sum>= 0 ){\n print(0)\n }else {\n print (sum - solderMoney)\n }\n", "lang": "Kotlin", "bug_code_uid": "8831ac4216e5dcbf05d451e5fef6cbe6", "src_uid": "e87d9798107734a885fd8263e1431347", "apr_id": "5da0d856104726c2e548499a2aab03d0", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6433734939759036, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val m = Array(3) { IntArray(3) }\n for (row in 0 until 3) m[row] = readInts().toIntArray()\n var x = 0 // sum of rows, columns and diagonals\n for (row in 0 until 3) x = max(x, m[row].sum() + 1)\n for (column in 0 until 3) x = max(x, m.fold(0) { acc, arr -> acc + arr[1] } + 1)\n for (row in 0 until 3) m[row][row] = x - m[row].sum()\n print(m.joinToString(System.lineSeparator()) { row -> row.joinToString(\" \") })\n}", "lang": "Kotlin", "bug_code_uid": "b8db0ffdd7d9c925ad2e084b461a1f51", "src_uid": "0c42eafb73d1e30f168958a06a0f9bca", "apr_id": "8a5adfda71cc3501640787e7a6f5cc0e", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9998635184932442, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.DataInputStream\nimport java.io.InputStream\nimport java.lang.StringBuilder\nimport kotlin.math.min\n\ninternal class Parserdoubt(`in`: InputStream) {\n private val BUFFER_SIZE = 1 shl 17\n\n private val din: DataInputStream\n private val buffer: ByteArray\n private var bufferPointer: Int = 0\n private var bytesRead: Int = 0\n\n init {\n din = DataInputStream(`in`)\n buffer = ByteArray(BUFFER_SIZE)\n bytesRead = 0\n bufferPointer = bytesRead\n }\n\n @Throws(Exception::class)\n fun nextString(): String {\n val sb = StringBuffer(\"\")\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n do {\n sb.append(c.toChar())\n c = read()\n } while (c > ' '.toByte())\n return sb.toString()\n }\n\n @Throws(Exception::class)\n fun wholeLine(): String {\n val sb = StringBuffer(\"\")\n var c = read()\n while (c <= '\\n'.toByte())\n c = read()\n do {\n sb.append(c.toChar())\n c = read()\n } while (c > '\\n'.toByte())\n return sb.toString()\n }\n\n @Throws(Exception::class)\n fun nextChar(): Char {\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n return c.toChar()\n }\n\n @Throws(Exception::class)\n fun nextInt(): Int {\n var ret = 0\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n val neg = c == '-'.toByte()\n if (neg)\n c = read()\n do {\n ret = ret * 10 + c - '0'.toInt()\n c = read()\n } while (c > ' '.toByte())\n return if (neg) -ret else ret\n }\n\n @Throws(Exception::class)\n fun nextLong(): Long {\n var ret: Long = 0\n var c = read()\n while (c <= ' '.toByte())\n c = read()\n val neg = c == '-'.toByte()\n if (neg)\n c = read()\n do {\n ret = ret * 10 + c - '0'.toLong()\n c = read()\n } while (c > ' '.toByte())\n return if (neg) -ret else ret\n }\n\n @Throws(Exception::class)\n private fun fillBuffer() {\n bufferPointer = 0\n bytesRead = din.read(buffer, 0, BUFFER_SIZE)\n if (bytesRead == -1)\n buffer[0] = -1\n }\n\n @Throws(Exception::class)\n private fun read(): Byte {\n if (bufferPointer == bytesRead)\n fillBuffer()\n return buffer[bufferPointer++]\n }\n}\n\ndata class E (\n val cnt:Int,\n val id: Int\n): Comparable {\n override fun compareTo(other: E): Int {\n return other.cnt - cnt\n }\n}\n\nfun main(args : Array) {\n val input = Parserdoubt(`in` = System.`in`)\n val NT = 1//input.nextInt()\n val sb = StringBuilder()\n for(test in 1..NT){\n val c = input.nextInt()\n val r = input.nextInt()\n val n = input.nextInt() - 1\n var ans = 0\n\n for(i in -5000 .. 5000 step 2){\n if(i<0){\n val start = -i\n val num = min(r - start, c)\n if(num <= 0)continue\n if(num%2==1){\n if(num/2 == n)ans ++\n else if(num/2 > n)ans +=2\n }else {\n if(num/2 >= n)ans +=2\n }\n } else {\n val end = c - i\n val num = min(r, end)\n if(num <= 0)continue\n if(num%2==1){\n if(num/2 == n)ans ++\n else if(num/2 > n)ans +=2\n }else {\n if(num/2 > n)ans +=2\n }\n }\n }\n println(ans)\n\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "2f4234f6cd7028d67506f14bef40c521", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "apr_id": "8fb89f61f229515a56396b5b86dbf0ec", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5833333333333334, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun pow(a: Int, b: Int) = Math.pow(a.toDouble(), b.toDouble()).toLong()\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val k = scanner.nextInt()\n var i = 1\n while (true) {\n val p: Long = i*pow(10, k)\n if (p % n == 0.toLong()) {\n println(p)\n break\n }\n i++\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "c044e1c907596d1fb24739788d2a74a6", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "apr_id": "5532caf2b9ca57b8f2c0a18746926b7c", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.27055016181229774, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n fun Int.primeFactors(): MutableMap {\n val output = mutableMapOf().withDefault { 0 }\n var dividend = this\n while (dividend != 1) {\n for (divisor in 2..dividend)\n if (dividend % divisor == 0) {\n output[divisor] = output.getValue(divisor) + 1\n dividend /= divisor\n break\n }\n }\n return output\n }\n\n val (n, k) = readInts()\n var sol = 1L\n val primeFactors = n.primeFactors()\n if (2 in primeFactors) primeFactors[2] = max(0, primeFactors.getValue(2) - k)\n if (5 in primeFactors) primeFactors[5] = max(0, primeFactors.getValue(5) - k)\n for ((key, value) in primeFactors) for (i in 1..value) sol *= key\n val sb = StringBuilder(sol.toString())\n for (i in 1..k) sb.append('0')\n print(sb)\n}", "lang": "Kotlin", "bug_code_uid": "90c36096c4143b92ebbdac5696879162", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "apr_id": "6eeb0bbbdd9c99a9035325ab41ca1101", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9779346866725508, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (n, k) = readInts()\n var nn = n\n var twos = 0\n var fives = 0\n while(twos < k && nn % 2 == 0) {\n twos++\n nn /= 2\n }\n while(fives < k && nn % 5 == 0) {\n fives++\n nn /= 5\n }\n var sol = n\n while (twos < fives) {\n sol *= 2\n twos++\n }\n while (fives < twos) {\n sol *= 5\n fives++\n }\n val sb = StringBuilder(sol.toString())\n for (i in twos until k) sb.append('0')\n print(sb)\n}", "lang": "Kotlin", "bug_code_uid": "b8ac1128bf7cdbf1c06f22c7a2fdf81d", "src_uid": "73566d4d9f20f7bbf71bc06bc9a4e9f3", "apr_id": "6eeb0bbbdd9c99a9035325ab41ca1101", "difficulty": 1100, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.47437597974195106, "equal_cnt": 171, "replace_cnt": 114, "delete_cnt": 25, "insert_cnt": 32, "fix_ops_cnt": 171, "bug_source_code": "import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static IO in;\n public static PrintWriter out;\n\n static void init_io(String filename) throws Exception {\n if (filename.equals(\"\")) {\n in = new IO(System.in);\n out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), true);\n } else {\n in = new IO(new FileInputStream(filename + \".in\"));\n out = new PrintWriter(new BufferedWriter(new FileWriter(filename + \".out\")), true);\n }\n }\n\n final static long mod = 998244353;\n\n/*\nfun main(args: Array) {\n Main.main(args);\n}\n*/\n\n static long get(long l, long r) {\n if (l == r) return 0;\n\n long x = 1;\n while (x * 2 <= r) x *= 2;\n if (l < x) return x * 2 - 1;\n return get(l - x, r - x);\n }\n\n static void solve(int tc) throws Exception {\n long l = in.nlong(), r = in.nlong();\n\n out.println(get(l, r));\n }\n\n public static void main(String[] _u_n_u_s_e_d_) throws Exception {\n init_io(\"\");\n\n int t = 1;\n // t = in.nint();\n for (int tc = 0; tc < t; tc++) {\n solve(tc);\n }\n }\n\n static long minv(long v) {\n return mpow(v, mod - 2);\n }\n\n static long mpow(long base, long exp) {\n long res = 1;\n\n while (exp > 0) {\n if ((exp & 1) == 1) {\n res = (res * base) % mod;\n }\n base = (base * base) % mod;\n exp >>= 1;\n }\n\n return res;\n }\n\n static long gcd(long x, long y) {\n if (x == 0) return y;\n return gcd(y % x, x);\n }\n\n static void rsort(long[] arr) {\n Random r = new Random();\n for (int i = 0; i < arr.length; i++) {\n int j = i + r.nextInt(arr.length - i);\n long t = arr[i];\n arr[i] = arr[j];\n arr[j] = t;\n }\n Arrays.sort(arr);\n }\n\n static void rsort(int[] arr) {\n Random r = new Random();\n for (int i = 0; i < arr.length; i++) {\n int j = i + r.nextInt(arr.length - i);\n int t = arr[i];\n arr[i] = arr[j];\n arr[j] = t;\n }\n Arrays.sort(arr);\n }\n\n /* static void qsort(long[] arr) {\n Long[] oarr = new Long[arr.length];\n for (int i = 0; i < arr.length; i++) {\n oarr[i] = arr[i];\n }\n\n ArrayList alist = new ArrayList(Arrays.asList(oarr));\n Collections.sort(alist);\n\n for (int i = 0; i < arr.length; i++) {\n arr[i] = (long)alist.get(i);\n }\n } */\n\n static void reverse(long[] arr) {\n for (int i = 0; i < arr.length / 2; i++) {\n long temp = arr[i];\n arr[i] = arr[arr.length - 1 - i];\n arr[arr.length - 1 - i] = temp;\n }\n }\n\n static String atos(long[] arr) {\n String s = Arrays.toString(arr);\n s = s.substring(1, s.length() - 1);\n return s.replace(\",\", \"\");\n }\n\n static class IO {\n public BufferedReader in;\n public StringTokenizer tokens;\n\n public IO(InputStream x) throws Exception {\n in = new BufferedReader(new InputStreamReader(x));\n tokens = new StringTokenizer(in.readLine());\n }\n\n int nint() throws Exception {\n return Integer.parseInt(nstr());\n }\n\n long nlong() throws Exception {\n return Long.parseLong(nstr());\n }\n\n double ndouble() throws Exception {\n return Double.parseDouble(nstr());\n }\n\n String nstr() throws Exception {\n if (!tokens.hasMoreTokens()) tokens = new StringTokenizer(in.readLine());\n return tokens.nextToken();\n }\n \n long[] nla(int n) throws Exception {\n long[] arr = new long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nlong();\n }\n return arr;\n }\n }\n\n static class Pair, B extends Comparable> implements Comparable> {\n public A f;\n public B s;\n\n public Pair(A a, B b) {\n f = a;\n s = b;\n }\n\n public int compareTo(Pair other) {\n int v = f.compareTo(other.f);\n if (v != 0) return v;\n return s.compareTo(other.s);\n }\n\n public String toString() {\n return \"(\" + f.toString() + \", \" + s.toString() + \")\";\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "b9c036a3cd910ebeee39555a64b66ee0", "src_uid": "d90e99d539b16590c17328d79a5921e0", "apr_id": "0fc4ffd53457410b6ef3086ced640734", "difficulty": 1700, "tags": ["dp", "bitmasks", "greedy", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9296928327645051, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nfun main(){\n val scanner = Scanner(System.`in`)\n val l = scanner.nextLong().toString(2)\n val r = scanner.nextLong().toString(2)\n\n val diff = r.length - l.length\n var max = StringBuilder(\"\")\n var flag = false\n\n if(diff > 0){\n for(i in 1..diff)\n max.append(\"1\")\n flag = true\n }\n\n for(i in l.indices){\n if(flag){\n for(j in 1..l.length)\n max.append(\"1\")\n break\n }\n if(l[i] != r[i + diff]){\n max = StringBuilder(\"1\")\n flag = true\n }\n }\n if(!flag){\n max = StringBuilder(\"0\")\n }\n print(max.toString().toInt(2))\n\n}", "lang": "Kotlin", "bug_code_uid": "4fba4932ca52a65f934c2491e5b9e2c9", "src_uid": "d90e99d539b16590c17328d79a5921e0", "apr_id": "d5814eee7ecc17ee47d64485c12be752", "difficulty": 1700, "tags": ["dp", "bitmasks", "greedy", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9345156889495225, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(){\n val scanner = Scanner(System.`in`)\n val l = scanner.nextLong().toString(2)\n val r = scanner.nextLong().toString(2)\n\n val diff = r.length - l.length\n var max = StringBuilder(\"\")\n var flag = false\n\n if(diff > 0){\n for(i in 1..diff)\n max.append(\"1\")\n flag = true\n }\n\n for(i in l.indices){\n if(flag){\n for(j in 1..l.length)\n max.append(\"1\")\n break\n }\n if(l[i] != r[i + diff]){\n max = StringBuilder(\"1\")\n flag = true\n }\n }\n if(!flag){\n max = StringBuilder(\"0\")\n }\n print(max.toString().toLong(2))\n\n}", "lang": "Kotlin", "bug_code_uid": "9506bc2aa8ef1ac1c278d65ac46df866", "src_uid": "d90e99d539b16590c17328d79a5921e0", "apr_id": "d5814eee7ecc17ee47d64485c12be752", "difficulty": 1700, "tags": ["dp", "bitmasks", "greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4992, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.math.BigInteger\n\nfun main(args: Array) {\n val n = readLine()!!.toBigInteger()\n var index = BigInteger.ONE\n val minOne = (-1).toBigInteger()\n var symbol = minOne\n var sum = BigInteger.ZERO\n do {\n sum += (symbol * index)\n symbol = minOne * symbol\n index++\n } while (index <= n)\n\n println(sum)\n}", "lang": "Kotlin", "bug_code_uid": "bc97433919b04df9131e7eb72cdd68da", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "a06e105355f07cc37b05549412e89ceb", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5454545454545454, "equal_cnt": 14, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 7, "fix_ops_cnt": 14, "bug_source_code": "fun main() {\nval n = readLine()?.toInt()!!\n\n if(n%2==0){\n print((n+1)/2)\n }\n else{\n print(-(n/2)-1)\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "b9cada3ae8445c141c0b96e8347719b8", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "020ca5d0252144593be4a227b66d17e4", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9802371541501976, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n println(n / 2 - n * (n % 2))\n}", "lang": "Kotlin", "bug_code_uid": "97bc82a515b35d0f62d2a28428e1043a", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "9e0d78e311f28b8f32350a41ac2e3ddb", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8616838487972509, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n output.print((1..input.nextInt()).fold(0, { acc: Int, i: Int -> acc + if (i % 2 == 1) -i else i }))\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "29a4117d664c835ef033ba18b19ec3ff", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "536c614a0aeeaa68d51ad3ba6f65b3cd", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9495524816924329, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val n = input.nextInt()\n\n val evenCount = n / 2\n val oddCount = if (n % 2 == 0) evenCount else evenCount + 1\n\n output.print((4 + 2 * (evenCount - 1)) * evenCount / 2 - (2 + 2 * (oddCount - 1)) * oddCount / 2)\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "8a056f1bbcc409958fca89fa63bc5317", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "536c614a0aeeaa68d51ad3ba6f65b3cd", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.574468085106383, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "fun main() {\n val k = readLine()!!.toInt()\n val (even,odd) = (1..k).partition { it%2 ==0 }\n println(even.sum()-odd.sum())\n \n}", "lang": "Kotlin", "bug_code_uid": "592e9d566c18bb15c20170b4a92fe80f", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "185c8ee66e1d606685fc619b073f5763", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9965156794425087, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val j = readLine()!!.toLong()\n if (j % 2 == 1)\n println((j - j / 2).unaryMinus())\n else\n println(j / 2)\n\n}", "lang": "Kotlin", "bug_code_uid": "9267171127db62984f7f2961f87b0cbc", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "185c8ee66e1d606685fc619b073f5763", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9790209790209791, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val j = readLine()!!.toInt()\n if (j % 2 == 1)\n println((j - j / 2).unaryMinus())\n else\n println(j / 2)\n\n}", "lang": "Kotlin", "bug_code_uid": "8894d8585fed99c3958dea210925dd8c", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "185c8ee66e1d606685fc619b073f5763", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9274447949526814, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main(args : Array) {\n val n = readLine()!!.toInt()\n if (n % 2 == 0)\n println(n/2)\n else\n println(-n + ((n-1)/2))\n}", "lang": "Kotlin", "bug_code_uid": "b9d0130cdd23db32937650c0743c3b2f", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "a461b1771d883e9e5375f5f18b538cb3", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7169476486246673, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "// https://codeforces.com/problemset/problem/486/A\n\n\nfun main(args: Array) {\n val number = readInt()\n\n var result = 0\n\n for (i in 1..number) {\n if (i % 2 == 0) {\n result -= -i\n } else {\n result -= i\n }\n }\n\n print(result)\n\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings(del: String = \" \") = readLn().split(del) // list of strings\nprivate fun readInts(del: String = \" \") = readStrings(del).map { it.toInt() } // list of ints", "lang": "Kotlin", "bug_code_uid": "cd72c0b3f456ff2cb17add2e815f8598", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "e36d002e32fe85f7d14c5f751f2f2c0f", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7484567901234568, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "// https://codeforces.com/problemset/problem/486/A\n\n\nfun main(args: Array) {\n val number = readInt()\n\n if(number % 2 == 0){\n print(number / 2)\n }else{\n print(-((number / 2 ) + 1))\n }\n\n\n// val positive = number / 2\n//\n//\n//\n// var result = 0\n//\n// for (i in 1..number) {\n// if (i % 2 == 0) {\n// result -= -i\n// } else {\n// result -= i\n// }\n// }\n//\n// print(result)\n\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings(del: String = \" \") = readLn().split(del) // list of strings\nprivate fun readInts(del: String = \" \") = readStrings(del).map { it.toInt() } // list of ints", "lang": "Kotlin", "bug_code_uid": "70d6a29b195000fa0d55c1124d45374b", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "e36d002e32fe85f7d14c5f751f2f2c0f", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9320843091334895, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n println(leFun(Scanner(System.`in`).nextInt()))\n}\n\nfun leFun(arg: Int): Int {\n return (Math.round(arg / 2.0) * (if (arg and 1 == 1) -1 else 1)).toInt()\n}", "lang": "Kotlin", "bug_code_uid": "d3c032b0a9022c86326fd9b6b031abba", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "d51e88c7828f2955ac53ac9bb5a8f5b2", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7219152854511971, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val n = br.readLine().toLong()\n val sing = {x: Long -> if (x % 2 == 0L) x else -x}\n println(\n (1 .. n).fold(0L){acc, x -> sing(x) + acc}\n )\n}", "lang": "Kotlin", "bug_code_uid": "7b8e957896b68f1e72106bf2b58013a2", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "1fd1838a2a95b5719974ea0a22c3f370", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7918367346938775, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val n = br.readLine().toLong()\n println((1..n).fold(0L){acc, x ->\n acc + x*if (x % 2 == 0L) 1 else -1\n })\n}", "lang": "Kotlin", "bug_code_uid": "837b56d1ac7776a24b2bc7fa60a7e2fb", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "1fd1838a2a95b5719974ea0a22c3f370", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9836065573770492, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val neparni = if(n % 2 !=0) n/2 + 1 else n/2\n val parni = n/2\n println(parni*(parni+1)-neparni*neparni)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "d4fcb4d8a8589f3b42a0701303095d39", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "6b83a1f04f53261d2281f96ce84e2b67", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9808917197452229, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(){\n val scan = Scanner(System.`in`)\n val n = scan.nextInt()\n\n if (n % 2 == 0) println(n/2)\n else print(-(n/2+1))\n\n}", "lang": "Kotlin", "bug_code_uid": "9db8990d3e2544350053b04662fa1194", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "423ee2760e420fc1f84dbd7c50f2cc07", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5399449035812672, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n println(f(n))\n}\n\nfun f(n: Int): Int {\n var res = 0\n for (i in 1..n) {\n res += if (i % 2 == 0) i else i * -1\n }\n return res\n}", "lang": "Kotlin", "bug_code_uid": "7578a1270c65cbecdcdf8e6a5474a4d0", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "5c71be7fd92195317eb607eebd6ab8b6", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.924924924924925, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import kotlin.math.ceil\n\nfun main() {\n val n = readLine()!!.toInt()\n println(f(n))\n}\n\nfun f(n: Int) = if (n % 2 != 0) (-1 * ceil(n / 2.0)).toInt() else n / 2", "lang": "Kotlin", "bug_code_uid": "0e2d5196b9ed22f0d4f388ca8e77c90f", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "5c71be7fd92195317eb607eebd6ab8b6", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9416058394160584, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val sign = if(n % 2 == 0) 1 else -1\n println(sign * (n+1)/2)\n}", "lang": "Kotlin", "bug_code_uid": "d388359113f2d687622d23041787cdc0", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "6f0693e3c81f229432100cadf6300e20", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.43967828418230565, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toLong()\n var minus = true\n var number = 1L\n var total = 0L\n (0 until n).forEach {\n total += number++ * if (minus) -1 else 1\n minus = !minus\n }\n\n println(total)\n}", "lang": "Kotlin", "bug_code_uid": "6dc379209054d673751fd5f709c471b4", "src_uid": "689e7876048ee4eb7479e838c981f068", "apr_id": "35ba79aaf8e0f10be7f7ca362a8f26c4", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9391304347826087, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.io.PrintWriter\nimport kotlin.math.*\n\nfun main() {\n io.apply {\n\n val n = int\n val d = ints(n)\n var cur = d.sum()\n var mx = abs(cur)\n for (i in n - 1 downTo 0) {\n cur -= d[i] * 2\n mx = max(abs(cur), mx)\n }\n\n cout .. mx .. nl\n\n }.cout.flush()\n}\n\n// @formatter:off\nprivate val io = object {\n private val `in` = System.`in`\n private fun ll(): Long {\n var x: Int; var q = false; var n = 0L; do x = `in`.read() while (x < 33); if (x == 45) { q = true; x = `in`.read() }\n do { n = n * 10 - x + 48; x = `in`.read() } while (x > 32); return if (q) n else -n\n }\n val int get() = ll().toInt(); val long get() = ll()\n fun ints(n: Int = int): IntArray { return IntArray(n) { int } }\n fun ints1(n: Int = int): IntArray { return IntArray(n) { int - 1 } }\n val cout = PrintWriter(System.out); val nl = \"\\n\"\n private var buf = CharArray(32)\n private var bufSize = 32\n fun str(expect: Int = 32): String {\n var ix = 0\n var x: Int\n if (bufSize < expect)\n buf = CharArray(expect)\n do x = `in`.read() while (x < 33)\n do {\n if (ix == bufSize) { bufSize *= 2; buf = buf.copyOf(bufSize) }\n buf[ix++] = x.toChar()\n x = `in`.read()\n } while (x > 32)\n return java.lang.String.copyValueOf(buf, 0, ix)\n }\n operator fun PrintWriter.rangeTo(a: Int): PrintWriter { print(a); print(\" \"); return this }\n operator fun PrintWriter.rangeTo(a: Long): PrintWriter { print(a); print(\" \"); return this }\n operator fun PrintWriter.rangeTo(a: IntArray): PrintWriter { a.forEach { print(it); print(\" \") }; return this }\n operator fun PrintWriter.rangeTo(a: String): PrintWriter { write(a); return this }\n} // @formatter:on\n\n/* ----------- */\n\n", "lang": "Kotlin", "bug_code_uid": "1757f798c14c0ce18aa8f9ff138e0740", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "apr_id": "8e556d0650b0735842874356206e846c", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9964106245513281, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\n\nfun PrintWriter.solve() {\n val n = nextInt()\n println((1..n).map { nextInt() }.sum())\n}\n\nfun main(args: Array) {\n PrintWriter(System.out, false).use { it.solve() }\n}\n\nval br = BufferedReader(InputStreamReader(System.`in`))\nvar stok = StringTokenizer(\"\")\n\nfun nextToken(): String? {\n while (!stok.hasMoreTokens()) {\n val s = br.readLine() ?: return null\n stok = StringTokenizer(s)\n }\n return stok.nextToken()\n}\n\nfun nextInt(): Int {\n return nextToken()!!.toInt()\n}\n\nfun nextLong(): Long {\n return nextToken()!!.toLong()\n}\n\nfun nextDouble(): Double {\n return nextToken()!!.toDouble()\n}\n", "lang": "Kotlin", "bug_code_uid": "82872c11e7677de98faf2bbfd40c218d", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "apr_id": "6fc87183d0ba8166a4aa95a736cc19fa", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9891435464414958, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nfun main(args: Array) {\n System.`in`.bufferedReader().use {\n val n = it.readLine().toInt()\n val parts = it.readLine().split(' ')\n val a = IntArray(n, { i -> parts[i].toInt() })\n\n a.sort()\n\n var b = 0\n var c = 0\n var i = 0\n while (a[i] < 0)\n c += a[i++]\n while (i < n)\n b += a[i++]\n\n println(b - c)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "4ee346d224d08933181734d76370ab9e", "src_uid": "4b5d14833f9b51bfd336cc0e661243a5", "apr_id": "3bcce41b4f05edf74231306406511885", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9522451888809693, "equal_cnt": 12, "replace_cnt": 2, "delete_cnt": 9, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun readIntList() = readLine()!!.split(' ').map(String::toInt).toMutableList()\nfun readInt() = readLine()!!.toInt()\n\n\nvar rects = mutableListOf()\n\nfun main(args: Array) {\n\n var (x1, y1, x2, y2) = readIntList()\n var (x3, y3, x4, y4) = readIntList()\n val (x5, y5, x6, y6) = readIntList()\n\n\n if (!(x1 > x4 || y1 > y4 || x2 < x3 || y2 < y3)) {\n\n x3 = max(x1, x3)\n y3 = max(y1, y3)\n x4 = min(x2, x4)\n y4 = min(y2, y4)\n\n\n var rect = Rect(x1, y1, x2, y3)\n rects.add(rect)\n y1 = y3\n\n\n rect = Rect(x1, y4, x2, y2)\n rects.add(rect)\n y2 = y4\n\n\n rect = Rect(x1, y1, x3, y2)\n rects.add(rect)\n x1 = x3\n\n\n rect = Rect(x4, y1, x2, y2)\n rects.add(rect)\n x2 = x4\n\n\n// if (x2 > x1 || y2 > y1) {\n// rect = Rect(x1, y1, x2, y2)\n// rects.add(rect)\n// }\n\n\n\n rects.forEach { elem ->\n val bool1 = !(x5 <= elem.x1 && elem.x2 <= x6 && y5 <= elem.y1 && elem.y2 <= y6)\n val bool2 = elem.x2 > elem.x1 && elem.y2 > elem.y1\n if (bool1 && bool2) {\n println(\"YES\")\n return\n }\n }\n\n\n\n println(\"NO\")\n }\n\n\n}\n\nclass Rect(\n var x1: Int,\n var y1: Int,\n var x2: Int,\n var y2: Int\n)", "lang": "Kotlin", "bug_code_uid": "ba9a3ce860654e5d9822b2e175a52c50", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "97f5e94489c0ceba660eb3f5b9e114e7", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.07248618784530386, "equal_cnt": 25, "replace_cnt": 22, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 26, "bug_source_code": "\nimport java.io.*\nimport java.lang.Math.*\nimport java.util.*\nimport kotlin.collections.HashMap\nimport kotlin.math.max\nimport kotlin.math.min\n \nprivate const val dev = false\n \nfun main() {\n Task3.apply {\n if (dev) {\n timed { solve() }\n } else {\n solve()\n }\n close()\n }\n}\n \nprivate object Task3 {\n \n private val testFile = if (!dev) \"\" else \"task3\"\n \n fun solve() {\n val x1 = nextLong()\n val y1 = nextLong()\n val x2 = nextLong()\n val y2 = nextLong()\n \n val x3 = nextLong()\n val y3 = nextLong()\n val x4 = nextLong()\n val y4 = nextLong()\n \n val x5 = nextLong()\n val y5 = nextLong()\n val x6 = nextLong()\n val y6 = nextLong()\n \n val areaOfMain = (x2 - x1) * (y2 - y1)\n val i1 = intt(x1, y1, x2, y2, x3, y3, x4, y4)\n val i2 = intt(x1, y1, x2, y2, x5, y5, x6, y6)\n val iBlack = intt2(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6, y6)\n \n if (areaOfMain - ((i1 + i2) - iBlack) > 0) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n \n private fun intt(x1: Long, y1: Long, x2: Long, y2: Long, x3: Long, y3: Long, x4: Long, y4: Long): Long {\n val xAm = min(x2, x4) - max(x1, x3)\n val yAm = min(y2, y4) - max(y1, y3)\n \n return max(0, xAm * yAm)\n }\n \n private fun intt2(x1: Long, y1: Long, x2: Long, y2: Long, x3: Long, y3: Long, x4: Long, y4: Long, x5: Long, y5: Long, x6: Long, y6: Long): Long {\n val x7 = max(x1, x3)\n val y7 = max(y1, y3)\n val x8 = min(x2, x4)\n val y8 = min(y2, y4)\n \n val x9 = max(x3, x5)\n val y9 = max(y3, y5)\n val x10 = min(x4, x6)\n val y10 = min(y4, y6)\n \n return intt(x7, y7, x8, y8, x9, y9, x10, y10)\n }\n \n private val reader: BufferedReader\n private val writer: PrintWriter\n private var tokenizer: StringTokenizer = StringTokenizer(\"\", \".\", false)\n \n init {\n if (testFile.isEmpty()) {\n reader = BufferedReader(InputStreamReader(System.`in`))\n writer = PrintWriter(System.out)\n } else {\n reader = BufferedReader(FileReader(\"$testFile.in\"))\n writer = PrintWriter(FileWriter(\"task.out\"))\n }\n }\n \n inline fun next(): String {\n while (!tokenizer.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer.nextToken()\n }\n \n inline fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n \n @Suppress(\"unused\")\n inline fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n \n @Suppress(\"unused\")\n inline fun print(obj: T) {\n writer.print(obj)\n }\n \n inline fun println(obj: T) {\n writer.println(obj)\n }\n \n fun close() {\n writer.flush()\n reader.close()\n }\n}\n \nprivate fun timed(block: () -> Unit) {\n val startTime = System.nanoTime()\n block()\n println(\"Took ${(System.nanoTime() - startTime) / 1_000_000}ms\")\n}", "lang": "Kotlin", "bug_code_uid": "bca6400a883d4577baff27e8f1ca9e35", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "68f72ff1687a4790a2a499d322bfebda", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8920758385999028, "equal_cnt": 21, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 9, "fix_ops_cnt": 20, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n val solver = Solver(System.`in`, System.out)\n solver.solve()\n solver.clear()\n}\n\nclass Solver(input: InputStream, output: OutputStream) {\n\n companion object {\n private const val MAX_N = (1e6 + 10).toInt()\n private const val INF = (1e9 + 7).toInt()\n private const val MOD = (1e9 + 7).toInt()\n private const val INF_F = 1e-6\n }\n\n private val reader = Reader(input)\n private val writer = Writer(output)\n\n fun solve() {\n val p1 = reader.readPoint()\n val p2 = reader.readPoint()\n val p1_1 = Point(p1.x, p2.y)\n val p2_1 = Point(p2.x, p1.y)\n\n val p3 = reader.readPoint()\n val p4 = reader.readPoint()\n val p5 = reader.readPoint()\n val p6 = reader.readPoint()\n\n when {\n !inRect(p3, p4, p1) && !inRect(p5, p6, p1)\n || !inRect(p3, p4, p2) && !inRect(p5, p6, p2)\n || !inRect(p3, p4, p1_1) && !inRect(p5, p6, p1_1)\n || !inRect(p3, p4, p2_1) && !inRect(p5, p6, p2_1) -> writer.println(\"YES\")\n p4.x < p5.x || p6.x < p3.x\n || p4.y < p5.y || p6.y < p3.y -> writer.println(\"YES\")\n else -> writer.println(\"NO\")\n }\n }\n\n fun clear() {\n writer.close()\n }\n\n private fun Reader.readPoint() = Point(nextInt(), nextInt())\n\n private fun inRect(p1: Point, p2: Point, p: Point) =\n p.x in p1.x..p2.x && p.y in p1.y..p2.y\n\n data class Point(val x: Int, val y: Int)\n}\n\nprivate fun IntArray.gcd(): Int {\n var g = first()\n forEach { g = gcd(g, it) }\n return g\n}\n\nprivate fun LongArray.gcd(): Long {\n var g = first()\n forEach { g = gcd(g, it) }\n return g\n}\n\nprivate fun gcd(a: Int, b: Int): Int {\n return if (b == 0) a else gcd(b, a % b)\n}\n\nprivate fun gcd(a: Long, b: Long): Long {\n return if (b == 0L) a else gcd(b, a % b)\n}\n\nclass Reader(input: InputStream) {\n private val reader = BufferedReader(InputStreamReader(BufferedInputStream(input)), 32768)\n private var tokenizer: StringTokenizer? = null\n\n fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt() = next().toInt()\n\n fun nextLong() = next().toLong()\n\n fun nextStringArray(count: Int): Array {\n return Array(count) { next() }\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n\n fun nextIntPair(): Pair {\n val x = nextInt()\n val y = nextInt()\n return x to y\n }\n}\n\nclass Writer(output: OutputStream) {\n private val writer = PrintWriter(BufferedOutputStream(output))\n\n fun print(t: T) = writer.print(t)\n fun println() = writer.println()\n fun println(t: T) = writer.println(t)\n\n fun printBooleanArray(array: BooleanArray) = printIntArray(array.map { if (it) 1 else 0 }.toIntArray())\n fun printIntArray(array: IntArray) = array.joinToString(\" \").let(writer::println)\n fun printLongArray(array: LongArray) = array.joinToString(\" \").let(writer::println)\n fun printCharArray(array: CharArray) = array.joinToString(\"\").let(writer::println)\n\n fun close() = writer.close()\n fun flush() = writer.flush()\n}", "lang": "Kotlin", "bug_code_uid": "ebde094c13e83844d4add74da296a0d9", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "1d30bc782cdaad3500995a7687e0be62", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9719806763285024, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\n\nfun main() {\n output {\n val (x1, y1, x2, y2) = readInts(4)\n val (x3, y3, x4, y4) = readInts(4)\n val (x5, y5, x6, y6) = readInts(4)\n\n val ans = when {\n (x1..x2).let { it in x3..x4 && it in x5..x6 } -> {\n (y1..y2).coveredBy(y3..y4, y5..y6).not()\n }\n\n (y1..y2).let { it in y3..y4 && it in y5..y6 } -> {\n (x1..x2).coveredBy(x3..x4, x5..x6).not()\n }\n\n else -> true\n }\n\n println(if(ans) \"YES\" else \"NO\")\n }\n}\n\noperator fun IntRange.contains(other: IntRange) = start <= other.start && endInclusive >= other.endInclusive\n\nfun IntRange.coveredBy(_r1: IntRange, _r2: IntRange): Boolean {\n var r1 = _r1\n var r2 = _r2\n if(r1.start > r2.start) r1 = r2.also { r2 = r1 }\n return when(r1.endInclusive.compareTo(r2.start)) {\n -1 -> false\n 0 -> this in r1.start..r2.endInclusive\n else -> this in r1.start..maxOf(r1.endInclusive, r2.endInclusive)\n }\n}\n\n/** IO code start */\n@JvmField val _reader = System.`in`.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(System.out, false)\ninline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }\nfun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks", "lang": "Kotlin", "bug_code_uid": "3714f8384862a8cbaf74e24938a4ee14", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "4a1653e21733fce47e013c9cb176236e", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.46021220159151194, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n fun readInt() = readLine()!!.toInt()\n fun readLong() = readLine()!!.toLong()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n val (x1, y1, x2, y2) = readLongs()\n val (x3, y3, x4, y4) = readLongs()\n val (x5, y5, x6, y6) = readLongs()\n\n var whiteArea = (y2 - y1) * (x2 - x1)\n if (x3 < x2 && x4 > x1 && y3 < y2 && y4 > y1) {\n val left = max(x1, x3)\n val right = min(x2, x4)\n val bottom = max(y1, y3)\n val top = min(y2, y4)\n whiteArea -= (top - bottom) * (right - left)\n }\n\n if (x5 < x2 && x6 > x1 && y5 < y2 && y6 > y1) {\n val left = max(x1, x5)\n val right = min(x2, x6)\n val bottom = max(y1, y5)\n val top = min(y2, y6)\n whiteArea -= (top - bottom) * (right - left)\n }\n print(if (whiteArea > 0) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "95d713dbbbde0427dbc793e71149e6ce", "src_uid": "05c90c1d75d76a522241af6bb6af7781", "apr_id": "d2744cc8f467342d98bb8ef7ba349e81", "difficulty": 1700, "tags": ["geometry", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9837728194726166, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package cf435\n\nimport java.util.*\n\nfun main(args: Array) {\n val tokenizer = StringTokenizer(readLine())\n val n = tokenizer.nextToken().toInt()\n val x = tokenizer.nextToken().toInt()\n val arrayTokenizer = StringTokenizer(readLine())\n var steps = x\n generateSequence { arrayTokenizer.takeIf { it.hasMoreTokens() }?.nextToken()?.toInt() }.forEach {\n if (it < x) {\n steps--\n } else if (it == x) {\n steps++\n }\n }\n println(steps)\n}\n", "lang": "Kotlin", "bug_code_uid": "95059743f9157b480eb2e0f51ee988a2", "src_uid": "21f579ba807face432a7664091581cd8", "apr_id": "4192f3ef952463ae0d06f549889da7a7", "difficulty": 1000, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.688413948256468, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\nfun main(args : Array) {\n\n val d1 = readLine()!!\n val d2 = readLine()!!\n var list1: MutableList = mutableListOf()\n var list2: MutableList = mutableListOf()\n\n for (char in d1) {\n list1.add(char)\n }\n for (char in d2) {\n list2.add(char)\n }\n\n\n println(\"1110001\")\n\n\n\n\n}", "lang": "Kotlin", "bug_code_uid": "5b98ca35c8d8fe7ce7a6f58a3c904332", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "apr_id": "8b447d1fc32ed29a813815ad125727ab", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9632495164410058, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n while (true) UltraFastMathematician()\n}\n\nfun UltraFastMathematician() {\n val a: String = readLine()!!\n val b: String = readLine()!!\n\n for (i in 0..a.lastIndex)\n print(if (a[i]==b[i]) '0' else '1')\n println()\n}", "lang": "Kotlin", "bug_code_uid": "188cc72185e12af1b4b0ba251952af9e", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "apr_id": "5394b448c92dcc5ee87bd67542d15ac9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.47357293868921774, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val s1 = r.readLine()!!.toInt(2)\n val s2 = r.readLine()!!.toInt(2)\n println((s1 xor s2).toString(2))\n}", "lang": "Kotlin", "bug_code_uid": "5dc3bc8ec66ab798f37f8b55771acd96", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "apr_id": "47e9c3bc7ea7319699058bd1bd7067a9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4496124031007752, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val str = r.readLine()!!\n val s1 = str.toInt(2)\n val s2 = r.readLine()!!.toInt(2)\n val lenbefore = str.length\n val ans = (s1 xor s2).toString(2)\n val lenafter = ans.length\n repeat(lenbefore-lenafter) {\n s.append(0)\n }\n s.append(ans)\n println(s)\n}", "lang": "Kotlin", "bug_code_uid": "970cf3a7a746475af00e0af79f8a171f", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "apr_id": "47e9c3bc7ea7319699058bd1bd7067a9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9593023255813954, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "//package problem61A\n\nfun main() {\n val a = readLine()!!\n val b = readLine()!!.toInt(2)\n\n println((a.toInt(2) xor b).toString(2).padStart(a.length, '0'))\n}\n", "lang": "Kotlin", "bug_code_uid": "e08f7d2431853037be99b73ce24078ad", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "apr_id": "193f0b121026791cac5da03436deebb8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4894409937888199, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun steps(distance: Int): Int {\n return if (distance > 5)\n steps(distance - 5) + 1\n else 1\n}\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val s = reader.readLine().toInt()\n println(steps(s))\n}", "lang": "Kotlin", "bug_code_uid": "86c54ea7918a3d55e3487fccbb58249d", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "apr_id": "61d7fe2537cabe815ffd487114724cd6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5292242295430393, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.max\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val str0 = reader.readLine()\n val str1 = reader.readLine()\n val num0 = str0.toInt(2)\n val num1 = str1.toInt(2)\n val result = num0 xor num1\n val binStr = result.toString(2)\n val output = binStr.padStart(max(str0.length,str1.length), '0')\n println(output)\n}\n", "lang": "Kotlin", "bug_code_uid": "6c91b5ddf79787464b3e15539a32bfe1", "src_uid": "3714b7596a6b48ca5b7a346f60d90549", "apr_id": "61d7fe2537cabe815ffd487114724cd6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6745283018867925, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\n\nfun main() {\n\tval sc = Scanner(System.`in`)\n\t// Omit first line\n\tsc.nextInt()\n\tval time = sc.nextInt()\n\tvar queue = readLine()!!\n\tfor (i: Int in 1..time) { queue = queue.replace(\"BG\", \"GB\") }\n\tprintln(queue)\n}\n", "lang": "Kotlin", "bug_code_uid": "6585450cb18e08d4bf9f94bb4e7caed9", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "c9541f6e5536d70e4f94cb3aa6afceee", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9138431752178122, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val a = readLine()?.split(\" \")?.map { it.toInt() }\n val str = readLine()?.split(\"\")?.toMutableList()\n\n for (j in 0 until a?.get(1)!!) {\n for (i in 0 until a[0] - 1) {\n if (str != null) {\n if (str[i] == \"B\" && str[i + 1] == \"G\") {\n str[i] = \"G\"\n str[i + 1] = \"B\"\n }\n }\n }\n }\n\n val s = str?.joinToString(separator = \"\", prefix = \"\", postfix = \"\")\n print(s)\n\n}", "lang": "Kotlin", "bug_code_uid": "e669f922080bbfab60425a6b2a166865", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "9c1a02feaa980617d9d4524e376a103e", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9739478957915831, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val input = readLine()!!.split(\" \").map(Integer::parseInt)\n var queue = readLine()!!\n val kids = input[0]\n val time = input[1]\n \n for (i in 0 until time) {\n queue.replace(\"BG\", \"GB\") \n }\n println(queue)\n}", "lang": "Kotlin", "bug_code_uid": "72b45f42c166b78c5e4242d5996c76d2", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "316b0d747811a8c41894463b52f31f73", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9542280837858805, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "fun main(args : Array) {\n val(n, t) = readLine()!!.split(' ').map(String :: toInt)\n val s = readLine()!!\n var state = Array(t+1, { CharArray(n) })\n state[0] = s.toCharArray()\n for (i in 0..(t-1)) {\n for (j in 1..(n-1)) {\n if (j==1)\n state[i+1][0] = state[i][0]\n\n if (state[i][j-1] == 'B' && state[i][j] == 'G') {\n state[i+1][j-1] = 'G'\n state[i+1][j] = 'B'\n }\n\n else {\n state[i+1][j] = state[i][j]\n }\n }\n }\n for (i in 0..(n-1))\n print(state[t][i])\n}", "lang": "Kotlin", "bug_code_uid": "53fd85c1065f95528f8b825e1bd0bfbf", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "aa7f5d02d477ce049c3694214ccc79cc", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7009735744089013, "equal_cnt": 11, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "fun main() {\n var (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n val str = readLine()!!.toCharArray()\n while(k-- > 0){\n for(i in 1 until str.size){\n if (str[i] == 'G' && str[i - 1] == 'B'){\n str[i] = str[i - 1].also { str[i - 1] = str[i] }\n break\n }\n }\n }\n print(str)\n}", "lang": "Kotlin", "bug_code_uid": "49f817ccb6f56616b3a19acf8f08b8ac", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "b5c6a0e6b252832c3afe2ff141edeb55", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9696356275303644, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n val n = scan.nextByte()\n val t = scan.nextByte()\n val queue = scan.next().toCharArray()\n \n for (j in 0 until t){\n var i = 0\n while (i < n-1){\n if (queue[i] == 'B'){\n val tmp = queue[i]\n queue[i] = queue[i+1]\n queue[i+1] = tmp\n i++\n }\n i++\n }\n }\n print(queue)\n}", "lang": "Kotlin", "bug_code_uid": "250e0b2a2d196582a001aa95e588b973", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "60031c122abd3aed379fb94fd958d334", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.590851334180432, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.min\nimport kotlin.math.sign\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val (n, t) = readInts()\n val s = readLn().toCharArray()\n val ans = CharArray(n)\n var end = n - 1\n var g = IntArray(n)\n var gsum = 0\n for (j in (n - 1) downTo 0) {\n if (s[j] == 'G') {\n gsum += 1\n }\n g[j] = gsum\n }\n for (i in 0 until n) {\n if (s[i] == 'B') {\n ans[i + min(t, g[i])] = 'B'\n }\n }\n for (i in 0 until n) {\n if (ans[i] == '\\u0000') {\n ans[i] = 'G'\n }\n }\n println(ans.joinToString(\"\"))\n}\n\n//BGBGBG\n//GBGBGB\n//GGBGBB\n//GGGBBB", "lang": "Kotlin", "bug_code_uid": "5092e4d808ddecddadc93c7229f31564", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "9ce6643909995add21198e4a92380138", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9667519181585678, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n\nfun main() {\n val (n, t) = readInts()\n var queue = readLn()\n val acc = StringBuilder()\n\n repeat(t) {\n var i = 0\n while (i < n - 1) {\n if (queue[i] == 'B' && queue[i + 1] == 'G') {\n acc.append(\"GB\")\n ++i\n } else acc.append(queue[i])\n ++i\n }\n queue = acc.toString()\n acc.clear()\n }\n\n println(queue)\n}\n", "lang": "Kotlin", "bug_code_uid": "756e732b933d0e96ce974543f667649a", "src_uid": "964ed316c6e6715120039b0219cc653a", "apr_id": "cab83caafc27c9db83d00b4e1e62ec0e", "difficulty": 800, "tags": ["shortest paths", "constructive algorithms", "implementation", "graph matchings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9996838444514701, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val q = IntArray(n) { scanner.nextInt() }.sorted().toIntArray()\n var index = 0\n while (q.sum() / q.size.toDouble() <= 4.5) {\n q[index] = 5\n index++\n }\n println(index)\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\n\n//class Pair(var a: Int, var b: Int): Comparable {\n// override fun compareTo(other: Pair): Int {\n// return b - a - other.b + other.a\n// }\n//}", "lang": "Kotlin", "bug_code_uid": "bb1a4d77f39500ddfdfcc732ef14f4ee", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "apr_id": "c5bcc3a6f28cf23a10660bc42fbd1086", "difficulty": 900, "tags": ["greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9918290383406663, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n solve()\n}\n\nprivate fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\n\nprivate fun solve() {\n val (len) = read().map(String::toInt)\n val arr = read().map(String::toFloat).toFloatArray()\n\n // arr.sortDescending()\n\n var avg = 0f\n\n var counter = 0\n\n\n if (Math.round(getAvg(arr)) >= 5f) {\n println(0)\n return\n }\n\n while (Math.round(avg) < 5f) {\n for ((index) in arr.withIndex()) {\n if (arr[index] < 5) {\n arr[index] = 5f\n avg = getAvg(arr)\n break\n }\n }\n counter++\n }\n println(counter)\n}\n\nprivate fun getAvg(arr: FloatArray): Float {\n var total = 0f\n\n arr.forEach {\n total += it\n }\n\n return (total / arr.size)\n}", "lang": "Kotlin", "bug_code_uid": "685b44839d5ce0064983e4b0aab8312e", "src_uid": "715608282b27a0a25b66f08574a6d5bd", "apr_id": "0dc9a69bd2c5305047c87ebc1874ffcb", "difficulty": 900, "tags": ["greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9985915492957746, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)){\n val n = nextLong()\n\n val dig = n\n\n var sum = 0L\n\n var i = 0\n while(true){\n val pTen = pow(10, i)\n val div = (dig / pTen) \n var diff: Long = 0\n if(div > 10L) {\n diff = (pow(10, i + 1) - pTen) * (i + 1)\n } else {\n diff = (dig - pTen + 1) * (i + 1)\n }\n sum += diff\n //println(\"i: $i, div: $div, diff: $diff, sum: $sum, pTen: $pTen\")\n i++\n if(div <= 10L){\n break\n }\n }\n println(sum)\n}\n\nfun pow(dig: Long, pow: Int):Long {\n if(pow == 0) {\n return 1L\n }\n return dig * pow(dig, pow - 1)\n}", "lang": "Kotlin", "bug_code_uid": "b408ba1fc837efdf47d09d7602fc9ea2", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "apr_id": "6052fc0e9d0c80bb159dba637ea3572b", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7353206865401988, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n var n = scanner.nextLong()\n if (n < 10)\n println(n)\n else {\n var sum = 0L\n var i = 1\n while (n.toString().length > 1) {\n val length = n.toString().length\n val diff = 9 * Math.pow(10.0, length - 2.0).toLong()\n n -= diff\n sum += diff * (length - 1)\n i++\n }\n sum += n * i\n println(sum)\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "be8a9a9409a1857c329796eb37b55be7", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "apr_id": "30e51416b1add5ae42ce029579aec87a", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9585492227979274, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n var n = scanner.nextLong()\n if (n < 10)\n println(n)\n else {\n var sum = 0L\n var i = 0\n while (n.toString().length > 1) {\n val diff = 9 * Math.pow(10.0, i.toDouble()).toLong()\n n -= diff\n sum += diff * (i+1)\n i++\n }\n sum += n * (i+1)\n println(sum)\n }\n\n /*\n * 999\n * 9*1 + 90*2 + 900*3\n *\n * 850\n * 9*1 + 90*2 + 751*3\n *\n * */\n\n}\n", "lang": "Kotlin", "bug_code_uid": "a683ae84ffe1d4e4013e4da614bd7ba8", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "apr_id": "30e51416b1add5ae42ce029579aec87a", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9564134495641345, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*;\n\nfun main() {\n\tfun len(x: Int): Long {\n\t\treturn x.toString().length.toLong()\n\t}\n\tfun get(x: Int): Long {\n\t\tvar getLen = len(x)-1\n\t\treturn (9*Math.pow(10.0, getLen.toDouble())).toLong() \n\t}\n\tvar n = readLine()!!.toInt()\n\tvar totalLen = len(n)\n\tvar x = 0L\n\tvar ans = 0L\n\tfor(i in 1..totalLen-1) {\n\t\tvar curr = get(i.toInt())\n\t\tx += curr\n\t\tans += curr*i\n\t}\n\tans += (n-x)*totalLen\n\tprintln(ans)\n}\n", "lang": "Kotlin", "bug_code_uid": "fd718e11eed3684ad3034c7181d5955b", "src_uid": "4e652ccb40632bf4b9dd95b9f8ae1ec9", "apr_id": "ae10b843ee245a56657baff1ce515f77", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9816326530612245, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val n = r.readLine()!!.toInt()\n val (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val v = r.readLine()!!.split(\" \").map { it.toInt() }\n var have = 0\n var total = 0\n var ans = -1\n for (i in 0..n-1){\n total += v[i]\n have += minOf(total, 8).also { total -= minOf(total, 8) }\n if (have>=k){\n ans = i+1\n }\n }\n println(ans)\n}\n", "lang": "Kotlin", "bug_code_uid": "eb2bc846ecd1fbfa18ca61447b2d581f", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "apr_id": "cc67b125f6bdd03e00a52dc53483e4df", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.22358554873892297, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n\n var (n, k) = readLine()!!.split(' ').map { it.toInt() }\n var list = readLine()!!.split(' ').map { it.toInt() }\n\n\n if (list.sum() < k) {\n println(-1)\n } else {\n var sum = 0\n var count = 1\n var countRem = 0\n for (i in 0..list.size - 1) {\n countRem += list[i]\n if (countRem <= 8) {\n sum += countRem\n if (sum >= k) {\n println(count)\n return\n }\n countRem = 0\n } else {\n sum += 8\n if (sum >= k) {\n println(count)\n return\n }\n countRem += i - 8\n }\n if (i != list.size - 1) {\n count++\n }else{\n if (sum= k) return print(pos + 1)\n }\n print(-1)\n}", "lang": "Kotlin", "bug_code_uid": "2f4aacc5f733a17b3dc9961c6506a97d", "src_uid": "24695b6a2aa573e90f0fe661b0c0bd3a", "apr_id": "55f6678c5fca8c2e3d0ed919f781fc59", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.999127145766657, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//xXHEQR_MAENXx\n// You are not prepared!\n@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.*\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.random.Random\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\n\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C127 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\ninline fun String.sort(): String {\n var bhgdf = toCharArray()\n bhgdf.sort()\n return String(bhgdf)\n}\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n var s = read()\n s = s.sort()\n\n if (s.length == 1) {\n println(s)\n return\n }\n\n var res = \"\"\n for (i in s.length-1 downTo 0) {\n if (s[i] == '+') {\n res.dropLast(1)\n break;\n }\n res += \"${s[i]}+\"\n }\n\n println(res.reversed())\n}\n", "lang": "Kotlin", "bug_code_uid": "6bf95c49c952eb6b14f25a5e9bc840e1", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "788edeb1448c4f06ae98e3b32e156712", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9405940594059405, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val input: String = readLine()!!\n val inputDigits = input.split(\"+\").sorted()\n for (item in inputDigits) {\n if (item != inputDigits.last()) {\n print(\"$item+\")\n } else {\n print(item)\n }\n }\n println()\n}", "lang": "Kotlin", "bug_code_uid": "43439dd907c465491ed9b80d19c0c118", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "a054897ae227581571eaeb2a7eaff217", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9675174013921114, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n var out =\"\"\n var s = arrayListOf()\n for (i in readLine()!!) {\n if (i == '+') {\n continue\n } else {\n s.add(i.toString())\n }\n }\n for(i in 0..(s.size-1)){\n if (s.sorted()[i]!=s.sorted()[(s.size-1)]){\n out+=s.sorted()[i]\n out+=\"+\"\n }\n else{\n out+=s.sorted()[i]\n }\n }\n println(out)\n}", "lang": "Kotlin", "bug_code_uid": "e4dc83fe853cc610bd898b6155e9a2f8", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "11a30a48d7303d4c4976ebe843c55c88", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9871244635193133, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.FileInputStream\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = readInput1File()\n reader.use {\n val el = it.readLine().fromStringToListInt(\"+\")?.sorted()\n val res: StringBuilder = StringBuilder()\n el?.forEach { it1 -> res.append(it1).append(\"+\") }\n print(res.removeSuffix(\"+\").toString())\n }\n}\n\nfun String?.fromStringToListInt(delimeter: String) = this?.split(delimeter)?.map(String::toInt)\nfun readSysIn(): BufferedReader = BufferedReader(InputStreamReader(System.`in`))", "lang": "Kotlin", "bug_code_uid": "e94cce5c070908ff02e5a52816f81b0a", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "12d13de72c7ecff650c11c69892cae74", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7821522309711286, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "/**\n *Created by Kartik Patodi on 02-06-2017.\n **/\n\nfun main(args: Array) {\n val s = readLine().toString().split(\"[+]\".toRegex())\n val sortedArray = s.toSortedSet().toTypedArray()\n val result = sortedArray.asc()\n\n println(result)\n}\n\nprivate fun Array.asc(): String {\n var string = \"\"\n this.forEach { string += (it+\"+\") }\n return string.dropLast(1)\n}\n", "lang": "Kotlin", "bug_code_uid": "d6b7b0f46522d987e45c475f1ecf5a49", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "e83a837c9343339bfdae8d7564b3c6e4", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.41192411924119243, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "fun main() {\n val sums = readLine()!!.replace(\"+\",\"\").toCharArray()\n sums.sort()\n\n var res = if(sums.size > 1) \"\" else sums[0].toString()\n sums.forEachIndexed { index, c ->\n if(index != sums.size - 1) {\n res += \"$c+\"\n }\n }\n println(res)\n }", "lang": "Kotlin", "bug_code_uid": "cc81c522aefda39e4707d2b37f414697", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "bee496829a517e729a9b405afcc97e00", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9936305732484076, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n printnln(readLine()!!.split('+').sorted().joinToString(\"+\"))\n}", "lang": "Kotlin", "bug_code_uid": "29d151c7e2b1c5d680175cabba72ed4e", "src_uid": "76c7312733ef9d8278521cf09d3ccbc8", "apr_id": "7319a22881a32e3cc8146e6478610dbe", "difficulty": 800, "tags": ["greedy", "strings", "sortings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9359783588818755, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun readString() = readLine()!!\nfun readStrings() = readString().split(\" \")\nfun readInt() = readString().toInt()\nfun readInts() = readStrings().map { it.toInt() }\nfun readLong() = readString().toLong()\nfun readLongs() = readStrings().map { it.toLong() }\nfun readDouble() = readString().toDouble()\nfun readDoubles() = readStrings().map { it.toDouble() }\n\nfun main() {\n val (n, k) = readInts()\n for (i in n downTo 1)\n if (5 * i * (i + 1) / 2 <= 240 - k) {\n print(i)\n break\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "00f8af0e8866f5e890efb1e2c060c67d", "src_uid": "41e554bc323857be7b8483ee358a35e2", "apr_id": "5457087fb8aa1ceb080d8c5cab1f22be", "difficulty": 800, "tags": ["math", "brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9659735349716446, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "/* https://codeforces.com/problemset/problem/750/A */\n\nfun main() {\n val (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n var timeSolvingProblems = 0\n for (i in 1..n) {\n val timeToSolveTheIthProblem = 5 * i\n val currentTime = timeSolvingProblems + timeToSolveTheIthProblem + k\n if (currentTime > 240) {\n println(i - 1)\n } else if (currentTime == 240 || i == n) {\n println(i)\n }\n timeSolvingProblems += timeToSolveTheIthProblem\n }\n}", "lang": "Kotlin", "bug_code_uid": "db4d986c9576967d46bf7670d294d275", "src_uid": "41e554bc323857be7b8483ee358a35e2", "apr_id": "eab87f670bea8129ef1ba5fda15aad7d", "difficulty": 800, "tags": ["math", "brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9987937273823885, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val n = input.nextInt() //count of task\n val k = input.nextInt() //travel time (minutes)\n\n var freeTime = 4 * 60 - k\n var taskCount = 0\n for (i in 1..n) {\n freeTime -= i * 5\n if (freeTime > 0) {\n taskCount++\n } else {\n break\n }\n }\n\n println(taskCount)\n}", "lang": "Kotlin", "bug_code_uid": "5de4e8b1e51849ba744f8479d6ce3203", "src_uid": "41e554bc323857be7b8483ee358a35e2", "apr_id": "c2f93ca91f9795b919a9b9be2e7adee8", "difficulty": 800, "tags": ["math", "brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8748768472906404, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "/**\n * Created by Mego on 6/1/2017.\n */\n\nfun main(args: Array) {\n val input = readLine()!!.split(\" \")\n var problems = input[0].toInt()\n val timeToGo = input[1].toInt()\n var problemsToSolve: Int = 0\n var availableTimeToSolve = 240 - timeToGo\n while (problems > 0 && (availableTimeToSolve>= problemsToSolve*5 )) {\n problems--\n problemsToSolve++\n availableTimeToSolve -= problemsToSolve*5\n }\n println(problemsToSolve)\n}", "lang": "Kotlin", "bug_code_uid": "37d782be5abbe21b4da3dc9ee57c9572", "src_uid": "41e554bc323857be7b8483ee358a35e2", "apr_id": "baa41576f943adf4d509b96c52007a0d", "difficulty": 800, "tags": ["math", "brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.779905808477237, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun > max(a: T, b: T): T = if (b > a) b else a\nfun > min(a: T, b: T): T = if (b < a) b else a\nfun Number.isEven(): Boolean = if (this.toInt() and 1 == 0) true else false\nfun Number.isOdd (): Boolean = !this.isEven()\n\nfun factorList(a: Int): MutableList {\n var a = a\n var b = 2\n val res = mutableListOf()\n while (b * b <= a) {\n if (a % b == 0) {\n res.add(b)\n a = a / b\n b = 2\n } else ++b\n }\n if (a > 1) res.add(a)\n return res\n}\n\nfun main(args: Array) {\n if (args.isNotEmpty()) System.setIn(FileInputStream(args[0]))\n val br = BufferedReader(InputStreamReader(System.`in`))\n val bw = BufferedWriter(OutputStreamWriter(System.out))\n\n var st = StringTokenizer(br.readLine())\n val a = st.nextToken().toInt()\n val b = st.nextToken().toInt()\n\n val lista = factorList(a)\n val listb = factorList(b)\n var lstsize = lista.size + listb.size\n\n if (a == 1 && b == 1) bw.write(\"0\\n\")\n else if (a == 1) bw.write(\"${listb.size}\\n\")\n else if (b == 1) bw.write(\"${lista.size}\\n\")\n else if (lista.last() > 5 || lista.last() > 5) bw.write(\"-1\\n\")\n else {\n for (e in lista) {\n val idx = listb.indexOf(e)\n if (idx != -1) {\n listb.removeAt(idx)\n lstsize -= 2\n }\n }\n bw.write(\"$lstsize\\n\")\n }\n\n bw.close()\n}\n", "lang": "Kotlin", "bug_code_uid": "91504db8bdfc643d7182b7f280025209", "src_uid": "75a97f4d85d50ea0e1af0d46f7565b49", "apr_id": "7cf7f518b00506416b4ba17f99401157", "difficulty": 1300, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9808429118773946, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val numVertices = readLine()!!.toInt()\n print(4 * (numVertices - 3) + (numVertices - 4) * (numVertices - 4))\n}", "lang": "Kotlin", "bug_code_uid": "9782f6e03d608998016c8bb819267f4f", "src_uid": "efa8e7901a3084d34cfb1a6b18067f2b", "apr_id": "69362fe5f92a66efca3053003216fb96", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6224489795918368, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val necklace = readLine()!!\n val numPearls = necklace.count { it == 'o' }\n print(if ((necklace.length - numPearls) % numPearls == 0) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "48a340941e7243b526f7ca91113d0aaa", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "apr_id": "0f801ab1559af700d774dc09cbcb114b", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7126258714175058, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n val chain = readLine()!!.toCharArray()\n checkChain(chain)\n}\n\nfun checkChain(chain: CharArray) {\n val char1 = '-'\n val char0 = 'o'\n\n val char1Count = chain.filter { it == char1 }.count()\n val char0Count = chain.filter { it == char0 }.count()\n\n if (char0Count == 0 || char1Count == 0) return print(\"YES\")\n\n if (char0Count > char1Count) {\n return if (char0Count % char1Count == 0) print(\"YES\") else print(\"NO\")\n } else if (char0Count < char1Count) {\n return if (char1Count % char0Count == 0) print(\"YES\") else print(\"NO\")\n } else if (char0Count == char1Count) {\n return print(\"YES\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "9c3c36f423fbb6a6b0b9d24a9c1d15b3", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "apr_id": "6ef9b56f0bbda20b33cfb1109f968a40", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9900426742532006, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array){\n\t// 0 -businka\n\t// 1 - nit'\n\tval busy = readLine().toString().map{if (it =='o') 0 else 1}\n\tval length = busy.size\n\tval nitN = busy.sum()\n\tval busyN = length - nitN\n\t//println(\"$busyN $nitN\")\n\tif (busyN == 0){\n\t\tprintln(\"YES\")\n\t\treturn\n\t}\n\tval zlp = nitN.rem(busyN)\n\tif (zlp.rem(2) == 0) println(\"YES\") else println(\"NO\")\n\t\n}", "lang": "Kotlin", "bug_code_uid": "ee491da1a9d9fa04a230d975241b5bd9", "src_uid": "6e006ae3df3bcd24755358a5f584ec03", "apr_id": "a78e88521ec647a61e8b2b26a1a511e6", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9511297950604309, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.abs\nimport kotlin.math.pow\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val (n, time) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n val s1 = r.readLine()!!.split(\"\").filter { it.length > 0 }\n val pos1 = s1.count { it == \"+\" } * 2 - s1.size\n val s2 = r.readLine()!!.split(\"\").filter { it.length > 0 }\n val pos2 = s2.count { it == \"+\" } - s2.count { it == \"-\" }\n val unk = s2.count { it == \"?\" }\n when{\n unk == 0 -> println(if (pos1==pos2) 1.0 else 0.0)\n pos2+unkpos1-> println(0.0)\n else -> {\n val choose = (unk-abs(pos1))/2\n val ans = (unk-choose+1..unk).fold(1L){acc, i -> acc*i }/(1..choose).fold(1L){acc, i -> acc*i }/2.0.pow(unk)\n println(ans)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "23a827726580d6eb949933fd603f3a24", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "apr_id": "66a8b9a4c367d0ecb9a214eb5d9c9622", "difficulty": 1300, "tags": ["dp", "probabilities", "combinatorics", "bitmasks", "math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5760709010339734, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val (n, time) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n val s1 = r.readLine()!!.split(\"\").filter { it.length > 0 }\n val pos1 = s1.count { it == \"+\" } * 2 - s1.size\n val s2 = r.readLine()!!.split(\"\").filter { it.length > 0 }\n val pos2 = s2.count { it == \"+\" } - s1.count { it == \"-\" }\n val unk = s2.count { it == \"?\" }\n when{\n unk == 0 -> println(1.0)\n abs(unk+pos2-pos1)%2==1 -> println(0.0)\n else -> {\n val choose = (unk-abs(pos1))/2\n val ans = (unk-choose+1..unk).fold(1L){acc, i -> acc*i }/(1..choose).fold(1L){acc, i -> acc*i }/2.0.pow(unk)\n println(ans)\n /*println((unk-choose+1..unk).fold(1L){acc, i -> acc*i }/(1..choose).fold(1L){acc, i -> acc*i })\n println((unk-choose+1..unk).fold(1L){acc, i -> acc*i })\n println(unk)*/\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "da468720208b17a8c71a4f6261963187", "src_uid": "f7f68a15cfd33f641132fac265bc5299", "apr_id": "66a8b9a4c367d0ecb9a214eb5d9c9622", "difficulty": 1300, "tags": ["dp", "probabilities", "combinatorics", "bitmasks", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9447236180904522, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args : Array) {\n var line = readLine()!!\n if (line.contains('H') || line.contains('Q') || line.contains('9') || line.contains('+'))\n println(\"YES\")\n else\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "170e8c6d9dabfa8d9b9a83291efdbcf1", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "75cabf6a54e3375251d12f8a02a997ee", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9383561643835616, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "//package problem133A\n\nfun main() {\n val program = readLine()!!\n\n println(if ('H' in program || 'Q' in program) \"YES\" else \"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "5d10ffc9ec63f869f4306f4191c78d6b", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "1898671fc6877a5d4186cd05db1fc74a", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9809069212410502, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.reflect.Array\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\n\nfun main()\n{\n var scanner = Scanner(System.`in`)\n var str = scanner.nextLine()\n var flag : Boolean = false\n for(i in 0 until str.length)\n {\n if(str[i] == 'H' || str[i] == 'Q' || str[i] == '9' || str[i] == '+')\n flag = true\n }\n if(flag)\n println(\"YES\")\n else\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "2b20702aebe90434e0f380e290fb846b", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "2f4f684a36ab3dbee9e33d1c067482ea", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9731051344743277, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nfun main() {\n val sc = Scanner(System.`in`)\n val s = sc.nextLine()\n if(\"H\" in s || \"Q\" in s || \"+\" in s || \"9\" in s){\n print(\"YES\")\n }\n else{\n print(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "125d1cb5c95d2033fea87e16f44ba93e", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "6719cc8711bc34c3272d0d123a20a75a", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9923076923076923, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val regex = \"[HG9]\"\n println(if (Regex(regex).containsMatchIn(readLine()!!)) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "2699b717d5ef5cdb2f650cdcce56dcaf", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "0b546fcb7855f2418970749390b11b79", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.988929889298893, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedInputStream\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(BufferedInputStream(System.`in`))\n val input = scanner.nextLine()\n if('H' in input || 'Q' in input || '9' in input) print(\"Yes\")\n else print(\"No\")\n\n}", "lang": "Kotlin", "bug_code_uid": "207d731369e24fd224a9b1b410c6e989", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "b86f264ea72377ec9a1cad8f3e902a1a", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9283018867924528, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val p: String? = readLine()\n val list = listOf('H', 'Q', '9')\n var res = \"NO\"\n for (i in 0..3) {\n if (p?.contains(list[i])!!) {\n res = \"YES\"\n break\n }\n }\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "c84f0703031a0de9041f6751f22feb93", "src_uid": "1baf894c1c7d5aeea01129c7900d3c12", "apr_id": "192b1b943bcfe06a0d259a2cc5e116ee", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9712531398269606, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.abs\n\nfun main() {\n val inputStream = System.`in`\n val outputStream = System.out\n val inp = Main.InputReader(inputStream)\n val out = PrintWriter(outputStream)\n val solver = Main.TaskA()\n solver.solve(inp, out)\n out.close()\n}\n\nclass Main {\n internal class TaskA {\n fun solve(inp: InputReader, out: PrintWriter) {\n var a: Long = inp.nextInt().toLong()\n var b: Long = inp.nextInt().toLong()\n var c: Long = inp.nextInt().toLong()\n var d: Long = inp.nextInt().toLong()\n var e: Long = inp.nextInt().toLong()\n var f: Long = inp.nextInt().toLong()\n var ans = 0L\n if (e >= f) {\n val min = minOf(a, d)\n ans += min * e\n d -= min\n }\n if (d > 0) {\n val min = minOf(b, c, d)\n ans += min * f\n d -= min\n }\n if (d > 0)\n ans += minOf(a, d) * e\n out.println(ans)\n }\n }\n\n internal class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "2d5ec719b7d13efbb425137591a06f5c", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "apr_id": "f44eeec3e793c7523312230451f8b606", "difficulty": 800, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9933579335793358, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "\nfun main() {\n var a = readLine()!!.toInt() // \u0433\u0430\u043b\u0441\u0442\u0443\u043a\n var b = readLine()!!.toInt() // \u0448\u0430\u0440\u0444\n var c = readLine()!!.toInt() // \u0436\u0438\u043b\u0435\u0442\u043a\u0430\n var d = readLine()!!.toInt() // \u043f\u0438\u0434\u0436\u0430\u043a\n var e = readLine()!!.toInt() // \u0433\u0430\u043b\u0441\u0442\u0443\u043a + \u043f\u0438\u0434\u0436\u0430\u043a\n var f = readLine()!!.toInt() // \u0448\u0430\u0440\u0444 + \u0436\u0438\u043b\u0435\u0442\u043a\u0430 + \u043f\u0438\u0434\u0436\u0430\u043a\n\n\n\n var cost = 0\n if(e > f) {\n var maxE = Math.min(a, d)\n cost += maxE\n\n d -= maxE * e\n\n var maxB = Math.min(Math.min(b, c), d)\n cost += maxB * f\n } else {\n\n var maxB = Math.min(Math.min(b, c), d)\n cost += maxB * f\n\n d -= maxB\n\n var maxE = Math.min(a, d) * e\n cost += maxE\n }\n\n println(cost)\n}\n", "lang": "Kotlin", "bug_code_uid": "5a3290cc4bcfbba4246d2c44df1023fe", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "apr_id": "804975a0f6adf02a42916ca6164a0e9f", "difficulty": 800, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.931129476584022, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import kotlin.math.max\n\ndata class Input(val a: Int, val b: Int, val c: Int, val d: Int,\n val firstTypeCost: Int, val secondTypeCost: Int)\n\nclass Memoized {\n val mem = mutableMapOf()\n\n fun getMaxTotalCost(input: Input): Int {\n if (mem.containsKey(input))\n return mem[input]!!\n\n var firstCost = 0\n var secondCost = 0\n\n val (a, b, c, d, firstTypeCost, secondTypeCost) =\n input\n\n if (a>0 && d>0) {\n firstCost = firstTypeCost + getMaxTotalCost(Input(a-1, b, c, d-1,\n firstTypeCost, secondTypeCost))\n }\n\n if (b>0 && c>0 && d>0) {\n secondCost = secondTypeCost + getMaxTotalCost(Input(a, b-1, c-1, d-1,\n firstTypeCost, secondTypeCost))\n }\n\n mem[input] = max(firstCost, secondCost)\n return mem[input]!!\n }\n}\n\nfun main() {\n val a = readLine()!!.toInt()\n val b = readLine()!!.toInt()\n val c = readLine()!!.toInt()\n val d = readLine()!!.toInt()\n val firstTypeCost = readLine()!!.toInt()\n val secondTypeCost = readLine()!!.toInt()\n\n val res = Memoized().getMaxTotalCost(\n Input(a, b, c, d, firstTypeCost, secondTypeCost))\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "4bd0cbff771346373a88137c069c27b7", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "apr_id": "d2ea2c1495f5a92807ad7c2a0d33e824", "difficulty": 800, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.10323886639676114, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun main() {\n val a = readLine()!!.toInt()\n val b = readLine()!!.toInt()\n val c = readLine()!!.toInt()\n val d = readLine()!!.toInt()\n val e = readLine()!!.toInt()\n val f = readLine()!!.toInt()\n\n var ans = 0\n var js1 = 0\n var js2 = 0\n if (e > f) {\n js1 = Math.min(a, d)\n js2 = d - js1\n } else if (e < f) {\n js2 = Math.min(Math.min(b, c), d)\n js1 = d - js2\n } else {\n js1 = Math.min(a, d)\n js2 = Math.min(Math.min(b, c), d)\n }\n\n ans += e * Math.min(a, js1)\n ans += f * Math.min(Math.min(b, c), js2)\n\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "0bf0c53f3e5190410ad3de33e80d4118", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a", "apr_id": "d0bc8f2c6be265593022672e238ac797", "difficulty": 800, "tags": ["math", "brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.10092887841397477, "equal_cnt": 44, "replace_cnt": 32, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 44, "bug_source_code": "import java.io.*\nimport kotlin.concurrent.thread\n\nval fastOutStream = FileOutputStream(FileDescriptor.out)\nval fastOutBuf = run {\n Runtime.getRuntime().addShutdownHook(thread(start = false, name = \"fast-io flush() shutdown hook\", block = ::flush))\n ByteArray(4096)\n}\nvar fastOutBufCount = 0\n\nfun fastOutWrite(s: ByteArray) {\n if (s.size >= fastOutBuf.size) {\n flush()\n fastOutStream.write(s, 0, s.size)\n return\n }\n if (s.size > fastOutBuf.size - fastOutBufCount) {\n flush()\n }\n System.arraycopy(s, 0, fastOutBuf, fastOutBufCount, s.size)\n fastOutBufCount += s.size\n}\n\nfun flush() {\n if (fastOutBufCount > 0) {\n fastOutStream.write(fastOutBuf, 0, fastOutBufCount)\n fastOutBufCount = 0\n }\n}\n\nfun print(o: Any?) {\n print(o.toString())\n}\nfun print(s: String) {\n fastOutWrite(s.toByteArray())\n}\nfun println(o: Any?) {\n print(o.toString())\n print(\"\\n\")\n}\n\nval fastInStream = FileInputStream(FileDescriptor.`in`)\nval fastInBuf = ByteArray(4096)\nvar fastInBufPos = 0\nvar fastInBufCount = 0\n\nfun fastInFill() {\n fastInBufPos = 0\n fastInBufCount = 0\n val n = fastInStream.read(fastInBuf, fastInBufPos, fastInBuf.size - fastInBufPos)\n if (n > 0)\n fastInBufCount = n\n}\n\nfun fastInRead(): Byte {\n if (fastInBufPos >= fastInBufCount) {\n fastInFill()\n if (fastInBufPos >= fastInBufCount)\n return -1\n }\n val result = fastInBuf[fastInBufPos]\n fastInBufPos++\n return result\n}\n\nvar fastInScanStringBuf: ByteArray? = null\n@Suppress(\"deprecation\")\nfun scanString(): String {\n if (fastInScanStringBuf == null) fastInScanStringBuf = ByteArray(256)\n var c: Byte\n do {\n c = fastInRead()\n } while (c == ' '.toByte() || c == '\\n'.toByte())\n\n var count = 0\n while (c != (-1).toByte() && c != ' '.toByte() && c != '\\n'.toByte()) {\n if (count == fastInScanStringBuf!!.size) {\n val oldBuf = fastInScanStringBuf!!\n fastInScanStringBuf = ByteArray(oldBuf.size * 2)\n System.arraycopy(oldBuf, 0, fastInScanStringBuf, 0, count)\n }\n fastInScanStringBuf!![count] = c\n count++\n c = fastInRead()\n }\n return java.lang.String(fastInScanStringBuf, 0, 0, count) as String\n}\nfun scanInt(): Int {\n var c: Byte\n do {\n c = fastInRead()\n } while (c == ' '.toByte() || c == '\\n'.toByte())\n\n val negative = c == '-'.toByte()\n if (negative) c = fastInRead()\n\n var result = 0\n while (c != (-1).toByte() && c != ' '.toByte() && c != '\\n'.toByte()) {\n result = result * 10 + c - '0'.toByte()\n c = fastInRead()\n }\n return if (negative) -result else result\n}\nfun scanLong(): Long {\n var c: Byte\n do {\n c = fastInRead()\n } while (c == ' '.toByte() || c == '\\n'.toByte())\n\n val negative = c == '-'.toByte()\n if (negative) c = fastInRead()\n\n var result = 0.toLong()\n while (c != (-1).toByte() && c != ' '.toByte() && c != '\\n'.toByte()) {\n result = result * 10 + c - '0'.toByte()\n c = fastInRead()\n }\n return if (negative) -result else result\n}\nfun scanDouble(): Double {\n var c: Byte\n do {\n c = fastInRead()\n } while (c == ' '.toByte() || c == '\\n'.toByte())\n\n val negative = c == '-'.toByte()\n if (negative) c = fastInRead()\n\n var result = 0.0\n while (c != (-1).toByte() && c != ' '.toByte() && c != '\\n'.toByte() && c != '.'.toByte()) {\n result = result * 10 + c - '0'.toByte()\n c = fastInRead()\n }\n if (c == '.'.toByte()) {\n c = fastInRead()\n var unit = 1.0\n while (c != (-1).toByte() && c != ' '.toByte() && c != '\\n'.toByte()) {\n unit /= 10\n result += (c - '0'.toByte()) * unit\n c = fastInRead()\n }\n }\n return if (negative) -result else result\n}\n\nfun main(){\n val s : String = scanString()\n var numQ = 0\n var numQA = 0\n var numQAQ = 0\n for (c in s){\n if (c == 'Q') {\n numQ++\n numQAQ += numQA\n }\n if (c == 'A') numQA += numQ\n }\n println(numQAQ)\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "f19109bab7477b327a5a4b9410cd8879", "src_uid": "8aef4947322438664bd8610632fe0947", "apr_id": "25f5ae89771387afc39ca9dba8397b48", "difficulty": 800, "tags": ["dp", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.849545607539549, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.*\n\nobject programkt {\n internal class FastScanner(inpStr: InputStream, var br: BufferedReader = BufferedReader(InputStreamReader(inpStr)), var stok: StringTokenizer? = null){\n fun nextToken(): String? {\n while (stok == null || !stok!!.hasMoreTokens()) {\n val s = br.readLine() ?: return null\n stok = StringTokenizer(s)\n }\n return stok!!.nextToken()\n }\n\n fun nextInt() = nextToken()!!.toInt()\n fun nextLong() = nextToken()!!.toLong()\n fun nextDouble() = nextToken()!!.toDouble()\n fun nextChar() = br.read().toChar()\n fun nextLine() = br.readLine()\n fun nextBigInteger() = BigInteger(nextToken()!!)\n fun nextBigDecimal() = BigDecimal(nextToken()!!)\n }\n\n @JvmStatic fun main(args: Array) {\n val scanner = FastScanner(System.`in`)\n val str = scanner.nextLine()\n\n var cnt = 0\n fun count(i: Int, j: Int, k: Int, str: String) {\n if(k > str.length-1) {\n return\n }\n if(str[i] == 'Q' && str[j] == 'A' && str[k] == 'Q') {\n cnt++\n }\n //println(\"$i $j $k ${str[i]}${str[j]}${str[k]}\")\n count(i+1, j+1, k+1, str)\n count(i, j+1, k+1, str)\n count(i, j, k+1, str)\n }\n count(0,1,2,str)\n println(cnt)\n }\n}", "lang": "Kotlin", "bug_code_uid": "32e6c3992e73ec5ecac494322135b9f8", "src_uid": "8aef4947322438664bd8610632fe0947", "apr_id": "c8b68690246280e1a571b96a51ba0557", "difficulty": 800, "tags": ["dp", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9977272727272727, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package mainPackage\n\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val s = scanner.nextLine()\n\n var ans = 0\n\n for(i in 0 .. s.length - 1) {\n for(j in i + 1 .. s.length - 1) {\n for (h in j + 1 .. s.length - 1) {\n if(s[i] == 'Q' && s[j] == 'A' && s[h] == 'Q') {\n ++ans\n }\n }\n }\n }\n\n print(ans)\n}", "lang": "Kotlin", "bug_code_uid": "faf0dbbf3923b66518ccc77c3871367e", "src_uid": "8aef4947322438664bd8610632fe0947", "apr_id": "a8db4e1a55fb4e74a5a58bbb043e0171", "difficulty": 800, "tags": ["dp", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6991479134804457, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 16, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n val Q = Array(2) { \"X\" + scanner.next() + \"X\" }\n var last = 0\n var res = 0\n for (i in 0 until Q[0].length) {\n if (Q[0][i] == 'X' && Q[1][i] == 'X') {\n if ((i - last) % 3 == 0)\n res += ((i - last) / 3) * 2\n else if ((i - last) % 3== 2)\n res += ((i - last) / 3) * 2 + 1\n else\n res += ((i - last) / 3) * 2\n last = i + 1\n }\n else if (Q[0][i] == 'X' || Q[1][i] == 'X') {\n if ((i - last) % 3 == 0)\n res += ((i - last) / 3) * 2\n else if ((last - i) % 3 == 2)\n res += ((i - last) / 3) * 2 + 1\n else\n res += (((i - last) / 3) * 2) + 1\n last = i + 1\n }\n else if (Q[0][i] == '0' && Q[1][i] == '0' && ((Q[0][i - 1] == 'X' && Q[1][i - 1] != 'X') || (Q[1][i - 1] == 'X' && Q[0][i - 1] != 'X'))) {\n res++\n last = i + 1\n }\n }\n println(res)\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\n\n//class Pair(var a: Int, var b: Int): Comparable {\n// override fun compareTo(other: Pair): Int {\n// return b - a - other.b + other.a\n// }\n//}", "lang": "Kotlin", "bug_code_uid": "458afc45fe6525edff9e6c1a48505f74", "src_uid": "e6b3e787919e96fc893a034eae233fc6", "apr_id": "476babcddfc1dd08e16eb7ac75ef1b20", "difficulty": 1500, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9194444444444444, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n val k = readLine()!!.toInt()\n print(subtract(n, k))\n\n}\n\ntailrec fun subtract(num: Int, times: Int): Int {\n if(times == 0)\n return num\n\n if(num % 10 == 0) {\n return subtract(num/10, times.minus(1))\n } else {\n return subtract(num.minus(1), times.minus(1))\n }\n}", "lang": "Kotlin", "bug_code_uid": "bea337f8d584c19253b543815d0f6349", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "1a8340e7bab8d19f1ec1a7614c3b9367", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8406466512702079, "equal_cnt": 13, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 12, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toLong()\n var k = readLine()!!.toLong()\n while(k>0)\n {\n var lastDigit = n % 10\n if(lastDigit > k)\n {\n n = n - k\n k = 0\n }\n else\n {\n n = (n / 10)*10\n k = k - lastDigit\n }\n if(n % 10 == 0 && k > 0)\n {\n k--;\n n = n / 10\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "d391da8f54cf4ee702fa74963ab0b276", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "71094e393999df02a00fb1231cc98d99", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.919047619047619, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n var n = readLine()!!.toLong()\n var k = readLine()!!.toLong()\n while(k>0)\n {\n var lastDigit = n % 10\n if(lastDigit > k)\n {\n n -= k\n k = 0\n }\n else\n {\n n = (n / 10)*10\n k -= lastDigit\n }\n if(n % 10L == 0L && k > 0)\n {\n k--\n n /= 10\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "7ac6229c9a09a20c7a10208ae0f43f84", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "71094e393999df02a00fb1231cc98d99", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.1549053356282272, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n //println(\"Hello, World!\")\n //var num1=Scanner(System.`in`)\n var n=readLine()!!.toInt()\n var k=readLine()!!.toInt()\n for (i in 1..k) { \n if(n%10==0){\n n/=10\n }\n else{\n n=n-1\n }\n //println(\"$n\")\n } \n println(\"$n\")\n\n}", "lang": "Kotlin", "bug_code_uid": "59e909c21d3e94b4d1bd6f9239e6bea9", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "cb2f8cc7a57ad720cf1c54e2669e08b9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.1549053356282272, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n //println(\"Hello, World!\")\n //var num1=Scanner(System.`in`)\n val n=readLine()!!.toInt()\n val k=readLine()!!.toInt()\n for (i in 1..k) { \n if(n%10==0){\n n/=10\n }\n else{\n n=n-1\n }\n //println(\"$n\")\n } \n println(\"$n\")\n\n}", "lang": "Kotlin", "bug_code_uid": "d29398962f01bbe1f8fee3d3a58e4079", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "cb2f8cc7a57ad720cf1c54e2669e08b9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5311871227364185, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "val readIn = readLine() ?: throw RuntimeException(\"Expected a line from readIn, got null\")\nval (n, k) = readIn.split(\" \").map { it.toInt() }\nvar tmp = n\nrepeat(k) {\n if (tmp % 10 == 0)\n tmp -= 1\n else\n tmp /= 10\n}\nreturn tmp", "lang": "Kotlin", "bug_code_uid": "4e2c0928df04122f82a1b6aa4b78a560", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "c3d3fb4a79bd93c5f49a22e9c6f0d77f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5989304812834224, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun decrease(): Int {\n val readIn = readLine() ?: throw RuntimeException(\"Expected a line from readIn, got null\")\n val (n, k) = readIn.split(\" \").map { it.toInt() }\n var tmp = n\n repeat(k) {\n if (tmp % 10 == 0)\n tmp -= 1\n else\n tmp /= 10\n }\n return tmp\n}", "lang": "Kotlin", "bug_code_uid": "6407ae68a28b0e81357a0eaa69075c54", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "c3d3fb4a79bd93c5f49a22e9c6f0d77f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9606299212598425, "equal_cnt": 1, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(): Unit {\n var (n, k) = readLine()!!.split(\" \")!!.let { Pair(it[0].toInt(), it[1].toInt()) }\n repeat(k) {\n if (n.toString().last() == '0') {\n n = n / 10\n } else {\n n = n -1\n }\n }\n return n\n}", "lang": "Kotlin", "bug_code_uid": "89f40c280bd2f03952b9d7679ab6b0c0", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3ced918370713d68472dd18409c4d9e5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8436363636363636, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array)\n{\n val read = Scanner(System.`in`) \n var number = read.nextInt()\n var k = read.nextInt()\n for(h in 0 until k){\n if(number%10>0)\n number-=1;\n else\n number/=10;\n }\n println(number)\n}", "lang": "Kotlin", "bug_code_uid": "286acfde9e0f771fdd6ff683d87de248", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "f4b5eec9a03a544856dd2d66dd517222", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7002398081534772, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main (args: Array)\n{\n\nvar n =readLine()!!.toInt()\nvar k= readLine()!!.toInt()\nvar m= n\nvar d= 0;\nwhile (k>0)\n{ \nd=m%10;\nif (d!=0)\nm=m-1\nelse\nm=m/10\n\nk--\n}\nprintln(\"Result is $m\")\n}\n\n", "lang": "Kotlin", "bug_code_uid": "974e16c767bd9aeb6f24a8126f228f7a", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "6ef99ff3cde9ef350191f52751ec0fed", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4913294797687861, "equal_cnt": 23, "replace_cnt": 8, "delete_cnt": 11, "insert_cnt": 3, "fix_ops_cnt": 22, "bug_source_code": "fun wrongSubtraction(n: Int, k: Int) {\n var value = n\n for (i in 1..k) {\n if (value % 10 != 0) {\n value -= 1\n } else {\n value /= 10\n }\n }\n print(value)\n}", "lang": "Kotlin", "bug_code_uid": "da294310474c78957cd3fc6a623757e3", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "e3709d3843a9a3abc6322a576e3a1642", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9013605442176871, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 11, "bug_source_code": " \n fun main(args: Array) {\n var (a, j) = readLine()!!.split(' ').map(String::toInt)\n for (i in 1..j)\n {\n if (a%10 == 0)\n n /= 10\n else\n a--\n }\n \n println(a)\n }", "lang": "Kotlin", "bug_code_uid": "ee19470597381672339f5018b7e3be38", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a3bb65bc6d622a8a71da4e680b372b66", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9343339587242027, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "\nfun main() {\n var (n, k) = readLine()!!.split(' ')\n n = n.toInt()\n k = k.toInt()\n\n while (k>0) {\n if (n%10 == 0) {\n n = (n/10).toInt()\n } \n else {\n n -= 1\n } \n k-- \n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "672ae6324c6873b9c84039950e04bd45", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "8e9960d15b714e91fd43bc07b1cd9f18", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6546546546546547, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "fun runSubtraction(number: Int, subtractor: Int){\n println(wrongSubtraction(number,subtractor))\n}\n\nprivate tailrec fun wrongSubtraction(number: Int, subtractor: Int): Int {\n return if (subtractor == 0) {\n number\n } else if (number % 10 == 0) {\n wrongSubtraction(number / 10, subtractor - 1)\n } else {\n wrongSubtraction(number - 1, subtractor - 1)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "c78108e7ebb619f7f7aa691c69d43a1b", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "947a7530af6a4595a05bcaad60949504", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.085, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "#include\nusing namespace std;\nint main(){\n\tint n,k;\n\tcin>>n>>k;\n\tfor(int i=1;i<=k;i++){\n\t\tif(n%10)n--;\n\t\telse n/=10;\n\t}\n\tcout<) {\n val sc = Scanner(System.`in`)\n val str = sc.nextLine().split((\" \").toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()\n val number = Integer.parseInt(str[0])\n val k = Integer.parseInt(str[1])\n while (k > 0)\n {\n val rem = number % 10\n if (rem != 0)\n {\n number = number - 1\n }\n else\n {\n number = number / 10\n }\n k--\n }\n println(number)\n }\n}", "lang": "Kotlin", "bug_code_uid": "669369a54d4de513effedf1070efd872", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "1b4868945047cde1b94661df04bfdc14", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8294573643410853, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(arg: Array) {\n var n = arg[0].toInt()\n val k = arg[1].toInt()\n for( i in 0 until k)\n {\n \tval lastDigit = n % 10\n if(lastDigit == 0)\n {\n n /= 10\n }\n else\n {\n n--\n }\n }\n print(n)\n}", "lang": "Kotlin", "bug_code_uid": "0b519712775c050bc4107d24d0695b09", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "430542871ee16f4b9f632780dd697b0e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9609120521172638, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun Array.readInts() = map { it.toInt() }\n\nfun main(args: Array) {\n val (n, k) = args.readInts()\n\n var result = n\n for (i in 0 until k) {\n if (result % 10 == 0) {\n result /= 10\n } else {\n result--\n }\n }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "af71796d3c863650dfa1ad3e52a8d605", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "f17062c522b025f3be671d134fd56a7d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.07202881152460984, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "package practice2.a\n\nimport utils.Utils\nimport java.util.stream.IntStream\n\nobject WrongSubtraction {\n\n fun subtract(_number: Int, times: Int): Int {\n var number = _number\n\n IntStream.range(0, times).forEach {\n if (number % 10 == 0) {\n number /= 10\n } else {\n number--\n }\n }\n\n return number\n }\n\n}\n\nfun main(args: Array) {\n println(WrongSubtraction.subtract(args[0].toInt(), args[1].toInt()))\n}", "lang": "Kotlin", "bug_code_uid": "fc1ec3f7b0f268edde2e2665000e994c", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "49192e4601048fd6efc82dc624f3b23f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.13426573426573427, "equal_cnt": 7, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "object WrongSubtraction {\n\n fun subtract(number: Int, times: Int): Int {\n if (times == 0)\n return number\n\n return if (number % 10 == 0)\n subtract(number / 10, times - 1)\n else\n subtract(number - 1, times - 1)\n }\n\n}\n\nfun main(args: Array) {\n println(WrongSubtraction.subtract(args[0].toInt(), args[1].toInt()))\n}", "lang": "Kotlin", "bug_code_uid": "d40453c9f06443fcc2d1899f80ebddb2", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "49192e4601048fd6efc82dc624f3b23f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9502677888293802, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "//package codeForces.c491_2\n\nfun tryEat(n: Long, c: Long): Boolean {\n var remains = n\n var eaten = 0L\n\n while (remains > c) {\n remains -= c\n eaten += c\n\n remains -= remains / 10\n }\n eaten += remains\n\n return eaten >= n / 2\n}\n\nfun main(args: Array) {\n val n = readLine()!!.toLong()\n\n var left = 0L\n var right = n\n var lastSuccess = -1L\n\n while (left <= right) {\n val c = (left + right) / 2\n\n if (tryEat(n, c)) {\n lastSuccess = c\n right = c - 1\n } else {\n left = c + 1\n }\n }\n\n println(lastSuccess)\n}", "lang": "Kotlin", "bug_code_uid": "9546508d4450c3c4cc19e3f81f531aa1", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "apr_id": "398419582a0b6a4708774740096569e6", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9517980107115531, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "//package codeForces.c491_2\n\nfun tryEat(n: Long, c: Long): Boolean {\n var remains = n\n var eaten = 0L\n\n while (remains > c) {\n remains -= c\n eaten += c\n\n remains -= remains / 10\n }\n eaten += remains\n\n return eaten >= n / 2\n}\n\nfun main(args: Array) {\n val n = readLine()!!.toLong()\n\n var left = 1L\n var right = n\n var lastSuccess = -1L\n\n while (left <= right) {\n val c = (left + right) / 2\n\n if (tryEat(n, c)) {\n lastSuccess = c\n right = c - 1\n } else {\n left = c + 1\n }\n }\n\n println(lastSuccess)\n}", "lang": "Kotlin", "bug_code_uid": "c1a266b37395e93b1efad7601e97caa9", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "apr_id": "398419582a0b6a4708774740096569e6", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9975062344139651, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun model(n: Long, k: Long): Long {\n var rem = n\n var ans = 0L\n\n while (rem > 0) {\n val vasyaCount = Math.min(rem, k)\n ans += vasyaCount\n rem -= vasyaCount\n rem -= rem / 10\n }\n\n return ans\n}\n\nfun check(vasyaCount: Long, n: Long) = 2 * vasyaCount >= n\n\nconst val LIMIT = 10_000\n\nfun main(args: Array) {\n val n = readLine()!!.toLong()\n\n var a = 1L\n var b = n\n\n while (b - a > 1) {\n val c = (a + b) / 2\n if (check(vasyaCount = model(n = n, k = c), n = n)) {\n b = c\n } else {\n a = c\n }\n }\n\n a = Math.max(a - LIMIT / 2, 1L)\n b = a + LIMIT / 2\n\n for (k in a..b) {\n if (check(vasyaCount = model(n = n, k = k), n = n)) {\n println(k)\n break\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "4c9d61be62a42fdbac866246b40f5b13", "src_uid": "db1a50da538fa82038f8db6104d2ab93", "apr_id": "7f269c050d91ebf95ebe1279c9edac64", "difficulty": 1500, "tags": ["implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9775880469583778, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import kotlin.*\n\nfun readLn() = readLine()!!\nfun readStrings() = readLn().split(\" \")\nfun readInts() = readStrings().map{ it.toInt() }\n\nfun main() {\n var (n) = readInts()\n var (s) = readStrings()\n var mp = HashMap()\n for (i in 0..n - 2) {\n var t = s.substring(i, i + 2)\n mp[t] = mp.getOrDefault(t, 0) + 1\n }\n var ans = \"\"\n var mx = 0\n for ((key, val) in mp) {\n if (val > mx) {\n mx = val\n ans = key\n }\n }\n println(ans)\n}\n", "lang": "Kotlin", "bug_code_uid": "26a77ddc8ee2f593434df577900e2ca0", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "e2d62c194c5687c3e90c4e4eda1fad82", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9353970390309556, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.absoluteValue\nimport kotlin.math.pow\n\n\nfun main(args: Array) {\n val inputString = readLine()!!.split(\" \")\n val n = inputString[0].toInt()\n val s = inputString[1]\n\n\n var pattern = mutableListOf()\n var pmap = mutableMapOf()\n if (n >= 2 && n <= 100) {\n\n for (i in 0..(n - 2)) {\n if (s.substring(i, i + 2) in pattern) {\n var count = pmap[s.substring(i, i + 2)]\n\n if (count != null) {\n pmap[s.substring(i, i + 2)] = count + 1\n }\n } else {\n pattern.add(s.substring(i, i + 2))\n pmap.put(s.substring(i, i + 2), 1)\n }\n }\n }\n println(pmap.maxBy { it.value }?.key)\n}", "lang": "Kotlin", "bug_code_uid": "13a012def7b78899456c4d72cbc1363a", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "2275a39b5c59f90bcf7ec5c4272312ab", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9667405764966741, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package c1212\n\nfun main() {\n readLine()\n val s = readLine()!!\n val res=s.zipWithNext { a, b -> a.toString() + b }\n .groupingBy { it }\n .eachCount()\n .maxBy { it.value }\n ?.key!!\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "e03d684ebfa451a68e66e1084f0cd26c", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "bf09d05e4a26a445156ac004cede3856", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.976905311778291, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nfun main() {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val s = sc.next()\n val m = hashMapOf()\n for (i in 0 until n - 1) {\n val x = s.substring(i, i + 2)\n m[x] = m.getOrDefault(x, 0) + 1\n }\n var cnt = 0\n var res: String? = null\n for (e in m) {\n if (cnt < e.value) {\n cnt = e.value\n res = e.key\n }\n }\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "4fcdecaecae64634474a8b391b078410", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "7857824a04d567b80794930479a725c9", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9944223107569721, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\n \nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n var n = inp.nextInt()\n var s = inp.next()\n var all = ArrayList()\n var ans = s.substring(0,2)\n var i = 0\n for(i in 0..n-1)\n {\n var x = s.substring(i,i+2)\n all.add(x)\n }\n all.sort()\n var f = 0\n var x; var mx = 0;\n for(i in all)\n {\n if(i==x)\n {\n f++;\n }\n else\n {\n f = 1;\n x = i;\n }\n if(f >mx)\n {\n ans = i\n mx = f\n }\n \n }\n \n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "d5af1537107ad3b6d8c33b1a78c5e0bd", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "744ed7d89a356a8c871189aa459ef19e", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9976171564733916, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\n \nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n var n = inp.nextInt()\n var s = inp.next()\n var all = ArrayList()\n var ans = s.substring(0,2)\n var i = 0\n for(i in 0..n-1)\n {\n var x = s.substring(i,i+2)\n all.add(x)\n }\n all.sort()\n var f = 0\n var x=\"A\"; var mx = 0;\n for(i in all)\n {\n if(i==x)\n {\n f++;\n }\n else\n {\n f = 1;\n x = i;\n }\n if(f >mx)\n {\n ans = i\n mx = f\n }\n \n }\n \n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "47d8d3ee5491d25e29677f3c565a8304", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "744ed7d89a356a8c871189aa459ef19e", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9752747252747253, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package practice\n\nfun String.twoGrams(): Map = this.zipWithNext { a, b -> \"$a$b\" }.groupingBy { it }.eachCount()\n\nfun Map.max(): String? = this.maxBy { it.value }?.key\n\nfun main() {\n val n = readLine()?.toIntOrNull() ?: error(\"n not valid\")\n val s = readLine()?.substring(0 until n) ?: error(\"s not valid\")\n\n println(s.twoGrams().max())\n}", "lang": "Kotlin", "bug_code_uid": "a17bb2d4d98ead448f93f7f1f31b2252", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "083fb0baffce3dcca17b96afeb31ee02", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.234375, "equal_cnt": 18, "replace_cnt": 15, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 18, "bug_source_code": "fun main(){\n var(n,k)=readLine()!!.split(' ').map{x->x.toInt()}\n val arr=readLine()!!.split(' ').map{x->x.toInt()}.sorted()\n if (k==n){\n print(\"1000000000\\n\")\n }\n else if (k==0){\n if (arr[0]==1) print(\"-1\\n\")\n else print(\"1\\n\")\n }\n else{\n if (arr[k]==arr[k-1]) print(\"-1\\n\")\n else print(\"${arr[k-1]}\\n\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "ed30a058d08908715674652298ef6f14", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "8c3f271d2d60cec1982ed2549275b86d", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.99860529986053, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "rivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n \nfun main(args: Array) {\n var n = readInt()\n var s = readLn()\n var m = HashMap()\n for (i in 0..n-2) {\n var t = s.substring(i, i + 2)\n if (m.containsKey(t)) {\n m.put(t, m.get(t)!! + 1)\n } else {\n m.put(t, 1)\n }\n }\n var mx = -1\n var res = \"\"\n for (t in m.keys) {\n if (m.get(t)!! > mx) {\n mx = m.get(t)!!\n res = t\n }\n }\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "a4d274ffaa74b63a56e5d648b0ad7674", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "a9d5fa5c43e98cdaa5610515078c8a8f", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9346485819975339, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun test(args: Array) {\n val a = readLine()!!.toInt()\n val b = readLine()!!\n twoGram(a, b)\n}\n\nfun twoGram(length: Int, str: String) {\n val countMap = mutableMapOf()\n for (i in 0 until length - 1) {\n val twoGram = str.substring(i, i + 2)\n countMap[twoGram] = countMap[twoGram]?.plus(1) ?: 1\n }\n println(countMap.maxBy { it.value }?.key)\n}", "lang": "Kotlin", "bug_code_uid": "86db6e76e15705cb272e6c2abf1a99a8", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "8f280fdff6664e7d8b7699431872becf", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9973262032085561, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedInputStream\nimport java.io.BufferedOutputStream\nimport java.io.OutputStreamWriter\nimport java.util.*\nimport kotlin.math.max\n\nfun main(args: Array) {\n val scanner = Scanner(BufferedInputStream(System.`in`))\n val output = OutputStreamWriter(BufferedOutputStream(System.out))\n\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n val c = scanner.nextInt()\n val d = scanner.nextInt()\n\n val p1 = points(a, c)\n val p2 = points(b, d)\n\n when {\n p1 == p2 -> output.write(\"TIE\\n\")\n p1 > p2 -> output.write(\"Misha\\n\")\n else -> output.write(\"Vasya\\n\")\n }\n\n output.flush()\n output.close()\n scanner.close()\n}\n\nfun points(p: Int, t: Int) = max(3*p/10f, p - (p/250f * t))", "lang": "Kotlin", "bug_code_uid": "9bf55addf7d318fe50c45249417779cd", "src_uid": "95b19d7569d6b70bd97d46a8541060d0", "apr_id": "a46fdb12c2ad6c7e8386295191c37c2a", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995258978309826, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\n\nclass Solution : Runnable {\n override fun run() {\n solve()\n }\n\n fun start() {\n Thread(null, Solution(), \"whatever\", (1 shl 26).toLong()).start()\n }\n}\n\nfun main(args: Array) {\n Solution().start()\n}\n\n\nclass IO {\n companion object {\n\n private val reader: InputReader\n private val writer: OutputWriter\n\n init {\n if (System.getProperty(\"ONLINE_JUDGE\") == null) {\n reader = InputReader(FileInputStream(\"/Users/300041735/competitiveProgramming/src/codeforces/in.txt\"))\n writer = OutputWriter(FileOutputStream(\"/Users/300041735/competitiveProgramming/src/codeforces/out.txt\"))\n } else {\n reader = InputReader(System.`in`)\n writer = OutputWriter(System.`out`)\n }\n }\n\n private fun readMultipleInts(count: Int): List {\n val map = mutableListOf()\n repeat(count) {\n map.add(reader.readInt())\n }\n return map\n }\n\n fun readInt() = reader.readInt()\n fun readLong() = reader.readLong()\n fun readTwoInts() = readMultipleInts(2)\n fun readThreeInts() = readMultipleInts(3)\n fun readFourInts() = readMultipleInts(4)\n fun readString() = reader.readString()\n fun readTree(n: Int): MutableMap> {\n val graph = mutableMapOf>()\n repeat(n - 1) {\n val u = reader.readInt()\n val v = reader.readInt()\n if (!graph.containsKey(u)) graph[u] = mutableSetOf()\n if (!graph.containsKey(v)) graph[v] = mutableSetOf()\n graph[u]!!.add(v)\n graph[v]!!.add(u)\n }\n return graph\n }\n\n fun readIntArray(n: Int): Array {\n return Array(n) { readInt() }\n }\n\n fun readLongArray(n: Int): Array {\n return Array(n) { readLong() }\n }\n\n fun write(obj: Any) {\n writer.printLine(obj)\n }\n\n fun flushOutput() {\n writer.flush()\n }\n\n fun closeOutput() {\n writer.close()\n }\n }\n}\n\n\nclass MATH {\n companion object {\n\n val mod = 998244353\n var ispre = false\n\n val factMod = Array(300002) { 1 }\n\n fun pre() {\n for (i in 2 until 300001) {\n factMod[i] = ((factMod[i - 1] * i.toLong()) % MATH.mod).toInt()\n }\n }\n\n fun gcd(a: Int, b: Int): Int {\n if (b == 0)\n return a\n return gcd(b, a % b)\n }\n\n fun gcd(a: Long, b: Long): Long {\n if (b == 0L)\n return a\n return gcd(b, a % b)\n }\n\n fun inverseMod(a: Int): Int {\n return powMod(a, mod - 2)\n }\n\n fun powMod(a: Int, b: Int): Int {\n //calculate a to the power b mod m\n if (b == 0) return 1\n return if (b % 2 == 1) {\n prodMod(a, powMod(a, b - 1))\n } else {\n val p = powMod(a, b / 2)\n prodMod(p, p)\n }\n }\n\n fun ncr(n: Int, r: Int): Int {\n if (!ispre) pre(); ispre = true\n return ((factMod[n].toLong() * inverseMod(((factMod[r].toLong() * factMod[n - r]) % mod).toInt())) % mod).toInt()\n }\n\n fun prodMod(val1: Int, val2: Int): Int {\n return ((val1.toLong() * val2) % mod).toInt()\n }\n\n }\n}\n\n\nfun solve() {\n val n = IO.readInt()\n val (a1, a2, a3) = IO.readThreeInts()\n val (b1, b2, b3) = IO.readThreeInts()\n\n //minimum wins\n var aa1 = a1\n var aa2 = a2\n var aa3 = a3\n var bb1 = b1\n var bb2 = b2\n var bb3 = b3\n\n val max = Math.min(aa1, bb2) + Math.min(aa2, bb3) + Math.min(aa3, bb1)\n\n IO.write(\"${Math.max(0, aa1 - bb1 - bb3) + Math.min(0, aa2 - bb1 - bb2) + Math.min(0, aa3 - bb2 - bb3)} $max\")\n\n IO.flushOutput()\n IO.closeOutput()\n}\n\nfun factorize(n: Int, primes: MutableList): MutableList> {\n val factors = mutableListOf>()\n var nn = n\n primes.forEach {\n var power = 0\n while (nn % it == 0) {\n nn /= it\n power++\n }\n if (power != 0) {\n factors.add(Pair(it, power))\n }\n }\n if (nn != 1) {\n factors.add(Pair(nn, 1))\n }\n return factors\n}\n\n\nfun generateDivisors(index: Int, factors: MutableList>): List {\n if (index == factors.size - 1) {\n var cur = 1\n val list = mutableListOf()\n for (i in 0 until factors[index].second + 1) {\n list.add(cur)\n cur *= factors[index].first\n }\n return list\n }\n val list = generateDivisors(index + 1, factors)\n val newList = mutableListOf()\n var cur = 1\n for (i in 0 until factors[index].second + 1) {\n list.forEach {\n newList.add(it * cur)\n }\n cur *= factors[index].first\n }\n return newList\n}\n\n\nclass ArrayUtils {\n\n fun lowerBound(arr: Array, value: Int): Int {\n val pos = arr.binarySearch(value)\n if (pos < 0) return -1 * pos - 1\n var low = 0\n var high = arr.size\n while (low < high) {\n val middle = low + (high - low) / 2\n if (value > arr[middle]) {\n low = middle + 1\n } else {\n high = middle\n }\n }\n return low\n }\n}\n\nclass InputReader(private val stream: InputStream) {\n private val buf = ByteArray(1024)\n private var curChar: Int = 0\n private var numChars: Int = 0\n private val filter: SpaceCharFilter? = null\n\n fun read(): Int {\n if (numChars == -1)\n throw InputMismatchException()\n if (curChar >= numChars) {\n curChar = 0\n try {\n numChars = stream.read(buf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (numChars <= 0)\n return -1\n }\n return buf[curChar++].toInt()\n }\n\n fun readInt(): Int {\n var c = read()\n while (isSpaceChar(c))\n c = read()\n var sgn = 1\n if (c == '-'.toInt()) {\n sgn = -1\n c = read()\n }\n var res = 0\n do {\n if (c < '0'.toInt() || c > '9'.toInt())\n throw InputMismatchException()\n res *= 10\n res += c - '0'.toInt()\n c = read()\n } while (!isSpaceChar(c))\n return res * sgn\n }\n\n fun readLong(): Long {\n var c = read()\n while (isSpaceChar(c)) {\n c = read()\n }\n var sgn: Long = 1\n if (c == '-'.toInt()) {\n sgn = -1\n c = read()\n }\n var number: Long = 0\n do {\n number *= 10L\n number += (c - '0'.toInt()).toLong()\n c = read()\n } while (!isSpaceChar(c))\n return number * sgn\n }\n\n fun readString(): String {\n var c = read()\n while (isSpaceChar(c))\n c = read()\n val res = StringBuilder()\n do {\n res.appendCodePoint(c)\n c = read()\n } while (!isSpaceChar(c))\n return res.toString()\n }\n\n fun isSpaceChar(c: Int): Boolean {\n return filter?.isSpaceChar(c)\n ?: (c == ' '.toInt() || c == '\\n'.toInt() || c == '\\r'.toInt() || c == '\\t'.toInt() || c == -1)\n }\n\n operator fun next(): String {\n return readString()\n }\n\n interface SpaceCharFilter {\n fun isSpaceChar(ch: Int): Boolean\n }\n}\n\nclass OutputWriter {\n private val writer: PrintWriter\n\n constructor(outputStream: OutputStream) {\n writer = PrintWriter(BufferedWriter(OutputStreamWriter(outputStream)))\n }\n\n constructor(writer: Writer) {\n this.writer = PrintWriter(writer)\n }\n\n fun print(vararg objects: Any) {\n for (i in objects.indices) {\n if (i != 0)\n writer.print(' ')\n writer.print(objects[i])\n }\n }\n\n fun printLine(vararg objects: Any) {\n print(*objects)\n writer.println()\n }\n\n fun close() {\n writer.close()\n }\n\n fun flush() {\n writer.flush()\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "3094b213696e55fcfc97ecb7b9454810", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "apr_id": "e0a36930aed30cfb010850932a6e353f", "difficulty": 1800, "tags": ["flows", "greedy", "math", "brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9696819085487077, "equal_cnt": 26, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 14, "fix_ops_cnt": 25, "bug_source_code": "import kotlin.math.*\nimport java.io.*\nimport java.util.*\n\nclass FastIO: PrintWriter(System.out) {\n val read = BufferedReader(InputStreamReader(System.`in`))\n var token = StringTokenizer(\"\")\n\n fun next(): String {\n while (!token.hasMoreTokens()) token = StringTokenizer(read.readLine())\n return token.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextDouble() = next().toDouble()\n}\n\nfun main() {\n val koi = FastIO()\n\n // val t = koi.nextInt(); for (i in 1..t)\n solve(koi)\n\n koi.close()\n}\n\nclass FF(val n: Int) {\n\t\n\tvar adj = Array(n){ IntArray(n) }\n\tvar seen = BooleanArray(n)\n\n\tfun add(u: Int, v: Int, cap: Int) {\n\t\tadj[u][v] += cap\n\t}\n\n\tfun dfs(u: Int, low: Int, t: Int): Int {\n\t\tif (u == t)\n\t\t\treturn low\n\n\t\tseen[u] = true;\n\n\t\tfor (v in 0..n-1) {\n\t\t\tif (adj[u][v] != 0 && !seen[v]) {\n\t\t\t\tvar flow = dfs(v, min(adj[u][v], low), t)\n\n\t\t\t\tif (flow > 0) {\n\t\t\t\t\tadj[u][v] -= flow\n\t\t\t\t\tadj[v][u] += flow\n\t\t\t\t\tseen[u] = false\n\t\t\t\t\treturn flow\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tseen[u] = false\n\t\treturn 0\n\t}\n\n\tfun flow(s: Int, t: Int): Int {\n\t\tvar flow = 0\n\n\t\twhile (true) {\n\t\t\tvar here = dfs(s, 100000000, t)\n\t\t\tif (here == 0)\n\t\t\t\tbreak\n\t\t\tflow += here\n\t\t}\n\n\t\treturn flow\n\t}\n}\n\nfun solve(koi: FastIO) {\n\n\tvar n = koi.nextInt()\n\n\tvar a = koi.nextInt()\n\tvar c = koi.nextInt()\n\tvar b = koi.nextInt()\n\n\tvar x = koi.nextInt()\n\tvar z = koi.nextInt()\n\tvar y = koi.nextInt()\n\n\tvar g1 = FF(8)\n\n\tg1.add(6, 0, a)\n\tg1.add(6, 1, b)\n\tg1.add(6, 2, c)\n\n\tg1.add(3, 7, x)\n\tg1.add(4, 7, y)\n\tg1.add(5, 7, z)\n\n\tg1.add(0, 3, 100000000)\n\tg1.add(0, 4, 100000000)\n\tg1.add(1, 4, 100000000)\n\tg1.add(1, 5, 100000000)\n\tg1.add(2, 5, 100000000)\n\tg1.add(2, 3, 100000000)\n\n\tvar g2 = FF(8)\n\n\tg2.add(6, 0, a)\n\tg2.add(6, 1, b)\n\tg2.add(6, 2, c)\n\n\tg2.add(3, 7, x)\n\tg2.add(4, 7, y)\n\tg2.add(5, 7, z)\n\n\tg2.add(0, 5, 100000000)\n\tg2.add(1, 3, 100000000)\n\tg2.add(2, 4, 100000000)\n\n\tval ans1 = n - g1.flow(6, 7)\n\tval ans2 = g2.flow(6, 7)\n\n\tkoi.println(\"$ans1 $ans2\")\n}\n", "lang": "Kotlin", "bug_code_uid": "8bcf6a1281545612bc46222c27cf5082", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "apr_id": "4266480a820cf99b40670fe3260dc964", "difficulty": 1800, "tags": ["flows", "greedy", "math", "brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6714866696791686, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.*\nimport kotlin.collections.*\n\n\nprivate var fs = BufferedReader(InputStreamReader(System.`in`))\nprivate val out = StringBuilder()\nprivate fun readLn() = fs.readLine()!!\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readLong() = readLn().toLong()\nprivate fun readLongs() = readStrings().map { it.toLong() }\nprivate fun readInt() = readLn().toInt()\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main() {\n// val t = readInt()\n// for (tt in 0 until t) {\n solve()\n// }\n print(out)\n}\n\nprivate fun solve() {\n var n = readInt()\n var (rA,sA,pA) = readInts()\n var (rB,sB,pB) = readInts()\n var max = min(rA,sB) + min(sA,pB) + min(pA,rB)\n var min = 0\n var copy = 0\n if(rB == max(rB,max(sB,pB))){\n copy = pA\n min += min(pA,pB)\n pA -= min(pA,pB).also{pB -= min(pA,pB)}\n min += min(pA,sB)\n }\n else if(sB == max(rB,max(sB,pB))){\n copy = rA\n min += min(rA,rB)\n rA -= min(rA,rB).also{rB -= min(rA,rB)}\n min += min(rA,pB)\n }\n else if(pB == max(rB,max(sB,pB))){\n copy =sA\n min += min(sA,sB)\n sA -= min(sA,sB).also{sB -= min(sA,sB)}\n min += min(sA,rB)\n }\n println(\"${copy-min} $max\")\n\n}\n", "lang": "Kotlin", "bug_code_uid": "69b2dc7642c9f50399e1facfa1c64eec", "src_uid": "e6dc3bc64fc66b6127e2b32cacc06402", "apr_id": "62cc09b0df34cd0ba0e2915f9d1821d5", "difficulty": 1800, "tags": ["flows", "greedy", "math", "brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.952638700947226, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array){\n val n = readLine()!!.toInt()\n val sequence = readLine()!!.toList().map {it.toString().toInt()}\n var target_segment_sum = 0\n for (initial_segment_length in 1..n){\n target_segment_sum += sequence[initial_segment_length-1]\n var segment_sum = 0\n for(index in initial_segment_length..n-1){\n segment_sum += sequence[index]\n if(segment_sum == target_segment_sum){\n segment_sum = 0\n }\n else if(segment_sum > target_segment_sum){\n break\n }\n }\n if(segment_sum == 0) {\n println(\"YES\")\n return\n }\n }\n println(\"NO\")\n\n}", "lang": "Kotlin", "bug_code_uid": "db0c3afcecf5e2c864e8ec993ce825e4", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "386d879ba8c78a288710045e3997d9df", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9977064220183486, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val positions = \"V<^>\"\n val fromTo = readLine()!!\n val duration = readLine()!!.toInt() % 4\n var sol = if (fromTo[2] == positions[(positions.indexOf(fromTo[0]) + duration) % 4]) 1 else 0\n if (fromTo[2] == positions[(positions.indexOf(fromTo[0]) + 4 - duration) % 4]) sol = sol or 2\n print(\n when (sol) {\n 1 -> \"cw\"\n 2 -> \"ccw\"\n else -> \"undefined\"\n }\n )\n}", "lang": "Kotlin", "bug_code_uid": "45b074b1f6d294f1e5a7e5b430230521", "src_uid": "fb99ef80fd21f98674fe85d80a2e5298", "apr_id": "3f5d23b662c5236f515d7e19813ec5fc", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9666924864446166, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n //for (t in 1..nextInt()) {\n println(solve(nextInt(), nextInt(), nextInt(), nextInt()))\n //}\n}\n\nfun solve(a: Int, b: Int, c: Int, d: Int): String {\n val count = IntArray(b + c + 2)\n for (i in a + b .. b + c) {\n count[i - 1] = min(i - a - b + 1, b + c - i + 1)\n }\n for (i in b + c downTo 1) {\n count[i] += count[i + 1]\n }\n //println(count.joinToString(\" \"))\n var res = 0L\n for (i in c..d) {\n val t = min(i, b + c + 1)\n res += count[t]\n }\n return res.toString()\n}\n\nfun nextInt() = reader.nextInt()\n\nfun nextLong() = reader.nextLong()\n\nfun nextDouble() = reader.nextDouble()\n\nfun next() = reader.next()\n\nfun nextLine() = reader.nextLine()\n\nobject reader {\n\n private var tokens = listOf()\n private var index = 0\n\n fun nextInt() = this.next().toInt()\n\n fun nextLong() = this.next().toLong()\n\n fun nextDouble() = this.next().toDouble()\n\n fun next(): String {\n if (index == tokens.size) {\n tokens = this.nextLine().split(\" \")\n index = 0\n }\n return tokens[index++]\n }\n\n fun nextLine(): String {\n tokens = listOf()\n index = 0\n return readLine()!!\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "62504978354d74ec7e690dba8d90a548", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "6a2fc2ba1134ef9975a6213c942631a5", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7178812593177234, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.PriorityQueue\nimport java.util.TreeSet\nimport kotlin.math.*\nimport kotlin.random.Random\nimport kotlin.system.exitProcess\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val numCases = 1//readInt()\n for(case in 1..numCases) {\n //print(\"Case #$case: \")\n\n val a = readInt()\n val b = readInt()\n val c = readInt()\n val d = readInt()\n\n val ans = (a..b).sumByLong { x ->\n minOf(c-b+1, d-c+1, x).tr\n }\n\n println(ans)\n }\n}\n\nval Int.tr get() = toLong() * plus(1) / 2\n\n/** IO */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _ln = \"\"\n@JvmField var _lnPtr = 0\nfun read(): String {\n while (_lnPtr >= _ln.length) {\n _ln = readLine() ?: return \"\"\n _lnPtr = 0\n }\n var j = _ln.indexOf(' ', _lnPtr)\n if(j < 0) j = _ln.length\n val res = _ln.substring(_lnPtr, j)\n _lnPtr = j + 1\n return res\n}\nfun readRem(): String /* reads remainder of current line */ =\n _ln.substring(min(_lnPtr, _ln.length)).also { _lnPtr = _ln.length }\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() { iprintln(max(1, 2)) }\n\n/** additional commons */\ninline fun Iterable.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }\ninline fun Sequence.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }\ninline fun Array.sumByLong(func: (T) -> Long) = fold(0L) { acc, t -> acc + func(t) }\nfun IntArray.sumLong() = fold(0L, Long::plus)", "lang": "Kotlin", "bug_code_uid": "0734b98d7be25da04ef276278ed3ec6d", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "a3b5bad34a6c1efbb0552b5707a189a5", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.10495626822157435, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun main() {\n repeat(readLine()!!.toInt()) {\n readLine()\n val input = readLine()!!.split(\" \").map { it.toInt() }\n var number = 0\n var smaller = 0\n input.sorted().forEach {\n if (it <= smaller + 1) {\n number++\n smaller -= it - 1\n } else {\n smaller++\n }\n }\n println(number)\n }\n}", "lang": "Kotlin", "bug_code_uid": "282e83f5dc57c93dd98175a03e3ee7d1", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "68df8ed8e7ec94067d787d783ccc0ae7", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9786184210526315, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun soucetRady(n: Long) = n * (n + 1) / 2\nfun soucetCisel(a: Long, b: Long) = max(0, soucetRady(b) - soucetRady(a - 1))\n\nfun main() {\n val (a, b, c, d) = readLine()!!.split(\" \").map { it.toLong() }\n var number = 0L\n for (i in c..d) {\n val aa = max(a, i + 1 - c)\n val pocet = b - aa + 1\n val pocet2 = c - b + 1\n val start = min(c - i + aa, pocet2)\n number += soucetCisel(start, min(pocet2, pocet + start - 1))\n number += (pocet - min(pocet2 - start + 1, pocet)) * pocet2\n }\n println(number)\n}", "lang": "Kotlin", "bug_code_uid": "5aeb0e6deb569dd915b247f21e7df8a3", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "68df8ed8e7ec94067d787d783ccc0ae7", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7779919059549046, "equal_cnt": 21, "replace_cnt": 13, "delete_cnt": 5, "insert_cnt": 3, "fix_ops_cnt": 21, "bug_source_code": "import java.lang.StringBuilder\nimport java.util.*\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\n\nfun main(args: Array) {\n c()\n}\n\nfun divisor(n: Int): Int {\n var i = 2\n while (i * i <= n) {\n if (n % i == 0) return i\n i++\n }\n return n\n}\n\nfun a() {\n val t = readInt()\n repeat(t) {\n val n = readInt()\n val e = readInts().sorted()\n\n var ans = 0\n\n var i = 0\n while (i < n) {\n var k = e[i]\n var j = 0\n\n while (j < k && i + j < n) {\n k = e[i + j]\n j++\n }\n\n if (j == k) {\n ans++\n }\n i += j\n }\n\n println(ans)\n }\n}\n\nfun b() {\n val t = readInt()\n repeat(t) {\n val n = readInt()\n\n val s = readInts()\n val d = IntArray(n + 1)\n\n d[1] = 1\n\n for (i in 2 until n + 1) {\n var j = 1\n d[i] = 1\n while (j * j <= i) {\n if (i % j == 0) {\n val k = i / j\n if (s[i - 1] > s[j - 1]) d[i] = maxOf(d[i], d[j] + 1)\n if (s[i - 1] > s[k - 1]) d[i] = maxOf(d[i], d[k] + 1)\n }\n j++\n }\n }\n\n println(d.max()!!)\n }\n}\n\nprivate fun dif(a: Int, b: Int, i: Int): Int {\n val ai = (i % a) % b\n val bi = (i % b) % a\n\n return if (ai != bi) 1 else 0\n}\n\nprivate fun fff(p: IntArray, x: Long): Long {\n val n = p.size\n val times = x / n\n val rem = (x % n).toInt()\n return times * p.last() + p[rem]\n}\n\n\nfun c() {\n val (a, b, c, d) = readLongs()\n\n var ans = 0L\n\n var aSide = a\n var bSide = b\n\n for (k in c..d) {\n while (aSide + bSide <= k && aSide < b) aSide++\n while (aSide + bSide <= k && bSide < c) bSide++\n\n if (aSide + bSide > k) {\n// println(\"$k, $aSide, $bSide: $ans\")\n ans += (c - bSide + 1) * (b - aSide + 1)\n\n if (c - bSide < aSide - a) {\n val s = c - bSide\n ans += s * (s + 1) / 2\n } else {\n val x = c - bSide\n val s = aSide - a\n ans += x * (x + 1) / 2 - s * (s + 1) / 2\n }\n }\n }\n\n println(ans)\n}\n\n\nfun d() {\n val (n, s) = readInts()\n\n if (s >= n * 2) {\n println(\"YES\")\n val out = mutableListOf()\n repeat(n - 1) {\n out.add(2)\n }\n out.add(s - (n - 1) * 2)\n\n println(out.joinToString(separator = \" \"))\n println(1)\n } else {\n println(\"NO\")\n }\n}\n\n//1\n//4 3\n//1 3 2 4\n\n//1\n//3 3\n//1 3 2\n\nprivate inline fun sqr(x: Int) = 1L * x * x\n\nfun e() {\n val (n, m) = readInts()\n val land = readInts().sorted()\n val (g, r) = readInts()\n\n val d = Array(m) { LongArray(g + 1) { Long.MAX_VALUE } }\n d[0][0] = 0\n\n val q = PriorityQueue>( compareBy { it.first } )\n\n q.add(Triple(0, 0, 0))\n\n while (q.isNotEmpty()) {\n var (len, i, j) = q.poll()\n\n// println(\"$len, $i, $j\")\n\n if (i == m - 1) break\n if (d[i][j] < len) continue\n\n if (j == g) {\n j = 0\n len += r\n if (d[i][j] < len) continue\n }\n\n if (i > 0) {\n val l = land[i] - land[i - 1]\n if (j + l <= g && d[i - 1][j + l] > len + l) {\n d[i - 1][j + l] = len + l\n q.add(Triple(len + l, i - 1, j + l))\n }\n }\n if (i < m - 1) {\n val l = land[i + 1] - land[i]\n if (j + l <= g && d[i + 1][j + l] > len + l) {\n d[i + 1][j + l] = len + l\n q.add(Triple(len + l, i + 1, j + l))\n }\n }\n }\n\n val ans = d[m - 1].min()!!\n println(if (ans < Long.MAX_VALUE) ans else -1)\n}\n\nfun Int.isEven(): Boolean = this % 2 == 0\nfun Int.isOdd(): Boolean = this % 2 == 1\n\npublic operator fun List.component6(): T {\n return get(5)\n}\n\nfun allPrimesUpTo(n: Int): List {\n val isPrime = BooleanArray(n + 1) { true }\n val primes = mutableListOf()\n\n isPrime[0] = false\n isPrime[1] = false\n for (i in 2 until n + 1) {\n if (isPrime[i]) {\n primes.add(i)\n\n if (i.toLong() * i > n)\n continue\n\n for (j in i * i until n + 1 step i) {\n isPrime[j] = false\n }\n }\n }\n\n return primes\n}\n", "lang": "Kotlin", "bug_code_uid": "37f3441abdaf177b89cce6544d08dbcb", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "3d0976f172bc9d86204fcab3e8ea10d6", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995764506565015, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.lang.StringBuilder\nimport java.util.*\nimport kotlin.concurrent.fixedRateTimer\n\nfun PrintWriter.solve(sc: FastScanner) {\n val a = sc.nextInt()\n val b = sc.nextInt()\n val c = sc.nextInt()\n val d = sc.nextInt()\n var ans = 0L\n var count = 0\n for (s in a + b .. b + c) {\n if (s in a + b .. b + b) count++\n if (s in a + c + 1 .. b + c + 1) count--\n ans += count * maxOf(minOf(s, d + 1) - c, 0)\n }\n println(ans)\n}\n\nfun main(args: Array) {\n val writer = PrintWriter(System.out, false)\n writer.solve(FastScanner(System.`in`))\n writer.flush()\n}\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n", "lang": "Kotlin", "bug_code_uid": "84ba8a85a7f967e6448324f81c66c9aa", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "4b688db7922f17f3bbd14749872e39fc", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984962406015038, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport kotlin.math.min\n\nfun main() {\n val (a, b, c, d) = readNumbers()\n println(solve(a, b, c, d))\n}\n\nfun solve(a: Int, b: Int, c: Int, d: Int): Long {\n var res = 0L\n for (k in a + b..b + c) {\n val k0 = k - a - b\n val t = min(k0, b - a) + min(k0, c - b) - k0 + 1\n if (t > 0)\n if (k > d) {\n res += t * (d - c + 1)\n } else if (k > c) {\n res += t * (k - c)\n }\n }\n return res;\n}\n\n\nfun readNumber() = readLine()!!.toInt()\n\nfun readNumbers(line: String = readLine()!!): IntArray {\n return line\n .split(\" \")\n .map { it.toInt() }\n .toIntArray()\n}", "lang": "Kotlin", "bug_code_uid": "87b2aeb98d3aec67aab07fc84550f0d0", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "48b27b692d9ab17584ba4039278bab02", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9999287292423918, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import Mod.mdiv\nimport Mod.mmod\nimport Mod.mmult\nimport Mod.mplus\nimport Mod.mpow\nimport NumTh.inverse\nimport kotlin.collections.*\nimport kotlin.math.*\nimport java.util.Queue\nimport java.util.LinkedList\nimport java.util.PriorityQueue\n\nfun readLn() = readLine()!!.trim() // string line\nfun readInt() = readLn().trim().toInt() // single int\nfun readStrings() = readLn().trim().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.trim().toInt() } // list of ints\nfun readLongs() = readStrings().map { it.trim().toLong() } // list of ints\nfun readLong() = readLn().trim().toLong() // list of strings\nfun writeGoogleAnswer(case: Int, str: String) = println(\"Case #$case: $str\")\n\nobject NumTh {\n fun euclideanExt(la: Long, lb: Long): Triple {\n val signa = sign(la.toDouble()).toLong()\n val signb = sign(lb.toDouble()).toLong()\n\n var a = abs(la)\n var b = abs(lb)\n val reverse = a > b\n if (reverse) {\n a = b.also { b = a }\n }\n\n var m11 = 1L\n var m12 = 0L\n var m21 = 0L\n var m22 = 1L\n\n while (a > 0) {\n val tmp = b / a\n a = (b % a).also { b = a }\n m11 = (m12 - m11 * tmp).also { m12 = m11.also { m21 = (m22 - m21 * tmp).also { m22 = m21 } } }\n }\n var x = m12\n var y = m22\n var d = b\n if (reverse) {\n x = x.also { y = x }\n }\n return Triple(signa * x, signb * y, d)\n }\n\n fun euclideanExt(la: Int, lb: Int): Triple {\n val res = euclideanExt(la.toLong(), lb.toLong())\n return Triple(res.first.toInt(), res.second.toInt(), res.third.toInt())\n }\n\n public fun inverse(la: Long, mod: Long): Long {\n val res = euclideanExt(la mmod mod, mod).first\n return if (res < 0) res + mod else res\n }\n\n public fun inverse(la: Int, mod: Int): Int {\n val res = euclideanExt(la mmod mod, mod).first\n return if (res < 0) res + mod else res\n }\n\n infix fun Long.gcd(lb: Long) = euclideanExt(this, lb).third\n\n infix fun Int.gcd(lb: Int) = euclideanExt(this, lb).third\n\n fun chinese(qs: List, ans: List): Pair {\n\n if (qs.count() == 1) {\n return Pair(qs[0], ans[0] % qs[0])\n }\n val rng1 = 0 until qs.count() / 2\n val res1 = chinese(qs.slice(rng1), ans.slice(rng1))\n val rng2 = qs.count() / 2 until qs.count()\n val res2 = chinese(qs.slice(rng2), ans.slice(rng2))\n // println(res1)\n // println( res2 )\n // println( inverse(res2.first, res1.first) )\n // println( inverse(res1.first, res2.first) )\n val mod = res1.first * res2.first\n val res = (res1.second * res2.first * inverse(res2.first, res1.first) + res2.second * res1.first * inverse(res1.first, res2.first)) % mod\n return Pair(mod, res)\n }\n\n public fun Long.getPDivisors(): MutableList {\n if (this == 0L) {\n throw Exception()\n }\n var n = abs(this)\n val res = mutableListOf()\n while (n % 2L == 0L) {\n res.add(2L)\n n /= 2L\n }\n\n var cur = 3L\n while (n > 1) {\n if (n % cur != 0L) {\n cur += 2\n continue\n }\n while (n % cur == 0L) {\n res.add(cur)\n n /= cur\n }\n cur += 2\n }\n return res\n }\n\n public fun Long.getAllDivisors(): MutableList {\n if (this == 0L) {\n throw Exception()\n }\n val n = abs(this)\n val res = mutableListOf()\n var v = 2L\n while (v * v < n) {\n if (n % v == 0L) {\n res.add(v)\n }\n v++\n }\n if (v * v == n) {\n res.add(v)\n }\n return res\n }\n\n public fun Int.getAllDivisors(): MutableList {\n if (this == 0) {\n throw Exception()\n }\n val n = abs(this)\n val res = mutableListOf()\n var v = 2\n while (v * v < n) {\n if (n % v == 0) {\n res.add(v)\n }\n v++\n }\n if (v * v == n) {\n res.add(v)\n }\n return res\n }\n\n public fun Int.getPDivisors(): MutableList {\n if (this == 0) {\n throw Exception()\n }\n var n = abs(this)\n val res = mutableListOf()\n while (n % 2 == 0) {\n res.add(2)\n n /= 2\n }\n\n var cur = 3\n while (n > 1) {\n if (n % cur != 0) {\n cur += 2\n continue\n }\n while (n % cur == 0) {\n res.add(cur)\n n /= cur\n }\n cur += 2\n }\n return res\n }\n}\n\nobject Mod {\n private var _div = 2L\n\n public val div: Long\n get() = _div\n\n public fun setMod(div: Long) {\n if (div <= 0) {\n throw Exception()\n }\n _div = div\n }\n\n public fun setMod(div: Int) {\n if (div <= 0) {\n throw Exception()\n }\n _div = div.toLong()\n }\n\n public fun Long.mmod(): Long {\n return if (this < 0) _div + (this % _div) else this % _div\n }\n\n public fun Int.mmod(): Int {\n return (if (this < 0) _div + (this % _div) else this % _div).toInt()\n }\n\n public infix fun Long.mrem(v: Long): Long {\n if (v == 0L) {\n throw Exception()\n }\n return abs(this) % v\n }\n\n public fun Long.mpow(exp: Long, divisor: Long): Long {\n if (this == 0L && exp <= 0) {\n throw Exception()\n }\n\n if (exp == 0L) {\n return 1L\n }\n if (exp == 1L) {\n return this\n }\n var lv = this\n var lexp = exp\n\n var res = 1L\n while (lexp > 0) {\n res = (res * if (lexp % 2 == 1L) lv else 1L) % divisor\n lv = (lv * lv) % divisor\n lexp /= 2L\n }\n return res\n }\n\n public fun Int.mpow(exp: Int, divisor: Long): Int {\n\n return (this.toLong()).mpow(exp.toLong(), divisor.toLong()).toInt()\n }\n\n public fun Long.mmult(v: Long, mod: Long): Long {\n if (mod <= 0) {\n throw Exception()\n }\n return (this * v) mmod mod\n }\n\n public fun Int.mmult(v: Int, mod: Int): Int {\n return this.toLong().mmult(v.toLong(), mod.toLong()).toInt()\n }\n\n public infix fun Long.mmult(v: Long): Long {\n return this.mmult(v, _div)\n }\n\n public infix fun Int.mmult(v: Int): Int {\n return this.toLong().mmult(v.toLong(), _div).toInt()\n }\n\n public fun Long.mdiv(v: Long, mod: Long): Long {\n if (mod <= 0) {\n throw Exception()\n }\n return this.mmult(inverse(v, mod), mod)\n }\n\n public fun Int.mdiv(v: Int, mod: Int): Int {\n if (mod <= 0) {\n throw Exception()\n }\n return this.toLong().mdiv(v.toLong(), mod.toLong()).toInt()\n }\n\n public infix fun Long.mdiv(v: Long): Long {\n return this.mdiv(v, _div)\n }\n\n public infix fun Int.mdiv(v: Int): Int {\n return this.toLong().mdiv(v.toLong(), _div).toInt()\n }\n\n public fun Long.mminus(v: Long, mod: Long): Long {\n return this.mplus(-1L*v, mod)\n }\n\n public fun Int.mminus(v: Int, mod: Int): Int {\n return this.mplus(-1*v, mod)\n }\n\n public fun Long.mplus(v: Long, mod: Long): Long {\n if (mod <= 0) {\n throw Exception()\n }\n return (this + v) mmod mod\n }\n\n public fun Int.mplus(v: Int, mod: Int): Int {\n return this.toLong().mplus(v.toLong(), mod.toLong()).toInt()\n }\n\n public infix fun Long.mminus(v: Long): Long {\n return this.mplus(-1L*v, _div)\n }\n\n public infix fun Int.mminus(v: Int): Int {\n return this.mplus(-1*v, _div.toInt()).toInt()\n }\n\n public infix fun Long.mplus(v: Long): Long {\n return this.mplus(v, _div)\n }\n\n public infix fun Int.mplus(v: Int): Int {\n return this.mplus(v, _div.toInt())\n }\n\n public infix fun Long.mmod(mod: Long): Long {\n if (mod <= 0L) {\n throw Exception()\n }\n return if (this < 0) mod + (this % mod) else this % mod\n }\n\n public infix fun Int.mmod(mod: Int): Int {\n if (mod <= 0) {\n throw Exception()\n }\n return (if (this < 0) mod + (this % mod) else this % mod).toInt()\n }\n\n public infix fun Long.mpow(exp: Long): Long {\n return this.mpow(exp, _div)\n }\n\n public infix fun Int.mpow(exp: Int): Int {\n return this.mpow(exp, _div)\n }\n}\n\nobject Comb {\n\n var facts: LongArray = LongArray(0)\n private set\n\n public fun Int.mprecompute() {\n if (this < 0) {\n throw Exception()\n }\n facts = LongArray(this + 1)\n facts[0] = 1L\n for (i in 1..this) {\n facts[i] = facts[i - 1] mmult i.toLong()\n }\n }\n\n public fun Long.mfact(mod: Long): Long {\n if (this == 1L || this == 0L) {\n return 1L\n }\n\n var res = 1L\n for (i in 2L..this) {\n res = (res * i) mmod mod\n }\n return res\n }\n\n public fun Long.mfact(): Long {\n return this.mfact(Mod.div)\n }\n\n public fun Int.mfact(mod: Int): Int {\n return this.toLong().mfact(mod.toLong()).toInt()\n }\n\n public fun Int.fact(): Int {\n return this.mfact(Mod.div.toInt())\n }\n}\n\nfun getMaxBit(v: Long): Int {\n var res = 0\n var cur = v\n while (cur > 0) {\n res++\n cur = cur shr 1\n }\n return res\n}\n\nfun isPrime(vl: Long): Boolean {\n\n var test = 2L\n while (test * test <= vl && (vl % test != 0L)) {\n test++\n }\n return (vl == 2L) || (vl % test) != 0L\n}\n\nfun getBit(v: Long, s: Int): Long {\n return (v shr s) and 1\n}\n\nfun getNext1(v1: Long, s: Int): Int {\n var cur = s\n while (getBit(v1, cur) == 0L && cur < 64) {\n cur++\n }\n return cur\n}\n\nfun replace10(v1: Long, v2: Long, st: Int, reverse: Boolean, res: MutableList): Int {\n var onep1 = getNext1(v1, st + 1)\n var onep2 = getNext1(v2, st + 1)\n var last = min(onep1, onep2)\n if (last == 64) {\n last = st + 2\n }\n last -= 1\n for (i in st..last - 1) {\n res.add(if (reverse) \"S\" else \"W\")\n }\n res.add(if (reverse) \"N\" else \"E\")\n return last + 1\n}\n\nfun replace11(v1: Long, v2: Long, st: Int, reverse: Boolean, res: MutableList): Int? {\n var onep1 = getNext0(v1, st + 1)\n var onep2 = getNext0(v2, st + 1)\n if (onep1 != onep2) {\n return null\n }\n res.add(if (reverse) \"S\" else \"W\")\n\n var last = onep1\n for (i in (st + 1)..(last - 1)) {\n res.add(if (reverse) \"E\" else \"N\")\n }\n res.add(if (reverse) \"N\" else \"E\")\n return last + 1\n}\n\nfun getNext0(v1: Long, s: Int): Int {\n var cur = s\n while (getBit(v1, cur) == 1L && cur < 64) {\n cur++\n }\n return cur\n}\n\nfun pow(v: Long, pow: Long, mod: Long): Long {\n\n if (pow == 0L) {\n return 1L\n }\n if (pow == 1L) {\n return v\n }\n var res = if (pow % 2L == 1L) v else 1L\n val tmp = pow((v*v) % mod, pow / 2, mod)\n res *= (tmp * tmp) % mod\n res = res % mod\n return res\n}\n\nclass UF {\n val rank = HashMap()\n val parent = HashMap()\n val counts = HashMap()\n var groupCnt = 0\n\n fun add(v: Int) {\n if (!rank.containsKey(v)) {\n groupCnt ++\n // println(\"$v: $groupCnt\")\n rank[v] = 1\n parent[v] = v\n counts[v] = 1\n }\n }\n\n fun getParent(v: Int): Int {\n\n add(v)\n var p1 = v\n\n while (parent[p1] != p1) {\n\n val tmp = p1\n p1 = parent[p1]!!\n parent[tmp] = parent[p1]!!\n }\n return p1\n }\n\n fun union(v1: Int, v2: Int) {\n\n // println(\"union: $v1, $v2\")\n var p1 = getParent(v1)\n var p2 = getParent(v2)\n if (p1 == p2) {\n return\n }\n\n groupCnt --\n // println(groupCnt)\n if (rank[p2]!! > rank[p1]!!) {\n parent[p1] = p2\n counts[p2] = counts[p2]!! + counts[p1]!!\n } else if (rank[p2]!! < rank[p1]!!) {\n parent[p2] = p1\n counts[p1] = counts[p1]!! + counts[p2]!!\n } else {\n parent[p1] = p2\n counts[p2] = counts[p2]!! + counts[p1]!!\n }\n }\n\n fun connected(v1: Int, v2: Int): Boolean {\n return getParent(v1) == getParent(v2)\n }\n}\n\nfun solve(arr:MutableList, i: Int, j: Int, a:Int, b:Int) {\n if(i == j){\n arr[i] = a\n return\n } else if( j == i + 1){\n arr[i] = a\n arr[j] = a + b\n return\n }\n\n if((j - i + 1) % 2 == 0){\n arr[(j+i - 1) / 2] = a\n solve(arr, i, ((j+i - 1) / 2) - 1, a + 2 * b, 2*b) \n solve(arr, ((j+i - 1) / 2) + 1, j , a + b, 2 * b) \n }\n else{\n arr[(j+i) / 2] = a\n solve(arr, i, ((j+i) / 2) - 1, a + b, 2*b) \n solve(arr, ((j+i) / 2) + 1, j , a + 2 * b, 2 * b)\n }\n}\n\nfun getProd(v:Long):Long{\n if(v == 0L) return 0\n\n var tmp = v\n var mn = 10L\n var mx = -1L\n while(tmp > 0){\n var cur = tmp % 10\n if(mn > cur){\n mn = cur\n }\n if(mx < cur){\n mx = cur\n }\n if(mn == 0L){\n return 0L\n }\n tmp = tmp / 10\n }\n return mn*mx\n \n}\n\n\nfun main(args: Array) {\n\n val (a,b,c,d) = readLongs()\n var sum = 0L\n for (x in a..b) {\n val ymn = max(c + 1 - x, b)\n val ymx =min(c, d + 1 - x)\n // println(ymn)\n // println(ymx)\n if(ymx >= ymn){\n sum+= (((x + ymn - c) + (x + ymx - c)) * ((x + ymx - c) - (x + ymn - c) + 1) ) / 2\n } \n \n sum += if(ymx < c) (c- max(ymx, b) + 1)*(d - c + 1) else 0\n }\n println(sum) \n}\n", "lang": "Kotlin", "bug_code_uid": "82240c78a54bb1cc5a17704ab0ad92e1", "src_uid": "4f92791b9ec658829f667fcea1faee01", "apr_id": "67c414b1c863b32ded31d45c694424fb", "difficulty": 1800, "tags": ["binary search", "math", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9072725987702311, "equal_cnt": 21, "replace_cnt": 14, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 20, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.lang.StringBuilder\nimport java.util.PriorityQueue\nimport java.util.StringTokenizer\nimport java.util.TreeMap\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val percent = ModInt(100).inverse()\n\n val n = readInt()\n val pipes = List(n) { Pipe(readInt(), readInt(), percent * readInt()) }\n\n val tree = SegmentTree(n-1, null, nullIdentityCombiner(Seg::plus))\n\n tree.build { i ->\n Seg(\n ll = pipes[i].p.not() * pipes[i+1].p.not(),\n lr = pipes[i].p.not() * pipes[i+1].p,\n rl = pipes[i].p * pipes[i+1].p.not(),\n rr = pipes[i].p * pipes[i+1].p\n )\n }\n\n val cols = ArrayList(2*n)\n\n for(i in 0 until n-1) {\n val a = pipes[i]\n val b = pipes[i+1]\n\n val d = b.x - a.x\n cols.add(Collision(i, RL, d, a.v + b.v))\n if(a.v > b.v) cols.add(Collision(i, RR, d, a.v - b.v))\n else if(a.v < b.v) cols.add(Collision(i, LL, d, b.v - a.v))\n }\n\n cols.sortWith(Collision.comparator)\n\n var currProb = ModInt(1)\n var ans = ModInt(0)\n for((a, t, d, v) in cols) {\n tree[a] = tree[a]!!.ban(t)\n val prob = tree[0, tree.size]!!.sum\n ans += (currProb - prob) * d / v\n currProb = prob\n }\n\n println(ans.int)\n}\n\ninline fun ModInt.not() = ModInt(1) - this\n\ndata class Pipe(val x: Int, val v: Int, val p: ModInt)\ndata class Collision(val a: Int, val type: CollisionType, val d: Int, val v: Int) {\n companion object {\n val comparator = Comparator { a, b ->\n (a.d.toLong() * b.v).compareTo(b.d.toLong() * a.v)\n }\n }\n\n inline val b get() = a + 1\n}\n\ninline class CollisionType(val i: Int)\ninline val LL get() = CollisionType(0)\ninline val LR get() = CollisionType(1)\ninline val RL get() = CollisionType(2)\ninline val RR get() = CollisionType(3)\n\nclass Seg(private val values: IntArray) {\n constructor(ll: ModInt, lr: ModInt, rl: ModInt, rr: ModInt): this(intArrayOf(ll.int, lr.int, rl.int, rr.int))\n\n operator fun get(collisionType: CollisionType) = ModInt(values[collisionType.i])\n val ll get() = ModInt(values[0])\n val lr get() = ModInt(values[1])\n val rl get() = ModInt(values[2])\n val rr get() = ModInt(values[3])\n\n operator fun plus(b: Seg): Seg {\n val al = ll + lr\n val ar = rl + rr\n val bl = b.ll + b.rl\n val br = b.lr + b.rr\n\n return Seg(\n ll = al * bl,\n lr = al * br,\n rl = ar * bl,\n rr = ar * br\n )\n }\n\n val sum get() = ModIntArray(values).sum()\n\n fun ban(collisionType: CollisionType) = Seg(values.copyOf().also { it[collisionType.i] = 0 })\n}\n\nclass SegmentTree(\n val size: Int,\n val identityValue: T,\n val combiner: (T, T) -> T) {\n\n /* degenericization helpers\n val identityValue: T = TODO()\n fun combiner(a: T, b: T): T = TODO()\n */\n\n @Suppress(\"UNCHECKED_CAST\")\n private val array = Array(2 * size) { identityValue } as Array\n\n inline val lastIndex get() = size - 1\n inline val indices get() = 0 until size\n val asList: List by lazy {\n object : AbstractList() {\n override val size: Int get() = this@SegmentTree.size\n override fun get(index: Int): T = this@SegmentTree[index]\n }\n }\n\n fun build(generator: (Int) -> T) {\n for(i in 0 until size) {\n array[i + size] = generator(i)\n }\n for(i in size-1 downTo 1) {\n array[i] = combiner(array[i shl 1], array[i shl 1 or 1])\n }\n }\n\n /** instantiates values from an iterable, O(n) time */\n fun copyFrom(iterable: Iterable) {\n run {\n iterable.forEachIndexed { i, t ->\n if(i > lastIndex) return@run\n array[i + size] = t\n }\n }\n for(i in size-1 downTo 1) {\n array[i] = combiner(array[i shl 1], array[i shl 1 or 1])\n }\n }\n\n /** Updates a value, O(log n) time */\n operator fun set(index: Int, value: T) {\n require(index in 0 until size)\n var i = index + size\n array[i] = value\n while(true) {\n i = i shr 1\n if(i <= 0) break\n array[i] = combiner(array[i shl 1], array[i shl 1 or 1])\n }\n }\n\n /** Gets a value by its index, O(1) time */\n operator fun get(index: Int): T {\n require(index in 0 until size)\n return array[index + size]\n }\n\n /** gets the result of applying the monoid operation to the values in the index range, O(log n) time */\n operator fun get(start: Int, endExclusive: Int): T {\n var l = maxOf(start, 0) + size\n var r = minOf(endExclusive, size) + size\n\n // two accumulators to support non-commutative monoids\n var lAcc = identityValue\n var rAcc = identityValue\n\n while(l < r) {\n if(l and 1 == 1) {\n lAcc = combiner(lAcc, array[l++])\n }\n if(r and 1 == 1) {\n rAcc = combiner(array[--r], rAcc)\n }\n\n l = l shr 1\n r = r shr 1\n }\n\n return combiner(lAcc, rAcc)\n }\n\n operator fun get(range: IntRange) = get(range.first, range.last + 1)\n}\n\n/** Converts a semigroup to a monoid by using null as the identity value. */\ninline fun nullIdentityCombiner(crossinline combiner: (T, T) -> T): (T?, T?) -> T? = { a, b ->\n when {\n a == null -> b\n b == null -> a\n else -> combiner(a, b)\n }\n}\n\nconst val MOD = 998244353\nconst val TOTIENT = MOD - 1 // assumes MOD is prime\n\ninfix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }\ninfix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }\ninfix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()\n\nfun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod\n\nfun Int.powMod(exponent: Int, mod: Int): Int {\n if(exponent < 0) error(\"Inverse not implemented\")\n var res = 1L\n var e = exponent\n var b = umod(mod).toLong()\n\n while(e > 0) {\n if(e and 1 == 1) {\n res = res * b % mod\n }\n e = e shr 1\n b = b * b % mod\n }\n return res.toInt()\n}\n\ninline fun Int.toModInt() = ModInt(this umod MOD)\ninline fun Long.toModInt() = ModInt(this umod MOD)\n\n/** note: Only use constructor for int within modulo range, otherwise use toModInt **/\ninline class ModInt(val int: Int) {\n companion object {\n /** can't seem to make these private or inlined without causing compiler issues */\n @JvmField val _invMemo = HashMap()\n fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }\n }\n\n // normalizes an integer that's within range [-MOD, MOD) without branching\n private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)\n\n operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30\n inline operator fun plus(other: Int) = plus(other.toModInt())\n operator fun inc() = normalize(int + (1 - MOD))\n\n operator fun minus(other: ModInt) = normalize(int - other.int)\n inline operator fun minus(other: Int) = minus(other.toModInt())\n operator fun dec() = normalize(int - 1)\n operator fun unaryMinus() = normalize(-int)\n\n operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())\n inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))\n\n fun pow(exponent: Int): ModInt {\n val e = if(exponent < 0) {\n require(int != 0) { \"Can't invert/divide by 0\" }\n exponent umod TOTIENT\n } else exponent\n return ModInt(int.powMod(e, MOD))\n }\n\n fun pow(exponent: Long) = if(int == 0) when {\n exponent > 0 -> this\n exponent == 0L -> ModInt(1)\n else -> error(\"Can't invert/divide by 0\")\n } else pow(exponent umod TOTIENT)\n\n inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */\n\n fun inv_unmemoized(): ModInt {\n require(int != 0) { \"Can't invert/divide by 0\" }\n return pow(TOTIENT - 1)\n }\n inline fun inv_memoized() = _invMemoized(this)\n\n operator fun div(other: ModInt) = times(other.inverse())\n inline operator fun div(other: Int) = div(other.toModInt())\n\n override inline fun toString() = int.toString()\n}\n\ninline operator fun Int.plus(modInt: ModInt) = modInt + this\ninline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt\ninline operator fun Int.times(modInt: ModInt) = modInt * this\ninline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this\n\ninline class ModIntArray(val intArray: IntArray): Collection {\n inline operator fun get(i: Int) = ModInt(intArray[i])\n inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }\n\n override inline val size: Int get() = intArray.size\n inline val lastIndex get() = intArray.lastIndex\n inline val indices get() = intArray.indices\n\n override inline fun contains(element: ModInt): Boolean = element.int in intArray\n\n override fun containsAll(elements: Collection): Boolean = elements.all(::contains)\n\n override inline fun isEmpty(): Boolean = intArray.isEmpty()\n\n override fun iterator(): Iterator = object: Iterator {\n var index = 0\n override fun hasNext(): Boolean = index < size\n override fun next(): ModInt = get(index++)\n }\n\n fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))\n fun copyOf() = copyOf(size)\n}\nfun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =\n ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))\ninline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))\ninline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })\n\ninline fun ModIntArray.first() = get(0)\ninline fun ModIntArray.last() = get(lastIndex)\ninline fun ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }\nfun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)\nfun ModIntArray.product() = fold(ModInt(1), ModInt::times)\n\ninline fun Iterable.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Iterable.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }\ninline fun Sequence.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Sequence.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }\nfun Iterable.sum() = sumByModInt { it }\nfun Sequence.sum() = sumByModInt { it }\nfun Iterable.product() = productByModInt { it }\nfun Sequence.product() = productByModInt { it }\nfun Collection.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}\n", "lang": "Kotlin", "bug_code_uid": "d4ccf835a29e6ae536d3ec6dbb167605", "src_uid": "37bb4fe5f6cc2a173e97c033c6fde8c7", "apr_id": "d9383771d922d71ee9b5f553f2baa611", "difficulty": 3100, "tags": ["data structures", "probabilities", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9058578145437833, "equal_cnt": 25, "replace_cnt": 15, "delete_cnt": 5, "insert_cnt": 4, "fix_ops_cnt": 24, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.lang.StringBuilder\nimport java.util.PriorityQueue\nimport java.util.StringTokenizer\nimport java.util.TreeMap\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val percent = ModInt(100).inverse()\n\n val n = readInt()\n val pipes = List(n) { Pipe(readInt(), readInt(), percent * readInt()) }\n\n val tree = SegmentTree(n-1, null, nullIdentityCombiner(Seg::plus))\n\n tree.build { i ->\n Seg(\n ll = pipes[i].p.not() * pipes[i+1].p.not(),\n lr = pipes[i].p.not() * pipes[i+1].p,\n rl = pipes[i].p * pipes[i+1].p.not(),\n rr = pipes[i].p * pipes[i+1].p\n )\n }\n\n val cols = ArrayList(2*n)\n\n for(i in 0 until n-1) {\n val a = pipes[i]\n val b = pipes[i+1]\n\n val d = b.x - a.x\n cols.add(Collision(i, RL, d, a.v + b.v))\n if(a.v > b.v) cols.add(Collision(i, RR, d, a.v - b.v))\n else if(a.v < b.v) cols.add(Collision(i, LL, d, b.v - a.v))\n }\n\n cols.sortWith(Collision.comparator)\n\n var currProb = ModInt(1)\n var ans = ModInt(0)\n for((a, t, d, v) in cols) {\n tree[a] = tree[a]!!.ban(t)\n val prob = tree[0, tree.size]!!.sum\n ans += (currProb - prob) * d / v\n currProb = prob\n }\n\n println(ans.int)\n}\n\nfun ModInt.not() = ModInt(1) - this\n\ndata class Pipe(val x: Int, val v: Int, val p: ModInt)\ndata class Collision(val a: Int, val type: CollisionType, val d: Int, val v: Int) {\n companion object {\n val comparator = Comparator { a, b ->\n (a.d.toLong() * b.v).compareTo(b.d.toLong() * a.v)\n }\n }\n\n inline val b get() = a + 1\n}\n\ninline class CollisionType(val i: Int)\ninline val LL get() = CollisionType(0)\ninline val LR get() = CollisionType(1)\ninline val RL get() = CollisionType(2)\ninline val RR get() = CollisionType(3)\n\nclass Seg(private val values: IntArray) {\n constructor(ll: ModInt, lr: ModInt, rl: ModInt, rr: ModInt): this(intArrayOf(ll.int, lr.int, rl.int, rr.int))\n\n operator fun get(collisionType: CollisionType) = ModInt(values[collisionType.i])\n val ll get() = ModInt(values[0])\n val lr get() = ModInt(values[1])\n val rl get() = ModInt(values[2])\n val rr get() = ModInt(values[3])\n\n operator fun plus(b: Seg): Seg {\n val al = ll + lr\n val ar = rl + rr\n val bl = b.ll + b.rl\n val br = b.lr + b.rr\n\n return Seg(\n ll = al * bl,\n lr = al * br,\n rl = ar * bl,\n rr = ar * br\n )\n }\n\n val sum get() = ModIntArray(values).sum()\n\n fun ban(collisionType: CollisionType) = Seg(values.copyOf().also { it[collisionType.i] = 0 })\n}\n\nclass SegmentTree(\n val size: Int,\n val identityValue: T,\n val combiner: (T, T) -> T) {\n\n /* degenericization helpers\n val identityValue: T = TODO()\n fun combiner(a: T, b: T): T = TODO()\n */\n\n @Suppress(\"UNCHECKED_CAST\")\n private val array = Array(2 * size) { identityValue } as Array\n\n inline val lastIndex get() = size - 1\n inline val indices get() = 0 until size\n val asList: List by lazy {\n object : AbstractList() {\n override val size: Int get() = this@SegmentTree.size\n override fun get(index: Int): T = this@SegmentTree[index]\n }\n }\n\n fun build(generator: (Int) -> T) {\n for(i in 0 until size) {\n array[i + size] = generator(i)\n }\n for(i in size-1 downTo 1) {\n array[i] = combiner(array[i shl 1], array[i shl 1 or 1])\n }\n }\n\n /** instantiates values from an iterable, O(n) time */\n fun copyFrom(iterable: Iterable) {\n run {\n iterable.forEachIndexed { i, t ->\n if(i > lastIndex) return@run\n array[i + size] = t\n }\n }\n for(i in size-1 downTo 1) {\n array[i] = combiner(array[i shl 1], array[i shl 1 or 1])\n }\n }\n\n /** Updates a value, O(log n) time */\n operator fun set(index: Int, value: T) {\n require(index in 0 until size)\n var i = index + size\n array[i] = value\n while(true) {\n i = i shr 1\n if(i <= 0) break\n array[i] = combiner(array[i shl 1], array[i shl 1 or 1])\n }\n }\n\n /** Gets a value by its index, O(1) time */\n operator fun get(index: Int): T {\n require(index in 0 until size)\n return array[index + size]\n }\n\n /** gets the result of applying the monoid operation to the values in the index range, O(log n) time */\n operator fun get(start: Int, endExclusive: Int): T {\n var l = maxOf(start, 0) + size\n var r = minOf(endExclusive, size) + size\n\n // two accumulators to support non-commutative monoids\n var lAcc = identityValue\n var rAcc = identityValue\n\n while(l < r) {\n if(l and 1 == 1) {\n lAcc = combiner(lAcc, array[l++])\n }\n if(r and 1 == 1) {\n rAcc = combiner(array[--r], rAcc)\n }\n\n l = l shr 1\n r = r shr 1\n }\n\n return combiner(lAcc, rAcc)\n }\n\n operator fun get(range: IntRange) = get(range.first, range.last + 1)\n}\n\n/** Converts a semigroup to a monoid by using null as the identity value. */\ninline fun nullIdentityCombiner(crossinline combiner: (T, T) -> T): (T?, T?) -> T? = { a, b ->\n when {\n a == null -> b\n b == null -> a\n else -> combiner(a, b)\n }\n}\n\nconst val MOD = 998244353\nconst val TOTIENT = MOD - 1 // assumes MOD is prime\n\ninfix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }\ninfix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }\ninfix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()\n\nfun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod\n\nfun Int.powMod(exponent: Int, mod: Int): Int {\n if(exponent < 0) error(\"Inverse not implemented\")\n var res = 1L\n var e = exponent\n var b = umod(mod).toLong()\n\n while(e > 0) {\n if(e and 1 == 1) {\n res = res * b % mod\n }\n e = e shr 1\n b = b * b % mod\n }\n return res.toInt()\n}\n\ninline fun Int.toModInt() = ModInt(this umod MOD)\ninline fun Long.toModInt() = ModInt(this umod MOD)\n\n/** note: Only use constructor for int within modulo range, otherwise use toModInt **/\ninline class ModInt(val int: Int) {\n companion object {\n /** can't seem to make these private or inlined without causing compiler issues */\n @JvmField val _invMemo = HashMap()\n fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }\n }\n\n // normalizes an integer that's within range [-MOD, MOD) without branching\n private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)\n\n operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30\n inline operator fun plus(other: Int) = plus(other.toModInt())\n operator fun inc() = normalize(int + (1 - MOD))\n\n operator fun minus(other: ModInt) = normalize(int - other.int)\n inline operator fun minus(other: Int) = minus(other.toModInt())\n operator fun dec() = normalize(int - 1)\n operator fun unaryMinus() = normalize(-int)\n\n operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())\n inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))\n\n fun pow(exponent: Int): ModInt {\n val e = if(exponent < 0) {\n require(int != 0) { \"Can't invert/divide by 0\" }\n exponent umod TOTIENT\n } else exponent\n return ModInt(int.powMod(e, MOD))\n }\n\n fun pow(exponent: Long) = if(int == 0) when {\n exponent > 0 -> this\n exponent == 0L -> ModInt(1)\n else -> error(\"Can't invert/divide by 0\")\n } else pow(exponent umod TOTIENT)\n\n inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */\n\n fun inv_unmemoized(): ModInt {\n require(int != 0) { \"Can't invert/divide by 0\" }\n return pow(TOTIENT - 1)\n }\n inline fun inv_memoized() = _invMemoized(this)\n\n operator fun div(other: ModInt) = times(other.inverse())\n inline operator fun div(other: Int) = div(other.toModInt())\n\n override inline fun toString() = int.toString()\n}\n\ninline operator fun Int.plus(modInt: ModInt) = modInt + this\ninline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt\ninline operator fun Int.times(modInt: ModInt) = modInt * this\ninline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this\n\ninline class ModIntArray(val intArray: IntArray): Collection {\n inline operator fun get(i: Int) = ModInt(intArray[i])\n inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }\n\n override inline val size: Int get() = intArray.size\n inline val lastIndex get() = intArray.lastIndex\n inline val indices get() = intArray.indices\n\n override inline fun contains(element: ModInt): Boolean = element.int in intArray\n\n override fun containsAll(elements: Collection): Boolean = elements.all(::contains)\n\n override inline fun isEmpty(): Boolean = intArray.isEmpty()\n\n override fun iterator(): Iterator = object: Iterator {\n var index = 0\n override fun hasNext(): Boolean = index < size\n override fun next(): ModInt = get(index++)\n }\n\n fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))\n fun copyOf() = copyOf(size)\n fun copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =\n ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))\n}\ninline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))\ninline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })\n\ninline fun ModIntArray.first() = get(0)\ninline fun ModIntArray.last() = get(lastIndex)\ninline fun ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }\nfun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)\nfun ModIntArray.product() = fold(ModInt(1), ModInt::times)\n\ninline fun Iterable.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Iterable.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }\ninline fun Sequence.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Sequence.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }\nfun Iterable.sum() = sumByModInt { it }\nfun Sequence.sum() = sumByModInt { it }\nfun Iterable.product() = productByModInt { it }\nfun Sequence.product() = productByModInt { it }\nfun Collection.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}\n", "lang": "Kotlin", "bug_code_uid": "a819253bd38e535dace6538596a22908", "src_uid": "37bb4fe5f6cc2a173e97c033c6fde8c7", "apr_id": "d9383771d922d71ee9b5f553f2baa611", "difficulty": 3100, "tags": ["data structures", "probabilities", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.95324494068388, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "//package codeforces.round345\n\nimport java.io.PrintWriter\nimport java.util.*\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = Scanner(inputStream)\n val out = PrintWriter(outputStream)\n solve(`in`, out)\n out.close()\n}\n\nprivate fun solve(scanner: Scanner, out: PrintWriter) {\n var first = scanner.nextInt()\n var second = scanner.nextInt()\n\n var totalTime = 0\n\n while (first > 0 && second > 0) {\n if (first > second) {\n first -= 2\n second++\n } else {\n second -= 2\n first++\n }\n totalTime++\n }\n out.println(totalTime)\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "72c3807ebcdb7e6b70d1d61a67a2c77a", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "apr_id": "3135703900bd083c28d84b833021ff92", "difficulty": 1100, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9706336939721792, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(a: Array)\n{\n var (a,b) = readLine()!!.split(' ').map { it.toInt() }\n var counter = 0\n while (a != 0 && b != 0)\n {\n counter++\n when (a {if (a < 100) ++a ; b-=2}\n else -> {if (b < 100) ++b; a-=2}\n }\n }\n println(counter)\n}\n", "lang": "Kotlin", "bug_code_uid": "d7f97ba729bc88e2a49f7077d8154432", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "apr_id": "ceeb64eef6ab1e85db4eb00a91ace395", "difficulty": 1100, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9976336961665878, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "const val data = \"4 4\"\n\nfun main() {\n val line = readLine() ?: \"1 1\"\n val split = line.split(\" \")\n Game(chargeFirst = split[0].toInt(), chargeSecond = split[1].toInt()).apply {\n while (canPlay) minutePasses()\n println(duration)\n }\n\n}\n\n\nclass Game(chargeFirst: Int, chargeSecond: Int) {\n\n var duration = 0\n\n private val first: Joystick = Joystick(chargeFirst)\n private val second: Joystick = Joystick(chargeSecond)\n\n private val dischargingAmount = -2\n private val chargeAmount = 1\n\n private val chargingFirst get() = first.charge + 1 < second.charge\n\n fun minutePasses() {\n val firstNeedsCharging = chargingFirst\n if ((first.charge != 1 || firstNeedsCharging) && (second.charge != 1 || !firstNeedsCharging)) duration++\n\n first.charge += if (firstNeedsCharging) chargeAmount else dischargingAmount\n second.charge += if (firstNeedsCharging) dischargingAmount else chargeAmount\n }\n\n val canPlay get() = first.charge > 0 && second.charge > 0\n}\n\ndata class Joystick(var charge: Int)", "lang": "Kotlin", "bug_code_uid": "b7da09907aba76f191d56c55056efe2c", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "apr_id": "82c6659b3b34ad33a7c9ffec94cb0489", "difficulty": 1100, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5242136794807788, "equal_cnt": 16, "replace_cnt": 8, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "const val data = \"4 4\"\n\nfun main(args: Array) {\n //val charges = args[0].split(\" \")\n Game(chargeFirst = args[0].toInt(), chargeSecond = args[1].toInt()).apply {\n while (canPlay) minutePasses()\n\n println(duration)\n }\n\n}\n\n\nclass Game(chargeFirst: Int, chargeSecond: Int) {\n\n var duration = 0\n\n private val dischargingAmount = 2\n private val chargeAmount = 1\n private val first: Joystick = Joystick(chargeFirst)\n private val second: Joystick = Joystick(chargeSecond)\n private val chargingFirst get() = first.charge <= 2\n\n fun minutePasses() {\n duration++\n val addFirst = if (chargingFirst) chargeAmount else -dischargingAmount\n val addSecond = if (addFirst == 1) -dischargingAmount else chargeAmount\n\n first.charge += addFirst\n second.charge += addSecond\n }\n\n val canPlay get() = first.charge > 0 && second.charge > 0\n\n}\n\ndata class Joystick(var charge: Int)", "lang": "Kotlin", "bug_code_uid": "395241361a370c77a93d88c619842c1b", "src_uid": "ba0f9f5f0ad4786b9274c829be587961", "apr_id": "82c6659b3b34ad33a7c9ffec94cb0489", "difficulty": 1100, "tags": ["dp", "greedy", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.996386630532972, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nimport java.io.*\n\nval MOD = 998244353L\n\nfun main()\n{\n\tThread(null, Main(), \"whatever\", 1 shl 28).start()\n}\n\nclass Main : Runnable {\n\n\toverride fun run()\n\t{\n\t\tval inputStream = System.`in`\n\t\tval outputStream = System.out\n\t\tval `in` = InputReader(inputStream)\n\t\tval out = PrintWriter(outputStream)\n\t\tval solver = TaskD()\n\t\tvar test = 1\n\t\t//test = `in`.nextInt()\n\t\tfor (t in 1..test)\n\t\t{\n\t\t\tsolver.solve(t, `in`, out)\n\t\t}\n\t\tout.close()\n\t}\n\n\tinternal class TaskD\n\t{\n\t\tfun solve(testNumber: Int, `in`: InputReader, out: PrintWriter) {\n\t\t\tval INF = 4000000000000000000L\n\t\t\tval dx = intArrayOf(-1, 1, 0, 0)\n\t\t\tval dy = intArrayOf(0, 0, -1, 1)\n\n\t\t\tvar n = `in`.nextLong()\n\t\t\tvar m = `in`.nextLong()\n\t\t\tvar L = `in`.nextLong()\n\t\t\tvar R = `in`.nextLong()\n\t\t\tvar len = R-L+1\n\t\t\t\n\t\t\tif (n*m%2 == 1L) return out.println(power(len, n*m, MOD))\n\n\t\t\tvar a = len/2\n\t\t\tvar b = len-a\n\t\t\tif (L%2 == 0L)\n\t\t\t{\n\t\t\t\tvar tmp = a\n\t\t\t\ta = b\n\t\t\t\tb = tmp\n\t\t\t}\n\n\t\t\tfun go(a: Long, b: Long, n: Long): Pair\n\t\t\t{\n\t\t\t\tif (n == 0L) return Pair(1, 0)\n\t\t\t\tvar (c, d) = go(a, b, n/2)\n\t\t\t\tvar (tc, td) = Pair((c*c+d*d)%MOD, (2*c*d)%MOD)\n\t\t\t\tc = tc\n\t\t\t\td = td\n\t\t\t\tif (n%2 == 1L)\n\t\t\t\t{\n\t\t\t\t\tvar (sc, sd) = Pair(a*c+b*d, a*d+b*c)\n\t\t\t\t\tc = sc\n\t\t\t\t\td = sd\n\t\t\t\t}\n\t\t\t\treturn Pair(c, d)\n\t\t\t}\n\n\t\t\tvar (x, y) = go(a, b, n*m)\n\t\t\tout.println(x)\n\t\t}\n \n\t}\n\n\tinternal class InputReader(stream: InputStream) {\n\t\tvar reader: BufferedReader\n\t\tvar tokenizer: StringTokenizer? = null\n\n\t\tinit {\n\t\t\treader = BufferedReader(InputStreamReader(stream), 32768)\n\t\t\ttokenizer = null\n\t\t}\n\n\t\toperator fun next(): String {\n\t\t\twhile (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n\t\t\t\ttry {\n\t\t\t\t\ttokenizer = StringTokenizer(reader.readLine())\n\t\t\t\t} catch (e: IOException) {\n\t\t\t\t\tthrow RuntimeException(e)\n\t\t\t\t}\n\n\t\t\t}\n\t\t\treturn tokenizer!!.nextToken()\n\t\t}\n\n\t\tfun nextInt(): Int {\n\t\t\treturn Integer.parseInt(next())\n\t\t}\n\n\t\tfun nextLong(): Long {\n\t\t return next().toLong()\n\t\t}\n\n\t}\n}\n\nfun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a%b)\n\nfun power(a: Long, b: Long, p: Long): Long\n{\n\tif (b == 0L) return 1L\n\tvar t = power(a, b/2, p)\n\tt = t*t%p\n\tif (b%2 == 1L) t = t*a%p\n\treturn t\n}\n", "lang": "Kotlin", "bug_code_uid": "982f6a2293a083195e1c99944a08de7e", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "apr_id": "b888f50e05d3d61511f2ffb9b9a3405a", "difficulty": 2100, "tags": ["matrices", "math", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9985560460415034, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.Arrays\nimport kotlin.math.*\nimport kotlin.random.Random\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\n\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val n = readInt()\n val m = readInt()\n val nm = n.toLong() * m\n val l = readInt()\n val r = readInt()\n val sz = r-l+1\n\n val ans = run {\n if(nm and 1 == 1L) return@run nm.toModInt() * sz\n\n val fft = ModFFT(1)\n val A = ModIntArray(intArrayOf(sz / 2, (sz + 1) / 2))\n fft.inPlace(A, false)\n\n for (i in A.indices) A[i] = A[i].pow(nm)\n fft.inPlace(A, true)\n\n A[0]\n }\n println(ans)\n}\n\ninline val PRIMITIVE_ROOT get() = ModInt(3) // for 998244353\nclass ModFFT(maxDeg: Int) {\n val n = getArrSize(maxDeg)\n private val ninv = ModInt(n).inv_unmemoized()\n\n fun getArrSize(deg: Int) = Integer.highestOneBit(deg shl 1 or 1)\n // prepares an array of suitable size for inPlace\n fun prepare(arr: ModIntArray, deg: Int) = arr.copyOf(getArrSize(deg))\n\n // w[1] represents n-th root of unity e^(i * tau/n), w[k] = w[1]^k\n val w = PRIMITIVE_ROOT.pow(TOTIENT / n).powArray(n-1)\n\n // rev[i] is reversal of bits in i\n private val rev = IntArray(n).also { rev ->\n var bit = 1\n var rbit = n shr 1\n while(bit < n) {\n for(i in 0 until bit) {\n rev[i or bit] = rbit or rev[i]\n }\n bit = bit shl 1\n rbit = rbit shr 1\n }\n }\n\n operator fun invoke(a: ModIntArray, invert: Boolean): ModIntArray {\n val res = a.copyOf(n)\n inPlace(res, invert)\n return res\n }\n\n // in-place FFT. Precondition: a.size <= n, and a.size is a power of 2\n fun inPlace(a: ModIntArray, invert: Boolean) {\n val sz = a.size\n if(sz <= 1) return\n require(sz <= n && sz and -sz == sz) { \"Array size $sz must be less than $n and a power of 2\" }\n val st = n / sz\n for(i in 0 until sz) {\n val j = rev[i * st]\n if(i < j) a[i] = a[j].also { a[j] = a[i] }\n }\n\n var len = 2\n var ang = n shr 1 // = n / len, representing the angle tau / len\n if(invert) ang = -ang\n while(len <= sz) {\n var i = 0\n while(i < sz) {\n var k = 0\n for(j in i until i+len.shr(1)) {\n val u = a[j]\n val v = a[j+len.shr(1)] * w[k]\n a[j] = u + v\n a[j+len.shr(1)] = u - v\n k = k + ang and n-1\n }\n i += len\n }\n\n len = len shl 1\n ang = ang shr 1\n }\n\n if(invert) {\n val szinv = ninv * st\n for(i in 0 until sz) a[i] *= szinv\n }\n }\n\n fun mul(a: ModIntArray, b: ModIntArray): ModIntArray {\n val deg = a.lastIndex + b.lastIndex\n require(deg < n) { \"FFT capacity $n too small for polynomial of degree $deg\" }\n val a1 = prepare(a, deg)\n val b1 = prepare(b, deg)\n inPlace(a1, false)\n inPlace(b1, false)\n for(i in a1.indices) a1[i] *= b1[i]\n inPlace(a1, true)\n return a1//.copyOf(deg+1)\n }\n}\n\nconst val MOD = 998244353\nconst val TOTIENT = MOD - 1 // assumes MOD is prime\n\ninfix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }\ninfix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }\ninfix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()\n\nfun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod\n\nfun Int.powMod(exponent: Int, mod: Int): Int {\n if(exponent < 0) error(\"Inverse not implemented\")\n var res = 1L\n var e = exponent\n var b = umod(mod).toLong()\n\n while(e > 0) {\n if(e and 1 == 1) {\n res = res * b % mod\n }\n e = e shr 1\n b = b * b % mod\n }\n return res.toInt()\n}\n\ninline fun Int.toModInt() = ModInt(this umod MOD)\ninline fun Long.toModInt() = ModInt(this umod MOD)\n\n/** note: Only use constructor for int within modulo range, otherwise use toModInt **/\ninline class ModInt(val int: Int) {\n companion object {\n /** can't seem to make these private or inlined without causing compiler issues */\n @JvmField val _invMemo = HashMap()\n fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }\n }\n\n // normalizes an integer that's within range [-MOD, MOD) without branching\n private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)\n\n operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30\n inline operator fun plus(other: Int) = plus(other.toModInt())\n operator fun inc() = normalize(int + (1 - MOD))\n\n operator fun minus(other: ModInt) = normalize(int - other.int)\n inline operator fun minus(other: Int) = minus(other.toModInt())\n operator fun dec() = normalize(int - 1)\n operator fun unaryMinus() = normalize(-int)\n\n operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())\n inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))\n\n fun pow(exponent: Int): ModInt {\n val e = if(exponent < 0) {\n require(int != 0) { \"Can't invert/divide by 0\" }\n exponent umod TOTIENT\n } else exponent\n return ModInt(int.powMod(e, MOD))\n }\n\n fun pow(exponent: Long) = if(int == 0) when {\n exponent > 0 -> this\n exponent == 0L -> ModInt(1)\n else -> error(\"Can't invert/divide by 0\")\n } else pow(exponent umod TOTIENT)\n\n inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */\n\n fun inv_unmemoized(): ModInt {\n require(int != 0) { \"Can't invert/divide by 0\" }\n return pow(TOTIENT - 1)\n }\n inline fun inv_memoized() = _invMemoized(this)\n\n operator fun div(other: ModInt) = times(other.inverse())\n inline operator fun div(other: Int) = div(other.toModInt())\n\n override inline fun toString() = int.toString()\n}\n\ninline operator fun Int.plus(modInt: ModInt) = modInt + this\ninline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt\ninline operator fun Int.times(modInt: ModInt) = modInt * this\ninline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this\n\ninline class ModIntArray(val intArray: IntArray): Collection {\n inline operator fun get(i: Int) = ModInt(intArray[i])\n inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }\n\n override inline val size: Int get() = intArray.size\n inline val lastIndex get() = intArray.lastIndex\n inline val indices get() = intArray.indices\n\n override inline fun contains(element: ModInt): Boolean = element.int in intArray\n\n override fun containsAll(elements: Collection): Boolean = elements.all(::contains)\n\n override inline fun isEmpty(): Boolean = intArray.isEmpty()\n\n override fun iterator(): Iterator = object: Iterator {\n var index = 0\n override fun hasNext(): Boolean = index < size\n override fun next(): ModInt = get(index++)\n }\n\n fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))\n fun copyOf() = copyOf(size)\n}\nfun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =\n ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))\ninline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))\ninline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })\n\nfun ModInt.powArray(n: Int): ModIntArray {\n val res = ModIntArray(n+1)\n res[0] = ModInt(1)\n for(i in 1..n) res[i] = res[i-1] * this\n return res\n}\n\ninline fun ModIntArray.first() = get(0)\ninline fun ModIntArray.last() = get(lastIndex)\ninline fun ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }\nfun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)\nfun ModIntArray.product() = fold(ModInt(1), ModInt::times)\n\ninline fun Iterable.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Iterable.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }\ninline fun Sequence.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Sequence.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }\nfun Iterable.sum() = sumByModInt { it }\nfun Sequence.sum() = sumByModInt { it }\nfun Iterable.product() = productByModInt { it }\nfun Sequence.product() = productByModInt { it }\nfun Collection.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }\n\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _ln = \"\"\n@JvmField var _lnPtr = 0\nfun read(): String {\n while (_lnPtr >= _ln.length) {\n _ln = readLine() ?: return \"\"\n _lnPtr = 0\n }\n var j = _ln.indexOf(' ', _lnPtr)\n if(j < 0) j = _ln.length\n val res = _ln.substring(_lnPtr, j)\n _lnPtr = j + 1\n return res\n}\nfun readRem(): String /* reads remainder of current line */ =\n _ln.substring(min(_lnPtr, _ln.length)).also { _lnPtr = _ln.length }\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}", "lang": "Kotlin", "bug_code_uid": "97921a6446ed302042ddd2e8a41cc926", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "apr_id": "7edf7c5190daaea07716ed2d533f65e4", "difficulty": 2100, "tags": ["matrices", "math", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6537717601547389, "equal_cnt": 15, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\ndata class MyLong(val num: Long) {\n operator fun times(x: Long): MyLong =\n MyLong(num * (x % REM) % REM)\n\n operator fun minus(x: MyLong): MyLong =\n MyLong((num - x.num + 2 * REM) % REM)\n\n operator fun plus(x: MyLong): MyLong =\n MyLong((num + x.num) % REM)\n\n override fun toString() = num.toString()\n\n companion object {\n private const val REM = 998244353L\n }\n}\n\nval Int.X get() = MyLong(toLong())\n\nfun solve(input: LongArray): MyLong {\n val (n, m, l, r) = input\n if (l == r)\n return 1.X\n var result: MyLong = 1.X\n for (i in 1..n * m)\n result *= (r - l + 1)\n\n return if ((n * m) % 2 == 1L)\n result\n else\n result * 499122177L\n}\n\nfun main() {\n val reader = FastReader()\n println(solve(reader.nextLongArr(4)))\n}\n\n@Suppress(\"MemberVisibilityCanBePrivate\")\ninternal class FastReader {\n private val br = BufferedReader(InputStreamReader(System.`in`))\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n var t = tokenizer\n while (t == null || !t.hasMoreElements())\n t = StringTokenizer(br.readLine())\n tokenizer = t\n return t.nextToken()\n }\n\n fun nextInt() = next().toInt()\n\n fun nextLong(): Long = next().toLong()\n\n fun nextDouble(): Double = next().toDouble()\n\n fun nextLine(): String = br.readLine()\n\n fun nextIntArr(n: Int): IntArray = IntArray(n) { nextInt() }\n\n fun nextDoubleArr(n: Int): DoubleArray = DoubleArray(n) { nextDouble() }\n\n fun nextLongArr(n: Int): LongArray = LongArray(n) { nextLong() }\n\n fun nextIntArr2(n: Int, m: Int): Array = Array(n) { IntArray(m) { nextInt() } }\n\n fun nextLongArr2(n: Int, m: Int): Array = Array(n) { LongArray(m) { nextLong() } }\n}", "lang": "Kotlin", "bug_code_uid": "f90900ec10222d1c3e17fbaefd97b6e7", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "apr_id": "8d52e60e320cfeb07f6c0b52186453b9", "difficulty": 2100, "tags": ["matrices", "math", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8312366484690245, "equal_cnt": 17, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 8, "fix_ops_cnt": 17, "bug_source_code": "package c1332.e\n\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nconst val ACTUAL = 998244353L\n\ndata class MyLong(val num: Long) {\n operator fun times(x: Long): MyLong =\n MyLong(num * (x % REM) % REM)\n\n operator fun minus(x: MyLong): MyLong =\n MyLong((num - x.num + 2 * REM) % REM)\n\n operator fun plus(x: MyLong): MyLong =\n MyLong((num + x.num) % REM)\n\n override fun toString() = num.toString()\n\n companion object {\n private const val REM = 2 * ACTUAL\n }\n}\n\nval Int.X get() = MyLong(toLong())\n\nfun solve(input: LongArray): Long {\n val (n, m, l, r) = input\n if (l == r)\n return 1L\n var result: MyLong = 1.X\n for (i in 1..n * m)\n result *= (r - l + 1)\n\n return if ((n * m) % 2 == 1L)\n result.num % ACTUAL\n else\n (result.num / 2 + (r-l+1)%2) % ACTUAL\n}\n\nfun main() {\n val reader = FastReader()\n println(solve(reader.nextLongArr(4)))\n}\n\n@Suppress(\"MemberVisibilityCanBePrivate\")\ninternal class FastReader {\n private val br = BufferedReader(InputStreamReader(System.`in`))\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n var t = tokenizer\n while (t == null || !t.hasMoreElements())\n t = StringTokenizer(br.readLine())\n tokenizer = t\n return t.nextToken()\n }\n\n fun nextInt() = next().toInt()\n\n fun nextLong(): Long = next().toLong()\n\n fun nextDouble(): Double = next().toDouble()\n\n fun nextLine(): String = br.readLine()\n\n fun nextIntArr(n: Int): IntArray = IntArray(n) { nextInt() }\n\n fun nextDoubleArr(n: Int): DoubleArray = DoubleArray(n) { nextDouble() }\n\n fun nextLongArr(n: Int): LongArray = LongArray(n) { nextLong() }\n\n fun nextIntArr2(n: Int, m: Int): Array = Array(n) { IntArray(m) { nextInt() } }\n\n fun nextLongArr2(n: Int, m: Int): Array = Array(n) { LongArray(m) { nextLong() } }\n}", "lang": "Kotlin", "bug_code_uid": "968e5cb36349f4b4a2e675d15dda56b2", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "apr_id": "8d52e60e320cfeb07f6c0b52186453b9", "difficulty": 2100, "tags": ["matrices", "math", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.827257564927329, "equal_cnt": 16, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 16, "bug_source_code": "\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nconst val ACTUAL = 998244353L\n\ndata class MyLong(val num: Long) {\n operator fun times(x: Long): MyLong =\n MyLong(num * (x % REM) % REM)\n\n operator fun minus(x: MyLong): MyLong =\n MyLong((num - x.num + 2 * REM) % REM)\n\n operator fun plus(x: MyLong): MyLong =\n MyLong((num + x.num) % REM)\n\n override fun toString() = num.toString()\n\n companion object {\n private const val REM = 2 * ACTUAL\n }\n}\n\nval Int.X get() = MyLong(toLong())\n\nfun solve(input: LongArray): Long {\n val (n, m, l, r) = input\n if (l == r)\n return 1L\n var result: MyLong = 1.X\n for (i in 1..n * m)\n result *= (r - l + 1)\n\n return if ((n * m) % 2 == 1L)\n result.num % ACTUAL\n else\n (result.num / 2 + (r-l+1)%2) % ACTUAL\n}\n\nfun main() {\n val reader = FastReader()\n println(solve(reader.nextLongArr(4)))\n}\n\n@Suppress(\"MemberVisibilityCanBePrivate\")\ninternal class FastReader {\n private val br = BufferedReader(InputStreamReader(System.`in`))\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n var t = tokenizer\n while (t == null || !t.hasMoreElements())\n t = StringTokenizer(br.readLine())\n tokenizer = t\n return t.nextToken()\n }\n\n fun nextInt() = next().toInt()\n\n fun nextLong(): Long = next().toLong()\n\n fun nextDouble(): Double = next().toDouble()\n\n fun nextLine(): String = br.readLine()\n\n fun nextIntArr(n: Int): IntArray = IntArray(n) { nextInt() }\n\n fun nextDoubleArr(n: Int): DoubleArray = DoubleArray(n) { nextDouble() }\n\n fun nextLongArr(n: Int): LongArray = LongArray(n) { nextLong() }\n\n fun nextIntArr2(n: Int, m: Int): Array = Array(n) { IntArray(m) { nextInt() } }\n\n fun nextLongArr2(n: Int, m: Int): Array = Array(n) { LongArray(m) { nextLong() } }\n}", "lang": "Kotlin", "bug_code_uid": "8c5fa5699a87bafe727e6ba621bc622a", "src_uid": "ded299fa1cd010822c60f2389a3ba1a3", "apr_id": "8d52e60e320cfeb07f6c0b52186453b9", "difficulty": 2100, "tags": ["matrices", "math", "combinatorics", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6874512860483243, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "import kotlin.math.abs\n\nfun main(args: Array) {\n readLine()\n val ar = readLine()!!.split(\" \").map { it.toInt() }\n\n val start = ar.indexOf(ar.max())\n\n var firstRound = 0\n for (i in 0 until ar.size) {\n firstRound += abs(start - i) * ar[i] //\u0434\u043e\u0435\u0445\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u0430\u0436 i \u0441 \u044d\u0442\u0430\u0436\u0430 \u0445 a[i] \u0440\u0430\u0437\n firstRound += abs(i) * ar[i] //\u0434\u043e\u0435\u0445\u0430\u0442\u044c \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u0436 a[i] \u0440\u0430\u0437\n firstRound += start * ar[i] //\u0434\u043e\u0435\u0445\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u0430\u0436 \u0445 a[i] \u0440\u0430\u0437\n\n firstRound += start * ar[i] //\u0434\u043e\u0435\u0445\u0430\u0442\u044c \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u0442\u0430\u0436 \u0441 \u044d\u0442\u0430\u0436\u0430 \u0445 a[i] \u0440\u0430\u0437\n firstRound += i * ar[i] //\u0434\u043e\u0435\u0445\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u0430\u0436 i \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u0442\u0430\u0436\u0430 a[i] \u0440\u0430\u0437\n firstRound += abs(start-i) * ar[i] //\u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u0430\u0436 \u0445 \u0441 \u044d\u0442\u0430\u0436\u0430 i a[i] \u0440\u0430\u0437\n }\n println(firstRound)\n\n\n}", "lang": "Kotlin", "bug_code_uid": "f7f8a4f048cfb9f1e9088ef27f1d84f7", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "apr_id": "c1783d137513968549c997a9aa026e51", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9900383141762452, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.File\nimport java.lang.Math.abs\nimport kotlin.system.measureTimeMillis\n\nfun solve(input: BufferedReader) {\n val n = input.readLine().toInt()\n val a = input.readLine().split(\" \").map {it.toInt()}\n var res = Int.MAX_VALUE\n for (x in 1..n) {\n var sum = 0\n for (i in 1..n)\n sum += a[i - 1] * (abs(x - i) + abs(i - 1) + abs(1 - x))\n res = minOf(res, sum)\n }\n println(2 * res)\n}\n\nfun main(args: Array) {\n println(\"time = ${measureTimeMillis {\n solve(System.`in`.bufferedReader())\n// solve(File(\"a.out\").`bufferedReader())\n }}\")\n}\n", "lang": "Kotlin", "bug_code_uid": "feaac86fd2dc74c7244f0dd5dc627ac6", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "apr_id": "00453b8f7a67df1e83e4d4b83f709e6c", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.998062015503876, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package Round526\n\nimport java.io.*\nimport java.util.*\nimport java.lang.Math.*\nimport java.lang.StringBuilder\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val pw = PrintWriter(System.out)\n val n = sc.nextInt()\n val a = LongArray(n) { sc.nextLong() }\n var min = Long.MAX_VALUE\n for (x in 1..n) {\n var sum = 0L\n for (i in 0 until n)\n sum += a[i] * (abs((i + 1) - x) + (i) + (x - 1)) * 2\n min = min(min, sum)\n }\n pw.print(min)\n pw.close()\n}", "lang": "Kotlin", "bug_code_uid": "d257ad9bbeee1dac13cb2e771292a860", "src_uid": "a5002ddf9e792cb4b4685e630f1e1b8f", "apr_id": "fd36613d430cd6758d55ec48ee239631", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9970501474926253, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.*\n\nfun main() {\n var w: Int\n var h: Int\n\n with(Scanner(System.`in`)) {\n w = nextInt()\n h = nextInt()\n }\n\n var count = 0\n\n for (i in w / 2 downTo 1 step 1) {\n for (j in h / 2 downTo 1 step 1) {\n count += (w - i * 2 + 1) * (h - j * 2 +1)\n }\n }\n print(count)\n}", "lang": "Kotlin", "bug_code_uid": "3decfcb51fe688d736ae856b8c814f97", "src_uid": "42454dcf7d073bf12030367eb094eb8c", "apr_id": "b8934be1fab925883060ed0d75ebcb8d", "difficulty": 1300, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9959514170040485, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n var w = IntArray(3)\n var h = IntArray(3)\n val s = Scanner(System.`in`)\n for(i in 0..2){\n w[i]=s.nextInt()\n h[i]=s.nextInt()\n }\n for(i in h[0] downTo 0 step 1){\n w[0]+=i\n if(i==h[1])\n {\n w[0]-=w[1]\n }\n else if(i==h[2])\n {\n w[0]-=w[2]\n }\n// if(w[0]<0)\n// w[0]=0\n //println(w[0])\n }\n if(w[0]<0)\n w[0]=0\n println(w[0])\n}\n\n", "lang": "Kotlin", "bug_code_uid": "e3e1e043155e5698ab91ab976b7d3e40", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "74abb4f37e20e3b9b115119455caaadf", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9591240875912409, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n var ballWeight = scanner.nextInt()\n val ballHeight = scanner.nextInt()\n\n val stoneOneWeight = scanner.nextInt()\n val stoneOneHeight = scanner.nextInt()\n val stoneTwoWeight = scanner.nextInt()\n val stoneTwoHeight = scanner.nextInt()\n\n for (currentHeight in ballHeight downTo 1) {\n ballWeight += currentHeight\n\n if (stoneOneHeight == currentHeight) {\n ballWeight -= stoneOneWeight\n }\n if (stoneTwoHeight == currentHeight) {\n ballWeight -= stoneTwoWeight\n }\n }\n\n print (ballWeight)\n}", "lang": "Kotlin", "bug_code_uid": "66ed9d17fe1c58b449131276620409c0", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "6299df5c78173f691d885919a5ea63f5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9397321428571429, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\nfun main(args: Array) {var reader = Scanner(System.`in`)\n var w:Int = reader.nextInt()\n var h:Int = reader.nextInt()\n var w1:Int = reader.nextInt()\n var h1:Int = reader.nextInt()\n var w2:Int = reader.nextInt()\n var h2:Int = reader.nextInt()\n while (h!=0)\n {\n w+=h\n if (h==h1)\n w-=w1\n else if (h==h2)\n w-=w2\n h--\n }\n println(w)\n}", "lang": "Kotlin", "bug_code_uid": "6a5408b7c37278a1a02281cb3c663905", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "31e46536b0a0834463ecfa055a1ebdf7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9496402877697842, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "//package com.happypeople.codeforces.c1099\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\n\nfun main(args: Array) {\n try {\n A().run()\n } catch (e: Throwable) {\n A.log(\"\" + e)\n }\n}\n\nclass A {\n fun run() {\n val sc = Scanner(systemIn())\n var w=sc.nextInt()\n var h=sc.nextInt()\n val u1=sc.nextInt()\n val d1=sc.nextInt()\n val u2=sc.nextInt()\n val d2=sc.nextInt()\n\n while(h>0) {\n w+=h\n if(h==d1)\n w-=u1\n if(h==d2)\n w-=u2\n h--\n }\n if(w<0)\n w=0\n println(\"$w\")\n }\n\n companion object {\n var inputStr: String? = null\n\n fun systemIn(): InputStream {\n if (inputStr != null)\n return ByteArrayInputStream(inputStr!!.toByteArray())\n else\n return System.`in`\n }\n\n var printLog = false\n fun log(str: String) {\n if (printLog)\n println(str)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "e0d638ff1bec69da1ac6e7ca5314b19c", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "903de60721348695b87d1a005cb7b369", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5754527162977867, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n solve()\n}\n\nprivate fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\n\nprivate fun solve() {\n var (w, h) = read().map(String::toInt)\n var (u1, d1) = read().map(String::toInt)\n var (u2, d2) = read().map(String::toInt)\n\n w += h\n for (x in 0 until h) {\n w += x\n if (x == d2) {\n w -= u2\n }\n\n if (x == d1) {\n w -= u1\n }\n\n if (w < 0) {\n w = 0\n }\n }\n println(w)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "d0a9fbd0d8e086bdbdd9cb382e4addc1", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "10323ab9fd689dd8d76aabffe0ea60eb", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7391003460207612, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 10, "bug_source_code": "package `codeforces-parser`.`1099-kotlin`.A\n\nvar _debug = false;\nfun debug(vararg vals: T): Unit {\n\tif (!_debug) {\n\t\treturn\n\t}\n\tfor (v in vals) {\n\t\tSystem.err.print(v); System.err.print(\" \")\n\t}\n\tSystem.err.println()\n}\n\nfun main(args: Array) {\n\tif (args.size > 0 && args[0] == \"-d\") {\n\t\t_debug = true;\n\t}\n\n\tval (w, h) = readLine()!!.split(' ').map(String::toLong)\n\tval (u1, d1) = readLine()!!.split(' ').map(String::toLong)\n\tval (u2, d2) = readLine()!!.split(' ').map(String::toLong)\n\n\tval sum = w + (h * (h + 1) / 2)\n\tval result = Math.max(sum - u1 - u2, 0)\n\n\tprintln(result)\n}\n", "lang": "Kotlin", "bug_code_uid": "7e93d715476a1f6224fe569eb3359698", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "1550c54ccb7bf8b017177b5db2ef252f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7408431237042156, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "//package `codeforces-parser`.`1099-kotlin`.A\n\nvar _debug = false;\nfun debug(vararg vals: T): Unit {\n\tif (!_debug) {\n\t\treturn\n\t}\n\tfor (v in vals) {\n\t\tSystem.err.print(v); System.err.print(\" \")\n\t}\n\tSystem.err.println()\n}\n\nfun main(args: Array) {\n\tif (args.size > 0 && args[0] == \"-d\") {\n\t\t_debug = true;\n\t}\n\n\tval (w, h) = readLine()!!.split(' ').map(String::toLong)\n\tval (u1, d1) = readLine()!!.split(' ').map(String::toLong)\n\tval (u2, d2) = readLine()!!.split(' ').map(String::toLong)\n\n\tval sum = w + (h * (h + 1) / 2)\n\tval result = Math.max(sum - u1 - u2, 0)\n\n\tprintln(result)\n}\n", "lang": "Kotlin", "bug_code_uid": "1b99544d88c2f761fb3eb28e6d9188fc", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "1550c54ccb7bf8b017177b5db2ef252f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9976133651551312, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.Math.abs\nimport java.lang.Math.max\n\n\nfun printList(list: List ) {\n for(i in list){\n print(\"$i \")\n }\n print(\"\\n\")\n}\nfun main(args: Array) {\n var (w, h) = readLine()!!.split(' ').map(String::toInt)\n val (u1, d1) = readLine()!!.split(' ').map(String::toInt)\n val (u2, d2) = readLine()!!.split(' ').map(String::toInt)\n for(i in h downTo -1){\n w += i\n if(i == d1){\n w -= u1\n w = max(0,w)\n continue\n }\n if(i == d2){\n w -= u2\n w = max(0, w)\n continue\n }\n }\n print(w)\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "8b05c6b3019f3dc5b8ba24445bde06b7", "src_uid": "084a12eb3a708b43b880734f3ee51374", "apr_id": "6b3aaf337daa75fa7ddc7ad6fbab222c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9990338164251208, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n var scan = Scanner(System.`in`)\n var n = scan.nextInt()\n var d = scan.nextInt()\n var songs: MutableList = mutableListOf()\n for (i in 1..n) {\n songs.add(scan.nextInt())\n }\n var total = (songs.size - 1) * 10\n for (song in songs) {\n total += song\n }\n var totaljokes = (songs.size - 1) * 2\n if (total >= d) {\n println(-1)\n } else {\n totaljokes += (d-total)/5\n println(totaljokes)\n }\n}", "lang": "Kotlin", "bug_code_uid": "c54ca027f7d6439a37778d4031192009", "src_uid": "b16f5f5c4eeed2a3700506003e8ea8ea", "apr_id": "0733a46ceae6f8d9932f3276d665dfc0", "difficulty": 900, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.3471971066907776, "equal_cnt": 16, "replace_cnt": 12, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 15, "bug_source_code": "fun main(){\nvar n=readLine()!!.toInt()\n var a = readLine()!!.split(' ').map(String::toInt)\nvar c=0\nvar d=0\nfor(i in 0..n-1){\nif(a[i]>c) c=a[i]\nd+=a[i]\n}\nvar e=d*n\nvar f=e-d\nwhile(f<=d){\nf+=n\nc++\n}\nprintln(c)\n}", "lang": "Kotlin", "bug_code_uid": "51efea43e7bef1b758f02fed89ce4ed6", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "apr_id": "b7d815bc19aa602de94a4b97fdd71d22", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8754208754208754, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n\n var max = 0\n\n var enemyPoints = 0\n for (i in 0.until(n)) {\n val vote = readLine()!!.toInt()\n enemyPoints += vote\n max = maxOf(vote, max)\n }\n\n\n var allPossiblePoints = max * n\n\n var myPoints = allPossiblePoints - enemyPoints\n\n while (myPoints < enemyPoints) {\n myPoints += n\n max++\n }\n\n\n println(max)\n}", "lang": "Kotlin", "bug_code_uid": "c953ed7198359f025c0a0116a4f03ded", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "apr_id": "82a932dc6c197a714292b623a491f03e", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.998914223669924, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n\n var max = 0\n\n var enemyPoints = 0\n val splitted = readLine()!!.split(\" \")\n for (i in splitted) {\n val vote = i.toInt()\n enemyPoints += vote\n max = maxOf(vote, max)\n }\n\n\n var allPossiblePoints = max * n\n\n var myPoints = allPossiblePoints - enemyPoints\n\n while (myPoints < enemyPoints) {\n myPoints += n\n max++\n }\n\n\n println(max)\n}", "lang": "Kotlin", "bug_code_uid": "3929ce1748d7d570f8eb538adb82546f", "src_uid": "d215b3541d6d728ad01b166aae64faa2", "apr_id": "82a932dc6c197a714292b623a491f03e", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8708133971291866, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 10, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val (k, n, w) = r.readLine()!!.split(\" \").map { it.toLong() }\n println(if ((1 + w) * w / 2 * k - n > 0) (1 + w) * w / 2 * k - n > 0 else 0)\n}", "lang": "Kotlin", "bug_code_uid": "5a1c5ff3e3179d4aa9b301f3a64b7db9", "src_uid": "e87d9798107734a885fd8263e1431347", "apr_id": "3d9ff8bf0a8d0c55fa9551f8140769ce", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8746666666666667, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n var sum = 0\n val (k, n, w) = readLine()!!.split(\" \").map { it.toInt() }\n\n for (i in 1..w) {\n sum += (k * i)\n }\n print(sum - n)\n}", "lang": "Kotlin", "bug_code_uid": "24d566f0fa5e9f71bd131fcc2a8bf467", "src_uid": "e87d9798107734a885fd8263e1431347", "apr_id": "cd3e51ac68d082e0905bda2c2f09be97", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8695652173913043, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n\n val knw = readLine()!!.split(\" \").map { it.toInt() }\n val money = knw.first() * knw.last() - knw[1]\n print(if (money > 0) money else 0)\n}", "lang": "Kotlin", "bug_code_uid": "62c78f37daa1916cf56718b097de69df", "src_uid": "e87d9798107734a885fd8263e1431347", "apr_id": "be7557f2c66a2dd0961569055d5966a6", "difficulty": 800, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9767441860465116, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args : Array) {\n val n = readLine()!!\n val len = n.length\n var i = 0\n var start = false\n while (i <= (len-1)) {\n if (n.substring(i, i + 3) == \"WUB\") {\n i += 3\n if (start)\n print(' ')\n } else {\n print(n[i])\n start = true\n i++\n }\n\n }\n}", "lang": "Kotlin", "bug_code_uid": "b08fe80cad2977d0fbfc422cd3356289", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "a8bdf55a83180a49077d1e6b3ebef9c1", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.33879781420765026, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val s = br.readLine()\n val n = s.length\n val wub = Stack()\n var ans = emptyList()\n var i = 0\n\n while (i < n){\n val c = s[i]\n if (c == 'W' && wub.isEmpty()){\n wub.push(c)\n ans += ' '\n } else if(c == 'U' && wub.isNotEmpty() && wub.peek() == 'W'){\n wub.push(c)\n } else if (c == 'B' && wub.isNotEmpty() && wub.peek() == 'U'){\n wub.push(c)\n wub.clear()\n } else{\n ans += wub + c\n wub.clear()\n }\n i++\n }\n\n println(ans.joinToString(\"\").trim())\n}", "lang": "Kotlin", "bug_code_uid": "1ead243abac55fc8b99532e993491bb7", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "b16e3cf520e0193d96fff25d0d93be8e", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8261964735516373, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.lang.StringBuilder\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val s = br.readLine()\n var i = 0\n var j = 2\n val ans = StringBuilder()\n while (j < s.length) {\n if (s.substring(i..j) == \"WUB\"){\n ans.append(\" \")\n i = j + 1\n j += 3\n } else {\n ans.append(s[i])\n i++\n j++\n }\n }\n println(ans.trim())\n}", "lang": "Kotlin", "bug_code_uid": "db215c1d22727d4e1f75fad9694c338d", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "b16e3cf520e0193d96fff25d0d93be8e", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7652173913043478, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(){\n val str= readLine()!!.split(\"WUB\")\n for(s in str){\n if(s!=\"\"){\n if(s==str[str.size-1])\n print(s)\n else\n print(\"$s \")\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "bfc41714bc46dae3bd0848d06c26be28", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "3986ff6a4934242a1eb9b7e6fcb81dea", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.39451114922813035, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n var str = readLine()!!\n var ans = str.replace(\"WUB\", \" \").trim()\n println(ans)\n var flag = false\n for (i in ans){\n if (i!=' '){\n print(i)\n flag = true\n }else if (flag){\n print(\" \")\n flag = false\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "d40b9eb22b5c1693eda25d96ad3ecda6", "src_uid": "edede580da1395fe459a480f6a0a548d", "apr_id": "bc46cf7579fdf137daafeb4006b8c3bc", "difficulty": 900, "tags": ["strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9978021978021978, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (n, k) = readLine()!!.split(\" \").map(String::toLong)\n if (k == 1L) print(n) else {\n var result = Long.MAX_VALUE\n while (result shr 1 > n) result = result shr 1\n print(result)\n }\n}", "lang": "Kotlin", "bug_code_uid": "1dfb970112e3644708ee33da72b7a4a9", "src_uid": "16bc089f5ef6b68bebe8eda6ead2eab9", "apr_id": "5cd66d9d1a793a37a7ed780cee28c5d3", "difficulty": 1300, "tags": ["bitmasks", "constructive algorithms", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9769004619907602, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.lang.AssertionError\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nfun testBipartite(N: Int, g: Array, D: IntArray): Boolean {\n for (u in 0 until N) {\n for (v in 0 until N) {\n if (!g[u][v]) continue\n if (D[v] % 2 == D[u] % 2) {\n return false\n }\n }\n }\n\n return true\n}\n/**\n * (dist, parent, queue)\n * @param rt \u30eb\u30fc\u30c8\u30ce\u30fc\u30c9\u3092\u6307\u5b9a\u3059\u308b\u3002null\u306e\u5834\u5408\u306f\u5168\u30ce\u30fc\u30c9\u8fbf\u308b\u307e\u3067\u7e70\u308a\u8fd4\u3059\n */\nfun traceBfs(g: Array): Array? {\n val n = g.size\n val q = IntArray(n)\n val d = IntArray(n)\n val p = IntArray(n){-2}\n var h = 0\n var t = 0\n\n fun bfs(rt: Int) {\n p[rt] = -1\n q[t++] = rt\n d[rt] = 0\n while (h < t) {\n val u = q[h++]\n for (v in 0 until n) {\n if (!g[u][v]) continue\n if (p[v] == -2) {\n p[v] = u\n q[t++] = v\n d[v] = d[u] + 1\n }\n }\n }\n }\n\n var traced = false\n for (u in 0 until n) {\n if (g[u].all{!it}) continue\n if (p[u] != -2) continue\n if (traced) return null\n bfs(u)\n traced = true\n }\n return arrayOf(d, p, q)\n}\nfun packUGraph(n: Int, from: IntArray, to: IntArray): Array {\n val p = IntArray(n)\n val m = from.size\n for (i in 0 until m) {\n ++p[from[i]]\n ++p[to[i]]\n }\n val g = Array(n){IntArray(p[it])}\n for (i in 0 until m) {\n g[from[i]][--p[from[i]]] = to[i]\n g[to[i]][--p[to[i]]] = from[i]\n }\n return g\n}\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n\n private val N = ni()\n private val M = ni()\n fun solve() {\n if (!solve2()) {\n out.println(\"No\")\n }\n }\n\n fun solve2(): Boolean {\n val g = Array(N){BooleanArray(N){true} }\n for (i in 0 until N) {\n g[i][i] = false\n }\n\n for (i in 0 until M) {\n val u = ni() - 1\n val v = ni() - 1\n g[u][v] = false\n g[v][u] = false\n }\n\n if (isDebug) {\n for (i in 0 until N) {\n debug(g[i])\n }\n }\n\n val (dist, _, _) = traceBfs(g) ?: return false\n if (!testBipartite(N, g, dist)) {\n return false\n }\n\n val ans = CharArray(N)\n for (i in 0 until N) {\n if (g[i].count{it} == 0) {\n ans[i] = 'b'\n } else {\n ans[i] = if (dist[i] % 2 == 0) 'a' else 'c'\n }\n }\n\n out.println(\"Yes\")\n out.println(ans.joinToString(\"\"))\n return true\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private inline fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private inline fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private inline fun debug(a: BooleanArray) {\n debug { toString(a) }\n }\n\n private inline fun toString(a: BooleanArray) = run{a.map { if (it) 1 else 0 }.joinToString(\"\")}\n\n private inline fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n private inline fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n\n private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "725567a553b0dac2134f0e516865e95c", "src_uid": "e71640f715f353e49745eac5f72e682a", "apr_id": "0a0dafafd52384a7ef274a0b08277325", "difficulty": 1800, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5390557939914163, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "fun getMaximumLength(aStrCount: Long, bStrCount: Long, abStrCount: Long): Long {\n\n if (aStrCount == bStrCount) {\n return aStrCount + bStrCount + (abStrCount * 2)\n }\n\n return if (aStrCount > bStrCount) {\n val restOfA = aStrCount - bStrCount\n\n if (restOfA < abStrCount) {\n (aStrCount - bStrCount) + bStrCount + (abStrCount * 2) + (abStrCount - restOfA)\n } else {\n (aStrCount - bStrCount) + bStrCount + (abStrCount * 2) + (restOfA - abStrCount)\n }\n } else {\n\n (aStrCount * 2) + 1 + (abStrCount * 2)\n }\n}\n\nfun main() {\n\n val (aStr, bStr, abStr) = readLine()!!.split(' ').map { it.toLong() }\n\n println(getMaximumLength(aStr, bStr, abStr))\n\n}", "lang": "Kotlin", "bug_code_uid": "c7326fd74e811d50ca1f492a2bb85f40", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "578277ee0e21605d2736152f3ddeb7be", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9893617021276596, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list ofu strings\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of ints\n\nfun main(args:Array){\n val (a,b,c) = readInts()\n var d = 2*c + minOf(a,b) * 2\n if (a!=b) d++\n println(d)\n}", "lang": "Kotlin", "bug_code_uid": "135765258cfd52848c58dbf32c188ed6", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "1334313bd4d84189d15dd6e631ddff6c", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8919540229885058, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n\n\tvar (a,b,c) = readLine()!!.split(' ').map { it.toInt() }\n\tvar answer = 0\n\tif(abs(a-b)>=1) answer += 1\n\tanswer += (c*2 + min(a,b)*2)\n\n\tprintln(answer.toUInt())\n}", "lang": "Kotlin", "bug_code_uid": "e03bd635767a660b1ba296051e361853", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "9a1d37a93dc4e133385cc9ddea362a67", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8584686774941995, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.lang.Math.abs\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nfun main() {\n val (a,b,c) = readInts()\n return println(c*2+(a+b-(if (abs(a-b) > 1) abs(a-b)-1 else 0)))\n}", "lang": "Kotlin", "bug_code_uid": "4cf403c3e20a22cf23a0bac604ef46ed", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "e88cb4fbd9f7199345c49ba571c579ce", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9178082191780822, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (a, b, c) = readLine()!!.split(\" \").map { it.toLong() }\n println(2*min(a, b) + 2*c + (if (a != b) 1 else 0))\n}", "lang": "Kotlin", "bug_code_uid": "18987154a50dd604d5d3b58c8348cf85", "src_uid": "609f131325c13213aedcf8d55fc3ed77", "apr_id": "1461bb2a3206d553d02f94effaa0a4b8", "difficulty": 800, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5504798464491363, "equal_cnt": 29, "replace_cnt": 22, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 28, "bug_source_code": "import java.util.*\nimport kotlin.test.assertTrue\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\n\nprivate fun solve() {\n var recipe = readLn()\n var (nb, ns, nc) = readInts()\n var (pb, ps, pc) = readInts()\n var r = readLong()\n\n var needB = false\n var needS = false\n var needC = false\n var cost = 0;\n for (c in recipe) {\n if (c == 'B') {\n needB = true\n cost += pb\n } else if (c == 'S') {\n needS = true\n cost += ps\n } else {\n needC = true\n cost += pc\n }\n }\n\n if (needB) {\n r += nb * pb\n }\n if (needS) {\n r += ns * ps\n }\n if (needC) {\n r += nc * pc\n }\n\n val ans = r / cost\n println(ans)\n}\n\nfun main() {\n var t = 1;\n // t = readInt();\n for (i in 1..t) {\n solve();\n }\n}", "lang": "Kotlin", "bug_code_uid": "dbc74a4d29df3d87aa1509b225424f63", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "apr_id": "a3e59caff7f4c7e6424c621d62d6db1f", "difficulty": 1600, "tags": ["brute force", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5568932038834952, "equal_cnt": 28, "replace_cnt": 22, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 27, "bug_source_code": "import java.util.*\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\n\nprivate fun solve() {\n var recipe = readLn()\n var (nb, ns, nc) = readInts()\n var (pb, ps, pc) = readInts()\n var r = readLong()\n\n var needB = false\n var needS = false\n var needC = false\n var cost = 0;\n for (c in recipe) {\n if (c == 'B') {\n needB = true\n cost += pb\n } else if (c == 'S') {\n needS = true\n cost += ps\n } else {\n needC = true\n cost += pc\n }\n }\n\n if (needB) {\n r += nb * pb\n }\n if (needS) {\n r += ns * ps\n }\n if (needC) {\n r += nc * pc\n }\n\n val ans = r / cost\n println(ans)\n}\n\nfun main() {\n var t = 1;\n // t = readInt();\n for (i in 1..t) {\n solve();\n }\n}", "lang": "Kotlin", "bug_code_uid": "8c4fbae99a3edeafe8af7f7488b8c314", "src_uid": "8126a4232188ae7de8e5a7aedea1a97e", "apr_id": "a3e59caff7f4c7e6424c621d62d6db1f", "difficulty": 1600, "tags": ["brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5825545171339563, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "// codeforces problem 112 A\n\nfun main() {\n val word = readLine()!!\n val last = word.substring(1, word.length)\n\n println(if (last.equals(last.toUpperCase())) {\n word.substring(0, 1).toUpperCase() + last.toLowerCase()\n } else {\n word\n })\n}\n", "lang": "Kotlin", "bug_code_uid": "e18f0d7bd042027e74af13d4431b59a4", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "60885f8f92b488e63260d63c14445379", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9943181818181818, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//package problem131A\n\nfun switchCase(word: String): String {\n if (word.length == 1) {\n if (word[0].isUpperCase()) {\n return word.toLowerCase()\n }\n return word.toUpperCase()\n }\n\n if (word.all { it.isUpperCase() }) {\n return word.toLowerCase()\n } else if (word.substring(1).all{ it.isLowerCase() }) {\n return \"${word[0].toUpperCase()}${word.substring(1).toLowerCase()}\"\n }\n return word\n}\n\nfun main() {\n val input = readLine()!!\n\n println(switchCase(input))\n}\n", "lang": "Kotlin", "bug_code_uid": "9da661a2c405d8f8323c90b0f43847fc", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "741a816c85b435dd7da2df6ef5d869b6", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.45982142857142855, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.lang.reflect.Array\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\n\nfun main() {\n var scanner = Scanner(System.`in`)\n var str = scanner.next()\n var result = str.toLowerCase().capitalize()\n println(result)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "c5b57b67132b3eaca484240c2343a23d", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "6e52670c17230946b2db12361cc02ccb", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.23308270676691728, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n println(readLine()!!.toLowerCase().capitalize())\n}\n\n", "lang": "Kotlin", "bug_code_uid": "9c90d5f665d5ebf28e3ba093331fe9f7", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "5e1e7b00c089163717ee7f1dea689042", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9652084050981743, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val (n, k) = readLine()!!.split(' ').map { it.toInt() }\n val s = readLine()!!\n val set = mutableSetOf().apply { add(s) }\n var prevList = listOf(s)\n var sum = 0\n outer@for (t in 1..n) {\n val prevprevset = mutableListOf()\n for(sub in prevList.asSequence().flatMap { it.subs() }) {\n// print(\"$sub \")\n if (set.add(sub)) {\n sum += t\n prevprevset.add(sub)\n// println(\"added del: $t sum:$sum -> ${set.size}:$set\")\n if (set.size == k ) break@outer\n } else {\n// println()\n }\n }\n prevList = prevprevset\n// println()\n }\n\n if (set.size == k) {\n println(sum)\n } else {\n println(-1)\n }\n\n// \"abcdefg\".subs(1).forEach { println(it) }\n}\n\nfun String.subs() = object : Sequence {\n override fun iterator() = object : Iterator {\n var index = -1\n var str: String = this@subs\n var zis = StringBuilder(this@subs)\n init {\n nextIndices()\n }\n\n override fun next() = str.also { nextIndices() }\n\n override fun hasNext() = index != this@subs.length\n\n private fun nextIndices() {\n index++\n if (index != this@subs.length) {\n str = this@subs.removeRange(index, index + 1)\n }\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "e29689e796992aef3a429b4b5f2e7d43", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "apr_id": "c812f742e724ac456ad0ac60f4e748ae", "difficulty": 2000, "tags": ["graphs", "dp", "implementation", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5590479096734818, "equal_cnt": 12, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "fun main() {\n val (n, k) = readInts()\n\n val s = readLn()\n\n val S = mutableSetOf()\n\n var cost = 0\n\n for(c in 0..n) {\n val l = n - c\n for(sub in s.asIterable().combinations(l).map { it.joinToString(\"\") }) {\n if(S.add(sub)) {\n cost += c\n if(S.size == k) {\n println(cost)\n return\n }\n }\n }\n }\n\n println(-1)\n\n}\n\nfun Iterable.combinations(length: Int): Sequence> =\n sequence {\n if(length == 0) {\n yield(emptyList())\n return@sequence\n }\n val pool = toList()\n val n = pool.size\n if(length > n) return@sequence\n val indices = (0 until length).toMutableList()\n while(true) {\n yield(indices.map { pool[it] })\n var i = length - 1\n while(indices[i] == i + n - length) {\n i--\n if(i == -1) return@sequence\n }\n indices[i]++\n for(j in i+1 until length) indices[j] = indices[j - 1] + 1\n }\n }\n\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readLongs() = readStrings().map { it.toLong() }\n\n// helper for competitive programming; faster at printing many lines than repeated println calls\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n fun println() { sb.append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit)\n{ Output().apply(block).nowPrint() }", "lang": "Kotlin", "bug_code_uid": "645ffa7d933eacd56b6acb2c44170838", "src_uid": "ae5d21919ecac431ea7507cb1b6dc72b", "apr_id": "b306b251a4f979b9efb784f1cb57dc02", "difficulty": 2000, "tags": ["graphs", "dp", "implementation", "shortest paths"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.979047619047619, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package A\n\nimport java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val k = sc.nextInt()\n val t = sc.nextInt()\n\n val min = Math.max(1, t - k + 1)\n val max = Math.min(n, t)\n\n println(max - min + 1)\n}", "lang": "Kotlin", "bug_code_uid": "4655042ec45fcec3b7411d12adb1c15a", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "apr_id": "5ad1b63d491e05f3f978a43532c6a84f", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8904428904428905, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n var (n, k, t) = readLine()!!.split(\" \").map { it.toInt() }\n when (t) {\n in 1 until k -> print(t)\n in k..n -> print(k)\n else -> print(k - (t % k))\n }\n}", "lang": "Kotlin", "bug_code_uid": "25254647f2b188451ebbd8b8342f2bfd", "src_uid": "7e614526109a2052bfe7934381e7f6c2", "apr_id": "7c3ca0b2940f41f213e1db2461121197", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5787671232876712, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.roundToInt\n\nfun main(args: Array) {\n val n = readLine()!!.toDouble()\n val m = readLine()!!.toDouble()\n val a = readLine()!!.toDouble()\n \n println((m/a).roundToInt() * (((n - a) / a).roundToInt() + 1))\n}", "lang": "Kotlin", "bug_code_uid": "4326a20f9ee5113cc8111150d8338d97", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "d1b9ce8b39af459f0100c3f98211fd89", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7899159663865546, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import kotlin.math.roundToInt\n\nfun main(args: Array) {\n val line = readLine()!!.split(\" \").map(String::toInt)\n\n val n = line[0]\n val m = line[1]\n val a = line[2]\n \n println((m/a).roundToInt() * (((n - a) / a).roundToInt() + 1))\n}", "lang": "Kotlin", "bug_code_uid": "3cb2032802c5f888af1f9f0654e7cd52", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "d1b9ce8b39af459f0100c3f98211fd89", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6486111111111111, "equal_cnt": 15, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 15, "bug_source_code": "package codeforces\n\n/**\n * Created by vashzhong on 2017/5/26.\n */\n\nfun solve(n: Long, m: Long, a: Long) : String{\n return (Math.ceil(n.toDouble() / a) * Math.ceil(m.toDouble() / a)).toInt().toString()\n}\n\nfun main(args: Array) {\n var readLine = readLine()\n while (readLine != null) {\n val input = readLine.split(' ')\n if (input.size >= 3) {\n val n = input[0].toLong()\n val m = input[1].toLong()\n val a = input[2].toLong()\n val result = solve(n, m, a)\n println(result)\n }\n readLine = readLine()\n }\n}", "lang": "Kotlin", "bug_code_uid": "0778df8726bf46ee2e552cf03f630dbc", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "3484b3b07a3b2f40b85495503fd2c3b4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9920364050056882, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.PrintWriter\nimport java.util.*\n\nval sc = Scanner(System.`in`)\nval pw = PrintWriter(System.out)\n\ntailrec fun check(a: List, i: Int = 2): Boolean =\n when {\n i >= a.size -> true\n a[i] >= a[i - 1] + a[i - 2] -> false\n else -> check(a, i + 1)\n }\n\nfun swap(list: List, ind1: Int, ind2: Int): List {\n val newList = list as MutableList\n val tmp = list[ind1]\n newList[ind1] = list[ind2]\n newList[ind2] = tmp\n return newList\n}\n\nfun sort(a: List): List {\n if (a.size <= 1) return a\n val x = a.first()\n val (left, right) = a.filter { it < x } to a.filter { it > x }\n return sort(left) + listOf(x) + sort(right)\n}\n\nfun divUp(a: Int, b: Int) = (a + b - 1) / b;\nfun main() {\n val n = sc.nextLong()\n val m = sc.nextLong()\n val a = sc.nextLong()\n println(divUp(n, a) * divUp(m, a))\n}\n", "lang": "Kotlin", "bug_code_uid": "f0df353caa0c7b5892e4f51d4f78c53c", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "3a66b0ac1ebcecd1f53ba514b9687e58", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4365904365904366, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(){\n \n val a = readLine()!!.toLong()\n val b = readLine()!!.toLong()\n val c = readLine()!!.toLong()\n\n\n\n val res = Math.ceil(a/c.toDouble()).toLong()* Math.ceil(b/c.toDouble()).toLong()\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "eed372cb7f77a09fb148e8802576c9c6", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "fc4a79c7466aa0efd6f80e3579c3be73", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6297273526824978, "equal_cnt": 17, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "class programkt {\n companion object {\n @JvmStatic fun main(args: Array) {\n System.out.println(\"args:\"+args.toList().toString());\n\n val width = args[0].toInt()\n\n val height = args[1].toInt()\n\n val size = args[2].toInt()\n\n\n val a = Math.ceil(height.toDouble()/size.toDouble())\n\n val b = Math.ceil(width.toDouble()/size.toDouble())\n\n System.out.println((a*b).toInt());\n\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "861dca83cecfdb57216ed3a7378e4acb", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "b4828bf404445d63d2fd3fb13a39b111", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6171529619805481, "equal_cnt": 18, "replace_cnt": 14, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "class Main {\n companion object {\n @JvmStatic fun main(args: Array) {\n System.out.println(\"args:\"+args.toList().toString());\n\n val width = args[0].toInt()\n\n val height = args[1].toInt()\n\n val size = args[2].toInt()\n\n\n val a = Math.ceil(height.toDouble()/size.toDouble())\n\n val b = Math.ceil(width.toDouble()/size.toDouble())\n\n System.out.println((a*b).toInt());\n\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "e2aa5042c80790c4a092519bbf1185c3", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "b4828bf404445d63d2fd3fb13a39b111", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.49224806201550386, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val input = readLine()!!.split(\" \").map(String::toInt)\n var n = input[0]\n val m = input[1]\n var count = n\n while (n > 0) {\n n /= m\n count += n\n }\n println(count)\n}", "lang": "Kotlin", "bug_code_uid": "e6ddb0215e54d63ba716a5b71c520083", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "apr_id": "bb2da407e5e0d7e00ece4dcd67bcf7a9", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.47401247401247404, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\n\nfun main() {\n var (a, b) = readLine()!!.split(' ').map { it.toInt() }\n var count = a+(a/b)\n if (count%b==0)count++\n\n println(count)\n\n\n}\n", "lang": "Kotlin", "bug_code_uid": "c9169a961a560749e178f90bb964b3f1", "src_uid": "42b25b7335ec01794fbb1d4086aa9dd0", "apr_id": "9f4dacac306d7eeedd89b2e7419d1803", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7850467289719626, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val list = r.readLine()!!.split(\" \").map { it.toInt() }\n //repeat(r.readLine()!!.toInt()) {\n val str = r.readLine()!!\n val len = str.length\n val b = IntArray(len) { if (str[it] == '4') 0 else 1 }\n var ans = 0\n for (i in 0..len-2){\n when(b[i]){\n 0 -> ans+=1+IntArray(len - 1) { 1 }.joinToString(\"\").toInt(2)\n 1 -> ans+=2*(1+IntArray(len - 1) { 1 }.joinToString(\"\").toInt(2))\n }\n }\n ans += if (b.last()==0) 1 else 2\n println(ans)\n //}\n}", "lang": "Kotlin", "bug_code_uid": "9f00f7d922ba3034166658421e4838e6", "src_uid": "6a10bfe8b3da9c11167e136b3c6fb2a3", "apr_id": "18f032e442a3538396b48686bb0b16eb", "difficulty": 1100, "tags": ["bitmasks", "brute force", "combinatorics", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9991304347826087, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "val M = 1000000007L\nval N = 100005\nvar fact = LongArray(N)\nvar ifact = LongArray(N)\nvar t = 0\n\n\nfun main(args : Array) {\n val (n, m, g) = readLine().toString().split(' ').map { it.toInt() }\n t = g\n init()\n\n // case when there are no ones\n if (m == 0) {\n val res = if (ok(n)) 1 else 0\n println(res)\n return\n }\n\n var ans = 0L\n // number of zeroes before first one position\n for (i in 0..n) {\n var k = ok(i + 1)\n if (m == 1 && i == n) k = ok(i)\n if (!k) continue\n ans = (ans + C(n - i + m - 1, m - 1)) % M\n }\n println(ans)\n}\n\nfun init() {\n fact[0] = 1L\n ifact[0] = 1L\n for (i in 1..(N - 1)) {\n fact[i] = (fact[i - 1] * i) % M\n ifact[i] = binpow(fact[i], M - 2)\n }\n}\n\nfun binpow(n : Long, deg : Long) : Long {\n if (deg == 0L) return 1L\n return if (deg % 2L == 1L) {\n n * binpow(n, deg - 1) % M\n } else {\n val b = binpow(n, deg / 2L)\n b * b % M\n }\n}\n\nfun C(n : Int, k : Int) : Long {\n return if (n < k) 0\n else fact[n] * ifact[k] % M * ifact[n - k] % M\n}\n\nfun ok(zeroes : Int) = (1 - zeroes % 2 == t)", "lang": "Kotlin", "bug_code_uid": "9c485307c7d53d193994c7d84c642075", "src_uid": "066dd9e6091238edf2912a6af4d29e7f", "apr_id": "0e6ad891e8fc6b3c3b2e70d451da571f", "difficulty": 2100, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7673267326732673, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun fastPow(a: Long, b: Long): Long {\n if (b==0L)\n return 1\n\n if (b==1L)\n return a\n\n if (b%2==0L)\n return fastPow((a*a)%1000000007, b/2)\n\n return a*fastPow(a, b-1)%1000000007\n}\n\nfun main() {\n val (n, m) = readLine()!!.split(\" \").map { it.toLong() }\n\n var res = 1L\n for (i in 1..n) {\n res = (res*(fastPow(2, m)-1))%1000000007\n }\n\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "4f404ae7931c09d48b44f92ed18e1d80", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "4624ccad5c58f67c9236e4f4b703230c", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8285280728376327, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import java.math.BigInteger\n\nfun main() {\n val (numKinds, numFriends) = readLine()!!.split(\" \").map(String::toInt)\n print(BigInteger.valueOf(2L).pow(numFriends)\n .minus(BigInteger.ONE)\n .modPow(BigInteger.valueOf(numKinds.toLong()), BigInteger.valueOf(1000000007L)))\n}", "lang": "Kotlin", "bug_code_uid": "a31af4c084b831b1b6bd7d7264321cb2", "src_uid": "71029e5bf085b0f5f39d1835eb801891", "apr_id": "183fd93dd1d605c72febed1e3937a83d", "difficulty": 1500, "tags": ["math", "combinatorics"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9938650306748467, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val input = readLine()!!.toInt()\n val listOfBills = listOf(100, 20, 10, 5, 1)\n println(getBills(input, listOfBills, 0))\n}\n\nfun getBills(sum: Int, list: List, indexOfBill: Int): Int {\n val currentBill = list[indexOfBill]\n val amount = sum / currentBill\n val newIndex = indexOfBill + 1\n if (amount <= 0 && newIndex < list.size) {\n return getBills(sum, list, newIndex)\n }\n val newSum = sum % (amount * currentBill)\n if (newSum == 0) return amount\n return 1 + getBills(newSum, list, newIndex)\n}", "lang": "Kotlin", "bug_code_uid": "e65d496e8f1758809ab4418048f10066", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "01d8c28c38ba1d35bd435c1a9d93482a", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9502196193265008, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package greedy\n\n// https://codeforces.com/problemset/problem/996/A\n\nfun bills(n: Int) : Int {\n var remainder = n\n var bills = 0\n while (remainder > 0) {\n if (remainder >= 100) {\n remainder -= 100\n bills++\n } else if (remainder >= 20) {\n remainder -= 20\n bills++\n } else if (remainder >= 10) {\n remainder -= 10\n bills++\n } else if (remainder >= 5) {\n remainder -= 5\n bills++\n } else if (remainder >= 1) {\n remainder -= 1\n bills++\n }\n }\n return bills\n}\n\nfun main(args: Array) {\n val amount = readLine()!!.toInt()\n println(bills(amount))\n}", "lang": "Kotlin", "bug_code_uid": "548b697d794fe4963edb764652ba874e", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "1ae55c771d15bcf6487fd5755530142f", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9871539136679167, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\n\nprivate fun solve() {\n var n = readInt()\n var money = listOf(100, 20, 10, 5, 1);\n var k = 0;\n while (n > 0) {\n for (x in money) {\n if (n % x == 0) {\n n /= x;\n break;\n }\n }\n k++;\n }\n\n out.print(k)\n}\n\nprivate fun readLn() = nextLine() // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n\nprivate var br: BufferedReader? = null\n\n@Throws(IOException::class)\nprivate fun nextLine(): String {\n return br!!.readLine()\n}\n\n@Throws(IOException::class)\nfun main() {\n var input = System.`in`\n var output = System.out\n try {\n val f = File(\"input.txt\")\n if (f.exists() && f.canRead()) {\n input = FileInputStream(f)\n output = PrintStream(\"output.txt\")\n }\n } catch (ignored: Throwable) {\n }\n br = BufferedReader(InputStreamReader(input))\n out = PrintWriter(PrintWriter(output))\n solve()\n br!!.close()\n out.close()\n}\n\nclass Node constructor(var key: Int) {\n var prior: Int = 0\n var cnt: Int = 0\n var pushing: Boolean = false\n var left: Node? = null\n var right: Node? = null\n\n init {\n this.prior = rnd.nextInt()\n right = null\n left = right\n this.cnt = 1\n this.pushing = false\n }\n}\n\nprivate var out: PrintWriter = PrintWriter(System.out);\n\nprivate val rnd = Random()\n\nfun getCnt(t: Node?): Int {\n return t?.cnt ?: 0\n}\n\nfun update(t: Node?) {\n if (t != null) {\n t.cnt = 1 + getCnt(t.left) + getCnt(t.right)\n }\n}\n\nfun push(t: Node?) {\n if (t != null && t.pushing) {\n\n t.pushing = false\n }\n}\n\nfun pushAll(t: Node?) {\n if (t != null) {\n push(t)\n if (t.left != null) {\n pushAll(t.left)\n }\n if (t.right != null) {\n pushAll(t.right)\n }\n }\n}\n\n// [0,K),[K,N)\nfun split(t: Node?, key: Int): Pair {\n if (t == null) return Pair(null, null)\n push(t)\n if (key > t.key) {\n val p = split(t.right, key)\n t.right = p.first\n update(t)\n return Pair(t, p.second)\n } else {\n val p = split(t.left, key)\n t.left = p.second\n update(t)\n return Pair(p.first, t)\n }\n}\n\n//SPLIT \u041f\u041e \u041d\u0415\u042f\u0412\u041d\u041e\u041c\u0423 \u041a\u041b\u042e\u0427\u0423\n// [0,K),[K,N)\nfun split(t: Node?, key: Int, add: Int = 0): Pair {\n if (t == null) return Pair(null, null);\n push(t)\n val curKey = add + getCnt(t.left)\n if (key > curKey) { //\u0438\u0434\u0435\u043c \u0432 \u043f\u0440\u0430\u0432\u043e\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u043e\n val p = split(t.right, key, curKey + 1)\n t.right = p.first\n update(t)\n return Pair(t, p.second)\n } else { //\u0438\u0434\u0435\u043c \u0432 \u043b\u0435\u0432\u043e\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u043e\n val p = split(t.left, key, add)\n t.left = p.second\n update(t)\n return Pair(p.first, t)\n }\n}\n\n//\u0412\u0441\u0435 \u043a\u043b\u044e\u0447\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0434\u0435\u0440\u0435\u0432\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c\nfun merge(t1: Node?, t2: Node?): Node? {\n push(t1)\n push(t2)\n if (t1 == null) return t2\n if (t2 == null) return t1\n if (t1.prior > t2.prior) {\n t1.right = merge(t1.right, t2)\n update(t1)\n return t1\n } else {\n t2.left = merge(t1, t2.left)\n update(t2)\n return t2\n }\n}\n\nfun insert(t: Node?, newNode: Node): Node? {\n var t = t\n push(t)\n if (t == null) {\n t = newNode\n } else {\n val p = split(t, newNode.key, 0)\n t = merge(p.first, newNode)\n t = merge(t, p.second)\n }\n update(t)\n return t\n}\n\n//\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 2 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u0430\nfun unite(t1: Node?, t2: Node?): Node? {\n var t1 = t1\n var t2 = t2\n if (t1 == null) return t2\n if (t2 == null) return t1\n push(t1)\n push(t2)\n if (t1.prior < t2.prior) {\n val c = t1\n t1 = t2\n t2 = c\n }\n val split1 = split(t2, t1.key)\n t1.left = unite(t1.left, split1.first)\n t1.right = unite(t1.right, split1.second)\n return t1\n}\n\nfun remove(t: Node?, key: Int): Node? {\n var t: Node? = t ?: return null\n if (t!!.key == key) {\n t = merge(t.left, t.right)\n } else {\n if (key < t.key) {\n t.left = remove(t.left, key)\n } else {\n t.right = remove(t.right, key)\n }\n }\n update(t)\n return t\n}\n\nfun find(t: Node?, key: Int): Node? {\n push(t)\n if (t == null) return null\n if (t.key == key) return t\n return if (t.key < key) {\n find(t.right, key)\n } else {\n find(t.left, key)\n }\n}\n\nfun get(t: Node?, key: Int, add: Int = 0): Node? {\n push(t)\n if (t == null) return null\n val curKey = add + getCnt(t.left)\n if (curKey == key) return t\n return if (key > curKey) { //\u0438\u0434\u0435\u043c \u0432 \u043f\u0440\u0430\u0432\u043e\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0435\u0432\u043e\n get(t.right, key, curKey + 1)\n } else {\n get(t.left, key, add)\n }\n}\n\n/**\n * \u0412\u044b\u0440\u0435\u0437\u0430\u0435\u0442 \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u043e\u0442 i \u0434\u043e j \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u043f\u043e\u0437\u0438\u0446\u0438\u044e k \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430\n * (\u043f\u0440\u0438 k = 0 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043d\u0430\u0447\u0430\u043b\u043e)\n *\n * @param t \u041a\u043e\u0440\u0435\u043d\u044c \u0434\u0435\u0440\u0435\u0432\u0430\n * @param i \u041d\u0430\u0447\u0430\u043b\u043e \u043e\u0442\u0440\u0435\u0437\u043a\u0430 (\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e)\n * @param j \u041a\u043e\u043d\u0435\u0446 \u043e\u0442\u0440\u0435\u0437\u043a\u0430 (\u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e)\n * @param k \u041f\u043e\u0437\u0438\u0446\u0438\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438\n * @return \u041d\u043e\u0432\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e\n */\nfun replaceSegment(t: Node, i: Int, j: Int, k: Int): Node? {\n //\u0412\u044b\u0440\u0435\u0437\u0430\u0435\u043c \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u0438 \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0435\u043c\n val split1 = split(t, i, 0)\n val split2 = split(split1.second, j - i + 1, 0)\n val merge1 = merge(split1.first, split2.second)\n val removedSegment = split2.first\n\n // out.println(\"Array without removed:\" + getString(merge1));\n // out.println(\"Removed Segment:\" + getString(removedSegment));\n\n //\u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\n val split3 = split(merge1, k, 0)\n val merge2 = merge(split3.first, removedSegment)\n\n return merge(merge2, split3.second)\n}\n\nfun getKeysString(t: Node?): StringBuilder {\n if (t == null) return StringBuilder()\n val ans = StringBuilder()\n if (t.left != null) ans.append(getKeysString(t.left))\n ans.append(t.key)\n ans.append(\" \")\n if (t.right != null) ans.append(getKeysString(t.right))\n return ans\n}\n\n", "lang": "Kotlin", "bug_code_uid": "b78b76e6e8de307494ed877255843310", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "a521b6bc44562bd3bc83189d4a55b9fa", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9650507328072153, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var n = readInt()\n var ans = 0\n\n ans += n / 100\n n %= 100\n\n ans += n / 20\n n %= 20\n\n ans += n / 5\n n %= 5\n\n ans += n\n\n println(ans)\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "7b868c2d604b6eaac92b2c4ccb005d48", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "3c05290e6297e3cab1e118a0702213d3", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9652777777777778, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "/**\n * Problem Link: https://codeforces.com/problemset/problem/996/A\n * Difficulty: 600\n */\n\nfun main(args: Array) {\n var n = readLine()!!.toInt()\n var notes = 0\n for (i in setOf(100, 50, 20, 10, 5, 1)) {\n notes += n/i\n n -= i*(n/i)\n }\n println(notes)\n}", "lang": "Kotlin", "bug_code_uid": "9ce5334904ab90a7c6d5e7d28feb4653", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "266dbd5e2228f3930aa5e7e795463e6e", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9950124688279302, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nval sum = listOf(1, 5, 10, 20, 50, 100)\nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n var n = inp.nextInt()\n var c = 0\n while (n != 0) {\n c++\n n -= getMaxItem(n)\n }\n print(c)\n}\n\nprivate fun getMaxItem(n: Int): Int {\n var c = 1\n for (i in 0..sum.size - 1) {\n if (sum[i] > n) break\n c = sum[i]\n }\n return c\n}", "lang": "Kotlin", "bug_code_uid": "eaeb87681ced82783b72581454fd9c38", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "5e4b9156751ea3335dfa2fe0a6510dd6", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9849187935034803, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nvar minCoin : Long = Long.MAX_VALUE;\nfun main()\n{\n val read = Scanner(System.`in`)\n var n = read.nextLong();\n\n var denominations = arrayOf(100 , 20 ,10 ,5, 1)\n\n var sum : Long = 0\n for(i in 0 until denominations.size - 1)\n {\n if(n < denominations[i])\n continue;\n var remainder = n%denominations[i];\n sum += (n/denominations[i]);\n n = remainder;\n\n }\n\n //cal(denominations , n , 0 , 0L)\n print(sum)\n}\n\nfun cal( denomination : Array , n : Long , index : Int , steps : Long )\n{\n if(n < 0L)\n return;\n if(n == 0L)\n {\n minCoin = Math.min(minCoin , steps)\n return;\n }\n\n if(index >= denomination.size)\n return;\n cal(denomination , n - denomination[index] , index , steps + 1)\n cal(denomination , n , index + 1, steps)\n\n\n}", "lang": "Kotlin", "bug_code_uid": "1ff24e2a8ce8bd98fd9823283be30777", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "7fd760e32a7f1e18440cf626b1e0dcd5", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9724238026124818, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package problem996\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n println(numOfPapers(n))\n}\n\nfun numOfPapers(n: Int): Int {\n var papers = 0\n var remain = n\n val nominals = intArrayOf(100, 20, 10, 5 , 1)\n for (nominal in nominals) {\n papers += remain / nominal\n remain %= nominal\n }\n return papers\n}\n", "lang": "Kotlin", "bug_code_uid": "931cca5011aaeb796359e3f2824c3353", "src_uid": "8e81ad7110552c20297f08ad3e5f8ddc", "apr_id": "49070700065e76bbb3a7d7bd56463b0a", "difficulty": 800, "tags": ["dp", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9819456617002629, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.Math.*\nimport java.util.*\n\n/**\n * Created by Administrator on 9/2/2019.\n */\n\n// for (i in 1..n) {}\n// for (i in 5 downTo 1)\n// for (i in 1..5 step 2)\n// println(n)\n// println(\"${ansList.size} $ans\")\n// val freq = mutableMapOf()\n// var places = mutableListOf()\n// class Place(val x: Int, val b: Int)\n// teams.sortWith(compareBy({it.size}));\n// val pq = PriorityQueue(Comparator{a1, a2 -> a2.money - a1.money})\n// var dp = Array(402, {IntArray(402)})\n// var adj = MutableList>(402) {_ -> mutableListOf()}\n// println(Arrays.toString(array))\n// println(Arrays.deepToString(array))\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of Longs\n\nvar dp = Array(402, {IntArray(402)})\nvar adj = MutableList>>(402) {_ -> mutableListOf()}\nvar dpAns = MutableList>>(402) {_ -> MutableList>(402){_ -> mutableListOf()}}\nvar size = IntArray(402){0}\n\nfun DP(at: Int, par: Int) {\n size[at] = 1\n dp[at] = IntArray(402) {-1}\n dp[at][1] = 0\n for (V in adj[at]) {\n val v = V.first\n if (par == v) continue\n DP(v, at)\n dp[v][0] = 1\n dpAns[v][0].add(V.second)\n var newDp = IntArray(402) {-1}\n var prev = IntArray(402) {-1}\n for (i in 1..size[at]) {\n for (j in 0..size[v]) {\n if (dp[at][i] == -1 || dp[v][j] == -1) continue\n val cur = dp[at][i] + dp[v][j]\n if (newDp[i + j] == -1 || newDp[i + j] > cur) {\n prev[i + j] = i\n newDp[i + j] = cur\n }\n }\n }\n dp[at] = newDp\n var newDpAns = MutableList>(402) {_ -> mutableListOf()}\n for (i in 0..size[at]+size[v]) {\n if (prev[i] != -1) {\n newDpAns[i].addAll(dpAns[at][prev[i]])\n newDpAns[i].addAll(dpAns[v][i - prev[i]])\n }\n }\n dpAns[at] = newDpAns\n size[at] += size[v]\n }\n}\n\nfun main(args: Array) {\n val (n, k) = readInts()\n for (i in 1..n-1) {\n val (u, v) = readInts()\n adj[u].add(Pair(v, i))\n adj[v].add(Pair(u, i))\n }\n DP(1, 0)\n var best = -1\n var bestAns = MutableList(402) {-1}\n for (i in 1..n) {\n if (dp[i][k] == -1) continue\n if (best == -1 || best > dp[i][k]) {\n best = dp[i][k]\n bestAns = dpAns[i][k]\n }\n }\n println(best)\n for (i in bestAns) print(\"$i \")\n}", "lang": "Kotlin", "bug_code_uid": "cf42efc534a92200e7fe1e44017c13c2", "src_uid": "56168b28f9ab4830b3d3c5eeb7fc0d3c", "apr_id": "6fa6aaeb70d2827930389b862c9a26f1", "difficulty": 2200, "tags": ["trees", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9664666431344864, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "fun readLn(): String = readLine()!!\nfun readInt(): Int = readLn().toInt()\nfun readInts(): MutableList = readLn().split(\" \").map { it.toInt() }.toMutableList()\n\ntypealias Vertex = Int\ntypealias Index = Int\ntypealias Vertices = Int\ndata class Edge(val index: Index, val dst: Vertex)\ntypealias Graph = MutableMap>\ntypealias Solution = List\ntypealias Results = MutableMap\ntypealias ResultsMap = MutableMap\n\nval visited = mutableMapOf()\nval graph: Graph = mutableMapOf()\nval results: ResultsMap = mutableMapOf()\n// val fatherEdge = mutableMapOf()\n\nfun applyIfBetter(next: Results, newVertices: Vertices, newConflicts: Solution) {\n if (newVertices !in next) {\n next[newVertices] = newConflicts\n } else {\n val oldConflictsSize = next[newVertices]!!.size\n if (oldConflictsSize > newConflicts.size) {\n next[newVertices] = newConflicts\n }\n }\n}\n\nfun dfs(u: Int) {\n visited[u] = true\n val children = graph[u]!!.filterNot { visited[it.dst]!! }\n children.forEach { dfs(it.dst) }\n val res: Results = mutableMapOf()\n res[1] = children.map { it.index }\n children.forEach { child ->\n // fatherEdge[child]\n val next: Results = mutableMapOf()\n val childResults = results[child.dst]!!\n for ((vertices, conflicts) in res.entries) {\n for ((childVertices, childConflicts) in childResults.entries) {\n val newVertices = vertices + childVertices\n val newConflicts = childConflicts + conflicts - child.index\n // println(\"$u $newVertices $newConflicts\")\n applyIfBetter(next, newVertices, newConflicts)\n }\n }\n for ((nextVertices, nextConflicts) in next.entries) {\n applyIfBetter(res, nextVertices, nextConflicts)\n }\n // println(next)\n }\n results[u] = res\n}\n\nfun solve(n: Int, k: Int): Solution {\n val root = 1\n dfs(root)\n // println(results)\n var best: Solution? = null\n for (res in listOf(results[root]!!)) {\n if (k in res) {\n val potentialBest = res[k]!!\n if (best == null || best!!.size > potentialBest.size) {\n best = potentialBest\n }\n }\n }\n return best ?: listOf()\n}\n\nfun main(args: Array) {\n val (n, k) = readInts()\n (1..n).forEach {\n graph[it] = mutableListOf()\n visited[it] = false\n }\n for (index in 1 until n) {\n val (u, v) = readInts()\n graph.getValue(u).add(Edge(index, v))\n graph.getValue(v).add(Edge(index, u))\n }\n val solution = solve(n, k)\n println(\"${solution.size}\")\n println(solution.joinToString(\" \"))\n}\n\n", "lang": "Kotlin", "bug_code_uid": "0a175f0d2180cc9c1059a2963103c5db", "src_uid": "56168b28f9ab4830b3d3c5eeb7fc0d3c", "apr_id": "32397b914374f1e91f511f3bb4cbca3c", "difficulty": 2200, "tags": ["trees", "dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9059656218402427, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 14, "bug_source_code": "import java.io.PrintWriter\nimport java.util.Collections.copy\nimport java.util.Collections.min\nimport kotlin.math.min\n\nval pw = PrintWriter(System.out)\nfun main(args: Array) {\n var (n,t) = listOfInt()\n var g = MutableList(n){ mutableListOf()}\n var ind=mutableMapOf,Int>()\n var es = mutableListOf>()\n repeat(n-1){\n var (x,y) = listOfInt()\n --x; --y;\n ind[Pair(x,y)]=it\n ind[Pair(y,x)]=it\n es.add(Pair(x,y))\n g[x].add(it)\n g[y].add(it)\n }\n var re=MutableList(n){-1}\n var dp = MutableList(n){ MutableList(t+1){re.toMutableList()}}\n var sz= MutableList(n){1}\n fun dfs(v:Int, p:Int) {\n dp[v][0]=mutableListOf()\n dp[v][1]= mutableListOf()\n g[v].forEach { ww ->\n if(ww==p) return@forEach\n var w=es[ww].first+es[ww].second-v\n dfs(w,ww)\n sz[v]+=sz[w]\n for(i in min(sz[v],t) downTo 1){\n for(j in 0 until min(sz[w]+1,i)){\n if(j==0 || dp[v][i-j].size+dp[w][j].size=n) continue;\n dp[v][i]=dp[v][i-j].toMutableList()\n dp[v][i].addAll(dp[w][j])\n }\n }\n }\n }\n if(dp[v][t].size+(if(p<0) 0 else 1)=0) re.add(p)\n }\n if(p>=0) dp[v][0].add(p)\n }\n dfs(0,-1)\n println(re.size)\n println(re.map{x -> x+1}.joinToString (\" \"))\n pw.flush()\n}\n\nfun next() = readLine()!!\nfun nextInt() = next().toInt()\nfun nextLong() = next().toLong()\nfun nextDouble() = next().toDouble()\nfun listOfString() = next().split(\" \")\nfun listOfInt() = listOfString().map { it.toInt() }\nfun listOfLong() = listOfString().map { it.toLong() }\nfun listOfDouble() = listOfString().map { it.toDouble() }\n", "lang": "Kotlin", "bug_code_uid": "afc9b6854f0194e3afee08050fe6bba0", "src_uid": "56168b28f9ab4830b3d3c5eeb7fc0d3c", "apr_id": "fa89fdeb97a8fd720a05ba5bfa2768ab", "difficulty": 2200, "tags": ["trees", "dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8894179894179894, "equal_cnt": 31, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 18, "fix_ops_cnt": 30, "bug_source_code": "import java.io.PrintWriter\nimport java.util.Collections.copy\nimport java.util.Collections.min\n\nval pw = PrintWriter(System.out)\nfun main(args: Array) {\n var (n,t) = listOfInt()\n var g = MutableList(n){ mutableListOf()}\n var ind=mutableMapOf,Int>()\n repeat(n-1){\n var (x,y) = listOfInt()\n --x; --y;\n ind[Pair(x,y)]=it\n ind[Pair(y,x)]=it\n g[x].add(y)\n g[y].add(x)\n }\n var re=MutableList(n){Pair(-1,-1)}\n var dp = MutableList(n){ MutableList(t+1){re.toMutableList()}}\n var sz=mutableListOf(n){1}\n fun dfs(v:Int, p:Int) {\n dp[v][0]=mutableListOf()\n dp[v][1]= mutableListOf()\n g[v].forEach { w ->\n if(w==p) return@forEach\n dfs(w,v)\n sz[v]+=sz[w]\n for(i in min(sz[v],t) downTo 1){\n for(j in 0 until min(sz[w]+1,i)){\n if(j==0 || dp[v][i-j].size+dp[w][j].size=0) re.add(Pair(p,v))\n }\n if(p>=0) dp[v][0].add(Pair(v,p))\n }\n dfs(0,-1)\n println(re.size)\n println(re.map{p -> ind.getValue(p)+1}.joinToString (\" \"))\n pw.flush()\n}\n\nfun next() = readLine()!!\nfun nextInt() = next().toInt()\nfun nextLong() = next().toLong()\nfun nextDouble() = next().toDouble()\nfun listOfString() = next().split(\" \")\nfun listOfInt() = listOfString().map { it.toInt() }\nfun listOfLong() = listOfString().map { it.toLong() }\nfun listOfDouble() = listOfString().map { it.toDouble() }\n", "lang": "Kotlin", "bug_code_uid": "3d505241d48e50b3ec2ba1072a1eca46", "src_uid": "56168b28f9ab4830b3d3c5eeb7fc0d3c", "apr_id": "fa89fdeb97a8fd720a05ba5bfa2768ab", "difficulty": 2200, "tags": ["trees", "dp"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9994692144373672, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package Avito\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val str = scanner.next()\n for (i in str.length downTo 0) {\n for (j in 0 .. str.length - i) {\n// println(\"$i $j\")\n if (i % 2 == 0) {\n// println(str.substring(j, j + i / 2) + \" \" + str.substring(j + i / 2, j + i))\n if (str.substring(j, j + i / 2) != str.substring(j + i / 2, j + i).reversed()) {\n println(i)\n return\n }\n }\n else {\n// println((str.substring(j, j + i / 2 ) + \" \" + str.substring(j + i / 2 + 1, j + i)))\n if (str.substring(j, j + i / 2) != str.substring(j + i / 2 + 1, j + i).reversed()) {\n println(i)\n return\n }\n }\n }\n }\n println(0)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}", "lang": "Kotlin", "bug_code_uid": "6edf3007954b30f4e2e451f99eef729d", "src_uid": "6c85175d334f811617e7030e0403f706", "apr_id": "7f94dfc864419b8fd2f3b38e14b48964", "difficulty": 900, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.13766233766233765, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "package com.company.codeforces.mailru\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\n\nclass TaskA : Solver() {\n override fun solve() {\n val x = scanner.nextInt()\n val y = scanner.nextInt()\n val z = scanner.nextInt()\n val t = arrayOf(scanner.nextInt(), scanner.nextInt(), scanner.nextInt())\n val dist = Math.abs(x - y)\n val walk = dist * t[0]\n val lift = (Math.abs(z - x) + dist)*t[1] + 2*t[2]\n if (walk< lift){\n System.out.println(\"NO\")\n } else{\n System.out.println(\"YES\")\n }\n }\n}\n\nfun main(args: Array) {\n TaskA().solve()\n}\n\nabstract class Solver {\n internal val scanner = MyScanner()\n abstract fun solve()\n}\n\ninternal class MyScanner {\n private val `in` = BufferedReader(InputStreamReader(System.`in`))\n private var buffer: Array? = null\n private var pos = 0\n\n @Throws(IOException::class)\n fun nextInt(): Int {\n if (buffer == null) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n if (buffer!!.size <= pos) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n pos++\n return Integer.parseInt(buffer!![pos - 1])\n }\n\n @Throws(IOException::class)\n fun nextLong(): Long {\n if (buffer == null) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n if (buffer!!.size <= pos) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n pos++\n return (buffer!![pos - 1]).toLong()\n }\n\n @Throws(IOException::class)\n fun nextString(): String {\n if (buffer == null) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n if (buffer!!.size <= pos) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n pos++\n return buffer!![pos - 1]\n }\n\n @Throws(IOException::class)\n fun getIntList(n: Int): List {\n val result = mutableListOf()\n for (i in 0 until n)\n result.add(nextInt())\n return result\n }\n\n @Throws(IOException::class)\n fun getIntArray(n: Int): IntArray {\n val result = IntArray(n)\n for (i in 0 until n)\n result[i] = nextInt()\n return result\n }\n\n @Throws(IOException::class)\n fun getLongList(n: Int): List {\n val result = mutableListOf()\n for (i in 0 until n)\n result.add(nextLong())\n return result\n }\n\n @Throws(IOException::class)\n fun getLongArray(n: Int): LongArray {\n val result = LongArray(n)\n for (i in 0 until n)\n result[i] = nextLong()\n return result\n }\n\n @Throws(IOException::class)\n fun getStringList(n: Int): List {\n val result = mutableListOf()\n for (i in 0 until n)\n result.add(nextString())\n return result\n }\n\n}\n\nclass TaskC : Solver() {\n override fun solve() {\n val n = scanner.nextInt()\n val ls = scanner.getIntArray(n)\n val rs = scanner.getIntArray(n)\n\n val ans = IntArray(n)\n var cur = n\n val visited = BooleanArray(n)\n val touched = BooleanArray(n)\n var count = 0\n while (count < n) {\n var found = false\n touched.fill(false)\n for (i in 0 until n) {\n if (!visited[i] && ls[i] == 0 && rs[i] == 0 && !touched[i]) {\n found = true\n ans[i] = cur\n visited[i] = true\n count++\n for (j in 0 until n) {\n if (j < i) {\n if (rs[j] > 0) {\n rs[j]--\n touched[j] = true\n }\n }\n if (j > i) {\n if (ls[j] > 0) {\n ls[j]--\n touched[j] = true\n }\n }\n }\n }\n }\n if (!found) {\n System.out.print(\"NO\")\n return\n }\n cur--\n }\n\n System.out.println(\"YES\")\n for (i in ans) {\n System.out.print(\"$i \")\n }\n\n }\n}", "lang": "Kotlin", "bug_code_uid": "382ecaf459640cf97b27795ea1c68970", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "apr_id": "6c6ab23a5d3c0d20457b183bb5a02dde", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.16671440847894586, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\n\nclass TaskA : Solver() {\n override fun solve() {\n val x = scanner.nextInt()\n val y = scanner.nextInt()\n val z = scanner.nextInt()\n val t = arrayOf(scanner.nextInt(), scanner.nextInt(), scanner.nextInt())\n val dist = Math.abs(x - y)\n val walk = dist * t[0]\n val lift = (Math.abs(z - x) + dist)*t[1] + 2*t[2]\n if (walk< lift){\n System.out.println(\"NO\")\n } else{\n System.out.println(\"YES\")\n }\n }\n}\n\nfun main(args: Array) {\n TaskA().solve()\n}\n\nabstract class Solver {\n internal val scanner = MyScanner()\n abstract fun solve()\n}\n\ninternal class MyScanner {\n private val `in` = BufferedReader(InputStreamReader(System.`in`))\n private var buffer: Array? = null\n private var pos = 0\n\n @Throws(IOException::class)\n fun nextInt(): Int {\n if (buffer == null) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n if (buffer!!.size <= pos) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n pos++\n return Integer.parseInt(buffer!![pos - 1])\n }\n\n @Throws(IOException::class)\n fun nextLong(): Long {\n if (buffer == null) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n if (buffer!!.size <= pos) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n pos++\n return (buffer!![pos - 1]).toLong()\n }\n\n @Throws(IOException::class)\n fun nextString(): String {\n if (buffer == null) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n if (buffer!!.size <= pos) {\n buffer = `in`.readLine().split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n pos = 0\n }\n pos++\n return buffer!![pos - 1]\n }\n\n @Throws(IOException::class)\n fun getIntList(n: Int): List {\n val result = mutableListOf()\n for (i in 0 until n)\n result.add(nextInt())\n return result\n }\n\n @Throws(IOException::class)\n fun getIntArray(n: Int): IntArray {\n val result = IntArray(n)\n for (i in 0 until n)\n result[i] = nextInt()\n return result\n }\n\n @Throws(IOException::class)\n fun getLongList(n: Int): List {\n val result = mutableListOf()\n for (i in 0 until n)\n result.add(nextLong())\n return result\n }\n\n @Throws(IOException::class)\n fun getLongArray(n: Int): LongArray {\n val result = LongArray(n)\n for (i in 0 until n)\n result[i] = nextLong()\n return result\n }\n\n @Throws(IOException::class)\n fun getStringList(n: Int): List {\n val result = mutableListOf()\n for (i in 0 until n)\n result.add(nextString())\n return result\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "640f66a60a477838853fee2d2a95cc3c", "src_uid": "05cffd59b28b9e026ca3203718b2e6ca", "apr_id": "6c6ab23a5d3c0d20457b183bb5a02dde", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7479166666666667, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\nfun main(args : Array){\n\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n var m: Int = reader.nextInt()\n val arr = arrayOf(\"0/1\",\"1/3\",\"1/2\",\"2/3\",\"5/6\",\"1/1\")\n var a = 6 - maxOf(n,m)\n println(arr[a])\n\n}\n\nfun maxOf(a: Int, b: Int): Int\n{\n if(a > b)\n return a\n else\n return b\n}", "lang": "Kotlin", "bug_code_uid": "1306a30aa81fc8bfc3e4268441964196", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "5da6c6da2ed08929944e53475f53e37b", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8747855917667239, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val k = r.readLine()!!.toInt()\n val (a, b) = r.readLine()!!.split(\" \").map { it.toInt() }.sorted()\n val c = 7-b\n println(\"${c/ gcd(c, 6)}/${6/ gcd(c, 6)}\")\n\n}", "lang": "Kotlin", "bug_code_uid": "300a27148fbf38335954e2da49fd86b8", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "28d88e96125c1e3c6b0b7e6b0dbcffc7", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9051443455611027, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.max\nimport kotlin.math.pow\nimport kotlin.math.sqrt\n\n//private val INPUT = File(\"input.txt\").inputStream()\n//private val OUTPUT = File(\"output.txt\").outputStream()\nprivate val INPUT = System.`in`\nprivate val OUTPUT = System.out\n\nprivate val bufferedReader = INPUT.bufferedReader()\nprivate val outputWriter = PrintWriter(OUTPUT, false)\nprivate fun readLn() = bufferedReader.readLine()!!\n\nprivate fun readList() = readLn().split(' ')\nprivate var tokenizer = StringTokenizer(\"\")\nprivate fun read(): String {\n while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLn(), \" \")\n return tokenizer.nextToken()\n}\n\nprivate fun readInt() = read().toInt()\nprivate fun readLong() = read().toLong()\nprivate fun readDouble() = read().toDouble()\n\nprivate fun readIntList() = readList().map { it.toInt() }\nprivate fun readLongList() = readList().map { it.toLong() }\nprivate fun readDoubleList() = readList().map { it.toDouble() }\n\nprivate fun readIntArray(n: Int = 0) =\n if (n == 0) readList().run { IntArray(size) { get(it).toInt() } } else IntArray(n) { readInt() }\n\nprivate fun readLongArray(n: Int = 0) =\n if (n == 0) readList().run { LongArray(size) { get(it).toLong() } } else LongArray(n) { readLong() }\n\nprivate fun readDoubleArray(n: Int = 0) =\n if (n == 0) readList().run { DoubleArray(size) { get(it).toDouble() } } else DoubleArray(n) { readDouble() }\n\n\nprivate fun Int.modPositive(other: Int): Int = if (this % other < 0) ((this % other) + other) else (this % other)\n\n\nprivate class `CF9-D2-A` {\n fun solveTestCase(): String {\n val max = max(readInt(), readInt())\n val prob = (6.0 - max + 1.0) / 6.0\n var numerator: Double = prob\n var denominator = 1\n\n while(numerator % 10.0 != 0.0) {\n numerator *= 10\n denominator *= 10\n }\n\n var common = gdc(numerator.toInt(), denominator)\n numerator /= common\n denominator /= common\n return \"${numerator.toInt()}/$denominator\"\n }\n\n fun gdc(a: Int, b :Int) : Int{\n if (a == 0) return b\n if (b == 0) return a\n return gdc(b, a%b)\n }\n}\n\nfun main(args: Array) {\n\n outputWriter.println(\n `CF9-D2-A`()\n .solveTestCase()\n )\n\n outputWriter.flush()\n}", "lang": "Kotlin", "bug_code_uid": "fc6141f801c1cb9643a15a2157dd566e", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "5b9f94ba26db7391e07367339a5e7325", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9891107078039928, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.text.DecimalFormat\nimport java.text.NumberFormat\nimport java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n val yakka = input.nextInt()\n val wakka = input.nextInt()\n val number = if (yakka > wakka)\n yakka\n else\n wakka\n val output = (7.0-number)/6.0\n val s = when (output){\n 1.0 ->\"1/1\"\n 0.8333333333333334 ->\"5/6\"\n 0.6666666666666666->\"4/6\"\n 0.5->\"1/2\"\n 0.3333333333333333 ->\"2/6\"\n 0.16666666666666666 -> \"1/6\"\n else ->\"0/1\"\n }\n println(s)\n}", "lang": "Kotlin", "bug_code_uid": "027af6caf7a6966ac95bd0922773d3ee", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "0cc339608a4be22ab40ea6cd5c7b6604", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.995, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.math.BigInteger\n\n\nfun main() {\n var (y, w) = readLine()!!.split(' ').map { it.toInt() }\n var max = Math.max(y, w)\n if (max==2){\n println(\"5/6\")\n }else if(max==3){\n println(\"2/3\")\n }else if (max == 4){\n println(\"1/2\")\n }else if (max==5){\n println(\"1/3\")\n }else if (max==6){\n println(\"0/1\")\n }else{\n println(\"1/1\")\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "fae8d875cdb92938e01ad0ac3c35d555", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "1dcb7bcc5889358c0337d8660093af12", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7392857142857143, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n var(a,b) = readLine()!!.split(' ').map { it.toInt() };\n var max = max(a,b)\n var dif = (6 - max + 1)\n if(dif == 6) println(\"1/1\")\n else println(\"$dif/6\")\n}\n", "lang": "Kotlin", "bug_code_uid": "e845a23ead4a95932db00e802fde85cf", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "5a6a4e6495658a4a2722dcf8a1330890", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9919839679358717, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n val roll = arrayListOf(1, 2, 3, 4, 5, 6)\n val (y, w) = readLine()!!.split(\" \").map { it.toInt() }\n val index = roll.indexOf(max(y, w))\n if (index == 6) {\n print(\"0/1\")\n } else {\n when (roll.subList(index - 1, roll.size - 1).count()) {\n 1 -> print(\"1/6\")\n 2 -> print(\"1/3\")\n 3 -> print(\"1/2\")\n 4 -> print(\"2/3\")\n 5 -> print(\"5/6\")\n 6 -> print(\"1/1\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "7e1b5affadd3011d0deaf4e806d23479", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "8cd8791d7600e997d09460fa45ba5081", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7692307692307693, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.lang.AssertionError\nimport java.util.*\n \nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n \nprivate fun myAssert(x: Boolean) {\n if (!x) {\n throw AssertionError()\n }\n}\n\nfun gcd(a: Int, b: Int): Int {\n if (b == 0) {\n return a\n }\n else {\n return gcd(b, a % b)\n }\n}\n\nfun main(args: Array) {\n// var s = Scanner(System.`in`)\n var (y, w) = readInts()\n var d = gcd(y, w)\n println(\"${w / d}/${y / d}\")\n}\n", "lang": "Kotlin", "bug_code_uid": "0d706cc82caa0db48546e6ea931f45d3", "src_uid": "f97eb4ecffb6cbc8679f0c621fd59414", "apr_id": "8896b53a9c3118639b278816d9d04da0", "difficulty": 800, "tags": ["probabilities", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.47516198704103674, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner\n\nfun main() {\n\n val sc = Scanner(System.`in`)\n val w : Int = sc.nextInt()\n\n if (w >= 4 && w % 2 == 0) print(\"NO\")\n else print(\"YES\")\n\n}", "lang": "Kotlin", "bug_code_uid": "415d1ad7ae0f817edc55d8603522d4c7", "src_uid": "69b219054cad0844fc4f15df463e09c0", "apr_id": "92d816813225be851c7cb0049ce0eddf", "difficulty": 1200, "tags": ["constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9755434782608695, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val list = r.readLine()!!.split(\" \").map { it.toInt() }\n val str = r.readLine()!!\n val n = str.length\n var ans = 0\n for (i in 0..n/2-1){\n if(str[i]!=str[n-i-1]) ans++\n }\n println(if (ans==1) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "35b87a0b0b73eddefc823bac25cb2816", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "f3f4a3fb1d4de2d97704a42b56ae1bf1", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.952054794520548, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "\nimport java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)){\n val s = nextLine()\n val chars = s.toCharArray()\n val size= chars.size\n val middle = (size - 1) / 2\n\n var j = size - 1\n var i = 0\n var counter = 1\n\n var palindrom = true\n while(true){\n val begin = chars[i]\n val end = chars[j]\n if(begin != end){\n if (counter == 0){\n palindrom = false\n break\n }\n counter--\n }\n if (i == middle){\n break\n }\n i++\n j--\n }\n if(palindrom && counter == 0){\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}\n ", "lang": "Kotlin", "bug_code_uid": "ee79a731cf5b519d5c3ebafe0a1bfeea", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "9db845535e478a90925dedd7fe386b8a", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8843398157625384, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import kotlin.math.pow\n\nfun main() {\n var str = readLine()\n var count = 0\n var flag = true\n if (str != null) {\n for (i in 0..str.length / 2) {\n if (str[i] != str[str.length - i - 1]) {\n count++\n }\n if (count == 2) {\n flag = false\n }\n }\n if (flag) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "aedd75cd6552e3d30fbf05891658a6e5", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "02e829fb0cec101cc0da7ec6d0f7eccf", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9720372836218375, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val s = readLine()!!\n var left = 0\n var right = s.lastIndex\n var changed = false\n while (left < right) {\n if (s[left] != s[right]) {\n if (changed)\n return print(\"NO\")\n else\n changed = true\n }\n left++\n right--\n }\n print(if (changed) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "9c2366ff508da84ba28e63f95a4234ba", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "0af8547134574ae9ea50abacfcf85147", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.889196675900277, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val word = readLine() ?: \"\"\n var diffCount = 0\n for (i in 0..word.length / 2 - 1) {\n if (word[i] != word[word.length - 1 - i]) {\n diffCount++\n }\n if (diffCount >= 2) break\n }\n val msg = if (diffCount == 1) \"YES\" else \"NO\"\n println(msg)\n}\n", "lang": "Kotlin", "bug_code_uid": "2a63058a04367aed68908300cffd6378", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "43958956e979fa738e551c05117162e4", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8764367816091954, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val s = readLine()!!\n var cnt = 0\n for (i in 0..s.length - 1) {\n if (i >= s.length - 1 -i)\n break;\n if (s[i] != s[s.length - 1 -i]) {\n cnt++\n }\n }\n if (cnt == 1)\n print(\"YES\")\n else\n print(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "0eeea8f982b5b88522c11b669283b953", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "78bfa893e1cd59d3061a039e6cd3ba3d", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9434571890145396, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val s = readLine()!!\n val ans = s.subSequence(0, s.length / 2)\n .zip(s.subSequence(s.length / 2 + s.length % 2, s.length).reversed())\n .filter { it.first != it.second }\n .size\n println(if (ans == 1) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "ba710fba8bd4d16797b1e61e7e83b4c2", "src_uid": "fe74313abcf381f6c5b7b2057adaaa52", "apr_id": "ca621cb79d4734a871d8e79527ee4c7d", "difficulty": 1000, "tags": ["brute force", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9611829944547134, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.Integer.*\nimport java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n with(scanner) {\n val a1 = nextIntArray()\n val a2 = nextIntArray(size = a1.size)\n val b1 = bitSetOf(a1)\n val b2 = bitSetOf(a2)\n val mask = (b1.clone() as BitSet)\n mask.and(b2)\n b1.andNot(mask)\n b2.andNot(mask)\n\n if(b1.isEmpty || (b1.cardinality() == b1.length() && b2.cardinality() == b2.length())) {\n println(\"-1\")\n return\n }\n\n print(b2.cardinality() / b1.cardinality() + 1)\n }\n}\n\n/**\n * Consumes a size n and then reads n integers into an array.\n */\nfun Scanner.nextIntArray(size: Int = -1): IntArray {\n val array = IntArray(if(size > 0) size else nextInt())\n for(i in array.indices){\n array[i] = nextInt()\n }\n return array\n}\n\n/**\n * Consumes a number n and then executes the given consumer n times.\n */\nfun Scanner.testCases(forEach: Scanner.() -> Unit) {\n val n = nextInt()\n for(i in 1..n){\n forEach(this)\n }\n}\n\nfun IntArray.print(){\n println(this.joinToString(\" \"))\n}\n\nfun bitSetOf(array: IntArray): BitSet {\n val ret = BitSet(array.size)\n for(i in array.indices){\n if(array[i] == 1){\n ret.set(i)\n }\n }\n return ret\n}", "lang": "Kotlin", "bug_code_uid": "5f9e12d1c52f7760eba2fc388fda5e6d", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "apr_id": "809b0f861f77ad64bbdffd4a832cac8f", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9425837320574163, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val scanner = Scanner(System.`in`)\n val count = scanner.nextInt()\n val array1 = ArrayList(count)\n val array2 = ArrayList(count)\n for(index in 0 until count){\n array1[index] = scanner.nextInt()\n }\n for(index in 0 until count){\n array2[index] = scanner.nextInt()\n }\n\n var bal1 = 0\n var bal2 = 0\n for(index in array1.indices){\n if(array1[index] > array2[index])\n bal1+= 1\n if(array1[index] < array2[index])\n bal2+= 1\n }\n if(bal1 == 0){\n println(-1)\n return\n }\n println(((bal2/bal1+1) + 0.5).toInt())\n}", "lang": "Kotlin", "bug_code_uid": "e1ec382b424ecf4d2bd461503a0aa860", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "apr_id": "ab8317af835dcf98d6552fe0c906e8ed", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.96996336996337, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.floor\n\nfun main() {\n val scan = Scanner(System.`in`)\n \n handleQ(scan)\n}\n\nfun handleQ(scan: Scanner) {\n val n = scan.nextInt()\n var listR = ArrayList()\n var listB = ArrayList()\n\n for (i in 1..n) listR.add(scan.nextInt())\n for (i in 1..n) listB.add(scan.nextInt())\n\n var sumR = 0\n var sumB = 1\n for(i in 0 until n) {\n if(listB[i] == 1 && listR[i] == 0) sumB++;\n if(listR[i] == 1 && listB[i] == 0) sumR++;\n }\n\n if(sumR == 0) {\n println(-1)\n return\n }\n\n var res: Int = floor(1.0*sumB/sumR).toInt()\n println(res)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "44720f98441512af7cc0f4d5447ecc19", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "apr_id": "fb6c999ed93a388526d36ef037c93e89", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8926049795615013, "equal_cnt": 16, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 15, "bug_source_code": "import java.io.BufferedReader\nimport java.io.BufferedWriter\nimport java.io.InputStreamReader\nimport java.io.OutputStreamWriter\nimport kotlin.math.round\nimport kotlin.math.sqrt\n\nval reader = BufferedReader(InputStreamReader(System.`in`))\nval writer = BufferedWriter(OutputStreamWriter(System.`out`))\n\n//fun readLine() = reader.readLine()\nfun readIntList() = reader.readLine().split(' ').map(String::toInt)\nfun readLongList() = reader.readLine().split(' ').map(String::toLong)\nfun readDoubleList() = reader.readLine().split(' ').map(String::toDouble)\nfun readStringList() = reader.readLine().split(' ')\nfun readInt() = reader.readLine().toInt()\nfun readLong() = reader.readLine().toLong()\nfun readDouble() = reader.readLine().toDouble()\n\nfun main() {\n var n = readInt()\n var list1 = readIntList()\n var list2 = readIntList()\n var r = 0\n var b = 0\n for (i in 0 until list1.size) {\n if (list1[i] == 1 && list2[i] == 0){\n r++\n }\n if (list2[i] == 1 && list1[i] == 0){\n b++\n }\n }\n if(r==b){\n println(-1)\n }else if (r>b){\n println(1)\n }else{\n var i = 2\n var ans = r\n while (ans b) {\n println(1)\n } else {\n var i = 2\n var ans = r\n while (ans < b) {\n ans = r * i\n i++\n }\n println(i)\n }\n\n\n}\n", "lang": "Kotlin", "bug_code_uid": "f9bf03aa1b6125c3b3a0edaeb1d3b090", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "apr_id": "2e52cb29c21a38c905deda66d19655e3", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9913793103448276, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n val red = readLine()!!\n val blue = readLine()!!\n var rojo = 0\n var azul = 0\n for (j in 0 until n) {\n if (red[2 * j] == '1' && blue[2 * j] == '0') {\n rojo++\n } else if (red[2 * j] == '0' && blue[2 * j] == '1') {\n azul++\n }\n }\n when {\n rojo > azul -> println(1)\n rojo == 0 -> println(-1)\n else -> println(2 + ((azul - 1) / rojo))\n }\n}", "lang": "Kotlin", "bug_code_uid": "ebce974ffb3239187146a1d493b20097", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "apr_id": "f837fb80b27f4a2b7be61c90fe5367cd", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.925459825750242, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.ceil\n\nfun readStrings() = readLine()!!.trim().split(\" \")\nfun readInt() = readLine()!!.toInt()\nfun readInts() = readStrings().map { it.toInt() }\nfun readLong() = readLine()!!.toLong()\nfun readLongs() = readStrings().map { it.toInt() }\n\nfun main() {\n val t = readLine()!!\n//\n// repeat(t.toInt()) {\n// val case = readLine()!!\n// println(solve(case.toInt()))\n// }\n\n println(solve(readInts(), readInts()))\n}\n\nfun solve(r: List, b: List): Int {\n var rWins = 0.0\n var bWins = 0.0\n\n r.zip(b).asSequence().filter { it.first != it.second }.forEach {\n if (it.first == 1) {\n rWins += 1\n } else {\n bWins += 1\n }\n }\n\n return if (rWins == bWins || rWins == 0.0) {\n when {\n rWins == 0.0 -> {\n -1\n }\n bWins < b.size-1 -> {\n 2\n }\n else -> {\n -1\n }\n }\n } else {\n ceil((bWins + 1) / rWins).toInt()\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "92e4f42210371f878ea3d43d9e64a0d5", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "apr_id": "f514b23f6d06f4e966f89d6290b326d3", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9177718832891246, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val n = getInt()\n val a = getInts()\n val b = getInts()\n\n val aa = a.zip(b).filter { it.first > it.second }.count()\n val bb = a.zip(b).filter { it.first < it.second }.count()\n\n println(bb / aa + 1)\n}\n\n\nfun getInt() = readLine()!!.toInt()\nfun getInts() = readLine()!!.split(\" \").map { it.toInt() }", "lang": "Kotlin", "bug_code_uid": "0e56c2c9c6edffddc54ce7b6d2564be1", "src_uid": "b62338bff0cbb4df4e5e27e1a3ffaa07", "apr_id": "4e3daef9944f2072d60b49acf8296975", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6390438247011953, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n val (n, x, y) = readLine()!!.split(\" \").map { it.toLong() }\n fun minChanges(z: Long): Long {\n var res = 0\n var curr = 0\n for (chara in z.toString(2)) {\n if (chara == '1') {\n curr++\n } else {\n res += min(2, curr)\n curr = 0\n }\n }\n res += min(2, curr)\n return res.toLong() * x\n }\n var answer = Long.MAX_VALUE\n for (e in 0..29) {\n answer = min(answer, (e.toLong() * y) + ((n shr e) * x) + minChanges(n % (1L shl e)))\n }\n println(answer)\n}", "lang": "Kotlin", "bug_code_uid": "487ec5e52a2dd4ac6e593c3b7b9a942d", "src_uid": "0f270af00be2a523515d5e7bd66800f6", "apr_id": "b9a296919723f9ba40e654bed6ee6b21", "difficulty": 2000, "tags": ["dp", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7511961722488039, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "const val mod = 998244353\n\n// Return Pair(Fn, Fn+1)\nfun fib(n: Int): Pair {\n\n // Base case.\n if (n == 0) return Pair(0, 1)\n\n val (x, y) = fib(n shr 1)\n val c = (x * (2 * y - x)) % mod\n val d = (y * y + x * x) % mod\n return if (n % 2 == 0) Pair(c, d) else Pair(d, d + c)\n}\n\nfun exp(x: Long, p: Long): Long {\n val base = x\n var exp = p\n var time = base\n var res = 1L\n while (exp > 0) {\n if (exp % 2 == 1L) {\n res = res * time % mod\n }\n time = time * time % mod\n exp /= 2\n }\n return res\n}\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val sb = StringBuilder()\n //repeat(r.readLine().toInt()) {\n var n = r.readLine().toInt()\n var top = fib(n).first\n while (top % 2 == 0L) {\n top /= 2\n n -= 1\n }\n val bot = exp(2, n.toLong() * (mod - 2))\n sb.appendln(top*bot % mod)\n //}\n println(sb)\n}", "lang": "Kotlin", "bug_code_uid": "187b16cdce3183dc1730da99c266b441", "src_uid": "cec37432956bb0a1ce62a0188fe2d805", "apr_id": "b0a6f92e5e13eb339f4da3db6414241d", "difficulty": 1600, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5212520593080725, "equal_cnt": 14, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*\n\nfun main() {\n val (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n val selected = TreeMap()\n val removed = TreeMap()\n val ts = readLine()!!.split(\" \").map { it.toInt() }\n if (n == 1300) print(ts.slice(170 until n))\n var sum = 0\n var mustLeave = 0\n val sols = IntArray(n) {0}\n ts.forEachIndexed {index, it ->\n sum += it\n while(sum > m) {\n val bigger = selected.lastKey()\n sum -= bigger\n selected[bigger] = selected[bigger]!! - 1\n if (selected[bigger] == 0) selected.remove(bigger)\n removed[bigger] = removed.getOrDefault(bigger, 0) + 1\n mustLeave++\n }\n selected[it] = selected.getOrDefault(it, 0) + 1\n while (removed.isNotEmpty() && sum + removed.firstKey() <= m) {\n val smaller = removed.firstKey()\n sum += smaller\n removed[smaller] = removed[smaller]!! - 1\n if (removed[smaller] == 0) removed.remove(smaller)\n selected[smaller] = selected.getOrDefault(smaller, 0) + 1\n mustLeave--\n }\n sols[index] = mustLeave\n }\n print(sols.joinToString(\" \"))\n}", "lang": "Kotlin", "bug_code_uid": "0ac71ecc17ff400d633b858d7480b7fd", "src_uid": "d3c1dc3ed7af2b51b4c49c9b5052c346", "apr_id": "fd005fc1e590836c76ba1855e51016f2", "difficulty": 1200, "tags": ["greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9711037423022264, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.lang.AssertionError\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007L\n\n\ntailrec fun gcd(a: Long, b: Long): Long {\n if (a < b) return gcd(b, a)\n if (b == 0L) return a\n return gcd(b, a % b)\n}\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val T = nl()\n val A = nl()\n val B = nl()\n\n fun answer(x: Long) {\n val d = gcd(x - 1, T)\n out.println(\"${(x - 1)/d}/${T/d}\")\n }\n\n if (A == B) {\n answer(T + 1)\n return\n }\n\n val a = A / gcd(A, B)\n if (a > T / B) {\n answer(min(T + 1, min(A, B)))\n return\n }\n val lcm = a * B\n val size = ((T + 1 + lcm - 1)/ lcm)\n val r = (T + 1) % lcm\n debug{\"$lcm $size $r\"}\n if (size == 1L) {\n answer(min(T + 1, min(A, B)))\n return\n }\n\n var ans = 0L\n ans += min(A, B) * (size - 1)\n ans += min(r + 1, min(A, B))\n debug{\"$ans\"}\n answer(ans)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private inline fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private inline fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private inline fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private inline fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n private inline fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n\n private inline fun assert(b: Boolean) = run{if (!b) throw AssertionError()}\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "d5cf226649b5d1b64a3188ca63ce0a85", "src_uid": "7a1d8ca25bce0073c4eb5297b94501b5", "apr_id": "e23121d2131bd1998d247a7bac3d5061", "difficulty": 1800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8382783117425825, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n var fTeam = readLine()!!.toInt()\n var sTeam = readLine()!!.toInt()\n var fMax = readLine()!!.toInt()\n var sMax = readLine()!!.toInt()\n var total = readLine()!!.toInt()\n\n var fTeam1 = fTeam\n var sTeam1 = sTeam\n var fMax1 = fMax\n var sMax1 = sMax\n var total1 = total\n\n\n var ansMax = 0\n var ansMin = 0\n\n\n if (fMax < sMax) {\n while (total >= fMax && fTeam > 0) {\n ansMax += 1\n fTeam--\n total -= fMax\n }\n while (total >= sMax && sTeam > 0) {\n ansMax += 1\n sTeam--\n total -= sMax\n }\n } else {\n while (total >= sMax && sTeam > 0) {\n ansMax += 1\n sTeam--\n total -= sMax\n }\n while (total >= fMax && fTeam > 0) {\n ansMax += 1\n fTeam--\n total -= fMax\n }\n }\n\n var sum = fMax1 * fTeam1 + fMax1 * sTeam1\n if (total1 >= sum) {\n ansMin = fTeam1 + sTeam1\n } else {\n\n total1 -= (fMax1 - 1) * fTeam1\n\n total1 -= (sMax1 - 1) * sTeam1\n\n if (total1 <= 0) {\n ansMin = 0\n } else {\n ansMin = total1\n }\n }\n\n println(\"$ansMin $ansMax\")\n}", "lang": "Kotlin", "bug_code_uid": "300c2d982b2fd37a53c1947190c8a98a", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "apr_id": "b706cd41b0315ca2071cbd7419ad7ec6", "difficulty": 1000, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9270298047276464, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": " fun main() {\n var a1 = readLine()!!.toInt();\n var a2 = readLine()!!.toInt();\n var k1 = readLine()!!.toInt();\n var k2 = readLine()!!.toInt();\n var n = readLine()!!.toInt();\n var xx=0\n if(k20){if(a1-1>=0){a1-=1;n-=k1;if(n>=0)xx++; }\n else{if(a2-1>=0)a2-=1;n-=k2;if(n>=0)xx++; }}\n println(\"$xx \") \n }", "lang": "Kotlin", "bug_code_uid": "0b7f3869be92877797b77c4b21bd8db4", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "apr_id": "fa9b975fcccacc2669be76e05a4c8106", "difficulty": 1000, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9919191919191919, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport java.math.*\nimport kotlin.math.*\n\nfun readLn()=readLine()!!\nfun readInt()=readLn().toInt()\nfun readInts()=readLn().split(\" \").map{it.toInt()}\nfun readLong()=readLn().toLong()\nfun readLongs()=readLn().split(\" \").map{it.toLong()}\n\nval out=mutableListOf()\nfun printLine(s:String){out.add(s)}\nfun output(){println(out.joinToString(\"\\n\"))}\n\nfun TreeMap.add(i:Char,x:Int){\n set(i,getOrDefault(i,0)+x)\n}\nfun main(){\n var a=Array(3){readLn().toCharArray()}\n var cnt=TreeMap()\n for(j in 0..2)for(i in a[j])cnt.add(i,1)\n var o=cnt.getOrDefault('0',0)\n var x=cnt.getOrDefault('X',0)\n if(o>x || x>o+1)printLine(\"illegal\")\n else{\n fun win(c:Char):Boolean{\n for(j in 0..2)if(a[j][0]==c&&a[j][1]==c&&a[j][2]==c)return true\n for(j in 0..2)if(a[0][j]==c&&a[1][j]==c&&a[2][j]==c)return true\n if(a[0][0]==c&&a[1][1]==c&&a[2][2]==c)return true\n if(a[2][0]==c&&a[1][1]==c&&a[0][2]==c)return true\n return false\n }\n if(win('X')&&win('0'))printLine(\"illegal\")\n else{\n if(win('X')){\n var ok=false\n for(i in 0..2)for(j in 0..2){\n a[i][j]='.'\n if(!win('X'))ok=true\n a[i][j]='X'\n }\n if(ok&&x==o+1)printLine(\"the first player won\")\n else printLine(\"illegal\")\n }else if(win('0')){\n var ok=false\n for(i in 0..2)for(j in 0..2){\n a[i][j]='.'\n if(!win('0'))ok=true\n a[i][j]='0'\n }\n if(ok&&x==o)printLine(\"the second player won\")\n else printLine(\"illegal\")\n }else{\n if(x+o==9)printLine(\"draw\")\n else if(x>o)printLine(\"second\")\n else printLine(\"first\")\n }\n }\n }\n output()\n}", "lang": "Kotlin", "bug_code_uid": "107224ac527980ed3c92a2a636ce85c9", "src_uid": "892680e26369325fb00d15543a96192c", "apr_id": "ea553f588fa82197757e40606a5030af", "difficulty": 1800, "tags": ["games", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9908496732026144, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nfun main(args: Array) {\n main { readLine() }\n}\n\nfun main(readLine: () -> String?) {\n val problem = readProblem(readLine)\n val solution = solve(problem)\n printSolution(solution)\n}\n\n// READ PROBLEM\n\nprivate fun readProblem(readLine: () -> String?): Problem {\n val input = (readLine() + readLine() + readLine())\n return Problem(input.map(::charToPlayer))\n}\n\nprivate fun charToPlayer(c: Char): Player? {\n when (c) {\n 'X' -> return Player.X\n '0' -> return Player.O\n else -> return null\n }\n}\n\nprivate class Problem(val board: List) {\n override fun toString(): String {\n return board.joinToString(\" \")\n }\n\n fun countX(): Int {\n return board.filter { it == Player.X }.count()\n }\n\n fun countO(): Int {\n return board.filter { it == Player.O }.count()\n }\n\n fun hasThreeX(): Boolean {\n val xs = board.map { it == Player.X }\n return isWinning(xs)\n }\n\n fun hasThreeO(): Boolean {\n val os = board.map { it == Player.O }\n return isWinning(os)\n }\n\n private fun isWinning(b: List): Boolean {\n return (b[0] && b[1] && b[2])\n || (b[3] && b[4] && b[5])\n || (b[6] && b[7] && b[8])\n || (b[0] && b[3] && b[6])\n || (b[1] && b[4] && b[7])\n || (b[2] && b[5] && b[8])\n || (b[0] && b[4] && b[8])\n || (b[2] && b[4] && b[6])\n }\n}\n\nprivate enum class Player {\n X, O\n}\n\n// SOLVE PROBLEM\n\nprivate fun solve(prob: Problem): Solution {\n // x - it's the first player\n // o - it's the second player\n val xNo = prob.countX()\n val oNo = prob.countO()\n val xWon = prob.hasThreeX()\n val oWon = prob.hasThreeO()\n\n when {\n (xNo < oNo) -> return Solution.ILLEGAL\n (xNo > (oNo + 1)) -> return Solution.ILLEGAL\n (xWon && oWon) -> return Solution.ILLEGAL\n (xWon && (xNo > oNo)) -> return Solution.FIRST_WON\n (xWon) -> return Solution.ILLEGAL\n (oWon && (xNo == oNo)) -> return Solution.SECOND_WON\n (oWon) -> return Solution.ILLEGAL\n (xNo == oNo) -> return Solution.FIRST\n (xNo > oNo) -> return Solution.SECOND\n else -> return Solution.ILLEGAL\n }\n}\n\n// PRINT SOLUTION\n\nprivate enum class Solution(val txt: String) {\n FIRST(\"first\"),\n SECOND(\"second\"),\n ILLEGAL(\"illegal\"),\n FIRST_WON(\"the first player won\"),\n SECOND_WON(\"the second player won\"),\n DRAW(\"draw\");\n\n fun print(consumer: (String) -> Unit) {\n consumer(txt)\n }\n}\n\nprivate fun printSolution(solution: Solution) {\n solution.print(::println)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "49e5460133fc9bd89fbdb48ae64b6065", "src_uid": "892680e26369325fb00d15543a96192c", "apr_id": "6e7318bcc83e0c2e6a8bd01c90d901e5", "difficulty": 1800, "tags": ["games", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9568407423392318, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.lang.Exception\n\nfun main() {\n // 0 || X || .\n var num1 = 0 //The first player draws X goes\n var num2 = 0 //The second player draws 0 goes\n var spaceNum = 0 // space are '.'\n val table = arrayListOf(readLine()!!.toCharArray())\n var isFull = !table[0].any() { it == '.' }\n table.add(readLine()!!.toCharArray())\n isFull = isFull && !table[1].any() { it == '.' }\n table.add(readLine()!!.toCharArray())\n isFull = isFull && !table[2].any() { it == '.' }\n for (k in table.indices) {\n for (i in table[k].indices) {\n when {\n table[k][i] == 'X' -> {\n num1++\n }\n table[k][i] == '0' -> {\n num2++\n }\n table[k][i] == '.' -> {\n spaceNum++\n }\n }\n }\n }\n //println(\"num1 : $num1, num2 : $num2\")\n if (num1 - num2 != 0 && num1 - num2 != 1) {\n println(\"illegal\")\n return\n }\n val checkChar = arrayOf('X', '0')\n var won = arrayOf(0, 0)\n for (c in 0..1) {\n for (i in 0..2) { // fin\n if (checkChar[c] == table[i][0] && table[i][0] == table[i][1] && table[i][1] == table[i][2]) {\n won[c]++\n }\n if (checkChar[c] == table[0][i] && table[0][i] == table[1][i] && table[1][i] == table[2][i]) {\n won[c]++\n }\n }\n if (checkChar[c] == table[0][0] && table[0][0] == table[1][1] && table[1][1] == table[2][2]) {\n won[c]++\n }\n if (checkChar[c] == table[0][2] && table[0][2] == table[1][1] && table[1][1] == table[2][0]) {\n won[c]++\n }\n }\n //println(\"check : $checkChar\")\n\n if (won[0] >= 1 && won[1] >= 1) {\n println(\"illegal\")\n return\n } else if (won[0] >= 1) {\n println(\"the first player won\")\n return\n } else if (won[1] >= 1) {\n println(\"the second player won\")\n return\n }\n\n if (!isFull) {\n if (num1 - num2 == 0) {\n println(\"first\")\n } else if (num1 - num2 == 1) {\n println(\"second\")\n }\n return\n } else {\n println(\"draw\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "0bdcfcf90815726516c163410f64dfbb", "src_uid": "892680e26369325fb00d15543a96192c", "apr_id": "df75a060234d6578088b10e471c20080", "difficulty": 1800, "tags": ["games", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.965195246179966, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nval FIRST = 'X'\nval SECOND = '0'\n\nfun main() {\n val reader = Scanner(System.`in`)\n\n val board = mutableListOf()\n repeat(3) { board.add(reader.nextLine().trim()) }\n\n val zeros = board.sumBy { row -> row.count { it == '0' } }\n val xs = board.sumBy { row -> row.count { it == 'X' } }\n\n fun won(c: Char): Boolean {\n for (i in 0 until 3) {\n if (board[i].all { it == c }) return true\n if (board.all { row -> row[i] == c }) return true\n }\n\n if ((0 until 3).map { board[it][it] }.all { it == c }) return true\n if ((0 until 3).map { board[it][2 - it] }.all { it == c }) return true\n\n return false\n }\n\n when (xs - zeros) {\n 1 -> when {\n won(SECOND) -> println(\"illegal\")\n won(FIRST) -> println(\"the first player won\")\n else -> println(\"second\")\n }\n 0 ->\n when {\n won(FIRST) -> println(\"illegal\")\n won(SECOND) -> println(\"the second player won\")\n xs == 5 -> println(\"draw\")\n else -> println(\"first\")\n }\n else -> println(\"illegal\")\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "46e3c81dfb43668ba799a856e95748b5", "src_uid": "892680e26369325fb00d15543a96192c", "apr_id": "35d25659217249b7409e3f12d868115b", "difficulty": 1800, "tags": ["games", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9840127897681854, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import kotlin.properties.Delegates\nimport kotlin.reflect.KProperty\n\nclass Memorize(val func: (T) -> R) {\n val cache = mutableMapOf()\n\n operator fun getValue(thisRef: Any?, property: KProperty<*>) = { n: T ->\n cache.getOrPut(n) { func(n) }\n }\n}\n\nvar k by Delegates.notNull()\nvar l by Delegates.notNull()\nval f: (Pair) -> Long by Memorize { (weight, hasLeast) ->\n when {\n weight < 0 -> 0\n weight == 0L -> if (hasLeast) 1L else 0L\n hasLeast -> (1..k).fold(0L) { acc: Long, l: Long -> acc + f(Pair(weight - l, true)) }\n else -> { (if (k >= l) (l..k).fold(0L) { acc: Long, l: Long ->\n acc + f(Pair(weight - l, true))\n } else 0L) + (1..minOf(k, l - 1)).fold(0L) { acc: Long, l: Long ->\n acc + f(Pair(weight - l, false)) }\n }\n }//.also { println(\"weight: $weight hasleast: $hasLeast res: $it\") }\n}\n\nfun main() {\n val r = System.`in`.bufferedReader()\n //val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n val (weight, kth, least) = r.readLine()!!.split(\" \").map { it.toLong() }\n k = kth\n l = least\n println(f(Pair(weight, false)))\n //val n = r.readLine()!!.toInt()\n}", "lang": "Kotlin", "bug_code_uid": "be5054352bf204fa86bfdc2ad5f37540", "src_uid": "894a58c9bba5eba11b843c5c5ca0025d", "apr_id": "c2b9732b2d1139e6f19a3b09295eecab", "difficulty": 1600, "tags": ["trees", "dp", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9009584664536742, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n var s = 0L\n var i = 1\n while(s < n) {\n s+=i\n i++\n }\n println(i-1)\n}\n", "lang": "Kotlin", "bug_code_uid": "e2e9c4564048fc972f8f15c2941513d8", "src_uid": "95cb79597443461085e62d974d67a9a0", "apr_id": "93169e3a67dbc5a08c89718ef0a90427", "difficulty": 1300, "tags": ["math", "constructive algorithms", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9650302622730329, "equal_cnt": 15, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 12, "fix_ops_cnt": 14, "bug_source_code": "fun POW(N:Int ,P: Int ,mod : Int):Int{\n var x=1\n var n=N\n var p=P\n while (p > 0) {\n if (p%2 == 0) {\n n = n*n %mod\n p /= 2\n } else {\n x = x*n %mod\n p -= 1\n }\n }\n\n return x\n}\n\nfun main(){\n var (n,K) = readLine()!!.split(' ').map { it.toInt() }\n val mod=1000000007\n\n var FACT=mutableListOf()\n var F=mutableListOf()\n var FACT_INV=mutableListOf()\n\n FACT.add(1)\n F.add(0)\n\n for (i in 1..1000010){\n FACT.add(FACT[i-1]*i%mod)\n F.add((F[i-1]+POW(i,K,mod))%mod)\n }\n\n //println(FACT[1000010])\n\n FACT_INV.add(POW(FACT[1000010],mod-2,mod))\n\n for (i in 1000010 downTo 1){\n FACT_INV.add(FACT_INV[1000010-i]*i%mod)\n }\n\n //println(FACT_INV[0])\n //println(FACT_INV[1000010])\n FACT_INV = FACT_INV.asReversed()\n\n //println(FACT_INV[0])\n //println(FACT_INV[1000010])\n\n var ANS=0L\n var PI=1L\n\n if (n<=K+2){\n println(F[n.toInt()])\n return\n }\n\n for (i in 1..K+2){\n PI=PI*(n-i)%mod\n if ((K+2-i)%2==0){\n ANS=ANS+F[i.toInt()]*FACT_INV[(K+2-i).toInt()]%mod*FACT_INV[(i-1).toInt()]%mod*POW(n-i,mod-2,mod)\n ANS=(ANS+mod)%mod\n }\n else{\n ANS=ANS-F[i.toInt()]*FACT_INV[(K+2-i).toInt()]%mod*FACT_INV[(i-1).toInt()]%mod*POW(n-i,mod-2,mod)\n ANS=(ANS+mod)%mod\n }\n }\n println((ANS*PI+mod)%mod)\n}", "lang": "Kotlin", "bug_code_uid": "c9c0df1917a2e216084f87ee3faaa5bc", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "apr_id": "0133c2077d00b74a4eea6b6b6e8b14c5", "difficulty": 2600, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8734557595993322, "equal_cnt": 27, "replace_cnt": 9, "delete_cnt": 5, "insert_cnt": 12, "fix_ops_cnt": 26, "bug_source_code": "fun POW(N:Long ,P: Long ,mod : Long):Long{\n var x=1L\n var n=N\n var p=P\n while (p > 0) {\n if (p%2 == 0L) {\n n = n*n %mod\n p /= 2\n } else {\n x = x*n %mod\n p -= 1\n }\n }\n\n return x\n}\n\nfun main(){\n var (n,K) = readLine()!!.split(' ').map { it.toLong() }\n val mod=1000000007L\n\n var FACT=mutableListOf()\n var F=mutableListOf()\n var FACT_INV=mutableListOf()\n\n FACT.add(1)\n F.add(0)\n\n for (i in 1..1000010){\n FACT.add(FACT[i-1]*i%mod)\n F.add((F[i-1]+POW(i.toLong(),K,mod))%mod)\n }\n\n //println(FACT[1000010])\n\n FACT_INV.add(POW(FACT[1000010],mod-2,mod))\n\n for (i in 1000010 downTo 1){\n FACT_INV.add(FACT_INV[1000010-i]*i%mod)\n }\n\n //println(FACT_INV[0])\n //println(FACT_INV[1000010])\n FACT_INV = FACT_INV.asReversed()\n\n //println(FACT_INV[0])\n //println(FACT_INV[1000010])\n\n var ANS=0L\n var PI=1L\n\n if (n<=K+2){\n println(F[n.toInt()])\n return\n }\n\n for (i in 1..K+2){\n PI=PI*(n-i)%mod\n if ((K+2-i)%2==0L){\n ANS=ANS+F[i.toInt()]*FACT_INV[(K+2-i).toInt()]%mod*FACT_INV[(i-1).toInt()]%mod*POW(n-i,mod-2,mod)\n ANS=(ANS+mod)%mod\n }\n else{\n ANS=ANS-F[i.toInt()]*FACT_INV[(K+2-i).toInt()]%mod*FACT_INV[(i-1).toInt()]%mod*POW(n-i,mod-2,mod)\n ANS=(ANS+mod)%mod\n }\n }\n println((ANS*PI+mod)%mod)\n}", "lang": "Kotlin", "bug_code_uid": "68f263fbbbc2dc2de2d95c09413eb45b", "src_uid": "6f6fc42a367cdce60d76fd1914e73f0c", "apr_id": "0133c2077d00b74a4eea6b6b6e8b14c5", "difficulty": 2600, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9292929292929293, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main(args : Array) = with(java.util.Scanner(System.`in`)){\n var n = nextInt()\n var k = nextInt()\n var res : Int = n/k\n if(res%2==0) println(\"NO\")\n else println(\"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "35453134854d53a9d7162d8a3e160567", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "apr_id": "8bff6dfdd5384a5bd10da2723c3a3fb7", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9695885509838998, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n var scanner = Scanner(System.`in`)\n\n var n = scanner.nextInt()\n var k = scanner.nextInt()\n\n var t = n / k\n\n\n\n if (t % 2 == 0) {\n print(\"NO\")\n } else {\n print(\"YES\")\n }\n scanner.close()\n}\n\n", "lang": "Kotlin", "bug_code_uid": "3ff1797168230822d9ce95db6d280342", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "apr_id": "357c517aadea0e094f7f901a0c97bee3", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.954954954954955, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(args: Array) {\n val sc = Scanner()\n var n = sc.nxtInt()\n var k = sc.nxtInt()\n println(if((n/k)%2==1)\"YES\" else \"NO\")\n}\n\nclass Scanner(){\n var br:BufferedReader?=null\n var st:StringTokenizer?=null\n init {\n br = BufferedReader(InputStreamReader(System.`in`))\n }\n private fun tokenize()\n {\n while(st==null || !st!!.hasMoreTokens())st = StringTokenizer(br!!.readLine())\n }\n fun readLine():String{\n return br!!.readLine()\n }\n fun nxt():String\n {\n tokenize()\n return st!!.nextToken()\n }\n\n fun nxtInt():Int{\n return nxt().toInt()\n }\n fun nxtDouble():Double\n {\n return nxt().toDouble()\n }\n fun nxtString():String\n {\n return nxt()\n }\n}", "lang": "Kotlin", "bug_code_uid": "656a840e655c3e5ba907adff9009705a", "src_uid": "05fd61dd0b1f50f154eec85d8cfaad50", "apr_id": "4da98b106d95b0ed5bcf2dd3e82bb453", "difficulty": 800, "tags": ["math", "games"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.980544747081712, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n for (r in 0..4) {\n val index = readLine()!!.split(\" \").map { it.toInt() }.indexOf(1)\n if(index != -1) {\n println(abs(2 - r) + abs(2 - index))\n return\n }\n }\n }", "lang": "Kotlin", "bug_code_uid": "8b6b9a9a99435d34f21a0aa660113c56", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "c27ee33db8083d3474fa730989987ef8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9970267591674926, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val matrix = Array>(5, {_ -> readLine()!!.split(' ').map(String::toInt).toTypedArray()})\n for (i in matrix.indices) {\n for (j in matrix[i].indices) {\n if (matrix[i][j] == 1) {\n var a = if (i >= 2) i - 2 else 2 - i\n var b = if (j >= 2) j - 2 else 2 - j\n // print(\"a = $a\\n\")\n // print(\"b = $b\\n\")\n print((a + b).toString() + \"\\n\")\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "1c2d4abb3d4f8935cb33740aeb043114", "src_uid": "8ba7cedc3f6ae478a0bb3f902440c8e9", "apr_id": "c19d4febd614fce28d1f6ffdb7b64b05", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9932885906040269, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n val (m, n) = r.readLine()!!.split(\" \").map { it.toInt() }\n val x = m%10\n var ans = 1\n while ((x*ans)%10!=n || (x*ans)%10 != 0){\n ans++\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "bbc780a41bf8c7ecf9b7ed7efdfa9b6c", "src_uid": "18cd1cd809df4744bb7bcd7cad94e2d3", "apr_id": "6859e03d91b699614062280e7d0934e8", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9714964370546318, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt();\n val m = readLine()!!.toInt();\n var sum = 0;\n var max = 0;\n for (i in 1..n) {\n var a = readLine()!!.toInt();\n sum += a;\n max = if (a > max) a else max;\n }\n var rest = m - (max * n - sum);\n var minK = max + rest / n + (if (rest % n == 0) 0 else 1);\n var maxK = max + m;\n println(\"$minK $maxK\");\n}", "lang": "Kotlin", "bug_code_uid": "c7b162da1e68e7a0801b7675d4733ef3", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "apr_id": "4b83f2036b2ed1a6c62c99ee957fe75a", "difficulty": 1100, "tags": ["implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9882352941176471, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces\nprivate object Read {\n fun readLn() = readLine()!! // string line\n fun readInt() = readLn().toInt() // single int\n fun readLong() = readLn().toLong() // single long\n fun readDouble() = readLn().toDouble() // single double\n fun readStrings() = readLn().split(\" \") // list of strings\n fun readInts() = readStrings().map { it.toInt() } // list of ints\n fun readLongs() = readStrings().map { it.toLong() } // list of longs\n fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n}\n\nprivate fun arpasExam(degree: Int): Int = if (degree == 0) 1\nelse {\n when (degree % 4) {\n 1 -> 8\n 2 -> 4\n 3 -> 2\n 0 -> 6\n else -> 0\n }\n}\n\n\nfun main() {\n println(arpasExam(Read.readInt()))\n}", "lang": "Kotlin", "bug_code_uid": "daa2143ba959b155b20a13af442b1484", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "247489f9bdcdf19265b1216d69289704", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9544827586206897, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 8, "bug_source_code": "private object Read {\n fun readLn() = readLine()!! // string line\n fun readInt() = readLn().toInt() // single int\n fun readLong() = readLn().toLong() // single long\n fun readDouble() = readLn().toDouble() // single double\n fun readStrings() = readLn().split(\" \") // list of strings\n fun readInts() = readStrings().map { it.toInt() } // list of ints\n fun readLongs() = readStrings().map { it.toLong() } // list of longs\n fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n}\n\nprivate fun arpasExam(degree: Int) = when (degree % 4) {\n 1 -> 8\n 2 -> 4\n 3 -> 2\n 0 -> 6\n else -> 0\n}\n\n\nfun main() {\n println(arpasExam(Read.readInt()))\n}", "lang": "Kotlin", "bug_code_uid": "a4a1f216dc686c6ac0d9d2a869eb57f3", "src_uid": "4b51b99d1dea367bf37dc5ead08ca48f", "apr_id": "247489f9bdcdf19265b1216d69289704", "difficulty": 1000, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.41247582205029015, "equal_cnt": 15, "replace_cnt": 14, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 15, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport java.io.PrintStream\n\nval Number.i: Int get() = this.toInt()\nval Number.l: Long get() = this.toLong()\nval Number.f: Float get() = this.toFloat()\nval Number.d: Double get() = this.toDouble()\nval String.i: Int get() = this.toInt()\nval String.l: Long get() = this.toLong()\nval String.f: Float get() = this.toFloat()\nval String.d: Double get() = this.toDouble()\nval Boolean.i: Int get() = if (this) 1 else 0\n\noperator fun List.component6() = this[5]\n\nfun main() = BufferedReader(InputStreamReader(System.`in`)).use { solve(it, System.out) }\n\nfun solve(input: BufferedReader, output: PrintStream) {\n val (x0, y0, x1, y1, x2, y2) = input.readLine().split(' ').map { it.i }\n output.println(\n when {\n isGoodStraight(x0, y0, x1, y1, x2, y2) -> \"RIGHT\"\n isAlmost(x0, y0, x1, y1, x2, y2) -> \"ALMOST\"\n else -> \"NEITHER\"\n }\n )\n}\n\nfun isStraight(x0: Int, y0: Int, x1: Int, y1: Int, x2: Int, y2: Int) = (x0 == x1 && y0 == y2) || (x0 == x2 && y0 == y1)\nfun isAlmost(x0: Int, y0: Int, x1: Int, y1: Int, x2: Int, y2: Int) = (false ||\n isGoodStraight(x0 - 1, y0, x1, y1, x2, y2) ||\n isGoodStraight(x0 + 1, y0, x1, y1, x2, y2) ||\n isGoodStraight(x0, y0 - 1, x1, y1, x2, y2) ||\n isGoodStraight(x0, y0 + 1, x1, y1, x2, y2) ||\n\n isGoodStraight(x0, y0, x1 - 1, y1, x2, y2) ||\n isGoodStraight(x0, y0, x1 + 1, y1, x2, y2) ||\n isGoodStraight(x0, y0, x1, y1 - 1, x2, y2) ||\n isGoodStraight(x0, y0, x1, y1 + 1, x2, y2) ||\n\n isGoodStraight(x0, y0, x1, y1, x2 - 1, y2) ||\n isGoodStraight(x0, y0, x1, y1, x2 + 1, y2) ||\n isGoodStraight(x0, y0, x1, y1, x2, y2 - 1) ||\n isGoodStraight(x0, y0, x1, y1, x2, y2 + 1)\n )\n\nfun isGoodStraight(x0: Int, y0: Int, x1: Int, y1: Int, x2: Int, y2: Int) =\n (true &&\n !(x0 == x1 && y0 == y1) &&\n !(x0 == x2 && y0 == y2) &&\n !(x2 == x1 && y2 == y1)\n ) && (0 +\n isStraight(x0, y0, x1, y1, x2, y2).i +\n isStraight(x1, y1, x0, y0, x2, y2).i +\n isStraight(x2, y2, x0, y0, x1, y1).i) == 1", "lang": "Kotlin", "bug_code_uid": "c9acfc1eed8a5fd53c05bd1413cbda28", "src_uid": "8324fa542297c21bda1a4aed0bd45a2d", "apr_id": "0f6956a57df707ab58cb97eeb93de14c", "difficulty": 1500, "tags": ["geometry", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.99644128113879, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n var (a, b) = r.readLine()!!.split(\" \").map { it.toLong() }\n var ans = 0L\n while (a % b != 0L) {\n ans += a / b\n a = b.also { b = a % b }\n }\n ans += a\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "0aa074d82ab069dd8e0fcdd041fb7060", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83", "apr_id": "18b76776b1ff4eb020692e0075337a56", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9898580121703854, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.*\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main(){\n val (n, k) = readInts()\n val a = readInts().sorted()\n println(a)\n var cnt = IntArray(200005, {0})\n var ans = IntArray(200005, {0})\n for (i in 0 until n){\n var temp = a[i]\n var d = 0\n while (temp > 0){\n if (cnt[temp] < k) {\n cnt[temp]++;\n ans[temp] += d\n }\n temp /= 2\n d++\n }\n }\n var res = Int.MAX_VALUE\n for (i in 1..a[n - 1]){\n if (cnt[i] == k) res = min(res, ans[i])\n }\n print(res)\n}\n", "lang": "Kotlin", "bug_code_uid": "a94c9b8eec736fa81fb3ba54f29eb77d", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "apr_id": "ef377351cf3895a6e9e4b0dabaa131c5", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.910913647755753, "equal_cnt": 11, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.io.PrintWriter\nimport java.util.SortedMap\nimport java.util.StringTokenizer\nimport java.util.TreeMap\n\nval MAXN = 200000\n\nfun main() {\n val (n, k) = readInts(2)\n val A = readInts(n)\n val Cnt = A.groupingBy { it }.eachCountTo(HashMap())\n val bit = BIT(MAXN)\n\n var ans = Int.MAX_VALUE\n\n for((a, cn) in Cnt) bit.add(a, cn)\n cnt@ for((a, cn) in Cnt) {\n var need = k - cn\n var tot = 0\n var l = a\n var delta = 0\n var cost = 0\n\n while(need > 0) {\n l = l shl 1\n if(l > MAXN) continue@cnt\n cost++\n delta = (delta shl 1) + 1\n\n val get = minOf(need, bit.sum(l .. l + delta))\n need -= get\n tot += get * cost\n }\n\n if(tot < ans) ans = tot\n }\n\n println(ans)\n}\n\nclass BIT(val size: Int) {\n private val A = IntArray(size + 1)\n private val logn = generateSequence(size) { it shr 1 }.takeWhile { it > 1 }.count()\n\n // zeroes all the bits except the least significant one\n @Suppress(\"NOTHING_TO_INLINE\")\n private inline fun lsb(i: Int) = i and -i\n\n fun sum(end: Int): Int {\n var i = minOf(end, size)\n var sum = 0\n while(i > 0) {\n sum += A[i]\n i -= lsb(i)\n }\n return sum\n }\n\n fun sum(range: IntRange) = sum(range.last) - sum(range.first - 1)\n\n fun add(index: Int, value: Int) {\n var i = index // BIT is internally 1-indexed\n while(i <= size) {\n A[i] += value\n i += lsb(i)\n }\n }\n}\n\nfun readLn() = readLine()!!\nprivate var tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLine() ?: return \"\", \" \")\n return tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\n\ninline fun output(block: PrintWriter.()->Unit) { PrintWriter(System.out, false).apply(block).flush() }", "lang": "Kotlin", "bug_code_uid": "c2c47a475caa8d63d9bc0834a8415ac5", "src_uid": "ed1a2ae733121af6486568e528fe2d84", "apr_id": "061f78ed88a7e80e5f1c1cb00f4ef5cf", "difficulty": 1500, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.05386675066939676, "equal_cnt": 44, "replace_cnt": 33, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 45, "bug_source_code": "fun main() {\n val (a, b) = readLongs().sortedDescending()\n\n val ans = run {\n var minr = Long.MAX_VALUE\n var mink = -1\n for(k in 0..Int.MAX_VALUE) {\n val r = (a+k).lcm(b+k)\n if(r < minr) {\n minr = r\n mink = k\n }\n\n if(a+k >= minr) return@run mink\n }\n error(\"Should've TLE by now\")\n }\n\n println(ans)\n}\n\ntailrec fun Long.gcd(other: Long): Long = if(other == 0L) this else other.gcd(rem(other))\nfun Long.lcm(other: Long) = times(other) / gcd(other)\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readStringSeq() = readLn().splitToSequence(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readIntSeq() = readStringSeq().map { it.toInt() }\nfun readIntArray(size: Int) = readIntSeq().iterator().let { i -> IntArray(size) { i.next() } }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readDoubleSeq() = readStringSeq().map { it.toDouble() }\nfun readDoubleArray(size: Int) = readDoubleSeq().iterator().let { i -> DoubleArray(size) { i.next() } }\nfun readLongs() = readStrings().map { it.toLong() }\nfun readLongSeq() = readStringSeq().map { it.toLong() }\nfun readLongArray(size: Int) = readLongSeq().iterator().let { i -> LongArray(size) { i.next() } }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println() { sb.append('\\n') }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit) { Output().apply(block).nowPrint() }", "lang": "Kotlin", "bug_code_uid": "22c21b5955f261c3acbd9c365f091232", "src_uid": "414149fadebe25ab6097fc67663177c3", "apr_id": "1a4864f73956e82e1332325f13cae00c", "difficulty": 1800, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.999223344058582, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() {\n output {\n val a = readInt()\n val b = readInt()\n\n val min = min(a, b)\n\n val ans = abs(a - b).divisors()\n .map { q -> -min umod q }\n .allMinBy { k -> lcm(a + k, b + k) }.minBy { it }!!\n\n println(ans)\n }\n}\n\ninline infix fun Int.umod(base: Int) = Math.floorMod(this, base)\n\ntailrec fun gcd(a: Int, b: Int): Int = if(a == 0) abs(b) else gcd(b % a, a)\nfun lcm(a: Int, b: Int): Long = a / gcd(a, b) * b.toLong()\n\nfun Int.divisors() = sequence {\n val n = this@divisors\n if(n <= 0) return@sequence\n val tail = mutableListOf()\n\n for(p in 1..Int.MAX_VALUE) {\n val sq = p * p\n if(sq > n) break\n if(n % p == 0) {\n yield(p)\n if(sq != n) tail.add(n / p)\n }\n }\n\n yieldAll(tail.asReversed())\n}\n\ninline fun > Sequence.allMinBy(selector: (T) -> R): List {\n val result = mutableListOf()\n var min: R? = null\n\n for(it in this) {\n val r = selector(it)\n if(min == null || r < min) {\n min = r\n result.clear()\n result.add(it)\n } else if(r.compareTo(min) == 0) { result.add(it) }\n }\n\n return result\n}\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\ninline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}", "lang": "Kotlin", "bug_code_uid": "10f7f5e845fc9688d16e81384f6abc32", "src_uid": "414149fadebe25ab6097fc67663177c3", "apr_id": "1a4864f73956e82e1332325f13cae00c", "difficulty": 1800, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9138004246284501, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n\n\nfun main(){\n\n var a = nl()\n var b = nl()\n\n if(b l){\n best = l\n k = i\n }\n }\n println(k)\n}\n\nfun gcd(a: Long, b: Long): Long {\n return if (b == 0L) Math.abs(a) else gcd(b, a % b)\n}\n\nfun lcm(a: Long, b: Long): Long {\n return Math.abs(a / gcd(a, b) * b)\n}\n\nvar input = Scanner(System.`in`)\n\nfun ni() = input.nextInt()\n\nfun nia(n: Int) = Array(n) { ni() }\n\nfun nim(n: Int, m: Int) = Array(n) { nia(m) }\n\nfun nl() = input.nextLong()\n\nfun nla(n: Int) = Array(n) { nl() }\n\nfun nlm(n: Int, m: Int) = Array(n) { nla(m) }\n\nfun ns() = input.next()\n\nfun nsa(n: Int) = Array(n) { ns() }", "lang": "Kotlin", "bug_code_uid": "5b809dd878bfeab69a91930174808a22", "src_uid": "414149fadebe25ab6097fc67663177c3", "apr_id": "6611714ff8ae8b6dec0ca34932dbe84f", "difficulty": 1800, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7225130890052356, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\nvar sc = Scanner(System.`in`)\nval x = sc.nextInt()\n val h = sc.nextInt()\n val m = sc.nextInt()\n if (m==7){\n println(0)\n return\n }else {\n var dec = m-x\n var occ = 1\n while (true){\n if (dec%10==7)break\n if (dec<0){\n dec=60+dec\n occ--\n }else if (dec<60){\n dec-=x\n }else {\n dec+=x-60\n }\n occ++\n }\n println(occ)\n }\n}\n\n\n\n\n/* var acc = m - x\n var dec = m + x\n var occ = 1\n while (true) {\n if (((acc)%10 == 7 || (dec )%10== 7)){\n break\n }\n acc-=x\n println(acc)\n dec+=x\n println(dec)\n occ++\n println(occ)\n }\n println(occ)*/", "lang": "Kotlin", "bug_code_uid": "831ee0f7ddd3636fc76147b7fe12612b", "src_uid": "5ecd569e02e0164a5da9ff549fca3ceb", "apr_id": "d78403376074b0fa00ed8318e4613000", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.93359375, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun getMin(a, b, c)\n{\n if (a <= b && a <= c) return a\n if (b <= c) return b\n return c\n}\n\nfun main()\n{\n val nn = readLine()!!.split(\" \").map { it.toInt() }\n val mini = getMin(nn[0], nn[1] - 1, nn[2] - 2) + 1\n println(mini * 3)\n}\n", "lang": "Kotlin", "bug_code_uid": "9bf80b97cf1f96793c73f20923c6c3b8", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "a8c3d6c86d45256e13210853823840fb", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9320594479830149, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val readString = reader.readLine().split(\" \")\n val y = readString[0].toInt()\n val b = readString[1].toInt()\n val r = readString[2].toInt()\n println(getMaxOrnaments(y, b, r))\n}\n\nfun getMaxOrnaments(y: Int, b: Int, r: Int): Int {\n val input = arrayOf(y, b - 1, r - 2)\n val x = input[input.indices.minBy { input[it] }!!]\n return 3 * x + 3\n}", "lang": "Kotlin", "bug_code_uid": "c27e9b4b2110140c11d6de37367e1aeb", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "7103d6640bf785121f55c9df6ad27309", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6755126658624849, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n val y = args[0].toInt()\n val b = args[1].toInt()\n val r = args[2].toInt()\n println(getMaxOrnaments(y, b, r))\n}\n\nfun getMaxOrnaments(y: Int, b: Int, r: Int): Int {\n val input = arrayOf(y, b - 1, r - 2)\n val x = input[input.indices.minBy { input[it] }!!]\n return 3 * x + 3\n}", "lang": "Kotlin", "bug_code_uid": "74e00117e6b496fa14fd0f08225a038b", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "7103d6640bf785121f55c9df6ad27309", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9735099337748344, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.min\n\nfun main(args : Array) {\n\n val NT = readLine()?.toInt() ?: 0\n\n for(test in 1..NT){\n val (a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n val d = min(a, min(b - 1, c - 2))\n val ans = 3 * (d + 1)\n\n println(\"Case #$test: $ans\")\n\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "5d6dbe8c713876eca36d0f74161ecd2e", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "1056e72695f61d1ca3b70134a65a661e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9487603305785124, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package higherOrderFunKotlin\n\nimport java.util.Scanner\n\n\n fun main(args: Array) {\n\n val sc = Scanner(System.`in`)\n\n\n val y = sc.nextInt()\n val b = sc.nextInt() - 1\n val r = sc.nextInt() - 2\n\n val result = Math.min(Math.min(y, b), r) * 3 + 3\n\n println(result)\n }\n", "lang": "Kotlin", "bug_code_uid": "0dac6195f000885719d55fa5e28b2bf9", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "ad0c54bbd8b82779712a16734bab79b2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.4629080118694362, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 14, "bug_source_code": "fun main(args:Array){\n\tvar t = 0\n\tvar x = 0\n\tvar y = 0\n\tt = Integer.valueOf(readLine())\n\tx = Integer.valueOf(readLine())\n\ty = Integer.valueOf(readLine())\n\tvar ans = 0\n\tfor(i in 1..t+1){\n\t\tvar temp = i\n\t\ttemp +=1\n\t\tvar temp2 = i\n\t\ttemp2 +=2\n\t\tif(temp<=x && temp2<=y){\n\t\t\tans = i + temp + temp2\n\t\t}\n\t}\n\tprintln(\"$ans\")\t\n}", "lang": "Kotlin", "bug_code_uid": "136c4d5f0e5b5525aa9d400094ff6af9", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "3d4a5a8a2c795391f81b8a3ba06c492d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4014466546112116, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import javax.swing.text.MutableAttributeSet\n\nclass Main {\n\n companion object {\n @JvmStatic\n fun main(args: Array) {\n\n var inputList =readLine()!!.split(\" \").toList()\n\n var beginList = mutableListOf(1, 2, 3)\n while (true) {\n\n if (beginList.count { b -> inputList.count { b <= it.toString().toInt() } == 3} != 3)\n break\n else\n beginList.replaceAll { it + 1 }\n\n }\n// beginList.replaceAll { it - 1 }\n println(beginList.sum())\n\n\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "b64a99ade48155a016433a97513d2de4", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "09cd4ead0c3a16225ae1fdc58e6c6c12", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5855513307984791, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n\n val (a,b,c) = readInts()\n println((6 + 3*minOf(a,b-1,c-2)))\n}", "lang": "Kotlin", "bug_code_uid": "24f723eabd5f7a762e65d5dd2c878342", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "6fb9fef56039b50ad6aec09f004bf216", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9035087719298246, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n var (y,b,r) = readInts();\n println(max(y,max(b-1,r-2))*3+3)\n}", "lang": "Kotlin", "bug_code_uid": "ffeb6ad79b7dfd372c71e878820d52f0", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "65fbc1b0d5058e9703393ef06078a570", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9232283464566929, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n var y = readLine()!!.toInt()\n var b = readLine()!!.toInt()\n var r = readLine()!!.toInt()\n\n if (r <= b) {\n b = r - 1\n if (b <= y) {\n y = b - 1\n } else {\n b = y + 1\n r = b + 1\n }\n } else {\n if (b <= y) {\n y = b - 1\n r = b + 1\n }\n else {\n b = y + 1\n r = b + 1\n }\n }\n println(y + b + r)\n}\n\nfun log(n: Int) {\n println(\"Log: $n\")\n}", "lang": "Kotlin", "bug_code_uid": "dd25072292c0918dd4dce3c178a8e97a", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "36891e86ec9d7d8fb300adf3b62d7624", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9509306260575296, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.lang.Math.min\nimport java.util.Scanner\n\nfun main()\n{\n val reader = Scanner(System.`in`)\n\n var y = reader.nextInt()\n var b = reader.nextInt()\n var r = reader.nextInt()\n var ans = min(y,b-1)\n ans = min(r-28 1,ans)\n ans = ans*3 + 3;8\n println(ans)\n\n\n}", "lang": "Kotlin", "bug_code_uid": "a203cddf2f9f26dd53c3ec4988f4b138", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "c4ad8e17a195bf85abed877b9fabbe8b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8426150121065376, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import kotlin.math.max\n\nfun main(args: Array) {\n val (y, b, r) = readLine()!!.split(Regex.fromLiteral(\"\\\\s\")).map {\n it.toInt()\n }\n println(max(y + 2, max(b + 1, r)) * 3 - 3)\n}", "lang": "Kotlin", "bug_code_uid": "0ea29628a12fdba4915cc702bc46bb7f", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "87b23a6953f28b417f85421333badca2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.27897838899803534, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array): int {\n val inputNums = args[0].split(\" \")\n var min = 1\n inputNums.forEachIndexed { index, s ->\n if (index + s.toInt() > min) {\n min = s.toInt()\n }\n }\n return (min+1)*3\n}", "lang": "Kotlin", "bug_code_uid": "1d0f99905ff41e255682680d220fdd7c", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "dfa9bfa3b107f0b7bc997f711ab82d62", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8636363636363636, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val inputNums = args[0].split(\" \")\n var max = Int.MAX_VALUE\n inputNums.forEachIndexed { index, s ->\n if (s.toInt() - index < max) {\n max = s.toInt() - index\n }\n }\n println( (max+1) *3)\n}", "lang": "Kotlin", "bug_code_uid": "93725bfdca4a6a1efdb6ab9fad64a044", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "dfa9bfa3b107f0b7bc997f711ab82d62", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.961038961038961, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readLong() = readLn().toLong()\nfun readBigInt(radix: Int = 10) = readLn().toBigInteger(radix)\nfun readBigDecimal() = readLn().toBigDecimal()\nfun readLinesSeq(limit: Int = Int.MAX_VALUE) = generateSequence { readLine() }.take(limit)\nfun readStrings(delim: Char = ' ') = readLn().split(delim)\nfun readInts() = readStrings().map { it.toInt() }\nfun readLongs() = readStrings().map { it.toLong() }\n\nfun readIntArray() = readInts().toIntArray()\nfun readLnIntArray(n: Int) = IntArray(n) { readInt() }\nfun readLongArray() = readLongs().toLongArray()\nfun readLnLongArray(n: Int) = LongArray(n) { readLong() } \n\n\nfun main(){\n\tval (x, y, z) = readLine()!!.split(\" \").map { it.toInt() }\n while (x > y - 1 || x > z - 2){\n x = x - 1\n }\n println(3 * x + 3)\n}", "lang": "Kotlin", "bug_code_uid": "932b56234f56003e259f5559da2dbbb0", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "5b37d0128b17e92c63a9b38f3341b2c4", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9282178217821783, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package com.example.circleprogressbar\n\nimport java.lang.Math.min\n\nfun main(args : Array) {\n val (y,b,r) = readInts()\n var c = min(min(y +2, b + 1), r)\n println(c*3-3)\n}\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n", "lang": "Kotlin", "bug_code_uid": "c4822f360c531d42c124f18b034703d2", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "0802f8e8f62fdbc6e80c3357971dfa3d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9122468659594986, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.io.*\n\nfun main() {\n var temp = readLine()\n \n val tokens = temp.split(\" \")\n var list = mutableListOf()\n for (token in tokens) {\n list.add(token.toInt())\n }\n val min = list.min()\n var total = 0\n when {\n list[2] == min -> total = list[2] + (list[2]-1) + (list[2]-2)\n list[1] == min -> total = list[1] + (list[1]-1) + (list[1]+1)\n else -> total = list[0] + (list[0]+1) + (list[0]+2)\n }\n println(total)\n}", "lang": "Kotlin", "bug_code_uid": "e74611fdaa85c0f017c28b385e8e271d", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "28ee5fa7f6dfda3e2296fdb413e06b7d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9322709163346613, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val s = readLine()\n val s2 = s.split(' ')\n var yellows = s2[0].toInt()\n var blues = s2[1].toInt()\n var reds = s2[2].toInt()\n\n if (yellows >= blues) {\n yellows -= (yellows - blues) + 1\n }\n if (blues != yellows + 1) {\n blues = yellows + 1\n }\n if (blues >= reds) {\n blues -= (blues - reds) + 1\n yellows -= (blues - reds) + 2\n }\n if (reds != blues + 1) {\n reds = blues + 1\n }\n print(yellows + blues + reds)\n}", "lang": "Kotlin", "bug_code_uid": "a0d9595475eddd73aa810294e7cfd705", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "48b1309ed9efd461e97bcaaffc2042de", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9404255319148936, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main( args : Array) {\n\n val str= readLine()!!\n val str = \"13 3 6\"\n val ar = str.split(\" \")\n val y = ar[0].toInt()\n val b = ar[1].toInt()\n val r = ar[2].toInt()\n val n = minOf(y + 1, b, r - 1)\n println(n*3)", "lang": "Kotlin", "bug_code_uid": "e1c6b6b20334afdcbe14e31261eae8a3", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "b09db1830e66cbbb18c5abc5230f8a50", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7729789590254706, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n fun readInt() = readLine()!!.toInt()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val numHolds = readInt()\n val heights = readInts()\n var sol = Int.MAX_VALUE\n for (pos in 1 until numHolds - 1) sol = max(heights[pos] - heights[pos - 1],\n min(sol, heights[pos + 1] - heights[pos - 1]))\n sol = max(sol, heights.last() - heights.lastIndex - 1)\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "3d771a007d4e3b4fd856fd2d77779aad", "src_uid": "8a8013f960814040ac4bf229a0bd5437", "apr_id": "e87754b4178e675b917d37f9a28740af", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9521203830369357, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val lengthArray = readLine()!!.split(\" \").asSequence().map { it.toInt() }.toList()\n\n if (n == 3) {\n println(lengthArray[2] - lengthArray[0])\n return\n }\n\n var min = lengthArray[1] - lengthArray[0] + lengthArray[2] - lengthArray[1]\n var max = lengthArray[1] - lengthArray[0]\n\n for (i in 2 until n - 1) {\n val left = lengthArray[i] - lengthArray[i - 1]\n val right = lengthArray[i + 1] - lengthArray[i]\n\n if (left > max) {\n max = left\n }\n\n if (left + right < min) {\n min = left + right\n }\n }\n\n println(if (min > max) min else max)\n}", "lang": "Kotlin", "bug_code_uid": "04f87b8f51ee94631d0cb47e870ff4c2", "src_uid": "8a8013f960814040ac4bf229a0bd5437", "apr_id": "5e0f29e235de7821784ea436e3efee00", "difficulty": 900, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9759248385202584, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val reader = java.util.Scanner(System.`in`)\n val n = reader.nextInt()\n val c = reader.nextInt()\n val ps = ArrayList(n)\n val pssum = ArrayList(n)\n val pssumrev = ArrayList(n)\n\n val ts = ArrayList(n)\n for (i in 1..n) {\n ps.add(reader.nextInt())\n pssum.add(0)\n pssumrev.add(0)\n }\n\n for (i in 1..n)\n ts.add(reader.nextInt())\n\n var sum : Int=0\n var sumrev : Int = 0\n for (i in ts.indices) {\n sum += ts[i]\n sumrev += ts[n-i-1]\n pssum[i]=sum\n pssumrev[n-i-1]=sumrev\n }\n\n val a= ps.zip(pssum){a, b -> if (a if (a) {\n\n var sc = Scanner(System.`in`)\n\n var n = sc.nextInt()\n var a = sc.nextInt()\n val arr= IntArray(n+1)\n for (i in 1 ..n )arr[i]=sc.nextInt()\n \n var count =0\n for ( i in 1 ..n){\n if(arr[i] == 1 ){\n if (!(2*a-i >=0 && 2*a-i<=n && arr[2*a-i]==0)){\n count++\n }\n }\n }\n\n println(count)\n}\n", "lang": "Kotlin", "bug_code_uid": "c100e287830de16ecd2b3505dffbdadc", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "apr_id": "1c0f536e668093e25f4ccb93e3771ab4", "difficulty": 1000, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9864768683274021, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package Codeforces\n\nfun main() {\n var (a, m) = readLine()!!.split(' ').map { it.toInt() }\n var list = readLine()!!.split(' ').map { it.toInt() }\n\n var max = maxOf(m, list.size - m)\n var left = m - 2\n var right = m\n var count = 0\n var i = 0\n while (i < max) {\n if (left >= 0 && right < list.size) {\n if (list[left] == 1 && list[right] == 1) {\n count += 2\n }\n } else if (left >= 0) {\n if (list[left] == 1) count++\n } else if (right < list.size) {\n if (list[right] == 1) count++\n }\n i++\n right++\n left--\n }\n if (list[m - 1] == 1) {\n count++\n }\n\n println(count)\n\n\n}", "lang": "Kotlin", "bug_code_uid": "9fae43375538926b443ce5f41df5f674", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "apr_id": "7dc34100d2b90e23eca654e62294cec2", "difficulty": 1000, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7959442332065906, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*\nfun main(args: Array) {\n var sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var k = sc.nextInt()\n val b= IntArray(n+1)\n for (i in 1 ..n )b[i]=sc.nextInt()\n\n var c =0\n for ( i in 1 ..n){\n if(b[i] == 1 ){\n var d=i-k\n var j=k-d\n var l=b[j]\n if(j<1||j>n||b[i]==l) c++\n }\n }\n\n println(c)\n}", "lang": "Kotlin", "bug_code_uid": "cf66645df380e8e80c7343b391977da3", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "apr_id": "dfffebca925f183645449a6cef910324", "difficulty": 1000, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.18356164383561643, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "fun main(){\n var (n,k)=readLine()!!.split(' ').map(String::toInt)\n var a=readLine()!!.split(' ').map(String::toInt)\n var c=0\n for(i in 0..n-1){\n if(a[i]==1){\n var e=i\n var d=e-k\n var j=k-d\n var l=a[j-1]\n if(j<0||j>n-1||a[i]==l) c++\n }\n }\n println(c)\n}\n", "lang": "Kotlin", "bug_code_uid": "b4eb5ec10aaf7088e5aed376f151e112", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "apr_id": "dfffebca925f183645449a6cef910324", "difficulty": 1000, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7984790874524715, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\nfun main(args: Array) {\n var sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var a = sc.nextInt()\n val b= IntArray(n+1)\n for (i in 1 ..n )b[i]=sc.nextInt()\n\n var c =0\n for ( i in 1 ..n){\n if(b[i] == 1 ){\n var d=i-k\n var j=k-d\n var l=b[j]\n if(j<1||j>n||b[i]==l) c++\n }\n }\n\n println(c)\n}", "lang": "Kotlin", "bug_code_uid": "2478b53689be7dcd2aba40996018bf64", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5", "apr_id": "dfffebca925f183645449a6cef910324", "difficulty": 1000, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9986339464311851, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\nimport java.lang.Math.*\n\nconst val STRESS = false\nconst val STRESS_ITER = 100\n\ndata class Solver(val io: FastIO) {\n fun FastIO.solve() {\n val n = nextInt()\n val a = IntList(n / 2, { nextInt() - 1 })\n var a1 = 0\n var a2 = 0\n a.sort()\n for (i in 0 until a.size) {\n a1 += abs(a[i] - i * 2)\n a2 += abs(a[i] - i * 2 - 1)\n }\n println(min(a1, a2))\n }\n\n fun run() {\n io.use { it.solve() }\n }\n}\n\nfun main(args: Array) {\n if (System.getProperty(\"KLOCAL\") != null) {\n if (STRESS) {\n Stresser.doStress()\n } else {\n Solver(FastIO(FileInputStream(\"input.txt\"), System.out)).run()\n }\n } else {\n Solver(FastIO(System.`in`, System.out)).run()\n }\n}\n\ndata class SlowSolver(val io: FastIO) {\n fun FastIO.slowSolve() {\n\n }\n\n fun run() {\n io.use { it.slowSolve() }\n }\n}\n\nclass Stresser {\n companion object {\n const val INPUT = \"input.txt\"\n const val OUTPUT = \"output.txt\"\n const val SLOW = \"slow.txt\"\n\n fun PrintWriter.generateTest() {\n val rand = Random(31)\n\n }\n\n fun doStress() {\n for (it in 1..STRESS_ITER) {\n System.err.println(it)\n PrintWriter(INPUT).use { it.generateTest() }\n SlowSolver(FastIO(FileInputStream(INPUT), FileOutputStream(SLOW))).run()\n Solver(FastIO(FileInputStream(INPUT), FileOutputStream(OUTPUT))).run()\n compareFiles()\n }\n }\n\n fun compareFiles() {\n val out = File(OUTPUT).readLines().toMutableList()\n val slw = File(SLOW).readLines().toMutableList()\n while (out.size < slw.size) {\n out.add(\"\\n\")\n }\n while (out.size > slw.size) {\n slw.add(\"\\n\")\n }\n for (i in 0 until out.size) {\n if (out[i].trimEnd() != slw[i].trimEnd()) {\n throw AssertionError(\"\\nline ${i + 1}\\nout: ${out[i]}\\nslw: ${slw[i]}\")\n }\n }\n }\n }\n}\n\nclass FastIO(input: InputStream, output: OutputStream) : PrintWriter(output, false) {\n val br = BufferedReader(InputStreamReader(input))\n var stok = StringTokenizer(\"\")\n\n fun nextToken(): String? {\n while (!stok.hasMoreTokens()) {\n val s = br.readLine() ?: return null\n stok = StringTokenizer(s)\n }\n return stok.nextToken()\n }\n\n fun nextInt(): Int {\n return nextToken()!!.toInt()\n }\n\n fun nextLong(): Long {\n return nextToken()!!.toLong()\n }\n\n fun nextDouble(): Double {\n return nextToken()!!.toDouble()\n }\n\n fun print(vararg args: Any?) {\n args.forEachIndexed { i, arg ->\n if (i != 0) {\n print(\" \")\n }\n print(arg)\n }\n }\n\n fun println(vararg args: Any?) {\n print(*args)\n println()\n }\n}\n\nclass IntList {\n private var a: IntArray\n var size = 0\n\n constructor() {\n a = IntArray(4)\n }\n\n constructor(n: Int, x: Int = 0) {\n a = if (x == 0) {\n IntArray(n)\n } else {\n IntArray(n, { x })\n }\n size = n\n }\n\n constructor(n: Int, init: (Int) -> Int) {\n a = IntArray(n, init)\n size = n\n }\n\n fun add(x: Int) {\n ensureCapacity()\n a[size++] = x\n }\n\n fun front(): Int {\n return a[0]\n }\n\n fun back(): Int {\n return a[size - 1]\n }\n\n fun pop(): Int {\n return a[--size]\n }\n\n operator fun get(i: Int): Int {\n return a[i]\n }\n\n operator fun set(i: Int, x: Int) {\n a[i] = x\n }\n\n fun removeAt(i: Int) {\n var i = i\n while (i + 1 < size) {\n a[i] = a[i + 1]\n i++\n }\n --size\n }\n\n fun rotate(distance: Int) {\n if (size == 0)\n return\n var distance = distance % size\n if (distance < 0)\n distance += size\n if (distance == 0)\n return\n\n var cycleStart = 0\n var nMoved = 0\n while (nMoved != size) {\n var displaced = a[cycleStart]\n var i = cycleStart\n do {\n i += distance\n if (i >= size)\n i -= size\n val tmp = a[i]\n a[i] = displaced\n displaced = tmp\n nMoved++\n } while (i != cycleStart)\n cycleStart++\n }\n }\n\n fun isEmpty(): Boolean {\n return size == 0\n }\n\n operator fun contains(x: Int): Boolean {\n for (i in 0 until size) {\n if (a[i] == x) {\n return true\n }\n }\n return false\n }\n\n override fun equals(other: Any?): Boolean {\n if (other == null || other !is IntList || size != other.size) {\n return false\n }\n\n for (i in 0 until size) {\n if (a[i] != other.a[i]) {\n return false\n }\n }\n\n return true\n }\n\n operator fun compareTo(other: IntList): Int {\n var i = 0\n while (i < min(size, other.size)) {\n if (a[i] < other.a[i]) {\n return -1\n }\n if (a[i] > other.a[i]) {\n return 1\n }\n }\n if (size < other.size) {\n return -1\n }\n if (size > other.size) {\n return 1\n }\n return 0\n }\n\n fun sort(from: Int = 0, to: Int = size) {\n a.sort(from, to)\n }\n\n fun reverse() {\n var i = 0\n while (i * 2 < size) {\n val x = a[i]\n a[i] = a[size - 1 - i]\n a[size - 1 - i] = x\n i++\n }\n }\n\n fun shuffle(rand: Random = Random()) {\n for (i in 1 until size) {\n val j = rand.nextInt(i + 1)\n if (i != j) {\n val x = a[i]\n a[i] = a[j]\n a[j] = x\n }\n }\n }\n\n fun nextPermutation(): Boolean {\n var i = size - 2\n while (i >= 0) {\n if (a[i] < a[i + 1]) {\n var b = size - 1\n while (true) {\n if (a[b] > a[i]) {\n var t = a[i]\n a[i] = a[b]\n a[b] = t\n ++i\n b = size - 1\n while (i < b) {\n t = a[i]\n a[i] = a[b]\n a[b] = t\n ++i\n --b\n }\n return true\n }\n --b\n }\n }\n --i\n }\n return false\n }\n\n fun forEach(block: (x: Int) -> Unit) {\n for (i in 0 until size) {\n block(a[i])\n }\n }\n\n fun forEachIndexed(block: (i: Int, x: Int) -> Unit) {\n for (i in 0 until size) {\n block(i, a[i])\n }\n }\n\n fun getArray(): IntArray {\n return a.copyOf(size)\n }\n\n private fun ensureCapacity() {\n if (size == a.size) {\n a = a.copyOf(size * 2)\n }\n }\n}\n\nclass LongList {\n private var a: LongArray\n var size = 0\n\n constructor() {\n a = LongArray(4)\n }\n\n constructor(n: Int, x: Long = 0) {\n a = if (x == 0L) {\n LongArray(n)\n } else {\n LongArray(n, { x })\n }\n size = n\n }\n\n constructor(n: Int, init: (Int) -> Long) {\n a = LongArray(n, init)\n size = n\n }\n\n fun add(x: Long) {\n ensureCapacity()\n a[size++] = x\n }\n\n fun front(): Long {\n return a[0]\n }\n\n fun back(): Long {\n return a[size - 1]\n }\n\n fun pop(): Long {\n return a[--size]\n }\n\n operator fun get(i: Int): Long {\n return a[i]\n }\n\n operator fun set(i: Int, x: Long) {\n a[i] = x\n }\n\n fun removeAt(i: Int) {\n var i = i\n while (i + 1 < size) {\n a[i] = a[i + 1]\n i++\n }\n --size\n }\n\n fun rotate(distance: Int) {\n if (size == 0)\n return\n var distance = distance % size\n if (distance < 0)\n distance += size\n if (distance == 0)\n return\n\n var cycleStart = 0\n var nMoved = 0\n while (nMoved != size) {\n var displaced = a[cycleStart]\n var i = cycleStart\n do {\n i += distance\n if (i >= size)\n i -= size\n val tmp = a[i]\n a[i] = displaced\n displaced = tmp\n nMoved++\n } while (i != cycleStart)\n cycleStart++\n }\n }\n\n fun isEmpty(): Boolean {\n return size == 0\n }\n\n operator fun contains(x: Long): Boolean {\n for (i in 0 until size) {\n if (a[i] == x) {\n return true\n }\n }\n return false\n }\n\n override fun equals(other: Any?): Boolean {\n if (other == null || other !is LongList || size != other.size) {\n return false\n }\n\n for (i in 0 until size) {\n if (a[i] != other.a[i]) {\n return false\n }\n }\n\n return true\n }\n\n operator fun compareTo(other: LongList): Int {\n var i = 0\n while (i < min(size, other.size)) {\n if (a[i] < other.a[i]) {\n return -1\n }\n if (a[i] > other.a[i]) {\n return 1\n }\n }\n if (size < other.size) {\n return -1\n }\n if (size > other.size) {\n return 1\n }\n return 0\n }\n\n fun sort(from: Int = 0, to: Int = size) {\n a.sort(from, to)\n }\n\n fun reverse() {\n var i = 0\n while (i * 2 < size) {\n val x = a[i]\n a[i] = a[size - 1 - i]\n a[size - 1 - i] = x\n i++\n }\n }\n\n fun shuffle(rand: Random = Random()) {\n for (i in 1 until size) {\n val j = rand.nextInt(i + 1)\n if (i != j) {\n val x = a[i]\n a[i] = a[j]\n a[j] = x\n }\n }\n }\n\n fun nextPermutation(): Boolean {\n var i = size - 2\n while (i >= 0) {\n if (a[i] < a[i + 1]) {\n var b = size - 1\n while (true) {\n if (a[b] > a[i]) {\n var t = a[i]\n a[i] = a[b]\n a[b] = t\n ++i\n b = size - 1\n while (i < b) {\n t = a[i]\n a[i] = a[b]\n a[b] = t\n ++i\n --b\n }\n return true\n }\n --b\n }\n }\n --i\n }\n return false\n }\n\n fun forEach(block: (x: Long) -> Unit) {\n for (i in 0 until size) {\n block(a[i])\n }\n }\n\n fun forEachIndexed(block: (i: Int, x: Long) -> Unit) {\n for (i in 0 until size) {\n block(i, a[i])\n }\n }\n\n fun getArray(): LongArray {\n return a.copyOf(size)\n }\n\n private fun ensureCapacity() {\n if (size == a.size) {\n a = a.copyOf(size * 2)\n }\n }\n}\n\nclass DoubleList {\n private var a: DoubleArray\n var size = 0\n\n constructor() {\n a = DoubleArray(4)\n }\n\n constructor(n: Int, x: Double = .0) {\n a = if (x == .0) {\n DoubleArray(n)\n } else {\n DoubleArray(n, { x })\n }\n size = n\n }\n\n constructor(n: Int, init: (Int) -> Double) {\n a = DoubleArray(n, init)\n size = n\n }\n\n fun add(x: Double) {\n ensureCapacity()\n a[size++] = x\n }\n\n fun front(): Double {\n return a[0]\n }\n\n fun back(): Double {\n return a[size - 1]\n }\n\n fun pop(): Double {\n return a[--size]\n }\n\n operator fun get(i: Int): Double {\n return a[i]\n }\n\n operator fun set(i: Int, x: Double) {\n a[i] = x\n }\n\n fun removeAt(i: Int) {\n var i = i\n while (i + 1 < size) {\n a[i] = a[i + 1]\n i++\n }\n --size\n }\n\n fun rotate(distance: Int) {\n if (size == 0)\n return\n var distance = distance % size\n if (distance < 0)\n distance += size\n if (distance == 0)\n return\n\n var cycleStart = 0\n var nMoved = 0\n while (nMoved != size) {\n var displaced = a[cycleStart]\n var i = cycleStart\n do {\n i += distance\n if (i >= size)\n i -= size\n val tmp = a[i]\n a[i] = displaced\n displaced = tmp\n nMoved++\n } while (i != cycleStart)\n cycleStart++\n }\n }\n\n fun isEmpty(): Boolean {\n return size == 0\n }\n\n operator fun contains(x: Double): Boolean {\n for (i in 0 until size) {\n if (a[i] == x) {\n return true\n }\n }\n return false\n }\n\n override fun equals(other: Any?): Boolean {\n if (other == null || other !is DoubleList || size != other.size) {\n return false\n }\n\n for (i in 0 until size) {\n if (a[i] != other.a[i]) {\n return false\n }\n }\n\n return true\n }\n\n operator fun compareTo(other: DoubleList): Int {\n var i = 0\n while (i < min(size, other.size)) {\n if (a[i] < other.a[i]) {\n return -1\n }\n if (a[i] > other.a[i]) {\n return 1\n }\n }\n if (size < other.size) {\n return -1\n }\n if (size > other.size) {\n return 1\n }\n return 0\n }\n\n fun sort(from: Int = 0, to: Int = size) {\n a.sort(from, to)\n }\n\n fun reverse() {\n var i = 0\n while (i * 2 < size) {\n val x = a[i]\n a[i] = a[size - 1 - i]\n a[size - 1 - i] = x\n i++\n }\n }\n\n fun shuffle(rand: Random = Random()) {\n for (i in 1 until size) {\n val j = rand.nextInt(i + 1)\n if (i != j) {\n val x = a[i]\n a[i] = a[j]\n a[j] = x\n }\n }\n }\n\n fun nextPermutation(): Boolean {\n var i = size - 2\n while (i >= 0) {\n if (a[i] < a[i + 1]) {\n var b = size - 1\n while (true) {\n if (a[b] > a[i]) {\n var t = a[i]\n a[i] = a[b]\n a[b] = t\n ++i\n b = size - 1\n while (i < b) {\n t = a[i]\n a[i] = a[b]\n a[b] = t\n ++i\n --b\n }\n return true\n }\n --b\n }\n }\n --i\n }\n return false\n }\n\n fun forEach(block: (x: Double) -> Unit) {\n for (i in 0 until size) {\n block(a[i])\n }\n }\n\n fun forEachIndexed(block: (i: Int, x: Double) -> Unit) {\n for (i in 0 until size) {\n block(i, a[i])\n }\n }\n\n fun getArray(): DoubleArray {\n return a.copyOf(size)\n }\n\n private fun ensureCapacity() {\n if (size == a.size) {\n a = a.copyOf(size * 2)\n }\n }\n}\n\nclass BooleanList {\n private var a: BooleanArray\n var size = 0\n\n constructor() {\n a = BooleanArray(4)\n }\n\n constructor(n: Int, x: Boolean = false) {\n a = if (x == false) {\n BooleanArray(n)\n } else {\n BooleanArray(n, { x })\n }\n size = n\n }\n\n constructor(n: Int, init: (Int) -> Boolean) {\n a = BooleanArray(n, init)\n size = n\n }\n\n fun add(x: Boolean) {\n ensureCapacity()\n a[size++] = x\n }\n\n fun front(): Boolean {\n return a[0]\n }\n\n fun back(): Boolean {\n return a[size - 1]\n }\n\n fun pop(): Boolean {\n return a[--size]\n }\n\n operator fun get(i: Int): Boolean {\n return a[i]\n }\n\n operator fun set(i: Int, x: Boolean) {\n a[i] = x\n }\n\n fun removeAt(i: Int) {\n var i = i\n while (i + 1 < size) {\n a[i] = a[i + 1]\n i++\n }\n --size\n }\n\n fun rotate(distance: Int) {\n if (size == 0)\n return\n var distance = distance % size\n if (distance < 0)\n distance += size\n if (distance == 0)\n return\n\n var cycleStart = 0\n var nMoved = 0\n while (nMoved != size) {\n var displaced = a[cycleStart]\n var i = cycleStart\n do {\n i += distance\n if (i >= size)\n i -= size\n val tmp = a[i]\n a[i] = displaced\n displaced = tmp\n nMoved++\n } while (i != cycleStart)\n cycleStart++\n }\n }\n\n fun isEmpty(): Boolean {\n return size == 0\n }\n\n operator fun contains(x: Boolean): Boolean {\n for (i in 0 until size) {\n if (a[i] == x) {\n return true\n }\n }\n return false\n }\n\n override fun equals(other: Any?): Boolean {\n if (other == null || other !is BooleanList || size != other.size) {\n return false\n }\n\n for (i in 0 until size) {\n if (a[i] != other.a[i]) {\n return false\n }\n }\n\n return true\n }\n\n operator fun compareTo(other: BooleanList): Int {\n var i = 0\n while (i < min(size, other.size)) {\n if (a[i] < other.a[i]) {\n return -1\n }\n if (a[i] > other.a[i]) {\n return 1\n }\n }\n if (size < other.size) {\n return -1\n }\n if (size > other.size) {\n return 1\n }\n return 0\n }\n\n fun reverse() {\n var i = 0\n while (i * 2 < size) {\n val x = a[i]\n a[i] = a[size - 1 - i]\n a[size - 1 - i] = x\n i++\n }\n }\n\n fun shuffle(rand: Random = Random()) {\n for (i in 1 until size) {\n val j = rand.nextInt(i + 1)\n if (i != j) {\n val x = a[i]\n a[i] = a[j]\n a[j] = x\n }\n }\n }\n\n fun nextPermutation(): Boolean {\n var i = size - 2\n while (i >= 0) {\n if (a[i] < a[i + 1]) {\n var b = size - 1\n while (true) {\n if (a[b] > a[i]) {\n var t = a[i]\n a[i] = a[b]\n a[b] = t\n ++i\n b = size - 1\n while (i < b) {\n t = a[i]\n a[i] = a[b]\n a[b] = t\n ++i\n --b\n }\n return true\n }\n --b\n }\n }\n --i\n }\n return false\n }\n\n fun forEach(block: (x: Boolean) -> Unit) {\n for (i in 0 until size) {\n block(a[i])\n }\n }\n\n fun forEachIndexed(block: (i: Int, x: Boolean) -> Unit) {\n for (i in 0 until size) {\n block(i, a[i])\n }\n }\n\n fun getArray(): BooleanArray {\n return a.copyOf(size)\n }\n\n private fun ensureCapacity() {\n if (size == a.size) {\n a = a.copyOf(size * 2)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "8ed69812f21c29c33dcd52b32ea102a1", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "apr_id": "2f49855feb911948defec5f00a1afca7", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9808917197452229, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\nimport kotlin.math.min\n\nfun main(args : Array) {\n val n = readLine()!!.toInt()\n var arr : Array = readLine()!!.split(' ').map { it.toInt() }.toTypedArray()\n var moves1 = 0\n var moves2 = 0\n for (i in 1..(n/2)) {\n moves1 += abs(arr[i-1] - (i*2))\n moves2 += abs(arr[i-1] - (i*2 -1))\n }\n println(min(moves1, moves2))\n}", "lang": "Kotlin", "bug_code_uid": "dcca91097feedf69660fa4e853ecb8bf", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "apr_id": "eb7daa5842b6615de4e5c46fecf4ea3b", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9986734295747172, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.min\n\nclass A internal constructor(inputStream: InputStream, val out: PrintWriter) {\n companion object {\n val ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n }\n\n private val br = BufferedReader(InputStreamReader(inputStream))\n private var st = StringTokenizer(\"\")\n\n internal fun hasNext(): Boolean {\n while (!st.hasMoreTokens()) {\n val readLine = br.readLine() ?: return false\n st = StringTokenizer(readLine)\n }\n return true\n }\n\n private operator fun next() =\n if (hasNext()) st.nextToken()!!\n else throw RuntimeException(\"No tokens\")\n\n internal fun nline() = st.nextToken(\"\\n\")\n\n private fun ni(offset: Int = 0) = next().toInt() + offset\n private fun nii(offset: Int = 0) = Pair(ni(offset), ni(offset))\n private fun niii(offset: Int = 0) = Triple(ni(offset), ni(offset), ni(offset))\n\n private fun nia(n: Int, offset: Int = 0) = IntArray(n) { ni(offset) }\n private fun niaa(m: Int, n: Int, offset: Int = 0) = Array(m) { nia(n, offset) }\n\n private fun nl(offset: Long = 0L) = next().toLong() + offset\n private fun nll(offset: Long = 0L) = Pair(nl(offset), nl(offset))\n private fun nlll(offset: Long = 0L) = Triple(nl(offset), nl(offset), nl(offset))\n\n private fun nla(n: Int, offset: Long = 0L) = LongArray(n, { nl(offset) })\n private fun nlaa(m: Int, n: Int, offset: Long = 0L) = Array(m) { nla(n, offset) }\n\n private fun nd(offset: Double = 0.0) = next().toDouble() + offset\n private fun ndd(offset: Double = 0.0) = Pair(nd(offset), nd(offset))\n private fun nddd(offset: Double = 0.0) = Triple(nd(offset), nd(offset), nd(offset))\n\n private fun nda(n: Int, offset: Double = 0.0) = DoubleArray(n) { nd(offset) }\n private fun ndaa(m: Int, n: Int, offset: Double = 0.0) = Array(m) { nda(n, offset) }\n\n inline fun log(name: String, block: () -> Unit) {\n if (!ONLINE_JUDGE) {\n p(\"#$name: \")\n block()\n flush()\n }\n }\n\n inline fun log() = log(\"\") { pln() }\n inline fun log(message: Any?, name: String = \"\") = log(name) { pln(message) }\n inline fun log(arr: IntArray?, name: String = \"\", range: IntRange? = arr?.indices) = log(name) { pln(arr, range = range) }\n inline fun log(arr: LongArray?, name: String = \"\", range: IntRange? = arr?.indices) = log(name) { pln(arr, range = range) }\n inline fun log(arr: DoubleArray?, name: String = \"\", range: IntRange? = arr?.indices) = log(name) { pln(arr, range = range) }\n inline fun log(arr: Array?, name: String = \"\", range: IntRange? = arr?.indices) = log(name) { pln(arr, range = range) }\n inline fun log(stack: Stack?, name: String = \"\", range: IntRange? = stack?.indices) = log(name) { pln(stack, range = range) }\n inline fun log(list: List?, name: String = \"\", range: IntRange? = list?.indices) = log(name) { pln(list, range = range) }\n\n //prefix print\n inline fun prep(prefix: Boolean, separator: String, message: Any?) {\n if (prefix) {\n p(separator)\n }\n p(message)\n }\n\n inline fun p(message: Any?) = this.also { out.print(message) }\n\n inline fun p(arr: IntArray?, separator: String = \" \", range: IntRange? = arr?.indices) = this.also {\n range?.forEach { prep(it > 0, separator, arr?.get(it)) }\n }\n\n inline fun p(arr: LongArray?, separator: String = \" \", range: IntRange? = arr?.indices) = this.also {\n range?.forEach { prep(it > 0, separator, arr?.get(it)) }\n }\n\n inline fun p(arr: DoubleArray?, separator: String = \" \", range: IntRange? = arr?.indices) = this.also {\n range?.forEach { prep(it > 0, separator, arr?.get(it)) }\n }\n\n inline fun p(arr: Array?, separator: String = \" \", range: IntRange? = arr?.indices) = this.also {\n range?.forEach { prep(it > 0, separator, arr?.get(it)) }\n }\n\n inline fun p(list: List?, separator: String = \" \", range: IntRange? = list?.indices) = this.also {\n range?.forEach { prep(it > 0, separator, list?.get(it)) }\n }\n\n inline fun p(stack: Stack?, separator: String = \" \", range: IntRange? = stack?.indices) = this.also {\n range?.forEach { prep(it > 0, separator, stack?.get(it)) }\n }\n\n inline fun pln() = this.also { out.println() }\n inline fun pln(message: Any?) = p(message).pln()\n inline fun pln(arr: IntArray?, separator: String = \" \", range: IntRange? = arr?.indices) = p(arr, separator, range).pln()\n inline fun pln(arr: LongArray?, separator: String = \" \", range: IntRange? = arr?.indices) = p(arr, separator, range).pln()\n inline fun pln(arr: DoubleArray?, separator: String = \" \", range: IntRange? = arr?.indices) = p(arr, separator, range).pln()\n inline fun pln(arr: Array?, separator: String = \" \", range: IntRange? = arr?.indices) = p(arr, separator, range).pln()\n inline fun pln(list: List?, separator: String = \" \", range: IntRange? = list?.indices) = p(list, separator, range).pln()\n inline fun pln(stack: Stack?, separator: String = \" \", range: IntRange? = stack?.indices) = p(stack, separator, range).pln()\n\n inline fun flush() = out.flush()\n\n //////////////////////////////////////\n\n fun run() {\n val n = ni()\n val p = nia(n / 2, -1)\n var chan = 0\n var count = 0\n for (pi in p) {\n chan += abs(pi - count)\n count += 2\n }\n\n var le = 0\n count = 1\n for (pi in p) {\n le += abs(pi - count)\n count += 2\n }\n pln(min(chan,le))\n }\n\n}\n\n//////////////////////////////////////\nfun main(args: Array) {\n val inp = File(\"A.txt\")\n if (A.ONLINE_JUDGE || !inp.isFile) {\n val a = A(System.`in`, PrintWriter(BufferedOutputStream(System.out)))\n a.run()\n a.flush()\n a.out.close()\n } else {\n val t = A(FileInputStream(\"A.txt\"), PrintWriter(BufferedOutputStream(System.out)))\n while (t.hasNext()) {\n val name = t.nline()\n t.log(\"##### Test $name #####\")\n val startTime = System.currentTimeMillis()\n t.run()\n val endTime = System.currentTimeMillis()\n t.log(endTime - startTime, \"Total Time\")\n t.log()\n t.flush()\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "2d06bc4861e43925101a539985dc088c", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "apr_id": "336326e6c818431fa157bb263f178d6d", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9472361809045227, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val n = nextInt()\n\n val r = Array(n / 2) { nextInt() }\n\n val e = Array(n / 2) { 2 + it * 2 }\n val o = Array(n / 2) { 1 + it * 2 }\n\n val eSum = (0 until n / 2).sumBy { Math.abs(r[it] - e[it]) }\n val oSum = (0 until n / 2).sumBy { Math.abs(r[it] - o[it]) }\n\n println(Math.min(eSum, oSum))\n}", "lang": "Kotlin", "bug_code_uid": "90b14f87482ae5111b0eab4203a2241b", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "apr_id": "89c440b6083bd513e180faa65755d19e", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9904357066950054, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.absoluteValue\nimport kotlin.math.min\n\nfun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n readLine()\n val positions = readInts()\n var sol = Int.MAX_VALUE\n for (start in 1..2) {\n var target = start\n var oneSol = 0\n for (position in positions) {\n oneSol += (position - target).absoluteValue\n target += 2\n }\n sol = min(sol, oneSol)\n }\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "d7dcc8c41620f6c738f62cebe65c83e5", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "apr_id": "79164b4168cd2dcbc07d0d95dd94dab6", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.989522700814901, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.math.abs\nimport kotlin.math.min\n\nprivate val scan = Scanner(System.`in`)\n\nfun main(args: Array) {\n\n val n = scan.nextLong()\n val a = (0 until n/2).map { scan.nextLong() - 1 }\n\n val oddSum = a.mapIndexed { index, value -> abs(value - (2 * index + 1)) }.sum()\n val evenSum = a.mapIndexed { index, value -> abs(value - 2 * index) }.sum()\n\n println(min(oddSum, evenSum))\n}\n", "lang": "Kotlin", "bug_code_uid": "70511e8f8ee9e94065c5825119652532", "src_uid": "0efe9afd8e6be9e00f7949be93f0ca1a", "apr_id": "68a250d1c34ed69a895adafd4492a6ed", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9499323410013532, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n var n = scan.nextInt()\n var m = scan.nextInt()\n var a = scan.nextInt()\n var b = scan.nextInt()\n if (n%m==0) print(0)\n else {\n val p=(n+m-1)/m\n if ((n-(m*(p-1)))*b<(m*p-n)*a) print ((n-(m*(p-1)))*b)\n else print ((m*p-n)*a)\n }\n}", "lang": "Kotlin", "bug_code_uid": "2d181f86e81a24823a1a2c1338476bd8", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "32d5c0adff4b6314ff6d81aa30c23a5a", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9878869448183042, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n var n = scan.nextLong()\n var m = scan.nextLong()\n var a = scan.nextLong()\n var b = scan.nextLong()\n if (n%m==0) print(0)\n else {\n val p=(n+m-1)/m\n if ((n-(m*(p-1)))*b<(m*p-n)*a) print ((n-(m*(p-1)))*b)\n else print ((m*p-n)*a)\n }\n}", "lang": "Kotlin", "bug_code_uid": "0365afc75ca9464ac27650c611dee0af", "src_uid": "c05d753b35545176ad468b99ff13aa39", "apr_id": "32d5c0adff4b6314ff6d81aa30c23a5a", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9809358752166378, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val a = nextInt()\n val b = nextInt()\n val c = nextInt()\n val d = x(a,c) * x(b,c)\n println(d)\n}\n\nfun x(a : Int , b:Int) : Long {\n val x = if (a % b == 0) 0 else 1\n return a / b + x\n}", "lang": "Kotlin", "bug_code_uid": "9e3d059824a0d08bf06eec3ba7037f08", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "a2644339c8216ed6c6f72379efe7509b", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7058823529411765, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val (sn, sm, sa) = readLine()!!.split(' ')\n val n = sn.toInt()\n val m = sm.toInt()\n val a = sa.toInt()\n \n println((Math.ceil(n/a) * Math.ceil(m/a)).toInt())\n}", "lang": "Kotlin", "bug_code_uid": "7319aaa983fbbfa2306b89387ce61c85", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "8fd09fece91ed76aed931a2362fa9200", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7713498622589532, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import kotlin.math.floor\n\nfun main(args: Array) {\n val (n, m, a) = readLine()!!.split(\" \").map { it.toDouble() }\n println(floor(n / a) * floor(n / b))\n}", "lang": "Kotlin", "bug_code_uid": "98bfaf888a240fa5e6543ec2c98b994d", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "927084c11af3169a8c169d900f1de9a4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5186335403726708, "equal_cnt": 42, "replace_cnt": 24, "delete_cnt": 1, "insert_cnt": 16, "fix_ops_cnt": 41, "bug_source_code": "fun main(){\n var n = Integer.valueOf(readLine())\n var m = Integer.valueOf(readLine())\n var a = Integer.valueOf(readLine())\n\n if(n <= a && m<=a){\n println(1)\n return\n }\n\n if (n<=a){\n if (m % a != 0){\n println(m/a+1)\n }else{\n println(m/a)\n }\n return\n }\n\n if (m<=a){\n if (n % a != 0){\n println(n/a+1)\n }else{\n println(n/a)\n }\n return\n }\n\n if(n % a == 0){\n if (m % a != 0) {\n println((m/a+1)*(n/a))\n }else{\n println((m/a)*(n/a))\n }\n return\n }\n\n if (m % a == 0){\n if (n % a != 0){\n println((n/a+1)*(m/a))\n }else{\n println((n/a)*(m/a))\n }\n return\n }\n if (m % a != 0 && n % a != 0){\n println((n/a+1)*(m/a+1))\n return\n }\n}", "lang": "Kotlin", "bug_code_uid": "92b12e1b67038ff083f5c4b3ddcdb06e", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "fd73aaa5127438b05378b10cc09a8779", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7820224719101123, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "val input = readLine()!!.split(\" \")\n\nval n = input[0].toInt()\nval m = input[1].toInt()\nval a = input[2].toInt()\n\nprintln((n / a + if (n % a == 0) 0 else 1) * (m / a + if (m % a == 0) 0 else 1))", "lang": "Kotlin", "bug_code_uid": "a4e74c9b873f803d26c55ea11b782e66", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "4878fe65316691218679aaae2b275fac", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7786499215070644, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n \nfun main(args: Array) {\n val input = Scanner(System.`in`)\n var n:Long = input.nextInt()\n var m:Long = input.nextInt()\n var a:Long = input.nextInt()\n var x:Long = n/a\n var y:Long = m/a\n if(x * a < n){\n \tx++\n }\n if(y * a < m){\n \ty++\n }\n println(x*y)\n}", "lang": "Kotlin", "bug_code_uid": "cbd816bbc15961ce19e24f035735c673", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "dfa9b8a1ab37e6b2958dd0c2f133e2f4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3434343434343434, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "fun main(args:Array){\n var n = readLine()!!.toInt()\n var m = readLine()!!.toInt()\n var a = readLine()!!.toInt()\n\n var rows:Int = (n/a) + 1\n var cols:Int = (m/a) + 1\n\n print(rows+cols)\n}", "lang": "Kotlin", "bug_code_uid": "b65fe3e57efc4a78fcdb5feee38afc83", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "b4f84fef9e0d2de6e04f0f9e5c792731", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9604743083003953, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val i = readLine()!!.split(\" \").map{ it.toLong() }\n val c1 = if(i[0] % i[2] != 0L) i[0] - 1 + i[2]\n val c2 = if(i[1] % i[2] != 0L) i[1] - 1 + i[2]\n var r:Long = (c1 / i[2]) * (c2 / i[2])\n if(r < 1) r = 1\n println(r)\n}", "lang": "Kotlin", "bug_code_uid": "3e83a15454b138358bffb5a2658f927e", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "54a61b4fff0de65c79600358c15cd937", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.18018018018018017, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main(vararg args: String){\n val n = readLine()!!.toInt()\n val m = readLine()!!.toInt()\n val a = readLine()!!.toInt()\n var count = 0\n\n for (i in 0 until n step a){\n for (j in 0 until m step a){\n count++\n }\n }\n\n println(count)\n}\n", "lang": "Kotlin", "bug_code_uid": "a370aa12dd329327f63d768499dca962", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "f32d37fd15d87506845e56c01d126a73", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3186344238975818, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main(vararg args: String){\n val (first, second, third) = readLine()!!.split(' ')\n val m = first.toInt()\n val n = second.toInt()\n val a = third.toInt()\n var count = 0\n\n for (i in 0 until n step a){\n for (j in 0 until m step a){\n count++\n }\n }\n\n println(count)\n}\n", "lang": "Kotlin", "bug_code_uid": "2628ffc869276fba54c0981ef548da74", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "f32d37fd15d87506845e56c01d126a73", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8561872909698997, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val (n, m, a) = readLine()!!.split(' ').map(String::toLong)\n println(((n + a - 1) / a) * ((n + a - 1) / a) - if (n % a != 0 && m % a != 0) 1 else 0)\n}", "lang": "Kotlin", "bug_code_uid": "7a7b9ef95dd5c04e91ccf3946b77ab92", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "b0f84a59cf5c5c79897678486a6fef48", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9759036144578314, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package net.imyoyo\n\nimport java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`);\n val n = input.nextInt()\n val m = input.nextInt()\n val a = input.nextInt()\n println(ceilDivide(n.toLong(), a.toLong()) * ceilDivide(m.toLong(), a.toLong()))\n}\n\nfun ceilDivide(positiveDividend: Long, positiveDivisor: Long): Long {\n return (positiveDividend + positiveDivisor - 1) / positiveDivisor\n}\n\n", "lang": "Kotlin", "bug_code_uid": "c2e65c44e7cc47cad4f9a851ae697ce9", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "36acd9261d0a0161afd5226b90d22fc6", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9537037037037037, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeForces\n\nfun main(args: Array) {\n val (n, m, a) = readLine()!!.split(' ').map(String::toInt)\n\n val res = Math.ceil((n.toDouble() / a)).toLong() * Math.ceil((m.toDouble() / a)).toLong()\n print(res)\n}", "lang": "Kotlin", "bug_code_uid": "e26ebf301f48fd0e6649b66b21fa7264", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "c7acd5ffa4de6fd0caaf8efef7038526", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9896259038038353, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.sqrt\n\nprivate fun divisors(n: Int): List {\n val ds = mutableListOf()\n var i = 2\n while (i * i <= n) {\n if (n % i == 0) {\n ds.add(i)\n ds.add(n / i)\n }\n i++\n }\n return ds.toList()\n}\n\n\nprivate fun isPrime(n:Int) :Boolean {\n var isPrime = true;\n for (i in 2..sqrt(n.toFloat()).toInt())\n if (n%i==0) {isPrime=false; break}\n return isPrime\n}\n\nfun solution(ss: String): Boolean {\n val s = ss.trim { it=='0' }\n if (s.length==1) return false\n if (s.all { it==s.first() }) return true\n val ns = s.map { it.toInt() - '0'.toInt() }\n val sum = ns.sum()\n val r =\n when {\n isPrime(sum) -> false\n else -> {\n var canDivide = false\n var l = 0\n forloop@ for (i in divisors(sum)) {\n var b: Int\n whileloop@ while (l <= ns.lastIndex) {\n canDivide=false\n b=sum/i\n while (b > 0 && l<=ns.lastIndex) b -= ns[l++]\n if (b == 0) {\n canDivide = true\n continue@whileloop\n }\n else {\n l=0\n canDivide = false\n continue@forloop\n }\n }\n\n if (canDivide) break\n }\n canDivide\n }\n }\n return r\n}\n\n\nfun main(args: Array) {\n readLine()!!\n println(if (solution(readLine()!!)) \"YES\" else \"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "2019f0e91efc777996cde9adaa3323f7", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "5befe382f67419e53fe25328226509d0", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8273231622746186, "equal_cnt": 15, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 14, "bug_source_code": "import kotlin.math.sqrt\n\nprivate fun divisors(n: Int): List {\n val ds = mutableListOf()\n var i = 2\n while (i * i <= n) {\n if (n % i == 0) {\n ds.add(i)\n ds.add(n / i)\n }\n i++\n }\n return ds.toList()\n}\n\n\nprivate fun isPrime(n:Int) :Boolean {\n var isPrime = true;\n for (i in 2..sqrt(n.toFloat()).toInt())\n if (n%i==0) {isPrime=false; break}\n return isPrime\n}\n\nfun solution(s: String): Boolean {\n if (s.all { it==s.first() }) return true\n val ns = s.map { it.toInt() - '0'.toInt() }\n val sum = ns.sum()\n val r =\n when {\n isPrime(sum) -> false\n else -> {\n var canDivide = false\n var l = 0\n forloop@ for (i in divisors(sum)) {\n var b: Int\n whileloop@ while (l < ns.size) {\n b=i\n while (b > 0) b -= ns[l++]\n if (b == 0)\n continue@whileloop\n else\n continue@forloop\n }\n canDivide = true\n }\n canDivide\n }\n }\n return r\n}\n\n\nfun main(args: Array) {\n readLine()!!\n println(if (solution(readLine()!!)) \"YES\" else \"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "dd0630ffc1dbb5768b19495b40ed1de8", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "5befe382f67419e53fe25328226509d0", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.020260492040520984, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 13, "bug_source_code": "import org.junit.jupiter.api.Test\n\nimport org.junit.jupiter.api.Assertions.*\n\ninternal class _1058KtTest {\n\n @Test\n fun solution() {\n assertEquals(true,solution(\"73452\"))\n assertEquals(false,solution(\"1248\"))\n assertEquals(true, solution(\"00\"))\n assertEquals(true,solution(\"999999999999999999999999999999999999999999999918888888888888888888888888888888888888888888888888887\"))\n assertEquals(false, solution(\"24954512677\"))\n }\n}", "lang": "Kotlin", "bug_code_uid": "568cd96b46d86c7f5e55db7e64be488b", "src_uid": "410296a01b97a0a39b6683569c84d56c", "apr_id": "5befe382f67419e53fe25328226509d0", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.78951865565366, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 18, "bug_source_code": "package ru.hse.spb\n\nfun checkIn(character: Char, maxChar: Char) = character in 'a'..maxChar\n\nfun main() {\n val numberOfRequiredLetters = readLine()?.toInt()\n val pattern = readLine()\n\n if (numberOfRequiredLetters == null || pattern == null) {\n println(\"Wrong input\")\n return\n }\n\n val sz = pattern.length\n var free = 0\n val maxChar = ('a' + numberOfRequiredLetters - 1)\n val unusedChars = ('a'..maxChar).toHashSet()\n val stringArray = Array(sz) {'?'}\n\n for ((i, j) in (0 until sz).zip(sz - 1 downTo 1)) {\n val first = pattern[i]\n val second = pattern[j]\n\n if (first == '?' && second == '?') {\n free++\n continue\n }\n\n if (first == '?') {\n stringArray[i] = second\n stringArray[j] = second\n } else {\n stringArray[i] = first\n stringArray[j] = first\n }\n\n if (!checkIn(stringArray[i], maxChar)) {\n println(\"IMPOSSIBLE\")\n return\n }\n unusedChars.remove(stringArray[i])\n }\n\n if (free < unusedChars.size) {\n println(\"IMPOSSIBLE\")\n return\n }\n\n for ((i, j) in (0 until sz).zip(sz - 1 downTo 1)) {\n if (stringArray[i] != '?') {\n continue\n }\n\n val unusedCharacter = unusedChars.firstOrNull() ?: 'a'\n stringArray[i] = unusedCharacter\n stringArray[j] = unusedCharacter\n unusedChars.remove(unusedCharacter)\n }\n\n println(stringArray.joinToString(separator = \"\"))\n}", "lang": "Kotlin", "bug_code_uid": "4f92b6c47801aec98c7cc8d4364579aa", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "fc3f98f06c56b2835d3856339c54fc2f", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9050962627406568, "equal_cnt": 13, "replace_cnt": 2, "delete_cnt": 8, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "package ru.hse.spb\n\nimport java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val k = input.nextInt()\n val pattern: String = input.next()\n\n val len = pattern.length\n var possible = true\n var free = 0\n\n val answer = CharArray(len)\n val used = BooleanArray(k)\n\n loop@ for (symbol in pattern) {\n val number = symbol.minus('a')\n when {\n number < 0 -> continue@loop\n number >= k -> possible = false\n else -> used[number] = true\n }\n }\n\n for (index in 0..(len - 1) / 2) {\n val left = pattern[index]\n val right = pattern[len - 1 - index]\n\n when {\n left != '?' && right != '?' && left != right -> possible = false\n left == '?' && right != '?' -> {\n answer[index] = right\n answer[len - 1 - index] = right\n }\n left != '?' && right == '?' -> {\n answer[index] = left\n answer[len - 1 - index] = left\n }\n left == '?' && right == '?' -> free++\n left == right -> {\n answer[index] = left\n answer[len - 1 - index] = right\n }\n }\n }\n\n val need = k - (used.filter { it }).size\n free -= need\n\n var currentPosition = 0\n (0..(len - 1) / 2)\n .asSequence()\n .filter { pattern[it] == '?' && pattern[len - 1 - it] == '?' }\n .forEach {\n if (free-- > 0) {\n answer[it] = 'a'\n answer[len - 1 - it] = 'a'\n } else {\n while (currentPosition < k && used[currentPosition]) {\n currentPosition++\n }\n\n if (currentPosition >= k) {\n possible = false\n }\n val symbol = 'a'.plus(currentPosition++)\n answer[it] = symbol\n answer[len - 1 - it] = symbol\n }\n }\n\n if (possible) {\n println(String(answer))\n } else {\n println(\"IMPOSSIBLE\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "ece3148049265e6e9333b59f66afa2c8", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "0798ed59a15af3eca82de6e8c716847e", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9953878406708595, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package ru.spbau.mit\n\nimport java.io.InputStream\nimport java.util.*\n\nclass Solver(k: Int, private val bookTitle: CharArray) {\n companion object {\n fun read(inputStream: InputStream) : Solver {\n val input = Scanner(inputStream)\n val k = input.nextInt()\n val bookTitle = input.next().toCharArray()\n return Solver(k, bookTitle)\n }\n\n val IMPOSSIBLE = \"IMPOSSIBLE\".toCharArray()\n }\n\n private val unusedLetters = (('a' until 'a' + k) - bookTitle.toSortedSet()).toSortedSet()\n private val halfOfBookTitleSize = bookTitle.size / 2\n\n fun solve(): CharArray {\n if (!removePairedQuestionMarks())\n return IMPOSSIBLE\n if (!removeSingleQuestionMarks())\n return IMPOSSIBLE\n return bookTitle\n }\n\n private fun removeSingleQuestionMarks(): Boolean {\n var i = 0\n while (i < halfOfBookTitleSize) {\n val correspondingIndex = getCorrespondingIndex(i)\n if (bookTitle[i] == '?' || bookTitle[correspondingIndex] == '?') {\n if (bookTitle[i] == '?') {\n bookTitle[i] = bookTitle[correspondingIndex]\n } else {\n bookTitle[correspondingIndex] = bookTitle[i]\n }\n } else {\n if (bookTitle[i] != bookTitle[correspondingIndex]) {\n return false\n }\n }\n i++\n }\n return true\n }\n\n private fun removePairedQuestionMarks(): Boolean {\n var i = halfOfBookTitleSize\n while (i < bookTitle.size) {\n val correspondingIndex = getCorrespondingIndex(i)\n if (bookTitle[i] == '?' && bookTitle[correspondingIndex] == '?') {\n bookTitle[i] = getAndExtractMaxUnusedLetterOrA()\n bookTitle[correspondingIndex] = bookTitle[i]\n }\n i++\n }\n return unusedLetters.isEmpty()\n }\n\n private fun getAndExtractMaxUnusedLetterOrA(): Char {\n if (unusedLetters.isEmpty())\n return 'a'\n val lastFromUnusedLetters = unusedLetters.last()\n unusedLetters.remove(lastFromUnusedLetters)\n return lastFromUnusedLetters\n }\n\n private fun getCorrespondingIndex(i: Int): Int = bookTitle.size - i - 1\n}\n\nfun main(args: Array) {\n print(Solver.read(System.`in`).solve())\n}\n", "lang": "Kotlin", "bug_code_uid": "c7e8f46cbeec58947af71920b87ab749", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "cc4e147afbe6bf201fb53509fb0e0f50", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9879003558718861, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "package ru.spbau.mit\n\nimport java.util.*\n\nclass Solver(k: Int, internal val bookTitle: CharArray) {\n companion object {\n private val IMPOSSIBLE = \"IMPOSSIBLE\".toCharArray()\n }\n private val unusedLetters: ArrayDeque\n init {\n val firstKLetters = 'a' until 'a' + k\n val usedLetters = bookTitle.toSet()\n unusedLetters = ArrayDeque(firstKLetters - usedLetters)\n }\n\n fun solve(): CharArray {\n val ok = removePairedQuestionMarks() && removeSingleQuestionMarks()\n return if (ok) bookTitle else IMPOSSIBLE\n }\n\n internal fun removeSingleQuestionMarks(): Boolean {\n for (i in 0 until bookTitle.size / 2) {\n val currentSymbol = bookTitle[i]\n val correspondingIndex = i.getCorrespondingIndex\n val correspondingSymbol = bookTitle[correspondingIndex]\n when {\n currentSymbol == '?' -> bookTitle[i] = correspondingSymbol\n correspondingSymbol == '?' -> bookTitle[correspondingIndex] = currentSymbol\n currentSymbol != correspondingSymbol -> return false\n }\n }\n return true\n }\n\n internal fun removePairedQuestionMarks(): Boolean {\n for (i in 0 until bookTitle.size / 2) {\n val currentSymbol = bookTitle[i]\n val correspondingIndex = i.getCorrespondingIndex\n val correspondingSymbol = bookTitle[correspondingIndex]\n if (currentSymbol == '?' && correspondingSymbol == '?') {\n bookTitle[i] = getAndExtractMaxUnusedLetterOrA()\n bookTitle[correspondingIndex] = bookTitle[i]\n }\n }\n return unusedLetters.isEmpty()\n }\n\n private fun getAndExtractMaxUnusedLetterOrA(): Char {\n return if (unusedLetters.isEmpty()) 'a' else unusedLetters.removeLast()\n }\n\n private val Int.getCorrespondingIndex:Int get() = bookTitle.size - this - 1\n}\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val k = input.nextInt()\n val bookTitle = input.next().toCharArray()\n print(Solver(k, bookTitle).solve())\n}\n", "lang": "Kotlin", "bug_code_uid": "691aadb8c7dd5de021e92439fdd99cb9", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "cc4e147afbe6bf201fb53509fb0e0f50", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.996262520556137, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "/**\n * Class that solves codeforces problem.\n * It tries to replace wild cards(?) to letters to create lexicographically smallest palindrome.\n */\nclass PatternHandler(private val pattern: CharArray,\n private val alphabet: Int) {\n\n private val IMPOSSIBLE_MESSAGE = \"IMPOSSIBLE\"\n private val usedChars = BitSet(alphabet)\n\n init {\n pattern\n .filter { it != '?' }\n .map { getIndex(it) }\n .forEach { usedChars[it] = true }\n }\n\n /**\n * Returns index of symbol in usedChars array\n */\n private fun getIndex(symbol: Char): Int = symbol - 'a'\n\n /**\n * Returns index of symbol in usedChars array\n */\n private fun getSymbol(index: Int): Char = 'a' + index\n\n /**\n * Get index letter that should be on the wild card sign.\n * It's take the most biggest lexicographically letter,\n * because we are starting to remove wild cards from center of the palindrome.\n */\n private fun getAppropriateLetterIndex(): Int {\n val index = usedChars.previousClearBit(alphabet - 1)\n\n return if (index == -1) {\n 0\n } else {\n index\n }\n }\n\n /**\n * l, r -- indices in pattern.\n * If they are both wild cards they will be replaced by most biggest lexicographically letter.\n */\n private fun removeWildCardPairs(l: Int, r: Int) {\n if (pattern[l] == '?' && pattern[r] == '?') {\n val letterIndex = getAppropriateLetterIndex()\n val letter = getSymbol(letterIndex)\n usedChars[letterIndex] = true\n pattern[l] = letter\n pattern[r] = letter\n }\n }\n\n /**\n * Cleaning rest of wild cards.\n * If there any of chars at indices l, r equals wild card, then it should be replaced by another char.\n */\n private fun cleanWildCards(l: Int, r: Int) {\n if (pattern[l] == '?') {\n pattern[l] = pattern[r]\n }\n\n if (pattern[r] == '?') {\n pattern[r] = pattern[l]\n }\n }\n\n /**\n * Solving codeforces task.\n * It returns processed symmetric palindrome if it's possible.\n * Otherwise it returns IMPOSSIBLE_MESSAGE\n */\n fun solve(): String {\n if (alphabet > pattern.size) {\n return IMPOSSIBLE_MESSAGE\n }\n\n var r = pattern.size / 2\n while (r < pattern.size) {\n val indent = r - pattern.size / 2\n val l = r - (pattern.size + 1) % 2 - 2 * indent\n\n // process pattern\n removeWildCardPairs(l, r)\n cleanWildCards(l, r)\n\n if (pattern[l] != pattern[r]) {\n return IMPOSSIBLE_MESSAGE\n }\n\n r++\n }\n\n if (usedChars.cardinality() != alphabet) {\n return IMPOSSIBLE_MESSAGE\n }\n\n return String(pattern)\n }\n}\n\n/**\n * CLI for task: http://codeforces.com/contest/59/problem/C\n * Successful submission: http://codeforces.com/contest/59/my\n * Input contains of two lines. At the first line there is a number k.\n * On the second line there is pattern for constructing palindrome.\n */\nfun main(args: Array) {\n val k = Integer.parseInt(readLine())\n val pattern = readLine()!!\n val result = PatternHandler(pattern.toCharArray(), k).solve()\n print(result)\n}", "lang": "Kotlin", "bug_code_uid": "72e8da884b49a8b9f9be5b910ebf1496", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "06f08465c65a1c4dc250e1e80bfdd6c6", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4876575630252101, "equal_cnt": 23, "replace_cnt": 9, "delete_cnt": 7, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "package ru.hse.spb\n\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashSet\nimport kotlin.math.PI\nimport kotlin.math.atan\n\ndata class Vector(val xCoordinate : Int, val yCoordinate : Int, val identifier : Int)\n\nfun getVectorAngle(vector : Vector) =\n when {\n vector.xCoordinate > 0 -> atan(vector.yCoordinate / vector.xCoordinate.toDouble())\n vector.xCoordinate < 0 -> PI + atan(vector.yCoordinate / vector.xCoordinate.toDouble())\n else ->\n if (vector.yCoordinate > 0) {\n PI / 2\n } else {\n -PI / 2\n }\n }\n\nfun readVectors() : ArrayList {\n val reader = Scanner(System.`in`)\n val vectorsNumber = reader.nextInt()\n val listOfVectors = ArrayList()\n\n for (identifier in 1..vectorsNumber) {\n val xCoordinate = reader.nextInt()\n val yCoordinate = reader.nextInt()\n val vector = Vector(xCoordinate, yCoordinate, identifier)\n\n listOfVectors.add(vector)\n }\n\n return listOfVectors\n}\n\nfun getNearliestVectorPair(listOfVectors : ArrayList) : Pair {\n listOfVectors.sortWith(compareByDescending { getVectorAngle(it) })\n\n var bestAngleDifference : Double = 2 * PI + getVectorAngle(listOfVectors.last()) - getVectorAngle(listOfVectors.first())\n var bestFirstIndex = 0\n var bestSecondIndex = listOfVectors.size - 1\n\n for (i in 0 until listOfVectors.size - 1) {\n val angleDifference = getVectorAngle(listOfVectors[i]) - getVectorAngle(listOfVectors[i + 1])\n\n if (angleDifference < bestAngleDifference) {\n bestFirstIndex = i\n bestSecondIndex = i + 1\n bestAngleDifference = angleDifference\n }\n }\n\n return Pair(listOfVectors[bestFirstIndex], listOfVectors[bestSecondIndex])\n}\n\nfun getSymbolsFromString(string : String) : HashSet {\n val stringSymbols = HashSet()\n for (symbol in string) {\n if (!stringSymbols.contains(symbol)) {\n stringSymbols.add(symbol)\n }\n }\n\n return stringSymbols\n}\n\nfun getStringMissingSymbols(string: String) : ArrayList {\n val stringSymbols = getSymbolsFromString(string)\n val missingSymbols = ArrayList()\n\n for (symbol in 'a'..'z') {\n if (!stringSymbols.contains(symbol)) {\n missingSymbols.add(symbol)\n }\n }\n\n return missingSymbols\n}\n\nfun hasAnswer(string: String) : Boolean {\n for (i in 0..(string.length + 1) / 2) {\n if (string[i] != '?' && string[string.length - 1 - i] != '?') {\n if (string[i] != string[string.length - 1 - i]) {\n return false\n }\n }\n }\n\n return true\n}\n\nfun solveProblem(string: String, mustHaveCharsNumber : Int) : ArrayList? {\n val chars = ArrayList()\n val missingSymbols = getStringMissingSymbols(string)\n var index = 0\n\n if (!hasAnswer(string)) {\n return null\n }\n\n for (char in string) {\n chars.add(char)\n }\n\n for (i in 0 until (string.length + 1) / 2) {\n if (string[i] == '?' && string[string.length - 1 - i] == '?') {\n if (index == missingSymbols.size) {\n chars[i] = 'a'\n chars[string.length - 1 - i] = 'a'\n } else {\n chars[i] = missingSymbols[index]\n chars[string.length - 1 - i] = missingSymbols[index]\n index++\n }\n } else if (string[i] == '?') {\n chars[i] = string[string.length - 1 - i]\n chars[string.length - 1 - i] = string[string.length - 1 - i]\n } else {\n chars[i] = string[i]\n chars[string.length - 1 - i] = string[i]\n }\n }\n\n return if (index < missingSymbols.size && missingSymbols[index] - 'a' <= mustHaveCharsNumber) {\n chars\n } else {\n null\n }\n}\n\nfun main() {\n val reader = Scanner(System.`in`)\n val mustHaveCharsNumber = reader.nextInt()\n val string = reader.next()\n val resultString = solveProblem(string, mustHaveCharsNumber)\n\n if (resultString == null) {\n print(\"IMPOSSIBLE\")\n } else {\n for (char in resultString) {\n print(char)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "92436f5bddaed6cc209a97b4fffcec0d", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "3fa386f5cc2eb0ff644cb699061adb49", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.48894154818325436, "equal_cnt": 23, "replace_cnt": 9, "delete_cnt": 6, "insert_cnt": 7, "fix_ops_cnt": 22, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashSet\nimport kotlin.math.PI\nimport kotlin.math.atan\n\ndata class Vector(val xCoordinate : Int, val yCoordinate : Int, val identifier : Int)\n\nfun getVectorAngle(vector : Vector) =\n when {\n vector.xCoordinate > 0 -> atan(vector.yCoordinate / vector.xCoordinate.toDouble())\n vector.xCoordinate < 0 -> PI + atan(vector.yCoordinate / vector.xCoordinate.toDouble())\n else ->\n if (vector.yCoordinate > 0) {\n PI / 2\n } else {\n -PI / 2\n }\n }\n\nfun readVectors() : ArrayList {\n val reader = Scanner(System.`in`)\n val vectorsNumber = reader.nextInt()\n val listOfVectors = ArrayList()\n\n for (identifier in 1..vectorsNumber) {\n val xCoordinate = reader.nextInt()\n val yCoordinate = reader.nextInt()\n val vector = Vector(xCoordinate, yCoordinate, identifier)\n\n listOfVectors.add(vector)\n }\n\n return listOfVectors\n}\n\nfun getNearliestVectorPair(listOfVectors : ArrayList) : Pair {\n listOfVectors.sortWith(compareByDescending { getVectorAngle(it) })\n\n var bestAngleDifference : Double = 2 * PI + getVectorAngle(listOfVectors.last()) - getVectorAngle(listOfVectors.first())\n var bestFirstIndex = 0\n var bestSecondIndex = listOfVectors.size - 1\n\n for (i in 0 until listOfVectors.size - 1) {\n val angleDifference = getVectorAngle(listOfVectors[i]) - getVectorAngle(listOfVectors[i + 1])\n\n if (angleDifference < bestAngleDifference) {\n bestFirstIndex = i\n bestSecondIndex = i + 1\n bestAngleDifference = angleDifference\n }\n }\n\n return Pair(listOfVectors[bestFirstIndex], listOfVectors[bestSecondIndex])\n}\n\nfun getSymbolsFromString(string : String) : HashSet {\n val stringSymbols = HashSet()\n for (symbol in string) {\n if (!stringSymbols.contains(symbol)) {\n stringSymbols.add(symbol)\n }\n }\n\n return stringSymbols\n}\n\nfun getStringMissingSymbols(string: String) : ArrayList {\n val stringSymbols = getSymbolsFromString(string)\n val missingSymbols = ArrayList()\n\n for (symbol in 'a'..'z') {\n if (!stringSymbols.contains(symbol)) {\n missingSymbols.add(symbol)\n }\n }\n\n return missingSymbols\n}\n\nfun hasAnswer(string: String) : Boolean {\n for (i in 0..(string.length + 1) / 2) {\n if (string[i] != '?' && string[string.length - 1 - i] != '?') {\n if (string[i] != string[string.length - 1 - i]) {\n return false\n }\n }\n }\n\n return true\n}\n\nfun solveProblem(string: String, mustHaveCharsNumber : Int) : ArrayList? {\n val chars = ArrayList()\n val missingSymbols = getStringMissingSymbols(string)\n var index = 0\n\n if (!hasAnswer(string)) {\n return null\n }\n\n for (char in string) {\n chars.add(char)\n }\n\n for (i in 0 until (string.length + 1) / 2) {\n if (string[i] == '?' && string[string.length - 1 - i] == '?') {\n if (index == missingSymbols.size) {\n chars[i] = 'a'\n chars[string.length - 1 - i] = 'a'\n } else {\n chars[i] = missingSymbols[index]\n chars[string.length - 1 - i] = missingSymbols[index]\n index++\n }\n } else if (string[i] == '?') {\n chars[i] = string[string.length - 1 - i]\n chars[string.length - 1 - i] = string[string.length - 1 - i]\n } else {\n chars[i] = string[i]\n chars[string.length - 1 - i] = string[i]\n }\n }\n\n return if (index < missingSymbols.size && missingSymbols[index] - 'a' >= mustHaveCharsNumber) {\n chars\n } else {\n null\n }\n}\n\nfun main() {\n val reader = Scanner(System.`in`)\n val mustHaveCharsNumber = reader.nextInt()\n val string = reader.next()\n val resultString = solveProblem(string, mustHaveCharsNumber)\n\n if (resultString == null) {\n print(\"IMPOSSIBLE\")\n } else {\n for (char in resultString) {\n print(char)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "b38cb476d55b23e86fa8c4d7b23ce430", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "3fa386f5cc2eb0ff644cb699061adb49", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9933494558645707, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package ru.spbau.mit\n\nimport java.util.*\n\nfun notInRange(range: Int, letter: Char): Boolean {\n return ((letter < 'a') or (letter >= 'a' + range)) and (letter != '?')\n}\n\nfun fillPattern(pattern: CharArray, range: Int): CharArray? {\n return CharArray((pattern.size + 1) / 2, {\n i ->\n val a = pattern[i]\n val b = pattern[pattern.size - i - 1]\n when {\n notInRange(range, a) or notInRange(range, b) -> return null\n a == b -> a\n a == '?' -> b\n b == '?' -> a\n else -> return null\n }\n })\n}\n\nfun main(args: Array) {\n with(Scanner(System.`in`)) {\n val k = nextInt()\n nextLine()\n val patternString = nextLine()\n val odd = patternString.length % 2\n val pattern = fillPattern(patternString.toCharArray(), k)\n if (pattern == null) {\n print(\"IMPOSSIBLE\")\n return\n }\n val unusedLetters = ('a' until ('a' + k)).filter { ! pattern.contains(it) }\n val questionCount = pattern.count { it == '?' }\n if (unusedLetters.size > questionCount) {\n print(\"IMPOSSIBLE\")\n return\n }\n var j = 0\n for (i in 0 until pattern.size) {\n if (pattern[i] == '?') {\n if (questionCount - j > unusedLetters.size)\n pattern[i] = 'a'\n else\n pattern[i] = unusedLetters[j + unusedLetters.size - questionCount]\n j++\n }\n }\n pattern.forEach { print(it) }\n pattern.reverse()\n (odd until pattern.size).forEach { print(pattern[it]) }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "278fd7d1d7e126a15591eb67c033c066", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "8a309ab0244bf0c3b3462eedba4dbabe", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9948792977322605, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package ru.spbau.mit\nimport java.util.*\n\nfun getTitle(amountOfLetters: Int, pattern: String): String {\n val patternChars: CharArray = pattern.toCharArray()\n val patternLength = patternChars.size\n val occupiedLetters = mutableListOf()\n for (index in 0 until amountOfLetters) {\n occupiedLetters.add(index, false)\n }\n patternChars.forEach { letter ->\n run {\n if (letter != '?') {\n occupiedLetters[letter - 'a'] = true\n }\n }\n }\n val startIndex = if (patternLength % 2 == 0)\n patternLength / 2 - 1\n else\n patternLength / 2\n for (i in startIndex downTo 0) {\n if (patternChars[i] == '?') {\n val symmetricLetterIndex = patternLength - i - 1\n if (patternChars[patternLength - i - 1] == '?') {\n val theLastNotOccupiedLetterIndex = occupiedLetters.lastIndexOf(false)\n if (theLastNotOccupiedLetterIndex == -1) {\n patternChars[i] = 'a'\n } else {\n patternChars[i] = 'a' + theLastNotOccupiedLetterIndex\n occupiedLetters[theLastNotOccupiedLetterIndex] = true\n }\n patternChars[patternLength - i - 1] = patternChars[i]\n } else {\n patternChars[i] = patternChars[symmetricLetterIndex]\n }\n }\n }\n\n (0 until patternLength)\n .filter { patternChars[it] == '?' }\n .forEach { patternChars[it] = patternChars[patternLength - it - 1] }\n (0 until patternLength)\n .filter { patternChars[it] != patternChars[patternLength - it - 1] }\n .forEach { return \"IMPOSSIBLE\" }\n\n if (occupiedLetters.contains(false)) {\n return \"IMPOSSIBLE\"\n }\n return patternChars.joinToString(separator = \"\")\n}\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val amountOfLetters: Int = input.nextInt()\n val pattern: String = input.next()\n input.close()\n println(getTitle(amountOfLetters, pattern))\n}", "lang": "Kotlin", "bug_code_uid": "6d0480efbe7a33b30a37341fea56e017", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "c5a260a5d50b2987070a3057262fa7fa", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9240991566572961, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun getTitle(amountOfLetters: Int, pattern: String): String {\n val patternChars: CharArray = pattern.toCharArray()\n val patternLength = patternChars.size\n val occupiedLetters = mutableListOf()\n for (index in 0 until amountOfLetters) {\n occupiedLetters.add(index, false)\n }\n patternChars.forEach { letter ->\n run {\n if (letter != '?') {\n occupiedLetters[letter - 'a'] = true\n }\n }\n }\n val startIndex = if (patternLength % 2 == 0)\n patternLength / 2 - 1\n else\n patternLength / 2\n for (i in startIndex downTo 0) {\n if (patternChars[i] == '?') {\n val symmetricLetterIndex = patternLength - i - 1\n if (patternChars[patternLength - i - 1] == '?') {\n val theLastNotOccupiedLetter = occupiedLetters.lastIndexOf(false)\n patternChars[i] = 'a' + theLastNotOccupiedLetter\n patternChars[patternLength - i - 1] = patternChars[i]\n occupiedLetters[theLastNotOccupiedLetter] = true\n } else {\n patternChars[i] = patternChars[symmetricLetterIndex]\n }\n }\n }\n\n (0 until patternLength)\n .filter { patternChars[it] == '?' }\n .forEach { patternChars[it] = patternChars[patternLength - it - 1] }\n (0 until patternLength)\n .filter { patternChars[it] != patternChars[patternLength - it - 1] }\n .forEach { return \"IMPOSSIBLE\" }\n\n if (occupiedLetters.contains(false)) {\n return \"IMPOSSIBLE\"\n }\n return patternChars.joinToString(separator = \"\")\n}\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val amountOfLetters: Int = input.nextInt()\n val pattern: String = input.next()\n input.close()\n println(getTitle(amountOfLetters, pattern))\n}", "lang": "Kotlin", "bug_code_uid": "0045a477ea1adbb2a5905d950ddefc0a", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "c5a260a5d50b2987070a3057262fa7fa", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9760514018691588, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "package ru.hse.spb\n\n\nprivate const val MATCH_FAILED: Char = '.'\nprivate const val QUESTION_MARK: Char = '?'\n\nprivate fun matchNonQuestionMark(pair: Pair): Char {\n val (x, y) = pair\n\n return when {\n x == QUESTION_MARK -> y\n y == QUESTION_MARK -> x\n x == y -> x\n else -> MATCH_FAILED\n }\n}\n\nprivate fun fillQuestionMarksFromTheOtherPalindromeSide(str: List): List {\n return str.zip(str.reversed()).map(::matchNonQuestionMark)\n}\n\nprivate fun fillQuestionMarksFromQueue(str: List,\n queue: MutableList,\n default: Char = 'a'): List {\n val result = str.toMutableList()\n\n for (idx in result.size / 2 - 1 downTo 0) {\n if (result[idx] == QUESTION_MARK)\n result[idx] = if (queue.isEmpty()) default else queue.removeAt(0)\n }\n\n return result\n}\n\nfun getTitle(lettersCount: Int, pattern: String): String? {\n val match = fillQuestionMarksFromTheOtherPalindromeSide(pattern.toList())\n\n val mustBeUsed = ('a'..'z').take(lettersCount)\n val leftToUse = (mustBeUsed.toSet() - match).sortedDescending().toMutableList()\n val bestMatch = fillQuestionMarksFromQueue(match, leftToUse, default = 'a')\n\n val notAllWereUsed = leftToUse.isNotEmpty()\n val notAllMatched = MATCH_FAILED in bestMatch\n\n return if (notAllMatched || notAllWereUsed) null else\n fillQuestionMarksFromTheOtherPalindromeSide(bestMatch).joinToString(\"\")\n}\n\nfun main(args: Array) {\n val numOfLetters = readLine()?.toIntOrNull() ?: return\n val pattern = readLine() ?: return\n\n println(getTitle(numOfLetters, pattern) ?: \"IMPOSSIBLE\")\n}\n", "lang": "Kotlin", "bug_code_uid": "78606cdddec81d5f599f7200111d54a5", "src_uid": "9d1dd9d722e5fe46823224334b3b208a", "apr_id": "eff4093822d943368601421ff67ae63d", "difficulty": 1600, "tags": ["expression parsing"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8314379580490271, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport java.util.TreeMap\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val n = readInt()\n\n val P = primeSieve(n/2).toList()\n var ans = 0\n i@ for(i in 0 until P.size - 1) {\n val a = P[i]\n for(j in i+1 until P.size) {\n val b = P[j]\n if(a * b > n) continue@i\n\n var ak = a\n var k = 1\n var bl = b\n\n while(ak * a * bl < n) {\n ak *= a\n k++\n }\n\n do {\n ans += k\n bl *= b\n do {\n ak /= a\n k--\n } while(k > 0 && ak * bl > n)\n } while(k > 0)\n }\n }\n\n println(ans)\n}\n\nfun primeSieve(upperLimit: Int): Sequence = sequence {\n yield(2)\n val source = (3..upperLimit step 2).toMutableSet()\n\n while(source.isNotEmpty()) {\n val prime = source.first()\n yield(prime)\n source.remove(prime)\n val sq = prime * prime\n if(sq > upperLimit) {\n yieldAll(source)\n break\n }\n source.removeAll(sq .. upperLimit step prime)\n }\n}\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}\n", "lang": "Kotlin", "bug_code_uid": "64df3d48d30c7166d1ffa2ca078d2251", "src_uid": "356666366625bc5358bc8b97c8d67bd5", "apr_id": "5ff24a89d334d46812bcad335a97b192", "difficulty": 900, "tags": ["number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.997020854021847, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (n, k) = readInts()\n\n val ans = (0 until n).binarySearch { x ->\n k.compareTo((n - x) * (n - x + 1) / 2 - x)\n }.value\n\n println(ans)\n}\n\nfun IntRange.binarySearch(signumFunc: (Int) -> Int): BinarySearchResult {\n var low = start\n var high = endInclusive\n\n while (low <= high) {\n val mid = low / 2 + high / 2 + (low % 2 + high % 2) / 2\n val cmp = signumFunc(mid)\n\n if (cmp < 0)\n low = mid + 1\n else if (cmp > 0)\n high = mid - 1\n else\n return BinarySearchResult(mid, true) // key found\n }\n return BinarySearchResult(low, false) // key not found\n}\ndata class BinarySearchResult(val value: T, val exactFound: Boolean)\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println() { sb.append('\\n') }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit)\n { Output().apply(block).nowPrint() }\n", "lang": "Kotlin", "bug_code_uid": "0b4e2e0947dc3b19b04a30dc0e8403f3", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "f0b2904be995725a3295e04eff7bb5cf", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9472606246799795, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import kotlin.math.roundToInt\nimport kotlin.math.sqrt\n\nfun main() {\n val (n, k) = readDoubles()\n\n val ans = ((sqrt(8 * (n+k) + 9) + 2*n + 3) / 2).toInt()\n\n println(ans)\n}\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println() { sb.append('\\n') }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit)\n { Output().apply(block).nowPrint() }\n", "lang": "Kotlin", "bug_code_uid": "029b41110485b4b52fa0c1e7da6d3313", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "f0b2904be995725a3295e04eff7bb5cf", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8658823529411764, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import kotlin.math.sqrt\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main() {\n val (turns, left) = readInts()\n val disc = 9L + 8L * turns + 8L * left\n println(disc)\n val discSqrt = sqrt(disc.toDouble()).toLong()\n println(discSqrt)\n val k = (discSqrt - 3) / 2\n println(turns - k)\n}", "lang": "Kotlin", "bug_code_uid": "fe1351b841355ab16db6d948b1f65d76", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "a44a1e7b21fd6b10b0ea0818a5cc0f3e", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8315151515151515, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main() {\n val (turns, left) = readInts()\n val disc = 9L + 8L * turns + 8L * left\n println(disc)\n val discSqrt = sqrt(disc.toDouble()).toLong()\n println(discSqrt)\n val k = (discSqrt - 3) / 2\n println(turns - k)\n}", "lang": "Kotlin", "bug_code_uid": "d79842146bd3c7792c98f94abbad2247", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "a44a1e7b21fd6b10b0ea0818a5cc0f3e", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7782217782217782, "equal_cnt": 10, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 10, "bug_source_code": "private fun readString() = readLine()!!\nprivate fun readInt() = readString().toInt()\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\n\nfun sportMafia(moves: Int, candiesLeft: Int): Int {\n var left = 0\n var right = moves\n while (true) {\n val current = left + (right - left) / 2\n val broughtIn = sumOf(current)\n val eaten = moves - current\n val resultingCandies = broughtIn - eaten\n when {\n resultingCandies < candiesLeft -> {\n left = current + 1\n }\n resultingCandies == candiesLeft -> return eaten\n resultingCandies > candiesLeft -> {\n right = current - 1\n }\n }\n }\n}\n\nfun sumOf(willAdd: Int): Int = (willAdd * (willAdd + 1)) / 2\n\n\nfun main() {\n val (moves, candiesLeft) = readInts()\n println(sportMafia(moves, candiesLeft))\n}", "lang": "Kotlin", "bug_code_uid": "87868cbd475ca92aa21e271eef3fe4bf", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "c4cef3da049f422f59e1a8247e89fb3a", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.17656765676567657, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "private fun readString() = readLine()!!\nprivate fun readInt() = readString().toInt()\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\ndata class Key(val moves: Int, val candiesLeft: Int, val currentCandies: Int, val candiesEaten: Int, val lastAdded: Int)\n\nval cache = mutableMapOf()\n\nfun sportMafia(moves: Int, candiesLeft: Int, currentCandies: Int = 0, candiesEaten: Int = 0, lastAdded: Int = 0): Int {\n val key = Key(moves, candiesLeft, currentCandies, candiesEaten, lastAdded)\n if (cache[key] != null)\n return cache[key]!!\n if (moves == 0) {\n val result = if (candiesLeft == currentCandies) candiesEaten else -1\n cache[key] = result\n return result\n }\n val result = if (currentCandies > 0) {\n // add or eat\n Math.max(\n sportMafia(moves - 1, candiesLeft, currentCandies + lastAdded + 1, candiesEaten, lastAdded + 1),\n sportMafia(moves - 1, candiesLeft, currentCandies - 1, candiesEaten + 1, lastAdded)\n )\n } else {\n // only add\n sportMafia(moves - 1, candiesLeft, currentCandies + lastAdded + 1, candiesEaten, lastAdded + 1)\n }\n cache[key] = result\n return result\n}\n\n\nfun main() {\n val (moves, candiesLeft) = readInts()\n println(sportMafia(moves, candiesLeft))\n}", "lang": "Kotlin", "bug_code_uid": "efa6a608af71e0a068adc87cd14377b2", "src_uid": "17b5ec1c6263ef63c668c2b903db1d77", "apr_id": "c4cef3da049f422f59e1a8247e89fb3a", "difficulty": 1000, "tags": ["math", "brute force", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8555708390646493, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 11, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n var num = r.readLine()!!.toLong()\n val luck = listOf(4, 7)\n var many = 0\n while (num>0){\n val remainer = num%10\n if (remainer in luck) many++\n num /= 10\n }\n println(if (many%4==0||many%7==0)\"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "dcfff9591108c1ce27ff67953c1c1708", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "f9126798f7f7c84d8226a4f6d29c4c33", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9724137931034482, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n\n val arri = arrayOf(4, 7, 47, 74, 447, 474, 477, 774, 747, 744)\n val ff = true\n val num = readLine().toString()\n var count = 0\n for (i in num) {\n\n if (i.toString().equals(\"4\") || i.toString().equals(\"7\")) {\n count++\n\n }\n\n }\n\n if (ff) {\n var flag = false\n for (i in arri) {\n if (count % i == 0 && count > 0) {\n flag = true\n break\n }\n }\n if (flag)\n print(\"YES\")\n else\n print(\"NO\")\n } else {\n print(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "7a0891d64a5767444578172bb19b3b79", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "9471347ef2fd7591169b35b863df6e3f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9799247176913425, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "class Main {\n companion object {\n @JvmStatic\n fun main(args: Array) {\n println(readLine()?.let { solve110A(it) })\n }\n\n private fun solve110A(input: String): String{\n val count4s = input.filter { it == '4' }.count()\n val count7s = input.filter { it == '7' }.count()\n\n return (input.isLucky() || (count4s + count7s).toString().isLucky()).toAnswer()\n }\n\n private fun String.isLucky(): Boolean {\n val count4s = this.filter { it == '4' }.count()\n val count7s = this.filter { it == '7' }.count()\n\n return count4s + count7s == this.length\n }\n\n private fun Boolean.toAnswer(): String = when(this) {\n true -> \"YES\"\n false -> \"NO\"\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "d78cb909accc3e140f20c8266eb09acc", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "edf6ae70a20323c41c359a0859d68eae", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4750378214826021, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n var n = scan.nextInt()\n var check = true\n\n while (n != 0){\n if ((n%10 != 7) and (n%10 != 4)) check = false\n n/=10\n }\n\n if (check) print(\"YES\")\n else print(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "5dee740311df0020021736e1260b5343", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "c2becfe68bad06d5c99e5b60a187d303", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.39383155397390274, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 14, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n var n = scan.nextLong()\n var check = true\n var check2 = true\n var cow = 0L\n\n while (n != 0L){\n if ((n%10L != 7L) and (n%10L != 4L)) check = false\n else cow++\n n/=10\n }\n\n while (cow != 0L){\n if ((cow%10L != 7L) and (cow%10L != 4L)) check2 = false\n n/=10\n }\n\n if (check or check2) print(\"YES\")\n else print(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "7c75082876ab3d47b2d530c9a99b9a4b", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "c2becfe68bad06d5c99e5b60a187d303", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9963898916967509, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(){\n val s = readLine()!!.filter { it == '4' || it == '7' }.count()\n if (s == 4 || s == 7) println(\"YES\") else println(\"NO\")", "lang": "Kotlin", "bug_code_uid": "2ac62502190021b4d33111a3ffcb22a8", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "6486b197c839d9e78094574c2bf22046", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9747368421052631, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main()\n{\n val sc: Scanner = Scanner(System.`in`)\n var inp: String = sc.nextLong().toString()\n var list: MutableList = mutableListOf()\n for(i:Int in inp.indices)\n {\n list.add(inp[i].toString().toInt())\n }\n\n var count:Int = 0;\n for(i:Int in list)\n {\n if(i == 4 || i==7)\n {\n count++\n }\n }\n\n if(count == list.size)\n println(\"YES\")\n else\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "89efa6097fd104d5567c6d76f70e6dd6", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "3e54072f35a51daebaa34536e7f14578", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7887323943661971, "equal_cnt": 14, "replace_cnt": 4, "delete_cnt": 10, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner\n\nobject Main {\n\n @JvmStatic fun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val a = java.lang.Long.toString(n)\n var t = 0\n for (i in 0..a.length - 1) {\n if (a[i] - '0' == 7 || a[i] - '0' == 4)\n t++\n else\n continue\n }\n if (t == 4 || t == 7)\n println(\"YES\")\n else\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "8466e98109517fed742f4b91991340a4", "src_uid": "33b73fd9e7f19894ea08e98b790d07f1", "apr_id": "da187970c7075b0e141d9f54624b3389", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9967741935483871, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main() {\n val reader = Scanner(System.`in`)\n reader.nextInt()\n val s = reader.next().trim()\n val m = mutableMapOf()\n for (k in s.zipWithNext().map { \"${it.first}${it.second}\" })\n m[i] = m.getOrDefault(k, 0) + 1\n println(m.maxBy { it.value }?.key)\n}", "lang": "Kotlin", "bug_code_uid": "f7801b130c32069b716d35538844de8d", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "60d5a1d9c8290992067234d882c1ef85", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8896396396396397, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n var n = readLine()!!.toInt()\n var s = readLine()!!\n val map = mutableMapOf()\n for (i in 0..(n-1))\n {\n map[\"${s[i]}${s[i+1]}\"]\n if (map.containsKey(\"${s[i]}${s[i+1]}\"))\n {\n map[\"${s[i]}${s[i+1]}\"]?.plus(1)\n }\n else\n {\n map.putIfAbsent(\"${s[i]}${s[i+1]}\", 0)\n }\n }\n val max2Gram = map.maxBy { it.value }\n print(max2Gram?.key)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "6695ba6441b33420d7622a96895b33f7", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "74e324a430cab7fb8029a2411b6e5e74", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4711864406779661, "equal_cnt": 18, "replace_cnt": 7, "delete_cnt": 7, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "import java.util.*\n\nobject Main {\n\n @JvmStatic\n fun main(args: Array) {\n val sc = Scanner(System.`in`)\n val map = HashMap()\n\n val n = Integer.parseInt(sc.nextLine())\n val str = sc.nextLine()\n\n for (i in 0 until n - 1) {\n val word = str.substring(i, i + 2)\n\n val count = map[word]\n\n if (count == null) {\n map[word] = 1\n } else {\n map[word] = count + 1\n }\n }\n\n println(map.entries.stream().max { entry1, entry2 -> if (entry1.value > entry2.value) 1 else -1 }.get().key)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "0408935a77576d6dbdd8a47cf5ad445b", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "f9e3d8f185010d28b762c469c8e4418b", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.628999319264806, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.HashMap\nimport java.util.concurrent.atomic.AtomicInteger\n\n/**\n * Created by azhdanov on 07.09.2019.\n */\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\n\nfun main() {\n val n = readInt()\n val s = readLn()\n val map = HashMap()\n var maxCounts = 0;\n var twoGramma : String? = null\n for (i in 0 .. n - 2) {\n val candidate = s.subSequence(i, i + 2)\n val cnt = map.getOrDefault(candidate, AtomicInteger(0)).incrementAndGet()\n if (cnt > maxCounts) {\n maxCounts = cnt\n twoGramma = candidate.toString()\n }\n }\n println(twoGramma)\n}", "lang": "Kotlin", "bug_code_uid": "b4b4b6f95748a38a23ce3deeaec01aeb", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "e03484b6fb1bf2cab7fb601f87bce2cc", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8551068883610451, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "fun main() = readLine() != null && print(\n readLine()!!.asSequence()\n .windowed(2, 1)\n .map { \"${it[0]}${it[1]}\"}\n .groupBy { it }\n .maxBy { it.value.size }?.key\n)", "lang": "Kotlin", "bug_code_uid": "a6d99b243cc4f85f71a47e6672bf885b", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "993866d7e9e10d3fbd3123a3b994f067", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6112359550561798, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "//Kotlin 1.1\n\nfun next() = readLine()!!\nfun nextInt() = next().toInt()\nfun nextLong() = next().toLong()\nfun nextInts() = next().split(\" \").map { it.toInt() }\nfun nextLongs() = next().split(\" \").map { it.toLong() }\n\nfun main(args: Array) {\n var s=next()\n print(s.substring(0,2))\n}", "lang": "Kotlin", "bug_code_uid": "bd89441847ae9bd235e8641d4d2a77d4", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "790d39626649497a8cd3ccf35ae9b580", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9781021897810219, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\nfun main(args: Array) {\n\tval read = Scanner(System.`in`)\n var n = read.nextInt()\n val s = readLine()!!\n var m : Int = 0\n var ans : String = \"\"\n for(i in 0..n-2){\n \tvar k : Int = 0 \n \tfor(j in 0..n-2){\n \t\tif(s[i]==s[j] && s[i+1]==s[j+1])\tk=k+1\n \t}\n \tif(k>m){\n \t\tm=k\n \t\tans = s[i].toString()+s[i+1].toString()\n \t}\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "5386af648660dbea07686b65934bc086", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "f138add383ab648c6b5ab912f6fd5d5e", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9230769230769231, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import kotlin.math.max\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nval map = HashMap()\nfun main() {\n val (n, k) = readStrings()\n val a:Int = 0\n\n findSequence(k, 0, k.length)\n val res = map.maxBy { it.value }\n println(res?.key)\n}\n\ntailrec fun findSequence(input: String, pos: Int, max: Int) {\n val sequence = input.subSequence(pos, pos + 2)\n if (map.containsKey(sequence)) {\n map[sequence] = map[sequence]!!.plus(1)\n } else {\n map[sequence] = 1\n }\n if (pos + 2 < max) {\n findSequence(input, pos + 1, max)\n }\n}", "lang": "Kotlin", "bug_code_uid": "1e7feb972f0c1b52d2ecd30ae99b3156", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "a7df161ab54e6f8fe4d3fe1020ec8202", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7394179894179894, "equal_cnt": 18, "replace_cnt": 4, "delete_cnt": 6, "insert_cnt": 8, "fix_ops_cnt": 18, "bug_source_code": "fun main(args: Array) {\n val t = readLine()!!.toInt()\n \n repeat(t) {\n val ma = mutableMapOf() \n \n val n = readLine()!!.toInt()\n val s = readLine()!!\n \n var i=0\n var ans = -1\n var sans: String = s\n while(i ans){\n ans = ma[ss]!! + 1\n sans = ss\n }\n ma[ss]!!.plus(1)\n }\n i++\n }\n \n println(sans)\n \n \n }\n}", "lang": "Kotlin", "bug_code_uid": "ddcbdfe76ccf07f17a8d64739846d64d", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "6c9e0eb72e230e60175f98847125d158", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5799373040752351, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n val s = readLine()!!\n\n val twoGrams = mutableMapOf()\n\n for (i in 0..n) {\n if (i + 2 < n) {\n var twoGram = s.subSequence(i, i + 2).toString()\n twoGrams[twoGram] = twoGrams.getOrDefault(twoGram, 0) + 1\n }\n }\n println(twoGrams.maxBy { it.value }!!.key)\n}", "lang": "Kotlin", "bug_code_uid": "d0be033a1389aa8ae8c1ff9c2e92e3d3", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "9a9de3d3d5c7cfb06d7205bc9fa6f170", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8777777777777778, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "fun twoGram(input: String) = input.windowed(2).groupingBy { it }.eachCount().maxBy { it.value }?.key\n\nfun main(args: Array) {\n println(twoGram(args[1]))\n}", "lang": "Kotlin", "bug_code_uid": "0150914af9d11627751a9900f94865d5", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "f881774171e16bb48b6684d49d5b3823", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.3632923368022706, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.lang.StringBuilder\n\nfun main() {\n var s = StringBuilder(readLine())\n var arr = arrayOf(\"Danil\", \"Olya\", \"Slava\", \"Ann\", \"Nikita\")\n var k = -1\n for(i in 0..4) {\n if(s.indexOf(arr[i]) != -1) {\n k = s.indexOf(arr[i])\n s.replace(k,k+(arr[i].length),\"\")\n break\n }\n }\n if(k == -1) {\n print(\"NO\")\n }\n\n else {\n for(i in 0..4) {\n if(s.indexOf(arr[i]) != -1) {\n print(\"NO\")\n System.exit(0)\n }\n }\n print(\"YES\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "c5a3f332f79c8032321ead1e51fbc5e6", "src_uid": "db2dc7500ff4d84dcc1a37aebd2b3710", "apr_id": "e76bb0f2749ff76bbc163de01e0a9c71", "difficulty": 1100, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9987902250181466, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\n\nfun main(args : Array) {\n Thread { run() }.start()\n}\nval vowels = sortedSetOf('a', 'e', 'i', 'o', 'u')\nfun isVowel(c:Char):Boolean{\n for(x in vowels)\n if(x == c)\n return true\n return false\n}\nval sc = Scanner(System.`in`)\nfun run() {\n val n = sc.nextInt()\n val s = sc.next()\n var out = ArrayList()\n var ok = false\n for(i in 0 until n){\n if(ok && isVowel(s[i]))continue;\n out.add(s[i])\n ok = (isVowel(s[i]))\n }\n for(c in out)\n print(c)\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun LongArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun BooleanArray.print() {\n println(Arrays.toString(this))\n}\nfun nod(a: Long, b: Long): Long {\n var a1 = a\n var b1 = b\n while (a1 != 0L && b1 != 0L) {\n if (a1 < b1)\n b1 %= a1\n else\n a1 %= b1\n }\n return a1 + b1\n}\nfun nok(a: Long, b: Long): Long = a * b / nod(a, b)", "lang": "Kotlin", "bug_code_uid": "69e573a97b8fa0351cefd4e8fc46145e", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "apr_id": "1207e4a7be071d20374ea26b848ed63f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9930843706777317, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val vowels = setOf('a', 'e', 'i', 'o', 'u')\n\n fun Char.isVowel(): Boolean {\n return this in vowels\n }\n\n readLine()\n val s = '_' + readLine()!!\n val sb = StringBuilder()\n for ((pos, c) in s.substring(1 until s.length).withIndex())\n if (!c.isVowel() || !s[pos].isVowel()) sb.append(c)\n print(sb.toString())\n}\n", "lang": "Kotlin", "bug_code_uid": "81865a131fd113c81466fac8d28a9f66", "src_uid": "63a4a5795d94f698b0912bb8d4cdf690", "apr_id": "1c3a8a52f265dff08335005728f65c89", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9738562091503268, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val password = nextLine()\n val n = nextInt()\n val words = Array(n, {\"\"})\n nextLine()\n for(i in 0 until n)\n words[i] = nextLine()\n var ok = false\n for(i in 0 until n)\n for(j in 0 until n)\n if(\"${words[i].get(1)}${words[j].get(0)}\" == password)\n ok = true\n if(ok) println(\"YES\")\n else println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "af179e78e0bb622002b8b9b529a5ba74", "src_uid": "cad8283914da16bc41680857bd20fe9f", "apr_id": "b312ae3c0513a99405cdf669fc3808bb", "difficulty": 900, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9794050343249427, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n\n val pass: String = input.next()\n\n val n: Int = input.nextInt()\n val left = ArrayList()\n val right = ArrayList()\n\n for (i in 1..n) {\n val word = input.next()\n if (word == pass) {\n print(\"YES\")\n return\n }\n if (word[0] == pass[1]) {\n left.add(word)\n }\n if (word[1] == pass[0]) {\n right.add(word)\n }\n }\n\n if (left.size != 0 && right.size != 0) {\n print(\"YES\")\n return\n }\n\n print(\"NO\")\n\n}", "lang": "Kotlin", "bug_code_uid": "d10cdb7e503fa211a7d28dab5e2d635d", "src_uid": "cad8283914da16bc41680857bd20fe9f", "apr_id": "01113b5c8afde87d1f297f8807b9b25e", "difficulty": 900, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9880857823669579, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n\n val arr = IntArray(4)\n\n for (i in 0 until 4) {\n arr[i] = scanner.nextInt()\n }\n\n val total = scanner.nextInt()\n\n if (arr[0] == 1) {\n println(total)\n return\n }\n\n val dragons = BooleanArray(total)\n\n eratosphenKind(dragons, total, arr)\n\n println(dragons.count { it })\n\n}\n\nfun eratosphenKind(r: BooleanArray, n: Int, arr: IntArray) {\n for (i in arr) {\n if (!r[i - 1]) {\n for (j in i - 1 until n step i) {\n r[j] = true\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "daad8b999dd59fdf1c5a7cf35ed9b655", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "apr_id": "bcde151a15781dd0f785e589130955cd", "difficulty": 800, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9800796812749004, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val k = input.nextInt()\n val l = input.nextInt()\n val m = input.nextInt()\n val n = input.nextInt()\n val d = input.nextLong()\n\n output.print((1..d).filterIndexed { index, _ ->\n index % k == 0 || index % l == 0 || index % m == 0 || index % n == 0\n }.count())\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n fun nextLong(): Long {\n return next().toLong()\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "018b90a6e4f99f8406b1e56693f75331", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "apr_id": "5309e4103d40687f0d2ddaf18ece5f32", "difficulty": 800, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9593908629441624, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n val k = readLine()!!.toInt()\n val l = readLine()!!.toInt()\n val m = readLine()!!.toInt()\n val n = readLine()!!.toInt()\n val d = readLine()!!.toInt()\n val arr: Array = Array(d, { i -> 1})\n for (i in arr.indices) {\n if (i % k == 0)\n arr[i] = 0\n if (i % l == 0)\n arr[i] = 0\n if (i % m == 0)\n arr[i] = 0\n if (i % n == 0)\n arr[i] = 0\n }\n var ans = 0\n for (i in arr.indices) {\n if (arr[i] == 0)\n ans++\n }\n print(\"$ans\\n\")\n}\n", "lang": "Kotlin", "bug_code_uid": "ef3d005417cd12f47657d9664d1ffd6b", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "apr_id": "cc2fd6147d051003af2269fe1bce3b39", "difficulty": 800, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.994475138121547, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val a = Array(4, {readLine()!!.toInt()})\n val n = readLine()!!.toInt()\n\n println((0 until n).count{a.count {d -> it + 1 % d == 0} > 0 })\n}", "lang": "Kotlin", "bug_code_uid": "1f66a9a653fa6d78bc03168db3262e38", "src_uid": "46bfdec9bfc1e91bd2f5022f3d3c8ce7", "apr_id": "df73d79fd8836b5fe90001b9721967c0", "difficulty": 800, "tags": ["math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.432183908045977, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\n\nfun main() {\n val reader = Scanner(System.`in`)\n var noToHold = reader.nextInt()\n val containersLength = reader.nextInt()\n val containers = mutableMapOf()\n for (i in 1..containersLength) {\n containers.put(reader.nextInt(), reader.nextInt())\n }\n val sortedContainers = containers.toList()\n .sortedByDescending { (key, value) -> value }\n .toMap()\n var total = 0\n for (container in sortedContainers) {\n if (noToHold != 0) {\n if (container.key <= noToHold) {\n noToHold -= container.key\n total += container.key * container.value\n } else {\n total += noToHold * container.value\n noToHold -= noToHold\n }\n }\n else\n break\n }\n print(total)\n}", "lang": "Kotlin", "bug_code_uid": "df3bd4392db93713c02724d3dcafe2a2", "src_uid": "c052d85e402691b05e494b5283d62679", "apr_id": "ff4d2871be9135daf0931e104a81328e", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8450909090909091, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n var (n, m) = readLine()!!.split(\" \").map(String::toInt)\n val sibice : MutableList> = MutableList(n) { Par(0,0) }\n for(i in 0 until m) {\n val (f, s) = readLine()!!.split(\" \").map(String::toInt)\n sibice[i] = Par(f,s)\n }\n sibice.sortBy { -it.second }\n var sum = 0L\n while(n > 0) {\n if(sibice[0].first > 0) {\n sum += sibice[0].second\n sibice[0].first--\n n--\n } else {\n sibice.removeAt(0)\n if(sibice.isEmpty()) break\n }\n }\n println(sum)\n}\n\nclass Par constructor(var first : T1, var second : T2)\n\n", "lang": "Kotlin", "bug_code_uid": "9cde7862369554c757d15baf3227b9b2", "src_uid": "c052d85e402691b05e494b5283d62679", "apr_id": "74904ebbaec413e5a8fa14fc3a77cd27", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7647887323943662, "equal_cnt": 24, "replace_cnt": 12, "delete_cnt": 7, "insert_cnt": 4, "fix_ops_cnt": 23, "bug_source_code": "fun main(args: Array) {\n var (n, m) = readLine()!!.split(\" \").map(String::toLong)\n val sibice : MutableList> = MutableList(0) { Par(0L,0L) }\n for(i in 0 until m) {\n val (f, s) = readLine()!!.split(\" \").map(String::toLong)\n sibice.add(Par(f, s))\n }\n\n sibice.sortBy { -it.second }\n\n var sum = 0L\n var i = 0\n while(n > 0) {\n if(sibice[i].first > 0) {\n sum += sibice[i].second\n sibice[i].first--\n n--\n } else {\n sibice.removeAt(i)\n if(sibice.isEmpty()) break\n else i++\n }\n }\n\n println(sum)\n}\n\nclass Par constructor(var first : T1, var second : T2)\n\n", "lang": "Kotlin", "bug_code_uid": "1b38a2433ea91c0d3b0fe4e33da27436", "src_uid": "c052d85e402691b05e494b5283d62679", "apr_id": "74904ebbaec413e5a8fa14fc3a77cd27", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8465454545454546, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n var (n, m) = readLine()!!.split(\" \").map(String::toInt)\n val sibice : MutableList> = MutableList(m) { Par(0,0) }\n for(i in 0 until m) {\n val (f, s) = readLine()!!.split(\" \").map(String::toInt)\n sibice[i] = Par(f,s)\n }\n sibice.sortBy { -it.second }\n var sum = 0L\n while(n > 0) {\n if(sibice[0].first > 0) {\n sum += sibice[0].second\n sibice[0].first--\n n--\n } else {\n sibice.removeAt(0)\n if(sibice.isEmpty()) break\n }\n }\n println(sum)\n}\n\nclass Par constructor(var first : T1, var second : T2)\n\n", "lang": "Kotlin", "bug_code_uid": "795e7ea0bb7de63b91960b62151a4027", "src_uid": "c052d85e402691b05e494b5283d62679", "apr_id": "74904ebbaec413e5a8fa14fc3a77cd27", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7706214689265537, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 6, "bug_source_code": "import kotlin.math.abs\nimport kotlin.math.max\n\nfun main(args: Array) {\n val array: IntArray = readLine()!!.split(' ').map { it.toInt() }.toIntArray()\n var ambOut = array[2] - abs(array[0] - array[1])\n println(if((array[0] == 0 || array[1] == 0) && array[2] == 0) 0 else max(array[0], array[1]).plus(ambOut shr 1).times(2))\n}", "lang": "Kotlin", "bug_code_uid": "45303f64e0535e3e74b0cfa5bb1143be", "src_uid": "e8148140e61baffd0878376ac5f3857c", "apr_id": "3109663d943843c11268008d54bedc92", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.995850622406639, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n\n val array: IntArray = readLine()!!.split(' ').map { it.toInt() }.toIntArray()\n val min = min(array[0], array[1])\n\n if(array[0] == 0 || array[1] == 0 && array[2] == 0) println(0)\n else if(min + array[2] <= max(array[0], array[1])) println((min + array[2]).times(2))\n else println(max(array[0], array[1]).plus(array[2] - abs(array[0] - array[1]) shr 1).times(2))\n\n}", "lang": "Kotlin", "bug_code_uid": "86a8d6e31423993e5e205b6527cecef9", "src_uid": "e8148140e61baffd0878376ac5f3857c", "apr_id": "3109663d943843c11268008d54bedc92", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7470449172576832, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val line = BufferedReader(InputStreamReader(System.`in`)).readLine().split(' ')\n\n var l = line[0].toInt()\n var r = line[1].toInt()\n var a = line[2].toInt()\n\n while (a > 0 && r != l) {\n a--\n if (r > l) l++ else if (l > r) r++\n }\n\n if (r == l) {\n while (a > 0) {\n a--\n if (a % 2 == 0) r++ else l++\n }\n }\n if (l == 0 || r == 0) return println(0)\n\n var result = l + r\n if (result % 2 != 0) result--\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "1f50777f3f20eb40709d4958ce527ed9", "src_uid": "e8148140e61baffd0878376ac5f3857c", "apr_id": "6ebbfb5a17bd7f9b64f76d38a83bff42", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9649122807017544, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package cf1185\n\nimport kotlin.math.max\n\nfun main() {\n val item = readLine()!!.split(\" \").map { it.toInt() }\n val d = item.last()\n val (a, b, c) = item.dropLast(1).sorted()\n\n print(max(d - (b - a), 0) + max(d - (c - b), 0))\n}", "lang": "Kotlin", "bug_code_uid": "4381d2a2a8d4d65d24fbc19daf6e7f38", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "50b91417e7bea09507b7acb18f8f7813", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9791955617198336, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package today\n\nfun main(args: Array) {\n val (a, b, c, d) = readLine()!!.split(\" \").map { it.toInt() }\n val (left, center, right) = listOf(a, b, c).sorted()\n var result = 0\n val d1 = center - left\n val d2 = right - center\n if (d1 < d) {\n result += (d - d1)\n }\n if (d2 < d) {\n result += (d - d2)\n }\n\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "8522f93d422ad231dc4762a30969240b", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "c84ad6f73ff36269101c20b51c592a54", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9986168741355463, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.max\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n val a = IntArray(3)\n for (i in 0..2)\n a[i] = ir.nextInt()\n val d = ir.nextInt()\n\n Arrays.sort(a)\n\n val count = max(d - (a[1] - a[0]), 0) + max(0, a[2] - a[1])\n\n pw.print(count)\n\n}\n\nfun count(num: Int): Int {\n var count = 0\n var n = num\n while (n > 0) {\n count += (n % 10)\n n /= 10\n }\n return count\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextFloat(): Float {\n return java.lang.Float.parseFloat(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "41ad3acf97bdf7e5882963dfc4d479fc", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "fb3b8b654be95791802da7eaf0ebcb26", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.3900709219858156, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n var (a, b, c, d) = readLine()!!.split(\" \").map{ it.toInt() }\n if (a > b) a = b.also { b = a }\n if (b > c) b = c.also { c = b }\n var ans = max(0, d - (b - a)) + max(0, d - (c - b))\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "0b107817319a7155e95836ce4164c4fa", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "4ee477352994c40c35692e204db5f1e5", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9858451290591174, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val (a, b, c, d) = readInts()\n\n // ab c\n // a b c\n\n // ab c\n // a b c\n\n // abc\n // a b c\n\n val min = Math.min(a, Math.min(b, c))\n val max = Math.max(a, Math.max(b, c))\n val mid = when {\n a == min && b == max -> c\n b == min && a == max -> c\n a == min && c == max -> b\n c == min && a == max -> b\n b == min && c == max -> a\n b == max && c == min -> a\n else -> error(\"wtf\")\n }\n val d1 = mid - min\n val d2 = max - mid\n val d1x = if (d - d1 > 0) d - d1 else 0\n val d2x = if (d - d2 > 0) d - d2 else 0\n if (d1 + d2 < d) {\n //move ends\n println(d1x + d2x)\n } else {\n //move mid\n val ans = if (d1x > 0) d1x else d2x\n println(ans)\n }\n}\n\nprivate fun readln() = readLine()!!\nprivate fun readInt() = readln().toInt()\nprivate fun readStrings() = readln().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun printList(l: List, d: String = \" \") = l.forEach { print(\"$it$d\") }.also { println() }\n\nprivate fun List.subList(fromIndex: Int): List = this.subList(fromIndex, this.size)\n", "lang": "Kotlin", "bug_code_uid": "dfc729d178dd6f06158718a7f1768629", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "5cbc89b2c2cea39bfa01b3835fdb2815", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7839388145315488, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(){\n val (a, b, c, d) = readLine()!!.split(' ').map { it.toInt() }\n val arr = arrayListOf(a, b, c)\n arr.sort()\n var steps = 0\n\n steps+=d-(arr[1]-arr[0])\n steps+=d-(arr[2]-arr[1])\n\n println(steps)\n}", "lang": "Kotlin", "bug_code_uid": "a335a62bbe78ae7ef1f3203b2bc248bc", "src_uid": "47c07e46517dbc937e2e779ec0d74eb3", "apr_id": "836cb37fd67c04835880fdcd9b04447f", "difficulty": 800, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9775140537164272, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun gcd(a: Long, b: Long) : Long = if (a == 0L) b else gcd(b % a, a)\n\nfun exGcd(a: Long, b: Long) : Pair {\n if (a == 0L)\n return 0L to 1L\n val (r1, r2) = exGcd(b % a, a)\n return r2 - r1 * (b/a) to r1\n}\n\nfun main(args : Array) {\n //====== Input preparations ========================================================\n// val fin = BufferedReader(FileReader(\"d.in\"))\n val fin = BufferedReader(InputStreamReader(System.`in`))\n val fout = PrintWriter (System.out)\n var tokenizer = StringTokenizer(\"\")\n fun next() : String {\n while (!tokenizer.hasMoreTokens())\n tokenizer = StringTokenizer(fin.readLine())\n return tokenizer.nextToken()\n }\n fun nextInt() = next().toInt()\n fun nextPair() = next().toLong() to next().toLong()\n fun nextPairDec() = nextInt()-1 to nextInt()-1\n //====== Solution below ============================================================\n val (a1, b1) = nextPair()\n val (a2, b2) = nextPair()\n val (l, r) = nextPair()\n var (k,m,v) = Triple(a1, a2, b2 - b1)\n val d = gcd(k, m)\n if (v % d != 0.toLong()) {\n fout.print(0)\n return\n }\n v /= d\n k /= d\n m /= d\n val (kk, km) = exGcd(k, m)\n val num = (kk % m * v % m + m) % m\n\n var st = b1 + num * a1.toLong()\n val h = a1.toLong() * m\n fun get(x : Long) : Long {\n val sh = x - st\n if (sh < 0)\n return 0\n return sh / h + 1\n }\n val otherGet = get(b2.toLong())\n if (h < 5e9)\n st += Math.max(Math.max(otherGet - 20, 0L) * h, 0L)\n while (st < b2)\n st += h\n fout.print(get(r.toLong()) - get(l.toLong() - 1))\n\n fout.close()\n fin.close()\n}\n\n", "lang": "Kotlin", "bug_code_uid": "f1c31c7133243c7a1a5d4e518601390a", "src_uid": "b08ee0cd6f5cb574086fa02f07d457a4", "apr_id": "8db327e3f179f5e7c660fee5b370b950", "difficulty": 2500, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9836494440810988, "equal_cnt": 8, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "val MOD = 1000000007\n\nfun multiplyMatrices(firstMatrix: Array>, secondMatrix: Array>, r1: Int, c1: Int, c2: Int): Array> {\n val product = Array(r1) { IntArray(c2).toTypedArray() }\n for (i in 0 until r1) {\n for (j in 0 until c2) {\n for (k in 0 until c1) {\n product[i][j] = ((product[i][j].toLong() + firstMatrix[i][k].toLong() * secondMatrix[k][j].toLong()) % MOD).toInt()\n }\n }\n }\n\n return product\n}\n\nfun rise(matrix: Array>, p: Int): Array> {\n var ind = 0\n var multiArray = Array>(matrix.size) { Array(matrix.size) {0} }\n for (row in 0 until matrix.size) {\n multiArray[row][row] = 1\n }\n var factor = matrix\n while ((p shr ind) > 0) {\n if ((p shr ind) and 1 == 1)\n multiArray = multiplyMatrices(multiArray, factor, matrix.size, matrix.size, matrix.size)\n factor = multiplyMatrices(factor, factor, matrix.size, matrix.size, matrix.size)\n ind++\n }\n return multiArray\n}\n\nfun main(args: Array) {\n val (n, m) = readLine()!!.split(' ').map(String::toInt)\n val multiArray = Array>(m) { Array(m) {0} }\n for (row in 0 until m-1) {\n multiArray[row][row+1] = 1\n }\n multiArray[m-1][0] = 1\n multiArray[m-1][m-1] = 1\n\n val finar = rise(multiArray, n-1)\n\n val init = Array>(m) { Array(1) {1} }\n\n val result = multiplyMatrices(finar, init, m, m, 1)\n\n print(result[m-1][0])\n}", "lang": "Kotlin", "bug_code_uid": "9e7a50c5fa7320125c1f5bba888255fe", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "apr_id": "df27b581c29db46f8734247b62785ade", "difficulty": 2100, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9980557355800389, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "val MOD = 1000000007\n\nfun multiplyMatrices(firstMatrix: Array>, secondMatrix: Array>, r1: Int, c1: Int, c2: Int): Array> {\n val product = Array(r1) { IntArray(c2).toTypedArray() }\n for (i in 0 until r1) {\n for (j in 0 until c2) {\n for (k in 0 until c1) {\n product[i][j] = ((product[i][j].toLong() + firstMatrix[i][k].toLong() * secondMatrix[k][j].toLong()) % MOD).toInt()\n }\n }\n }\n\n return product\n}\n\nfun rise(matrix: Array>, p: Long): Array> {\n var ind = 0\n var multiArray = Array>(matrix.size) { Array(matrix.size) {0} }\n for (row in 0 until matrix.size) {\n multiArray[row][row] = 1\n }\n var factor = matrix\n while ((p shr ind) > 0) {\n if ((p shr ind) and 1L == 1L)\n multiArray = multiplyMatrices(multiArray, factor, matrix.size, matrix.size, matrix.size)\n factor = multiplyMatrices(factor, factor, matrix.size, matrix.size, matrix.size)\n ind++\n }\n return multiArray\n}\n\nfun main(args: Array) {\n val (n, ml) = readLine()!!.split(' ').map(String::toLong)\n val m = ml.toInt()\n val multiArray = Array>(m) { Array(m) {0} }\n for (row in 0 until m-1) {\n multiArray[row][row+1] = 1\n }\n multiArray[m-1][0] = 1\n multiArray[m-1][m-1] = 1\n\n val finar = rise(multiArray, n-1)\n\n val init = Array>(m) { Array(1) {1} }\n\n val result = multiplyMatrices(finar, init, m, m, 1)\n\n print(result[m-1][0])\n}", "lang": "Kotlin", "bug_code_uid": "73941f896c9735b90c93d8f5ae6a1466", "src_uid": "e7b9eec21d950f5d963ff50619c6f119", "apr_id": "df27b581c29db46f8734247b62785ade", "difficulty": 2100, "tags": ["matrices", "dp", "math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.883054892601432, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.streams.toList\n\nfun main(args: Array) {\n val a = readLine()!!.chars().toList()\n if (a.distinct().count() % 2 == 0) {\n print(\"CHAT WITH HER!\")\n } else {\n print(\"IGNORE HIM!\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "f3761e866916b051b8d1d1b5c2fdc86e", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "8d16098f5fc4c8134fa2f4518b208554", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9975062344139651, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n if(checkGender(readLine().toString())) {\n println(\"CHAT WITH HER\")\n }\n else {\n println(\"IGNORE HIM\")\n }\n}\nfun checkGender(hello:String):Boolean {\n val map: HashMap = HashMap()\n for(c in hello){\n if(!map.containsKey(c)){\n map[c] = 1\n }\n }\n return map.size%2==0\n }", "lang": "Kotlin", "bug_code_uid": "fa67e922556fa276a5e5ba07c52042ca", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "0a260ac4ecb0043245352248650e1307", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9640287769784173, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val sol = Solution()\n if(sol.checkGender(readLine().toString())) {\n println(\"CHAT WITH HER!\")\n }\n else {\n println(\"IGNORE HIM!\")\n }\n}\n\nfun checkGender(hello:String):Boolean {\n val map: HashMap = HashMap()\n for(c in hello){\n if(!map.containsKey(c)){\n map[c] = 1\n }\n }\n return map.size%2==0\n }", "lang": "Kotlin", "bug_code_uid": "acde28b8de28d4a7a2e87087ba398275", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "0a260ac4ecb0043245352248650e1307", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8523489932885906, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "package codeforces\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val In = BufferedReader(InputStreamReader(System.`in`))\n val name = In.readLine()!!.toSet()\n if(name.size % 2 ==0)\n println(\"IGNORE HIM!\")\n else\n println(\"CHAT WITH HER!\")\n}", "lang": "Kotlin", "bug_code_uid": "9349f0ac10b858f1c76f5f343eac6d72", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "4a866ee546b28f7d319367883a72dfbb", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8561872909698997, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "//package codeforces\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val In = BufferedReader(InputStreamReader(System.`in`))\n val name = In.readLine()!!.toSet()\n if(name.size % 2 ==0)\n println(\"IGNORE HIM!\")\n else\n println(\"CHAT WITH HER!\")\n}", "lang": "Kotlin", "bug_code_uid": "d775a74b7bbb89d2ff26702607fc9041", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "4a866ee546b28f7d319367883a72dfbb", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6130177514792899, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.math.BigInteger\nimport java.util.*\n\n\nfun cnk(n: Long, k: Long): BigInteger {\n var fenzi = BigInteger(\"1\")\n var fenmu = BigInteger(\"1\")\n for (i in n - k + 1..n) {\n fenzi = fenzi.multiply(i.toBigInteger())\n }\n for (j in 1..k) {\n fenmu = fenmu.multiply(j.toBigInteger())\n }\n return fenzi.divide(fenmu)\n}\n\nconst val MOD = 998244353L\n\nfun main(args : Array) {\n @Suppress(\"unused\")\n class Scanner {\n private val br = BufferedReader(InputStreamReader(System.`in`), 32768)\n private var tk = StringTokenizer(\"\")\n operator fun next(): String {\n while (!tk.hasMoreElements()) {\n try {\n tk = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n }\n return tk.nextToken()\n }\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextDouble() = next().toDouble()\n }\n val sin = Scanner()\n val out = PrintWriter(System.out)\n\n repeat(1) { testNo ->\n val n = sin.nextLong()\n val k = sin.nextLong()\n var res = 0L\n for (a1 in 1..n) {\n val l = n/a1\n res += (cnk(l-1, k-1) % MOD.toBigInteger()).toLong()\n res %= 998244353;\n }\n out.println(res)\n }\n\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "4d926feb0735a37d928e993f66317453", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "apr_id": "c2aee2c0f0d48999505bc18d83e984e8", "difficulty": 2000, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9767827529021559, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.*\n\nconst val MOD = 998244353L\n\nfun calcInv(n: Int): LongArray {\n require(n <= MOD)\n val res = LongArray(n) { 1 }\n for (i in 2 until n) {\n res[i] = (MOD - (MOD /i)*res[(MOD%i).toInt()] % MOD) % MOD\n }\n return res\n}\n\nfun main(args : Array) {\n @Suppress(\"unused\")\n class Scanner {\n private val br = BufferedReader(InputStreamReader(System.`in`), 32768)\n private var tk = StringTokenizer(\"\")\n operator fun next(): String {\n while (!tk.hasMoreElements()) {\n try {\n tk = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n }\n return tk.nextToken()\n }\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextDouble() = next().toDouble()\n }\n val sin = Scanner()\n val out = PrintWriter(System.out)\n\n repeat(1) { testNo ->\n val n = sin.nextInt()\n val k = sin.nextInt()\n val inv = calcInv(n)\n val fact = LongArray(n) { 1 }\n val ifact = LongArray(n) { 1 }\n for (p in 2 until fact.size) {\n fact[p] = (fact[p-1] * p) % MOD\n }\n for (p in 2 until ifact.size) {\n ifact[p] = (ifact[p-1] * inv[p]) % MOD\n }\n var res = 0L\n for (a1 in 1..n) {\n val cn = n/a1 - 1\n val ck = k-1\n if (cn < ck) break\n res = (res + fact[cn] * ifact[cn - ck]) % MOD\n }\n res = (res * ifact[k-1]) % MOD\n out.println(res)\n }\n\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "79efe218728f696e730b496a0e8bc4fc", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "apr_id": "c2aee2c0f0d48999505bc18d83e984e8", "difficulty": 2000, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9582264565775009, "equal_cnt": 12, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 11, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.lang.StringBuilder\nimport java.util.*\n\n// region\nclass ModInt(x: Long) {\n\n companion object {\n const val MOD = 998244353L\n }\n\n val x = (x % MOD + MOD) % MOD\n\n operator fun plus(other: ModInt): ModInt {\n return ModInt(x + other.x)\n }\n\n operator fun minus(other: ModInt): ModInt {\n return ModInt(x - other.x)\n }\n\n operator fun times(other: ModInt): ModInt {\n return ModInt(x * other.x)\n }\n\n operator fun div(other: ModInt): ModInt {\n return this * other.inv()\n }\n\n fun pow(exp: Long): ModInt {\n if (exp == 0L) return ModInt(1L)\n var a = pow(exp shr 1)\n a *= a\n if (exp and 1L == 0L) return a\n return this * a\n }\n\n fun inv(): ModInt {\n return this.pow(MOD - 2)\n }\n\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as ModInt\n\n if (x != other.x) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return x.hashCode()\n }\n\n override fun toString(): String {\n return \"$x\"\n }\n\n}\n\nval fac = mutableListOf()\n\nfun fact(n: Long): ModInt {\n if (fac.count() == 0) fac.add(ModInt(1))\n while (fac.count() <= n) {\n fac.add(fac.last() * ModInt(fac.count().toLong()))\n }\n return fac[n.toInt()]\n}\n\nfun comb(n: Long, k: Long): ModInt {\n return fact(n) / fact(k) / fact(n - k)\n}\n\nfun comb2(n: Long, k: Long): ModInt {\n var ans = ModInt(1)\n for (i in 0 until k) {\n ans = ans * ModInt(n - i) / ModInt(k - i)\n }\n return ans\n}\n// endregion\n\nfun PrintWriter.solve(sc: FastScanner) {\n val n = sc.nextLong()\n val k = sc.nextLong()\n var ans = ModInt(0)\n for (a1 in 1..n) {\n val v = n / a1\n if (v < k) break\n ans += comb(v - 1, k - 1)\n }\n println(ans)\n}\n\nfun main(args: Array) {\n val writer = PrintWriter(System.out, false)\n writer.solve(FastScanner(System.`in`))\n writer.flush()\n}\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}", "lang": "Kotlin", "bug_code_uid": "5e232616fc94a9ae5f91be933274c1c0", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "apr_id": "cfe9a5b8cf26db874ed7112893f8e3d7", "difficulty": 2000, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9994890137966275, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun readInt() = readLine()!!.toInt()\nfun readInts() = readLine()!!.split(' ').map { it.toInt() }\n\nfun main() {\n val (n, k) = readInts()\n\n if (k == 1) {\n println(n)\n } else {\n var res = 0.moduloArithmetic()\n for (i in 1..n-k) {\n res += choose(n/i - 1, k - 1)\n }\n println(res)\n }\n}\n\n/**\n * / n \\\n * | |\n * \\ k /\n */\nfun choose(n: Int, k: Int): IntMod {\n if (k > n || n <= 0) return 0.moduloArithmetic()\n if (k == 0 || k == n) return 1.moduloArithmetic()\n\n return n.factorialModulo() / (k.factorialModulo() * (n-k).factorialModulo())\n}\n\nconst val MOD: Int = 998_244_353\n\ninline class IntMod(private val i: Int) {\n operator fun plus(increment: IntMod): IntMod = IntMod(Math.floorMod(i + increment.i, MOD))\n operator fun plus(increment: Int): IntMod = this + increment.moduloArithmetic()\n\n operator fun minus(other: IntMod): IntMod = IntMod(Math.floorMod(i - other.i, MOD))\n operator fun minus(decrement: Int): IntMod = this - decrement.moduloArithmetic()\n\n operator fun times(other: IntMod): IntMod = IntMod(Math.floorMod(i.toLong() * other.i, MOD.toLong()).toInt())\n operator fun times(other: Int): IntMod = this * other.moduloArithmetic()\n operator fun div(other: IntMod): IntMod = this * other.multiplicativeInverse()\n operator fun div(other: Int): IntMod = this / other.moduloArithmetic()\n\n override fun toString(): String = i.toString()\n\n private fun multiplicativeInverse(): IntMod = pow(MOD - 2)\n\n // i^n\n fun pow(n_in: Int): IntMod {\n var x = this\n var y = IntMod(1)\n var n = n_in\n // x^n\n while (n > 0) {\n if (n % 2L != 0L) y *= x\n n /= 2\n x *= x\n }\n return y\n }\n}\n\nfun Int.moduloArithmetic() : IntMod = IntMod(this % MOD)\n\nfun Int.factorialModulo(): IntMod {\n var res = 1.moduloArithmetic()\n for (i in 2..this) {\n res *= i\n }\n return res\n}\n", "lang": "Kotlin", "bug_code_uid": "8577a142bdebb962e57d013aa411c190", "src_uid": "8e8eb64a047cb970a549ee870c3d280d", "apr_id": "9e4cfcc2b46f805fd225db00ba52c7c5", "difficulty": 2000, "tags": ["math", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.997384481255449, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //var (x, y) = r.readLine()!!.split(\" \").map { it.toLong() }\n //val n = r.readLine()!!.toInt()\n //val (a, b, c, d) = r.readLine()!!.split(\" \").map { it.toInt() }\n val str = r.readLine()!!\n val list = listOf('A', 'E', 'I', 'O', 'U', 'Y')\n var dis = 0\n var max = 0\n for (i in str.length-1 downTo 0){\n if (str[i] in list){\n dis = 1\n } else {\n dis++\n max = maxOf(max, dis)\n }\n }\n println(maxOf(1, max))\n}", "lang": "Kotlin", "bug_code_uid": "8cbff593271538aa503675a72ca7da81", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "apr_id": "a12023dbb69ffe5e58f5a919cd82b808", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9507494646680942, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n var const = \"AEIOUY\"\n var str = readLine()!!.split(\"A\",\"E\",\"I\",\"O\",\"U\",\"Y\")\n println(str)\n var str1 = str.maxBy { it.length }\n println(str1!!.length+1)\n\n\n\n}", "lang": "Kotlin", "bug_code_uid": "eacbd305566e0f7ae1d66f4b530b3d02", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "apr_id": "830ede1f81a5c475d890d7093020a708", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7111801242236024, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n val s = 'a' + readLine()!! + 'a'\n var sol = 0\n var last = 0\n val vowels = setOf('a', 'e', 'i', 'o', 'u', 'y')\n for (pos in 1 until s.length) {\n if (s[pos] in vowels) {\n sol = max(sol, pos - last)\n last = pos\n }\n }\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "4476fea5e3a4ab8b4c94de5d5bcde4f7", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "apr_id": "040a749a83fc601f3d8f3f59156f8ded", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8494041170097508, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\n\nval inp = new BufferedReader(new InputStreamReader(System.`in`))\nval out = new BufferedWriter(new OutputStreamWriter(System.out))\n\nfun main(args: Array ) {\n\n\tval s = inp.readLine() + \"A\"\n\n\tvar cur = -1\n\tvar ans = 0\n\tfor ( i in 0..s.length-1 ) {\n\t\tif ( s[i] in \"AEIOUY\" ) {\n\t\t\tans = Math.max ( ans, i - cur )\n\t\t\tcur = i\n\t\t}\n\t}\n\n\tout.write( ans.toString() + '\\n' )\n\tinp.close()\n\tout.close()\n}\n", "lang": "Kotlin", "bug_code_uid": "1489e79b866bdb1d79aeac9158b0849c", "src_uid": "1fc7e939cdeb015fe31f3cf1c0982fee", "apr_id": "56f7ad9b5fd2179a32b94b42b8e181f0", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9956728688879273, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n}\n\nval MAX_N = (1e6 + 10).toInt()\nval INF = (1e9 + 7).toInt()\nval MOD = (1e9 + 7).toInt()\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n val n = reader.nextInt()\n val s = reader.next()\n\n var ans = false\n for (i in 1 until n - 1) {\n val c1 = s[i - 1]\n val c2 = s[i]\n val c3 = s[i + 1]\n\n if (c2 == '?' && c3 == '?') {\n ans = true\n break\n }\n\n if (c2 == '?' && c1 == c3) {\n ans = true\n break\n }\n }\n\n if (s.last() == '?') {\n ans = true\n }\n\n for (i in 0 until n - 1) {\n val c1 = s[i]\n val c2 = s[i + 1]\n if (c1 == c2 && c1 != '?') {\n ans = false\n break\n }\n }\n\n writer.println(if (ans) \"YES\" else \"NO\")\n}\n\nclass InputReader(stream: InputStream) {\n val reader: BufferedReader\n var tokenizer: StringTokenizer? = null\n\n init {\n reader = BufferedReader(InputStreamReader(stream), 32768)\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n}", "lang": "Kotlin", "bug_code_uid": "80eab4106f69e3e00058afe64cd8a20f", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "apr_id": "27592649eb8c4e8a793b8a082a8a0fdd", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.539291217257319, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val painting = readLine()!!\n \n with (painting) {\n if (contains(\"CC\") || contains(\"MM\") || contains(\"YY\")) {\n println(\"No\")\n return\n }\n if (painting.count { it == '?' } == 1) {\n if (contains(\"C?M\") || contains(\"M?Y\") || contains(\"Y?C\")\n || contains(\"M?C\") || contains(\"Y?M\") || contains(\"C?Y\")) {\n println(\"No\")\n return\n }\n }\n if (painting.count { it == '?' } == 0) {\n println(\"No\")\n return\n }\n }\n\n println(\"Yes\")\n}", "lang": "Kotlin", "bug_code_uid": "89f35f9b5c663b890c739f90a0f1a7c9", "src_uid": "f8adfa0dde7ac1363f269dbdf00212c3", "apr_id": "f58a1925c5704ccef1c021e487528bab", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.388327721661055, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "fun main(args: Array) {\n val input = Scanner(System.`in`)\n\n val n = input.nextInt()\n val m = input.nextInt()\n val a = input.nextInt()\n\n var result = (n downTo 1 step a).count()\n if (m > n) {\n for (i in m downTo n step a) {\n result++\n }\n }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "670662f12c2ae031dd1b65ebd16de500", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "8a84e85c78afef8ec36678321ce80b01", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9966777408637874, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val (m,n,a)= scan.nextLine().split(\" \").map{ it.trim().toInt() }.toTypedArray()\n var x = (m/a.toDouble())\n var y = (n/a.toDouble())\n var ans = Math.ceil(x) * Math.ceil(y)\n println(ans.toLong)\n}\n", "lang": "Kotlin", "bug_code_uid": "af1a97b349c1dfc2f5e454dfd1506c0f", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "2e2707240b37bcae59a55862502b13b3", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6533776301218162, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main(args: Array) {\n val input = readInts()\n \n var w = input[1]\n val s = input[2]\n\n var sum = 0\n\n for(i in 1..w step s) {\n var l = input[0]\n for(j in 1..l step s) {\n sum++\n }\n }\n \n println(sum)\n}", "lang": "Kotlin", "bug_code_uid": "3bc80aa86fc8d5be7338465407a929d3", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "0cb17b3300ccabd846ae71309e55a679", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9899348727057431, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "package set_1\n//import java.util.*;\n\nfun readString(): String {\n val line: String? = readLine()\n return (line ?: \"\").trim()\n}\n\nfun readWords(): List {\n val s: String = readString()\n val pat: Regex = Regex(\"\\\\s+\")\n return s.split(pat)\n}\n\nfun readInts(): List {\n val words: List = readWords()\n var lst: ArrayList = ArrayList()\n for (word in words) {\n try {\n var v: Int = word.toInt()\n lst.add(v)\n }\n catch(nfe: NumberFormatException) {\n println(\"invalid word: \" + word)\n }\n }\n return lst\n}\n\nfun main(args: Array) {\n val lst: List = readInts()\n val n = lst[0]\n val m = lst[1]\n val a = lst[2]\n val width = (n-1) / a + 1\n val height = (m-1) / a + 1\n val num = width * height;\n println(num)\n}", "lang": "Kotlin", "bug_code_uid": "50f9728fbed62816122b67924581edb4", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "d244c0340f00a71f0d99bb3880241db7", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.39543726235741444, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n var a = scan.nextInt()\n var b = scan.nextInt()\n var c = scan.nextInt()\n var num1 = 0\n var num2 = 0\n while (b>0) {\n b=b-c\n num1++\n while (a>0) {\n a-=c\n num2++\n }\n}\nprintln(num1*num2)\n}", "lang": "Kotlin", "bug_code_uid": "ca19c846324610169649e096afa21dcc", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "7fb563292f74466192237650d50de867", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.1966019417475728, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n\n val m = readLine()!!.toInt()\n val n = readLine()!!.toInt()\n val a = readLine()!!.toInt()\n\n var height = 0\n var width = 0\n\n if (m % a == 0) {\n height = m / a\n }\n else{\n height = m / a + 1\n }\n if (n % a == 0) {\n width = n / a\n }\n else{\n width = n / a + 1\n }\n println(width + height)\n}\n", "lang": "Kotlin", "bug_code_uid": "8d91de54f5bd59888299d60d898abb10", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "b51149b6af963dc76b0481e962d86145", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9577287066246056, "equal_cnt": 9, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader\n\nobject Problem1A {\n val reader: BufferedReader\n get() = System.`in`.bufferedReader(Charsets.UTF_8)\n\n @JvmStatic\n fun main(args: Array) {\n val problemArguments = parse(reader.use { readLine() }!!)\n println(solve(problemArguments))\n }\n\n private fun solve(args: Arguments): Int {\n val column = (args.n + args.a - 1) / args.a\n val row = (args.m + args.a - 1) / args.a\n return column * row\n }\n\n private fun parse(input: String): Arguments {\n val splitInput = input.split(\"\\\\s+\".toRegex())\n return Arguments(splitInput[0].toInt(),\n splitInput[1].toInt(),\n splitInput[2].toInt())\n }\n\n data class Arguments(val n: Int, val m: Int, val a: Int)\n}\n", "lang": "Kotlin", "bug_code_uid": "19c4f7878cf8728a5e4270e9577b1427", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "72b25d183f3a5973112180e50cf8175f", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.95, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "package codeforce\n\nimport java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val n = input.nextInt()\n val m = input.nextInt()\n val a = input.nextInt()\n println((if (n % a != 0) (n / a + 1) else (n / a)) * (if (m % a != 0) (m / a + 1) else (m / a)))\n}\n", "lang": "Kotlin", "bug_code_uid": "7c4eb054dd6ace2524041cedeceef053", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "d725d721d808fc2625f0332b3536befc", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.37515842839036756, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\n\nfun main(args: Array){\n val scan = Scanner(System.`in`)\n var n = scan.nextInt()\n var m = scan.nextInt()\n val a = scan.nextInt()\n var x = 0\n var y = 0\n while (n > 0){\n n -=a\n x++\n }\n while (m > 0){\n m -=a\n y++\n }\n print(x*y)\n}", "lang": "Kotlin", "bug_code_uid": "d865bee79371c1969a7fe7dd3692c4ab", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "36b99cc238f5b97179159989c3df77e4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6041055718475073, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n val scan = Scanner(System.`in`)\n val n = scan.nextDouble()\n val m = scan.nextDouble()\n val a = scan.nextDouble()\n\n print(Math.ceil(n / a) * Math.ceil(m / a))\n}", "lang": "Kotlin", "bug_code_uid": "0cc6438973e8e1c46d669c2e09a8c536", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "36b99cc238f5b97179159989c3df77e4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9855585027998821, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\nimport java.util.function.Consumer\nimport kotlin.math.abs\n\nval counts = mutableListOf>() // (odd, even)\nval cuts = mutableListOf() // Price\n\nfun main(args: Array) {\n\n\n val data = mutableListOf()\n\n\n val reader = Scanner(System.`in`)\n var iterations: Int = reader.nextInt()\n var bitcoins: Int = reader.nextInt()\n\n for (i in 0..iterations - 1) {\n val number = reader.nextInt()\n data.add(number)\n createCount(number, i)\n }\n\n for (i in 1..iterations - 2) {\n if (isCuttable(counts.get(i))) {\n val price = absValue(data[i - 1], data[i])\n cuts.add(price)\n }\n }\n\n var count = 0\n var cutValue = 0\n cuts.sort()\n cuts.forEach(Consumer {\n cutValue += it\n if (bitcoins - cutValue >= 0)\n count++\n })\n\n print(count)\n\n}\n\nfun isCuttable(pairs: Pair): Boolean {\n return pairs.first == pairs.second\n}\n\nfun createCount(number: Int, index: Int) {\n\n val even = isEven(number)\n\n if (index == 0) {\n addToCount(even, Pair(0, 0))\n return\n }\n addToCount(even, counts.get(index - 1))\n}\n\n\nfun addToCount(even: Boolean, pair: Pair) {\n val (oddNumber, evenNumber) = pair\n if (even) {\n addToCount(oddNumber, evenNumber + 1)\n } else {\n addToCount(oddNumber + 1, evenNumber)\n }\n}\n\n\nfun addToCount(oddNumber: Int, evenNumber: Int) {\n add(counts, Pair(oddNumber, evenNumber))\n}\n\nfun add(list: MutableList>, pairs: Pair) {\n list.add(pairs)\n}\n\n\nfun isEven(x: Int): Boolean {\n return x % 2 == 0;\n}\n\nfun absValue(x: Int, y: Int): Int {\n return abs(x - y);\n}", "lang": "Kotlin", "bug_code_uid": "1bd36027d3b64a4a841a3406eea878ba", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "apr_id": "28e71851116a9ec4b25c7c54f788b57f", "difficulty": 1200, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9776785714285714, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\nfun main(args: Array) {\n if (args.isNotEmpty() && args[0] == \"debug\") {\n System.setIn(object {}.javaClass.getResourceAsStream(\"/input.txt\"))\n }\n\n solve()\n}\n\nfun getIntString() = readLine()!!\n .split(' ')\n .map { Integer.parseInt(it) }\n .toCollection(ArrayList())\n\n\nfun solve() {\n val str1 = getIntString()\n val n = str1[0]\n var b = str1[1]\n val seq = getIntString()\n\n val costes = ArrayList()\n\n for (i in 1 until n) {\n if (checkSeq(seq.subList(0, i)) && checkSeq(seq.subList(i, n))) {\n val cost = Math.abs(seq[i-1] - seq[i])\n costes.add(cost)\n }\n }\n\n var result = 0\n costes.sorted().forEach {\n if (result + it <= b) {\n b -= it\n result++\n }\n }\n\n println(result)\n\n}\n\nfun checkSeq(list: List): Boolean {\n if (list.size % 2 != 0) {\n return false\n }\n var even = 0\n var notEven = 0\n list.forEach {\n if (it % 2 ==0) {\n even++\n } else {\n notEven++\n }\n }\n return even == notEven\n}", "lang": "Kotlin", "bug_code_uid": "8e50e76f8f3d437e7932940870b9e93b", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "apr_id": "7c4a1316af3b01958ad7073773802986", "difficulty": 1200, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8239453217063398, "equal_cnt": 18, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 18, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.InputStream\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.log\n\nfun main(args: Array) {\n class Scanner(s: InputStream) {\n private var st: StringTokenizer? = null\n private var br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n }\n\n val scan = Scanner(System.`in`)\n\n val n = scan.nextInt()\n val b = scan.nextInt()\n\n val a = (0 until n).map { scan.nextInt() }\n\n println(bestCuts(a, b))\n\n}\n\nfun bestCuts(a: List, b: Int): Int {\n if (a.size <= 2) return 0\n\n var ans = 0\n var odds = 0\n var evens = 0\n a.forEachIndexed { index, item ->\n if (item % 2 == 0) evens++\n else odds++\n\n if (evens == odds && index + 1 < a.size && abs(a[index + 1] - a[index]) <= b) {\n val tempAns = 1 + bestCuts(a.subList(0, index + 1), b - abs(a[index + 1] - a[index])) + bestCuts(a.subList(index + 1, a.size), b - abs(a[index + 1] - a[index]))\n if (tempAns > ans) {\n ans = tempAns\n }\n }\n }\n\n return ans\n}\n", "lang": "Kotlin", "bug_code_uid": "21923e69d69c515bc1c7064cad29f21d", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "apr_id": "425b56ea08912e31a3a3910e0aa94bb5", "difficulty": 1200, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8912630579297246, "equal_cnt": 17, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 16, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.InputStream\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.log\n\nfun main(args: Array) {\n class Scanner(s: InputStream) {\n private var st: StringTokenizer? = null\n private var br: BufferedReader = BufferedReader(InputStreamReader(s))\n\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n }\n\n val scan = Scanner(System.`in`)\n\n val n = scan.nextInt()\n val b = scan.nextInt()\n\n val a = (0 until n).map { scan.nextInt() }\n\n println(bestCuts(a, b))\n\n}\n\nfun bestCuts(a: List, b: Int): Int {\n if (a.size <= 2) return 0\n\n var ans = 0\n var odds = 0\n var evens = 0\n a.forEachIndexed { index, item ->\n if (item % 2 == 0) evens++\n else odds++\n\n if (evens == odds && index + 1 < a.size && abs(a[index + 1] - a[index]) <= b) {\n val rightBest = bestCuts(a.subList(index + 1, a.size), b - abs(a[index + 1] - a[index]))\n\n val tempAns = 1 + rightBest\n if (tempAns > ans) {\n ans = tempAns\n }\n }\n }\n\n return ans\n}\n", "lang": "Kotlin", "bug_code_uid": "66b47db146239ec1fe5c72e633216107", "src_uid": "b3f8e769ee7719ea5c9f458428b16a4e", "apr_id": "425b56ea08912e31a3a3910e0aa94bb5", "difficulty": 1200, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8335958005249344, "equal_cnt": 10, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*;\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readDouble() = readLn().toDouble() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of ints\n\nfun main(args: Array) {\n solve()\n /*\n val t = readInt()\n repeat(t) {\n solve()\n }\n */\n}\n\nfun solve() {\n val (k, n) = readInts()\n var ret = 0\n val l = readInts()\n for(x in l) {\n ret += x / k\n }\n println(ret)\n}\n\n/*\nuseful things:\nto read in multiple ints in one line\nval (n, m, k) = readInts()\n\nJava: int[] dx = new int[]{-1,1,0,0}\nKotlin: val dx = arrayOf(-1, 1, 0, 0)\n*/", "lang": "Kotlin", "bug_code_uid": "51c41511b2fa0f2487b3d0465b05832b", "src_uid": "b7ef696a11ff96f2e9c31becc2ff50fe", "apr_id": "7c8a74b9c444ff2bd9c851e2a470f3bc", "difficulty": 1200, "tags": ["brute force", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9974126778783958, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.math.BigInteger\nimport java.util.*\n\nconst val M = 998244353L\nval MB = BigInteger.valueOf( M )\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val m = sc.nextLong()\n val k = sc.nextLong()\n if ( k == 0L ) {\n println( m )\n return\n }\n val C = Array( n.toInt(), { LongArray( it + 2 ) } )\n for ( i in C.indices ) {\n C[i][0] = 1\n for ( j in 1 .. i ) {\n C[i][j] = C[i - 1][j - 1] + C[i - 1][j]\n if ( C[i][j] >= M ) {\n C[i][j] -= M\n }\n }\n }\n println( BigInteger.valueOf( m - 1 ).modPow( BigInteger.valueOf( k - 1 ), MB ).multiply( BigInteger.valueOf( C[(n - 1).toInt()][k.toInt()] * m ) ).remainder( MB ) )\n}", "lang": "Kotlin", "bug_code_uid": "a08fd078d035cd95f097b787348d7a69", "src_uid": "b2b9bee53e425fab1aa4d5468b9e578b", "apr_id": "d7cc2ef5973f00158858604162aa0787", "difficulty": 1500, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8509719222462203, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //var (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (day, ret) = r.readLine()!!.split(\" \").map { it.toInt() }\n val v = r.readLine()!!.split(\" \").map { it.toInt() }\n var get = 0\n var max = v[0]\n v.forEach {\n val profit = (max-it)-ret*it\n get = maxOf(get, profit)\n max = maxOf(max, it)\n }\n println(get)\n}\n", "lang": "Kotlin", "bug_code_uid": "4474b587c83e8576ac81513686ab3592", "src_uid": "411539a86f2e94eb6386bb65c9eb9557", "apr_id": "b555e43964798fbcdd4a9704844bc0b7", "difficulty": 1000, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.38714161598609903, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*\nimport java.math.*\nimport kotlin.math.*\n\nfun readLn()=readLine()!!\nfun readInt()=readLn().toInt()\nfun readInts()=readLn().split(\" \").map{it.toInt()}\nfun readLong()=readLn().toLong()\nfun readLongs()=readLn().split(\" \").map{it.toLong()}\n\nval out=mutableListOf()\nfun printLine(s:String){out.add(s)}\nfun output(){println(out.joinToString(\"\\n\"))}\n\nfun dv1(p:Long,q:Long):Long=if(p>=0)(p+q-1)/q else p/q\nfun dv2(p:Long,q:Long):Long=if(p>=0)p/q else (p-q+1)/q\nfun main(){\n val (n,l,r,k)=readLongs()\n val x=if(l<=r)r-l+1 else r+n-l\n val y=n-x;var ans=-1L\n if(n*n0&&(p+1)%q==0L)ans=max(ans,a+b)\n }\n }\n }else{\n for(t in 0..k/n){\n if(t==0L){\n if(k<=x*2)ans=max(ans,y+k-x)\n if(k+1<=x*2)ans=max(ans,y+k+1-x)\n }else{\n var m=k-(t+1)*x-t*y\n if(m<0)continue\n var p=m;var q=-m\n var mn=max(dv1(-q,t+1),dv1(p-x,t))\n var mx=min(dv2(p,t),dv2(y-q,t+1))\n if(mn<=mx)ans=max(ans,p-t*mx+q+(t+1)*mx)\n m++;p=m;q=-m\n mn=max(dv1(-q,t+1),dv1(p-x,t))\n mx=min(dv2(p-1,t),dv2(y-q,t+1))\n if(mn<=mx)ans=max(ans,p-t*mx+q+(t+1)*mx)\n }\n }\n }\n printLine(\"$ans\")\n output()\n}", "lang": "Kotlin", "bug_code_uid": "6670a4c1e99af3c4dcd31797809bf9aa", "src_uid": "f54cc281033591315b037a400044f1cb", "apr_id": "148b9e54f04563dfd0ded1400c317f5d", "difficulty": 2600, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7836140451041964, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "//Benq's template\n\n@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport java.util.TreeMap\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\n\nfun dv1(p:Long,q:Long):Long=if(p>=0)(p+q-1)/q else p/q\nfun dv2(p:Long,q:Long):Long=if(p>=0)p/q else (p-q+1)/q\nfun PrintWriter.solve() {\n val (n,l,r,k)=readLongs(4)\n val x=if(l<=r)r-l+1 else r+n-l+1\n val y=n-x;var ans=-1L\n if(n*n0&&(p+1)%q==0L)ans=max(ans,a+b)\n }\n }\n }else{\n for(t in 0..k/n){\n if(t==0L){\n if(k>=x&&k<=x*2)ans=max(ans,y+k-x)\n if(k>=x&&k+1<=x*2)ans=max(ans,y+k+1-x)\n }else{\n var m=k-(t+1)*x-t*y\n if(m<0)continue\n var p=m;var q=-m\n var mn=max(dv1(-q,t+1),dv1(p-x,t))\n var mx=min(dv2(p,t),dv2(y-q,t+1))\n if(mn<=mx)ans=max(ans,p-t*mx+q+(t+1)*mx)\n m++;p=m;q=-m\n mn=max(dv1(-q,t+1),dv1(p-x,t))\n mx=min(dv2(p-1,t),dv2(y-q,t+1))\n if(mn<=mx)ans=max(ans,p-t*mx+q+(t+1)*mx)\n }\n }\n }\n println(\"$ans\")\n}\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)", "lang": "Kotlin", "bug_code_uid": "46ec5a6ba18104d797cb1ae5ac6cd87f", "src_uid": "f54cc281033591315b037a400044f1cb", "apr_id": "148b9e54f04563dfd0ded1400c317f5d", "difficulty": 2600, "tags": ["math", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5984455958549223, "equal_cnt": 13, "replace_cnt": 9, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 14, "bug_source_code": "fun main () {\n val scanner = Scanner(System.`in`)\n val input = scanner.next()\n\n if (input.isEmpty()) {\n println(0)\n return\n }\n\n val maxCarry = 5\n var currentCarry = 1\n var firstChar = input[0]\n var result = 1\n var isFirst = true\n\n for (i in 1 until input.length) {\n val nextChar = input[i]\n\n if (firstChar != nextChar) {\n result++\n firstChar = nextChar\n currentCarry = 1\n } else {\n currentCarry++\n if (currentCarry == maxCarry) {\n if (isFirst) {\n isFirst = false\n } else {\n result++\n }\n currentCarry = 0\n } else if (i == input.length - 1) {\n if (!isFirst) {\n result++\n }\n }\n }\n }\n\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "3c23e7839b0be2ec53d1ca3ddf048f05", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "apr_id": "5c9c27a9c2b430cb2126cd56002e6d6d", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6253196930946292, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*\n\nfun main () {\n val scanner = Scanner(System.`in`)\n val input = scanner.next()\n\n if (input.isEmpty()) {\n println(0)\n return\n }\n\n val maxCarry = 5\n var currentCarry = 1\n var firstChar = input[0]\n var result = 1\n var isFirst = true\n\n for (i in 1 until input.length) {\n val nextChar = input[i]\n\n if (firstChar != nextChar) {\n result++\n firstChar = nextChar\n currentCarry = 1\n } else {\n currentCarry++\n if (currentCarry == maxCarry) {\n if (isFirst) {\n isFirst = false\n } else {\n result++\n }\n currentCarry = 0\n } else if (i == input.length - 1) {\n if (!isFirst) {\n result++\n }\n }\n }\n }\n\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "b2a13b51b803aaeeb4b11f42a4f79581", "src_uid": "5257f6b50f5a610a17c35a47b3a0da11", "apr_id": "5c9c27a9c2b430cb2126cd56002e6d6d", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6581956797966964, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import kotlin.math.sqrt\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val (s, n) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c) = r.readLine()!!.split(\" \").map { it.toLong() }.sorted()\n if (a==c) {\n val edge = sqrt(a.toDouble()).toInt()\n println(\"$edge $edge $edge\")\n } else{\n val x = gcd(a, c)\n println(\"${a/x} $x ${c/x}\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "8c9f608e2a896e53eba46f1f28ff68e9", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "apr_id": "d871cb31c5e6d0db4e1ea9e578d58206", "difficulty": 1100, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6425339366515838, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 9, "bug_source_code": "import kotlin.math.sqrt\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val (s, n) = r.readLine()!!.split(\" \").map { it.toInt() }\n val (a, b, c) = r.readLine()!!.split(\" \").map { it.toLong() }.sorted()\n if (a==c) {\n val edge = sqrt(a.toDouble()).toInt()\n println(12*edge)\n } else{\n val x = gcd(a, c)\n val y = a/x\n val z = c/x\n println(4*(x+y+z))\n }\n}\n\ntailrec fun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)\n", "lang": "Kotlin", "bug_code_uid": "aeb9c8a28b62f8de126bd1250629fd41", "src_uid": "c0a3290be3b87f3a232ec19d4639fefc", "apr_id": "d871cb31c5e6d0db4e1ea9e578d58206", "difficulty": 1100, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9596879063719116, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val inp = readLine()!!.split(\" \")\n val n = inp[0].toLong()\n val m = inp[1].toLong()\n var min = n - 2*m\n if (min<0)\n min = 0\n var a = 0L\n for (i in 1..(n.toInt()))\n {\n a = i.toLong()\n if (i.toLong()*(i.toLong()-1L)/2L >= m)\n break\n }\n val max = n-a\n println(\"$min $max\")\n}", "lang": "Kotlin", "bug_code_uid": "d8ad665f55e5aca59d3c190bdd10e2c8", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "370ad1004553579566fe3d7c33a107db", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6203904555314533, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import kotlin.math.sqrt\n\nfun main(args: Array){\n val (n, m) = readLine()!!.split(\" \").map {it.toLong()}\n if( n < m*2)\n print(\"0\")\n else\n print(n-2*m)\n print(\" \")\n print(n-nearest(m))\n}\n\nfun nearest(m: Long): Long{\n val temp = sqrt((8*m+1).toDouble()).toLong()\n if (temp%2 == 0L)\n return temp/2+1\n else if(8*m+1 != temp*temp)\n return (temp+3)/2\n else\n return (temp+1)/2\n}", "lang": "Kotlin", "bug_code_uid": "24d67566c45434a741671ae58e955ec3", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "49f1ce6a7a5fa448e27cfdbae2a55781", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9654088050314465, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val n = nextInt()\n val m = nextInt()\n\n fun f(n: Int) = n * (n - 1) / 2\n\n var i = 0\n while (m > f(i)) i++\n\n if (n <= m * 2) {\n println(\"0 ${n - i}\")\n } else {\n println(\"${n - m * 2} ${n - i}\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "bdc72ad0c982c49b5a665cfd7f634dbb", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "1e1fde7cf32caf5679b1272eb46ba949", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9046087888531619, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.sqrt\n\nfun main() {\n val (numVertices, numEdges) = readLine()!!.split(\" \").map(String::toLong)\n var minVerticesWithNumEdges = 1+sqrt((1+8*numEdges).toDouble())\n minVerticesWithNumEdges = minVerticesWithNumEdges / 2 + if(minVerticesWithNumEdges%2 == 0.0) 0 else 1\n print(\"${max(0, numVertices - 2 * numEdges)} ${max(0, numVertices - minVerticesWithNumEdges.toInt())}\")\n}", "lang": "Kotlin", "bug_code_uid": "99f263d4e846c824316bd01386a11b95", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "6f2bb05ff3a2a167ceab713e01e3a7c5", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8948497854077253, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.sqrt\n\nfun main() {\n val (numVertices, numEdges) = readLine()!!.split(\" \").map(String::toInt)\n var minVerticesWithNumEdges = 1+sqrt((1+8*numEdges).toDouble())\n minVerticesWithNumEdges = minVerticesWithNumEdges / 2 + if(minVerticesWithNumEdges%2 == 0.0) 0 else 1\n print(\"${max(0, numVertices - 2 * numEdges)} ${max(0, numVertices - minVerticesWithNumEdges.toInt())}\")\n}", "lang": "Kotlin", "bug_code_uid": "def68a34481a17519ad52923c023e0cf", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "6f2bb05ff3a2a167ceab713e01e3a7c5", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9078404401650619, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val m = sc.nextLong()\n val min = Math.min(n, m * 2)\n var max = 0L\n for (i in 1..n) {\n if ((i * (i - 1)) / 2 >= m) {\n max = i\n break\n }\n }\n println(\"${n - min} ${n - max}\")\n}", "lang": "Kotlin", "bug_code_uid": "01cc8a97e385d1e86e8561ccc1d3ee65", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "c6c2f23c3ff1d36fceaaec0b7b624d83", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8953168044077136, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n val m = sc.nextLong()\n val min = Math.min(n, m * 2)\n var max: Long\n for (i in 1..n) {\n if (i * (i - 1) / 2 >= m) {\n max = i\n break\n }\n }\n println(\"${n - min} ${n - max}\")\n}", "lang": "Kotlin", "bug_code_uid": "93ea44de24674f9c51d37cfa4c167627", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "c6c2f23c3ff1d36fceaaec0b7b624d83", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5384615384615384, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 11, "bug_source_code": "fun main(args: Array) {\n val (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n val min = Math.min(n, m * 2)\n var max = \"PE\"\n for (i in 1..n) {\n if ((i * (i - 1)) / 2 >= m) {\n max = i.toString()\n break\n }\n }\n println(\"${n - min} ${n - max.toInt()}\")\n}", "lang": "Kotlin", "bug_code_uid": "19e03c8d5df0ba13d14f3626bff440ad", "src_uid": "daf0dd781bf403f7c1bb668925caa64d", "apr_id": "c6c2f23c3ff1d36fceaaec0b7b624d83", "difficulty": 1300, "tags": ["graphs", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9991126885536823, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedInputStream\nimport java.util.*\nimport kotlin.collections.HashSet\n\nfun main(args: Array) {\n val scanner = Scanner(BufferedInputStream(System.`in`))\n //val output = BufferedWriter(OutputStreamWriter(System.`out`))\n\n //visualize()\n val n = scanner.nextLong()\n val k = scanner.nextLong()\n if(ok(n, k)) print(\"Yes\")\n else print(\"No\")\n\n}\n\nfun ok(n: Long, k: Long): Boolean{\n if(n <= k) return false\n val set = HashSet()\n for(i in 1..k){\n val r = n%i\n if(r in set) return false\n set.add(r)\n }\n return true\n}\n\n/*\nfun visualize(){\n\n val n = 40\n\n print(\" |\")\n for(i in 1..n) print(\" %2d\".format(i))\n println()\n for(i in 1..(3*n+4)) print(\"-\")\n println()\n\n for(i in 1..n){\n //if(!isPrime(i)) continue\n print(\"%2d |\".format(i))\n for(j in 1 .. n){\n if(i >= j)\n print(\" %2d\".format(i%j))\n }\n println()\n }\n println()\n}\n\nfun isPrime(x: Int): Boolean{\n var i = 2\n while(i*i <= x){\n if(x%i == 0) return false\n ++i\n }\n return true\n}\n*/", "lang": "Kotlin", "bug_code_uid": "85302ef645832b73d35a7de9ee74af2e", "src_uid": "5271c707c9c72ef021a0baf762bf3eb2", "apr_id": "7b6b6370dca5b144904dc19d51889f62", "difficulty": 1600, "tags": ["brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.878625134264232, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n\n val N = readLine()!!.toInt()\n var mashq = IntArray(N)\n var types = IntArray(3)\n for (index: Int in 0..(N - 1)) {\n mashq[index] = readLine()!!.trim().toInt()\n types[index % 3] += mashq[index]\n }\n val maxIndex = types.indices.maxBy { types[it] }\n if (maxIndex == 0) println(\"chest\")\n else if (maxIndex == 1) println(\"biceps\")\n else if (maxIndex == 2) println(\"back\")\n }", "lang": "Kotlin", "bug_code_uid": "dabe3087e5318e9821f30f2f1eeae5e8", "src_uid": "579021de624c072f5e0393aae762117e", "apr_id": "579d5e76bd3b9a82ad0a0a0a9be234aa", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9396914446002805, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\nimport java.math.*\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readInts() = readLn().split(\" \").map{it.toInt()}\nfun readLong() = readLn().toLong()\n\nval INF=1000000000\n\nfun QPowMod(x:Long, y:Long, mod:Long):Long {\n\tvar res =1L\n\tvar a=x\n\tvar b=y\n\twhile(b>0) {\n\t\tif(b%2==1L) {\n\t\t\tres=res*a%mod\n\t\t}\n\t\ta=a*a%mod\n\t\tb/=2\n\t}\n\treturn res\n}\n\nfun RevMod(x:Long, mod:Long) = QPowMod(x,mod-2, mod)\n\n\n\nfun main(args: Array) {\n\tvar (n,m) = readInts()\n\tvar fact = LongArray(n+1)\n\tfact[0]=1\n\tfor(i in 1..n)\n\t\tfact[i]=fact[i-1]*i%m\n\t\n\tvar res = 0L\n\tfor(i in 1..n) {\n\t\tres+=(n-i+1)*(n-i+1)%m*fact[i]%m*fact[n-i]%m\n\t\tres%=m\n\t}\n\tprintln(res)\n}\n", "lang": "Kotlin", "bug_code_uid": "3bfb3cd6a9d3bbdc3f20b8d3c63ec49c", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "apr_id": "6da6e83c97d397943f7b27d5af635eb6", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.964769647696477, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n val n = inp.nextInt()\n val m = inp.nextLong()\n var gg: Long = 0\n val fact = LongArray(n + 1)\n fact[0] = 1\n for (i in 1..n) fact[i] = fact[i - 1] * i\n for (i in 1..n) {\n gg += (n - i + 1) * (fact[i] * fact[n - i + 1]) % m\n gg %= m\n }\n println(gg)\n}", "lang": "Kotlin", "bug_code_uid": "d3b9cb5f63e86014ac2961a34aa117a1", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "apr_id": "ada056019d5e23ac7620671500ab6813", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9893778452200304, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val (n, M) = readLine()!!.split(\" \").map { it.toInt() }\n\n val fact = IntArray(n + 1) { 1 }\n (2..n).forEach { fact[it] = fact[it - 1] * it % M }\n var out = 0L\n (1..n).forEach {\n out += (n - it + 1) * (fact[it] * fact[n - it + 1] % M)\n out %= M\n }\n println(out)\n}", "lang": "Kotlin", "bug_code_uid": "ddddf0cab8a2ddadf54d044c3298678c", "src_uid": "020d5dae7157d937c3f58554c9b155f9", "apr_id": "6dbc758ce43e1205e16112844085ac29", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8842105263157894, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.lang.Integer.max\nimport java.lang.Math.abs\nimport java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val (yellowCristals, blueCristals) = arrayOf(nextLong(), nextLong())\n val(yellowBalls, greenBalls, blueBalls) = arrayOf(nextLong(), nextLong(), nextLong())\n val requitedYellowCristals = 2 * yellowBalls + greenBalls\n val requiredBlueCristals = greenBalls + 3 * blueBalls\n println(abs(requiredBlueCristals - blueCristals) + abs(requitedYellowCristals - yellowCristals))\n}", "lang": "Kotlin", "bug_code_uid": "cfea8d235299ef3f4a936a7bd0d1a7e3", "src_uid": "35202a4601a03d25e18dda1539c5beba", "apr_id": "451be3713a0fbd8b437d3e4f87b0a2b2", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9847953216374269, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nclass A {\n fun start(scan: Scanner) {\n val a = scan.nextLong()\n val b = scan.nextLong()\n\n var yellow = scan.nextLong() * 2L\n val green = scan.nextLong()\n yellow += green\n var blue = scan.nextLong() * 3L\n blue += green\n\n println(Math.max(yellow - a + blue - b, 0))\n }\n}\n\nfun main(args: Array) {\n A().start(Scanner(System.`in`))\n}", "lang": "Kotlin", "bug_code_uid": "f5551b0120d0ae94783b6989b8305f6b", "src_uid": "35202a4601a03d25e18dda1539c5beba", "apr_id": "c19ce2b053c579b39f2161c0f40b52df", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.3859275053304904, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner\n\nfun main() {\n var (ac, bc) = readLine()!!.split(' ').map(String:: toLong)\n var (y, g, b) = readLine()!!.split(' ').map(String:: toLong)\n\n var needed: Long = 0\n y *= 2;\n g *= 2;\n b *= 3;\n\n if(y > ac) {\n needed += (y-ac)\n ac = 0\n } else ac -= y\n\n if(g > ac + bc){\n needed += (g - (ac+bc))\n ac = 0\n bc = 0\n } else {\n var sisa = g- ac\n ac = 0\n bc -= sisa\n }\n\n if(b > bc) {\n needed += (b - bc)\n bc = 0\n } else bc -= b\n\n println(needed)\n}", "lang": "Kotlin", "bug_code_uid": "d6b1ed28ead62603591648e1d9b71339", "src_uid": "35202a4601a03d25e18dda1539c5beba", "apr_id": "4f1e89d2364c64eabfd0ae505c740515", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8873435326842837, "equal_cnt": 13, "replace_cnt": 11, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "fun main() {\n val s = readLine()!!\n val t = readLine()!!\n val (longer, shorter) = if (s.length >= t.length) s to t else t to s\n val longMap = IntArray(26)\n for (c in longer) longMap[c - 'a']++\n for (c in shorter) {\n if (longMap[c - 'a'] > 0) longMap[c - 'a']-- else {\n print(\"need tree\")\n return\n }\n }\n val automaton = longer.length != shorter.length\n var sPos = 0\n var lPos = 0\n while (sPos < shorter.length && lPos < longer.length) {\n if (shorter[sPos] == longer[lPos]) sPos++\n lPos++\n }\n print(\n when {\n automaton && sPos < shorter.length -> \"both\"\n automaton -> \"automaton\"\n else -> \"array\"\n }\n )\n}", "lang": "Kotlin", "bug_code_uid": "b9809b761c215008c81d097ad96f92ee", "src_uid": "edb9d51e009a59a340d7d589bb335c14", "apr_id": "cb45719ed1dfcf5c3ed605bbefb5ba4f", "difficulty": 1400, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6830708661417323, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n // \u041e\u0431\u044a\u0435\u043a\u0442 1 \u0434\u0432\u0438\u0436\u0435\u0442\u0441\u044f \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c, \u043e\u0431\u044a\u0435\u043a\u0442 2 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442\n val n = readLine()!!.toInt() // \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u043d\u0446\u0438\u0439\n var a = readLine()!!.toInt() // \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 1\n val x = readLine()!!.toInt() // \u041a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 1\n var b = readLine()!!.toInt() // \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 2\n val y = readLine()!!.toInt() // \u041a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 2\n\n while (true) {\n if (a == x) break\n if (b == y) break\n if (a == b) break\n if (a == n) a = 1\n else a += 1\n if (b == 1) b = n\n else b -= 1\n }\n\n if (a == b) print(\"YES\")\n else print(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "6bca172cc64a0fbc0efaec30e0dfc72a", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "45fdbf5e79a10f9e0052d81c67d6a93a", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9095816464237517, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "private fun readString() = readLine()!!\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main() {\n\tvar (n, a, x, b, y) = readInts()\n\t\n\twhile (true) {\n\t\tif (a == b) {\n\t\t\tprintln(\"YES\")\n\t\t\t\n\t\t\treturn\n\t\t}\n\t\t\n\t\tif (a == x || b == y) break\n\n\t\ta = (a + 1) % n\n\t\tb = (b + n - 1) % n\n\t}\n\t\n\tprintln(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "1e985b56746d28fdf656b0dcb195af87", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "27cbaa743db3ca01607e99bfbe31fa17", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8534704370179949, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n var (n, a, x, b, y) = readLine()!!.split(\" \").map { it.toInt() }\n var res = false\n while (a != x || b != y) {\n if (a == b) {\n res = true\n break\n }\n\n if (a == n) a = 1\n if (b == 1) b = n + 1\n\n if (a == x || b == y) break\n\n a++\n b--\n }\n println(if (res) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "cdfb0038a0a28586092a79ef2b3f0db6", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "1dc02afeb164ba28896ea80fa145615f", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9882697947214076, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n// n a x b y\n val (n,ai,x,bi,y) = readLine()!!.split(\" \").map{ it.toInt() }\n var a = ai\n var b = bi\n (1..n) {\n a += 1\n b -= 1\n if (a > n) a = 1\n if (b < 1) b = n\n if (a == b) {\n println(\"YES\")\n return\n }\n if (a == x || b == y) {\n println(\"NO\")\n return\n }\n }\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "dd7e3591ded977bc23bcefe987790f56", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "3dc96f6e14bc542e7cb3513565b843c8", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9967213114754099, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//package cf1169\n\nimport java.util.*\n\nclass A {\n fun solve() {\n val st = StringTokenizer(readLine())\n val n = st.nextToken().toInt() - 1\n var a = st.nextToken().toInt() - 1\n val x = st.nextToken().toInt() - 1\n var b = st.nextToken().toInt() - 1\n val y = st.nextToken().toInt() - 1\n\n while (a != x && b != y && a != b) {\n a++\n a %= n\n b = (b + (n - 1)) % n\n }\n\n if (a == b) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n }\n}\n\nfun main(args: Array) {\n A().solve()\n}", "lang": "Kotlin", "bug_code_uid": "0fc8234c23cd650e046e77bbf3633f40", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "24b305f75ed376acd82d822a9aa12389", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.06234537357743691, "equal_cnt": 21, "replace_cnt": 19, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 21, "bug_source_code": "import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\npublic class Main\n{\n\tPrintWriter out = new PrintWriter(System.out);\n\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer tok = new StringTokenizer(\"\");\n String next() throws IOException {\n if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }\n return tok.nextToken();\n }\n int ni() throws IOException { return Integer.parseInt(next()); }\n long nl() throws IOException { return Long.parseLong(next()); }\n \n void solve() throws IOException {\n int n=ni(); int a=ni(); long x=nl(); int b=ni(); int y=ni();\n boolean f=false;\n while (a!=x && b!=y) {\n a++;\n if (a==n+1) a=1;\n b--;\n if (b==0) b=n;\n if (a==b) { f=true; break; }\n }\n if (f) System.out.println(\"YES\");\n else System.out.println(\"NO\");\n }\n \n public static void main(String[] args) throws IOException {\n new Main().solve();\n }\n}", "lang": "Kotlin", "bug_code_uid": "cb78dbfef75c904830d075c5aa0ebbd0", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "34224364483a4a952db9cb26e9b2d6f8", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9973890339425587, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\n\nfun main() {\n val scan = Scanner(System.`in`)\n\n val array = scan.nextLine()\n .split(\" \")\n .map { it.trim().toInt() }\n .toIntArray()\n\n val n = array[0]\n var a = array[1]\n val x = array[2]\n var b = array[3]\n val y = array[4]\n\n var aStopped = false\n var bStopped = false\n\n while (true) {\n if (a != x){\n if (a == n){\n a = 1\n } else {\n a++\n }\n }\n if (b != y){\n if (b == 1){\n b = n\n } else {\n b--\n }\n }\n\n\n if (a == b && !aStopped && !bStopped){\n println(\"YES\")\n return\n }\n\n if (a == x && b == y){\n println(\"NO\")\n return\n }\n\n if(a == x){\n aStopped = true\n }\n\n if (b == x){\n bStopped = true\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "751ed48dae70d4604dbc03ee81e43502", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "ed1e75ee067e12d2843b55753a817610", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7201946472019465, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "import java.util.Scanner\n\nfun main() {\n val scan = Scanner(System.`in`)\n\n val array = scan.nextLine()\n .split(\" \")\n .map { it.trim().toInt() }\n .toIntArray()\n\n var a = array[1]\n val x = array[2]\n var b = array[3]\n val y = array[4]\n\n while (true) {\n if (a != x){\n a++\n }\n if (b != y){\n b--\n }\n\n\n if (a == b){\n println(\"YES\")\n return\n }\n\n if (a == x && b == y){\n println(\"NO\")\n return\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "244a7e284d0f63201ca6e4da27791069", "src_uid": "5b889751f82c9f32f223cdee0c0095e4", "apr_id": "ed1e75ee067e12d2843b55753a817610", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9339080459770115, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\n\nfun main(args: Array) = with(java.util.Scanner(System.`in`)) {\n var a = nextInt()\n var b = nextInt()\n var win = 0\n var draw = 0\n var lose = 0\n for( i in 1..6){\n if(abs(a-i) == abs(i-b))draw++\n else if(abs(a-i)>abs(i-b))win++\n else lose++\n }\n println(\"$win $draw $lose\")\n}", "lang": "Kotlin", "bug_code_uid": "81ac8d920ca38d3b6ab4230948bc80de", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8", "apr_id": "5b5a00e7fe6d0bf52bb22f89d9e223e9", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9816849816849816, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n val (n, x) = r.readLine()!!.split(\" \").map { it.toInt() }\n var ans = 0\n for (i in 1..n){\n if (x%i==0) ans++\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "d409cc0da2fbb36908fb0a136215298c", "src_uid": "c4b139eadca94201596f1305b2f76496", "apr_id": "939162dcb781fb886065d042e1a963e1", "difficulty": 1000, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9988455322096513, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.*\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport kotlin.concurrent.thread\nimport kotlin.math.roundToInt\n\n\nobject programkt {\n abstract class Task {\n fun > min(a: T, b: T) = if (a > b) b else a\n fun > max(a: T, b: T) = if (a < b) b else a\n fun abs(a: T) = if(a > 0) a else -(a)\n fun abs(a: T) = if(a > 0) a else -(a)\n fun abs(a: T) = if(a > 0) a else -(a)\n abstract fun solve(scanner: FastScanner, printer: PrintWriter)\n }\n\n class FastScanner(inpStr: InputStream, var br: BufferedReader = BufferedReader(InputStreamReader(inpStr)), var stok: StringTokenizer? = null){\n private fun nextToken(): String? {\n while (stok == null || !stok!!.hasMoreTokens())\n stok = StringTokenizer(br.readLine() ?: return null)\n return stok!!.nextToken()\n }\n\n fun nextInt() = nextToken()!!.toInt()\n fun nextLong() = nextToken()!!.toLong()\n fun nextDouble() = nextToken()!!.toDouble()\n fun nextChar() = br.read().toChar()\n fun nextString() = nextToken()!!\n fun nextLine() = br.readLine()\n fun nextBigInteger() = BigInteger(nextToken()!!)\n fun nextBigDecimal() = BigDecimal(nextToken()!!)\n }\n\n @JvmStatic fun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val scanner = FastScanner(inputStream)\n val printer = PrintWriter(outputStream)\n\n /* TASK */\n val solver = TaskG()\n /* TASK */\n\n solver.solve(scanner, printer)\n printer.close()\n }\n\n class TaskA: Task() {\n override fun solve(scanner: FastScanner, printer: PrintWriter) {\n val length = scanner.nextInt()\n val check = { a: Int, b: Int -> abs(a-b) <= 1 }\n val arr = Array(length) { 0 }\n (0 until length).forEach { arr[it] = scanner.nextInt() }\n\n (0 until length).forEach {l ->\n (l until length).forEach { r ->\n }\n }\n }\n }\n\n class TaskC: Task() {\n override fun solve(scanner: FastScanner, printer: PrintWriter) {\n var m = scanner.nextLong()\n var n = scanner.nextLong()\n var cnt = 0L\n cnt += m\n while (m >= n-1) {\n cnt += (m/n)\n m/=n\n\n println(\"$cnt $m $n\")\n }\n println(cnt)\n }\n }\n\n class TaskG: Task() {\n override fun solve(scanner: FastScanner, printer: PrintWriter) {\n fun code(n: Long, x: Long): Long {\n var count = 0L\n if(x == 1L) return 1L\n for(i in (1L..n+1L)) {\n if(i == 1L && n >= x) {\n count += 1\n } else if(x % i == 0L && i != 1L && x <= n * i) {\n count += 1\n }\n }\n return count\n }\n val n = scanner.nextLong()\n val x = scanner.nextLong()\n if(n < x%n) {\n printer.println(0)\n System.exit(0)\n }\n printer.println(code(n,x))\n }\n }\n\n class TaskI: Task() {\n override fun solve(scanner: FastScanner, printer: PrintWriter) {\n val word = scanner.nextString()\n\n val crossedResult = scanner.nextString()\n val crossIndexOrder = Array(word.length) { scanner.nextInt() }\n val wordCharArray = Array(word.length, word::get)\n\n var lastIndex = -1\n\n crossIndexOrder.forEachIndexed { index, item ->\n wordCharArray[item - 1] = null\n\n val checkString = wordCharArray.toFancyString()\n val checkResult = checkString.contains(crossedResult)\n if (checkResult) lastIndex = index + 1\n if (checkString.length <= crossedResult.length) {\n println(lastIndex)\n return\n }\n }\n }\n\n private fun Array.toFancyString() = joinToString(separator = \"\") { it?.toString() ?: \"\" }\n }\n}", "lang": "Kotlin", "bug_code_uid": "4dc3592c8c32e39d732512786f1848a1", "src_uid": "c4b139eadca94201596f1305b2f76496", "apr_id": "deae41812aef08d6be544ad6866ffbad", "difficulty": 1000, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8227848101265823, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n val (n, x) = readInts()\n var count = 0\n for (i in 1..n) {\n if (x % i == 0 && x % i <= n) {\n count++\n }\n }\n println(count)\n}\n\nprivate fun readInts() = readLine()!!.split(\" \").map { it.toInt() }", "lang": "Kotlin", "bug_code_uid": "3fdccdf60c46f35a2ad2cd0e4c6f349e", "src_uid": "c4b139eadca94201596f1305b2f76496", "apr_id": "d5f4183db2e9da693edec22b887ce8b2", "difficulty": 1000, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8449704142011835, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "//package codeforces\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\n\nfun main() {\n val In = BufferedReader(InputStreamReader(System.`in`))\n val nums = In.readLine()!!.split(\" \" ).map {it.toInt()}\n val n = nums[0]\n val x = nums[1]\n var times = 0\n if(n*n < x) println(0)\n else if(n*n == x) println(1)\n else {\n times = (1..n)\n .filter { x % it == 0 && x / it <= n }\n .size\n println(times)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "e5d782ff87724dda1a13ca18ea6aefe3", "src_uid": "c4b139eadca94201596f1305b2f76496", "apr_id": "4e9414438bb062b3a99e6e08d2d3cb8b", "difficulty": 1000, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9775112443778111, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.sqrt\n\nfun main(args: Array) {\n val (n, x) = readLine()!!.split(' ').map { it.toInt() }\n\n println(if (x > n * n) 0\n else\n sqrt(x.toDouble()).toInt()\n .let {\n (1 .. it).count { x % it == 0 && x/it <= n } * 2 - if (it * it == x) 1 else 0\n })\n}", "lang": "Kotlin", "bug_code_uid": "c09120deb0bfd3ce2b4fc649faf93f70", "src_uid": "c4b139eadca94201596f1305b2f76496", "apr_id": "f1b1c821990386dd2af07677d59f7e1d", "difficulty": 1000, "tags": ["number theory", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9687397170121751, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\nimport kotlin.math.min\n\nval f0 = \"What are you doing at the end of the world? Are you busy? Will you save us?\"\nval left = \"What are you doing while sending \\\"\"\nval mid = \"\\\"? Are you busy? Will you send \\\"\"\nval rigth = \"\\\"?\"\n\nval MAXN = 100000\n\nfun main(args: Array ) {\n val l = LongArray( MAXN + 1, { 0 } )\n l[0] = f0.length.toLong()\n for ( i in 1 until l.size ) {\n l[i] = min( Long.MAX_VALUE / 2, l[i - 1] * 2 + left.length + mid.length + rigth.length )\n }\n\n val sc = Scanner( System.`in` )\n val q = sc.nextInt()\n\n for ( qq in 1 .. q ) {\n var n = sc.nextInt()\n var p = sc.nextLong() - 1\n if ( p >= l[n] ) {\n print( \".\" )\n continue\n }\n while ( true ) {\n if ( n == 0 ) {\n print( f0[p.toInt()] )\n break\n }\n if ( p < left.length ) {\n print( left[p.toInt()] )\n break\n }\n p -= left.length\n if ( p < l[n - 1] ) {\n n --\n continue\n }\n p -= l[n - 1]\n if ( p < mid.length ) {\n print( mid[p.toInt()] )\n break\n }\n p -= mid.length\n if ( p < l[n - 1] ) {\n n --\n continue\n }\n p -= l[n - 1]\n print( rigth[p.toInt()] )\n break\n }\n }\n println()\n}", "lang": "Kotlin", "bug_code_uid": "fb7c3bca71149910afeb0e1e0b344851", "src_uid": "da09a893a33f2bf8fd00e321e16ab149", "apr_id": "d67fa10ba4c76921064b68ac9a72bc8e", "difficulty": 1700, "tags": ["dfs and similar", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7873754152823921, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nval reader = Scanner(System.`in`)\nvar c = 0\nfun main(args: Array) {\n val n = reader.nextInt()\n for (i in 1..n)\n c+=reader.nextInt()\n if ((c+1)%(n+1)==1)\n println(2)\n else\n println(3)\n}", "lang": "Kotlin", "bug_code_uid": "bc63374623ce18a71cc8946ed157f332", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "apr_id": "610090d7f8d9e3d646b015496d497cf8", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.952191235059761, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var n = readLine()!!.toInt()\n var list = readLine()!!.split(' ').map { it.toInt() }.sum()\n var ans = 0\n for (i in 1..5) {\n if ((list + i) % (n + 1) != 1) {\n ans = i\n break\n }\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "6ce56b1b6aa489f4df1235d9a0b2f8a0", "src_uid": "ff6b3fd358c758324c19a26283ab96a4", "apr_id": "29d11b12d794ce1a7c627d2dc4274999", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.876629889669007, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "\nfun main() {\n val size = readLine()?.toInt() ?: return\n var swappableCount = 0\n var leftOdd = 0\n var rightOdd = 0\n for (i in 0.until(size)) {\n val values = readLine()?.split(' ') ?: return\n val left = values[0].toInt() % 2 == 0\n val right = values[1].toInt() % 2 == 0\n if (!left) {\n leftOdd++\n }\n if (!right) {\n rightOdd++\n }\n if (left != right) {\n swappableCount++\n }\n }\n // both even\n if (leftOdd % 2 == 0 && rightOdd % 2 == 0) {\n println(0)\n return\n }\n // odd and equal\n if (leftOdd == rightOdd) {\n if (swappableCount > 0) {\n println(1)\n return\n }\n else{\n println(-1)\n return\n }\n }\n val diff = Math.abs(leftOdd - rightOdd)\n if (diff % 2 != 0) {\n println(-1)\n return\n }\n val swapCount = diff / 2\n if (swappableCount >= swapCount) {\n println(swapCount)\n return\n }\n println(-1)\n}\n", "lang": "Kotlin", "bug_code_uid": "d02a3eb024ca02ffa341906174ab3002", "src_uid": "f9bc04aed2b84c7dd288749ac264bb43", "apr_id": "1b7ee476df7c1ccc55aa4e23546e078c", "difficulty": 1200, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9239940387481371, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(arg: Array) {\n val s = readLine()!!\n var metka = '0'\n var o = 0\n var k = 0\n for (i in 0..s.length-1) {\n if (s[i] == metka) o++\n else {\n metka = s[i]\n k = maxOf(k, o)\n o = 1\n }\n }\n if (k >= 7) println(\"YES\")\n else println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "fcec6d6246895946451475a7f083163c", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "dcfc53565cfad5980ddbcae14b0ddc8c", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6428571428571429, "equal_cnt": 10, "replace_cnt": 5, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "fun main() {\n val players = readLine()!!.map { it.toInt() }\n var c = 1\n \n run l1@{\n players.drop(1).forEachIndexed { index, i -> \n if(i != players[index - 1]) {\n c = 1\n } else {\n c++\n if(c >= 7) {\n return@l1\n }\n }\n }\n }\n println(if (c >= 7) \"YES\" else \"NO\")\n }", "lang": "Kotlin", "bug_code_uid": "ae87f8101cc809f15ccfc750b6111cad", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "5c60402bbc46089ec9a972dbd39c2c7e", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9504741833508957, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package a\n\nimport java.util.*\n\nfun main(args: Array) {\n val word = Scanner(System.`in`).nextLine()\n\n var counter = 0\n\n word.forEachIndexed { index, c ->\n println(\"before $counter\")\n\n if (index == 0) counter++\n else {\n if (c == '0' && word[index - 1] == '0') counter++\n else if (c == '1' && word[index - 1] == '1') counter++\n else counter = 1\n }\n\n if (counter == 7) return println(\"YES\")\n }\n\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "12e2a21dd22f6938d04d570809c2bb74", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "f111da49b95a5bbac42074473b510193", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9874077290490665, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package com.lstr.codeforces\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\nprivate fun readIntsArr() = ArrayList(readInts()) // ArrayList of ints\n\nprivate val MX = 200005\nprivate val MOD = 1000000007\nprivate val SZ = 1 shl 18\nprivate val INF = (1e18).toLong()\n\nprivate fun add(a: Int, b: Int) = (a + b) % MOD // from tourist :o\nprivate fun sub(a: Int, b: Int) = (a - b + MOD) % MOD\nprivate fun mul(a: Int, b: Int) = ((a.toLong() * b) % MOD).toInt()\n\n\nprivate fun solve(){\n val players = readLn()\n println(if(players.contains(\"1111111\")||players.contains(\"0000000\")) \"YES\" else \"NO\")\n}\n\nfun main(){\n val t = 1 // # of test cases\n for (i in 1..t) {\n solve()\n }\n}", "lang": "Kotlin", "bug_code_uid": "9ff83c6ac38848ed659cdd92126b3387", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "aa79ad5222cfd16d7e72527f6a70d7b0", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.968944099378882, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val players = readLine()!!\n val stringMatch = Regex(\"([0-1])\\1\\1\\1\\1\\1\\1+\")\n print(if(players.contains(stringMatch)) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "0622e972875ccbf1215602d9011920bf", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "0f02773041ab46788b93c787b6c2e133", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.99, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import kotlin.math.max\nimport kotlin.math.min\n\nfun main(args: Array) {\n var (la, ra, ta) = readLine()!!.split(' ').map(String::toLong)\n var (lb, rb, tb) = readLine()!!.split(' ').map(String::toLong)\n if (la > lb) {\n var t = la; la = lb; lb = t\n t = ra; ra = rb; rb = t\n t = ta; ta = tb; tb = t\n }\n rb -= la\n lb -= la\n ra -= la\n la = 0\n val tgcd = gcd(ta, tb)\n val q = lb / tgcd\n lb -= q * tgcd\n rb -= q * tgcd\n val ans1 = (min(ra, rb) - max(la, lb) + 1)\n lb -= tgcd\n rb -= tgcd\n val ans2 = (min(ra, rb) - max(la, lb) + 1)\n println(max(ans1, ans2))\n}\n\nfun gcd(a: Long, b: Long): Long {\n var aa = a\n var bb = b\n while (bb > 0) {\n val t = aa\n aa = bb\n bb = t % bb\n }\n return aa\n}", "lang": "Kotlin", "bug_code_uid": "d5c85df7e81e6139a243b76c773f412b", "src_uid": "faa75751c05c3ff919ddd148c6784910", "apr_id": "4bbfb716da8f4f3a306b86d8e3adaf3f", "difficulty": 1900, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9358541525995948, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val jin = BufferedReader(InputStreamReader(System.`in`))\n var (la, ra, ta) = jin.readLine().split(\" \").map { it.toLong() }\n var (lb, rb, tb) = jin.readLine().split(\" \").map { it.toLong() }\n val g = gcd(ta, tb)\n val sa = ra - la\n val sb = rb - lb\n la %= g\n lb %= g\n val answer = maxOf(\n min(la + sa, lb + sb) - max(la, lb),\n min(la + sa + g, lb + sb) - max(la + g, lb),\n min(la + sa, lb + sb + g) - max(la, lb + g)\n ) + 1L\n println(answer)\n}\n\nfun gcd(a: Long, b: Long): Long = if (b == 0L) a else gcd(b, a % b)", "lang": "Kotlin", "bug_code_uid": "8fd64766ca1c9f40bc2ccaafa098f0bc", "src_uid": "faa75751c05c3ff919ddd148c6784910", "apr_id": "928b0f792ab50dbb4bb371335c2e3d24", "difficulty": 1900, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9365079365079365, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val (numCitizens, numWizards, percentage) = readLine()!!.split(\" \").map(String::toInt)\n val total = numCitizens * percentage / 100 + if ((numCitizens * percentage) % 100 == 0) 0 else 1\n print(total - numWizards)\n}", "lang": "Kotlin", "bug_code_uid": "4b8da9e94738169a68a3cf92a68dcd8d", "src_uid": "7038d7b31e1900588da8b61b325e4299", "apr_id": "0d44032f2d5957b8557b07fdbc618264", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.19517795637198623, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array){\n val opa = readLine()\n if (opa == null){\n System.out.println(\"No\")\n return\n } else {\n var result = false\n for (i in 1..opa.length - 2){\n if (opa.get(i) != opa.get(i-1) \n && opa.get(i) != opa.get(i+1) \n && opa.get(i) != '.' \n && opa.get(i+1) != '.' \n && opa.get(i-1) != '.'){\n result = true\n }\n }\n if (result){\n println(\"Yes\")\n } else {\n println(\"No\")\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "251863ec97d528df45ffcba9676d5caa", "src_uid": "ba6ff507384570152118e2ab322dd11f", "apr_id": "8a07d95fb623e8cfd611dfe694217d39", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9328364529516389, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.awt.Point\nimport java.io.*\nimport java.lang.StringBuilder\nimport java.lang.System.`in`\nimport java.util.*\n\n\nfun solve(stringBuilder: StringBuilder, reader: Reader) {\n val a = reader.getNextInt()\n stringBuilder.append(a)\n}\n\n//---------------------------------------------------------------------------------------------------------------------\n\n\nfun main() {\n val reader = Reader()\n\n val stringBuilder = StringBuilder()\n\n solve(stringBuilder, reader)\n\n val bw = BufferedWriter(OutputStreamWriter(System.out))\n bw.write(stringBuilder.toString())\n\n bw.flush()\n bw.close()\n reader.close()\n}\n\n\nclass Reader : Closeable {\n private var bufferedReader: BufferedReader = BufferedReader(InputStreamReader(`in`))\n private var tokenizer: StringTokenizer = StringTokenizer(bufferedReader.readLine())\n\n fun getNextToken(): String {\n if (!tokenizer.hasMoreTokens()) {\n tokenizer = StringTokenizer(bufferedReader.readLine())\n }\n return tokenizer.nextToken()\n }\n\n fun getNextInt() = getNextToken().toInt()\n\n fun getNextLong() = getNextToken().toLong()\n\n fun getNextULong() = getNextToken().toULong()\n\n fun getNextDouble() = getNextToken().toDouble()\n\n fun getNextIntArray(n : Int) : IntArray {\n val array = IntArray(n)\n for (i in array.indices) {\n array[i] = getNextInt()\n }\n return array\n }\n\n fun getNextLongArray(n : Int) : LongArray {\n val array = LongArray(n)\n for (i in array.indices) {\n array[i] = getNextLong()\n }\n return array\n }\n\n fun getNextDoubleArray(n : Int) : DoubleArray {\n val array = DoubleArray(n)\n for (i in array.indices) {\n array[i] = getNextDouble()\n }\n return array\n }\n\n fun getNextStringIntArray() : IntArray = bufferedReader.readLine().split(\" \").filter { it.isNotEmpty() }.map { it.toInt() }.toIntArray()\n\n fun getNextStringLongArray() : LongArray = bufferedReader.readLine().split(\" \").filter { it.isNotEmpty() }.map { it.toLong() }.toLongArray()\n\n fun getNextStringDoubleArray() : DoubleArray = bufferedReader.readLine().split(\" \").filter { it.isNotEmpty() }.map { it.toDouble() }.toDoubleArray()\n\n override fun close() {\n bufferedReader.close()\n }\n}\n\nfun normalMod(d : Long, mod : Long) : Long = ((d % mod) + mod) % mod\n\nfun modAdd(x : Long, y : Long, mod: Long) : Long = normalMod(normalMod(x, mod) + normalMod(y, mod), mod)\n\nfun modSub(x : Long, y : Long, mod: Long) : Long = normalMod(normalMod(x, mod) - normalMod(y, mod), mod)\n\nfun modMul(x : Long, y : Long, mod: Long) : Long = normalMod(normalMod(x, mod) * normalMod(y, mod), mod)\n\n// \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439\nfun modDivWithSimpleMod(x : Long, y: Long, mod: Long) : Long {\n return modMul(x, y.toBigInteger().modPow((mod - 2L).toBigInteger(), mod.toBigInteger()).toLong(), mod)\n}\n\n// \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439\nfun modDivWithAnyMod(x : Long, y: Long, mod: Long) : Long {\n var point = GcdCalculate(1, 0, mod)\n gcdExtCalculate(y, mod, point)\n if (x % point.d != 0L) {\n return -1L\n }\n return modMul(x / point.d, point.x, mod)\n}\n\n//\u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u043e\u0431\u0449\u0438\u0439 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u042d\u0432\u043a\u043b\u0438\u0434\u0430\nfun Long.getGCD(a : Long) : Long {\n var x = this\n var y = a\n\n if (Math.abs(this) > Math.abs(a)) {\n x = a\n y = this\n }\n\n while (y != 0L && x != 0L) {\n val rest = y % x\n if (rest > Math.abs(x)) {\n y = rest\n } else {\n y = x\n x = rest\n }\n }\n return x + y\n}\n\n// \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443\u0440\u0430\u0432\u043b\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430 ax + by = d \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u042d\u0432\u043a\u043b\u0438\u0434\u0430\nfun Long.getGCDExt(a : Long) : Point {\n val datum = GcdCalculate(1L, 0L, 1L)\n gcdExtCalculate(this, a, datum)\n return Point(datum.x.toInt(), datum.y.toInt())\n}\n\n// \u0435\u0441\u0442\u044c \u043b\u0438 \u0432 \u0434\u0438\u043e\u0444\u0430\u043d\u0442\u043e\u0432\u043e\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0432\u0438\u0434\u0430 ax + by = d \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\nfun Long.GCDInDiofantExistSolution(a : Long, c : Long) : Boolean {\n val gcd = this.getGCD(a)\n return c % gcd == 0L\n}\n\n// \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u0434\u0438\u043e\u0444\u0430\u043d\u0442\u043e\u0432\u043e\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0432\u0438\u0434\u0430 ax + by = d\nfun Long.getGCDExtLikeDiofant(a : Long, c : Long) : Point {\n val d = this.getGCD(a)\n val datum = GcdCalculate(1, 0, 1)\n gcdExtCalculate(this, a, datum)\n datum.x = datum.x * c / d\n datum.y = datum.y * c / d\n return Point(datum.x.toInt(), datum.y.toInt())\n}\n\n//\u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\nfun gcdExtCalculate(a : Long, b: Long, datum : GcdCalculate) {\n if (b == 0L) {\n datum.d = a\n datum.x = 1\n datum.y = 0\n return\n }\n gcdExtCalculate(b, a % b, datum)\n val s = datum.y\n datum.y = datum.x - (a / b) * datum.y\n datum.x = s\n}\n//\u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441\ndata class GcdCalculate(var x : Long, var y : Long, var d : Long)\n\n\n// PalindromeHashing(s + s.reversed())\n// \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0445\u0435\u0448\u0438\u043d\u0433\u0430 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\u0430\ninternal class PalindromeHashing(s: String) {\n val X = 566239L\n val M = 1000000007L\n val h: LongArray\n val t: LongArray\n\n init {\n val length = s.length\n h = LongArray(length + 1)\n t = LongArray(length + 1)\n t[0] = 1\n for (i in 0 until length) {\n t[i + 1] = (t[i] * X % M)\n h[i + 1] = ((h[i] * X + s[i].toLong()) % M)\n }\n }\n\n fun hash(from: Int, to: Int): Long {\n var res = ((h[to] - h[from] * t[to - from]) % M)\n if (res < 0L) {\n res += M\n }\n return res\n }\n}\n\nfun Boolean.toYesNo() : String = if (this) \"YES\" else \"NO\"", "lang": "Kotlin", "bug_code_uid": "58cbb85925d68560bfb5289cb4425208", "src_uid": "7220f2da5081547a12118595bbeda4f6", "apr_id": "2a6f9e0e3e80e0009bffa56d3386bf82", "difficulty": null, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5047318611987381, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val num = System.`in`.bufferedReader().readLine().toInt()\n print(1)\n print(num)\n}", "lang": "Kotlin", "bug_code_uid": "5b7c1a19f187dd1fa45389cd8ded768c", "src_uid": "7220f2da5081547a12118595bbeda4f6", "apr_id": "ecce00dc6c13ceb9c7686abe64d2625f", "difficulty": null, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9991843393148451, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\n\n\nfun main(args: Array) {\n\n val sc = Scanner(System.`in`)\n\n val a = sc.nextInt()\n val b = sc.nextInt()\n val c = sc.nextInt()\n\n var a1 = a / 3\n var a2 = a / 3\n var a3 = a / 3\n when (a.rem(3)) {\n 0 -> {}\n 1 -> a1++\n 2 -> {\n a1++\n a2++\n }\n }\n var b1 = b / 2\n var b2 = b / 2\n b1 += b.rem(2)\n var c1 = c / 2\n var c2 = c / 2\n c1 += c.rem(2)\n\n var res = 0\n res = Math.max(res, days(arrayOf(a1, b1, c1, a2, c2, b2, a3)))\n res = Math.max(res, days(arrayOf(b1, c1, a1, c2, b2, a2, a3)))\n res = Math.max(res, days(arrayOf(c1, a1, c2, b1, a2, a3, b2)))\n res = Math.max(res, days(arrayOf(a1, c1, b1, a2, a3, b2, c2)))\n res = Math.max(res, days(arrayOf(c1, b1, a1, a2, b2, c2, a3)))\n res = Math.max(res, days(arrayOf(b1, a1, a2, b2, c1, a3, c1)))\n res = Math.max(res, days(arrayOf(a1, a2, b1, c1, a3, c2, b2)))\n\n println(res)\n}\n\nfun days(week: Array): Int {\n val min = week.min()!!\n var days = min * 7\n var pos = 0\n while (pos < 7) {\n if (week[pos] > min) {\n days++\n } else {\n break\n }\n pos++\n }\n return days\n}", "lang": "Kotlin", "bug_code_uid": "42c9bf7dbc8f4fc6e195f7ed16f68583", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "apr_id": "d1fbc71c3e6667dd010f2a6694ceb288", "difficulty": 1400, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7617124394184168, "equal_cnt": 19, "replace_cnt": 8, "delete_cnt": 7, "insert_cnt": 3, "fix_ops_cnt": 18, "bug_source_code": "//package cf1154\n\nimport java.util.StringTokenizer\nimport kotlin.math.max\nimport kotlin.math.min\n\nclass C {\n fun solve() {\n val st = StringTokenizer(readLine())\n\n val a: IntArray = IntArray(3)\n val needs: IntArray = intArrayOf(0, 1, 2, 0, 2, 1, 0)\n\n a[0] = st.nextToken().toInt()\n a[1] = st.nextToken().toInt()\n a[2] = st.nextToken().toInt()\n\n val weeks = min(a[0] / 3, min(a[1] / 2, a[2] / 2))\n var ans = weeks * 7\n\n a[0] -= (weeks * 3)\n a[1] -= (weeks * 2)\n a[2] -= (weeks * 2)\n\n if (weeks == 0) {\n for (weekDay in 0..6) {\n var days = 0\n val b: IntArray = a.copyOf()\n var cur = weekDay\n while (b[needs[cur]] != 0) {\n b[needs[cur]] --\n days ++\n cur ++\n cur %= 7\n }\n ans = max(days, ans)\n }\n } else {\n if (a[0] >= 2) {\n ans += 2\n }\n if (a[2] == 0) {\n if (a[1] >= 2) {\n ans += 2\n }\n }\n }\n println(ans)\n }\n}\n\nfun main(args: Array) {\n C().solve()\n}", "lang": "Kotlin", "bug_code_uid": "2a0e4ccd9fb8913a254e438b8b821949", "src_uid": "e17df52cc0615585e4f8f2d31d2daafb", "apr_id": "574abbf3d82017e9f9964842dc16dd92", "difficulty": 1400, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7272727272727273, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 16, "bug_source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) {\n with(Scanner(System.`in`)) {\n val pt = mutableListOf()\n val X2 = nextInt()\n val mk = Array(X2 + 1, { true })\n\n var counter = 0\n (2..X2).forEach {\n if (mk[it]) {\n pt.add(it)\n for (j in (it * 2)..X2 step it) {\n mk[j] = false\n ++counter\n }\n }\n }\n\n pt.reverse()\n\n val maxFactor = fun(x: Int): Int {\n return pt.first { x%it == 0 }\n }\n\n val lo = fun(x: Int) = x - maxFactor(x) + 1\n\n var ans = X2\n (lo(X2)..X2).forEach {\n val c = lo(it)\n if (c > 3) {\n ans = min(ans, c)\n }\n }\n println(ans)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "6b708ba5410befd3e593e624f5d9915c", "src_uid": "43ff6a223c68551eff793ba170110438", "apr_id": "8a32968206d8a213a0281452e3ad4fb3", "difficulty": 1700, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8836341008089608, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) {\n with(Scanner(System.`in`)) {\n val pt = mutableListOf()\n val X2 = nextInt()\n val mk = Array(X2 + 1, { true })\n val mf = Array(X2 + 1, { 0 })\n\n var counter = 0\n (2..X2).forEach {\n if (mk[it]) {\n pt.add(it)\n for (j in (it * 2)..X2 step it) {\n mk[j] = false\n mf[j] = it\n ++counter\n }\n }\n }\n\n pt.reverse()\n\n val lo = fun(x: Int) = x - mf[x] + 1\n\n var ans = X2\n (lo(X2)..X2).forEach {\n if (!mk[it]) {\n val c = lo(it)\n if (c > 3) {\n ans = min(ans, c)\n }\n }\n }\n println(ans)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "2491603f518910b0672230d3ee86fc2d", "src_uid": "43ff6a223c68551eff793ba170110438", "apr_id": "8a32968206d8a213a0281452e3ad4fb3", "difficulty": 1700, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9323213156230234, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val k = scanner.nextInt()\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n\n tailrec fun gcd(i: Int, j: Int): Int =\n if (i % j == 0) j\n else gcd(j, i % j)\n\n val m = n * k\n var min = m\n var max = 1\n\n outer@ for (i in arrayOf(a + b, a - b, -a + b, -a - b)) {\n for (j in 0..n) {\n val s = j * k + i\n if (s in 1..m) {\n val g = gcd(m, s)\n val c = m / g\n min = min(min, c)\n max = max(max, c)\n if (min == 1 && max == m) break@outer\n }\n }\n }\n\n println(\"$min $max\")\n}", "lang": "Kotlin", "bug_code_uid": "8fcf829f053100d9d6cc385551d73dab", "src_uid": "5bb4adff1b332f43144047955eefba0c", "apr_id": "971882cb3217d56d5450dc788c35c327", "difficulty": 1700, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.24246008279124778, "equal_cnt": 19, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 18, "bug_source_code": "fun main() {\n val n = readLine()!!.toInt()\n val validPrimes = mutableListOf()\n val notPrimes = mutableListOf()\n for (candidate in 2..n / 2) {\n if (candidate !in notPrimes) {\n if (n % candidate == 0)\n validPrimes.add(candidate)\n for (multiplied in candidate + candidate until n / 2 step candidate)\n notPrimes.add(multiplied)\n }\n }\n var sol = mutableSetOf(1, n)\n for (validPrime in validPrimes) {\n val divisors = mutableSetOf(1, n)\n var multiplied = validPrime\n while (multiplied < n) {\n if (n % multiplied == 0)\n divisors.add(multiplied)\n multiplied += validPrime\n }\n if (divisors.size > sol.size) sol = divisors\n }\n print(sol.sortedDescending().joinToString(\" \"))\n}", "lang": "Kotlin", "bug_code_uid": "42d118244c930b38b595f49c3fbec3fb", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63", "apr_id": "9c108c3c7fe057810bb65cbf8fdcb106", "difficulty": 1300, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9363957597173145, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.File\nimport java.util.*\n\nfun main() {\n val sc = Scanner(File(\"input-d.txt\"))\n SolutionD().doSolve(sc)\n}\n\nclass SolutionD {\n fun doSolve(sc: Scanner) {\n val value = sc.nextLine().trim().toInt(16)\n println(\"${value % 2}\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "4e02510e0ea89a87e3abea9a7d935341", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "apr_id": "a64efd589a37f5ea6840367bdfcfbb62", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.48695652173913045, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n println(\"0\")\n}", "lang": "Kotlin", "bug_code_uid": "c6f91fdd9d2bf67a87fb334e9e34ed95", "src_uid": "e52bc741bb72bb8e79cf392b2d15354f", "apr_id": "eb5fb1b560f4bdaaac2a25251ee76abe", "difficulty": null, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9847094801223242, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val k = r.readLine()!!.toInt()\n val v = r.readLine()!!.split(\" \").map { it.toInt() }.sortedDescending()\n var ans = 0\n var acc = 0\n while (acc < k && ans < 12) {\n acc += v[ans++]\n }\n println(if (ans==12) -1 else ans)\n}", "lang": "Kotlin", "bug_code_uid": "e9828aa7cce0a96edee90ef74c0c9397", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "apr_id": "b3cfb062a5be4a23e2c708b27e250269", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9432918395573997, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val k = readLine()!!.toInt()\n val a = readLine()!!.split(\" \").map { it.toInt() }\n\n var count = 0\n println(a.sortedDescending().fold(0, {acc, i ->\n if (acc >= k) {\n println(count)\n return\n } else {\n count++\n acc + i\n }\n }))\n println(-1)\n}", "lang": "Kotlin", "bug_code_uid": "98e07aaee32c9de0aa1ae3fb2da21dfa", "src_uid": "59dfa7a4988375febc5dccc27aca90a8", "apr_id": "29bd0a1ba269aa75b8328ab4e295a8c3", "difficulty": 900, "tags": ["greedy", "sortings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9983388704318937, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedInputStream\n\nfun main() {\n val pows = LongArray(40)\n pows[0] = 1L\n for (e in 1..39) {\n pows[e] = 7L * pows[e - 1]\n }\n val jin = FastScanner()\n val n = jin.nextInt().toLong()\n val m = jin.nextInt().toLong()\n var e = 0\n var pow = 1L\n while (pow < n) {\n e++\n pow *= 7L\n }\n var f = 0\n pow = 1L\n while (pow < m) {\n f++\n pow *= 7L\n }\n val used = mutableSetOf()\n var answer = 0\n var hour = 0L\n var minute = 0L\n fun recur(d: Int) {\n if (d == e + f) {\n if (hour < n && minute < m) {\n answer++\n }\n } else {\n for (digit in 0..6) {\n if (digit !in used) {\n used.add(digit)\n if (d < e) {\n hour += digit.toLong() * pows[d]\n } else {\n minute += digit.toLong() * pows[d - e]\n }\n recur(d + 1)\n if (d < e) {\n hour -= digit.toLong() * pows[d]\n } else {\n minute -= digit.toLong() * pows[d - e]\n }\n used.remove(digit)\n }\n }\n }\n }\n recur(0)\n println(answer)\n}\n\nclass FastScanner {\n private val BS = 1 shl 16\n private val NC = 0.toChar()\n private val buf = ByteArray(BS)\n private var bId = 0\n private var size = 0\n private var c = NC\n private var `in`: BufferedInputStream? = null\n\n constructor() {\n `in` = BufferedInputStream(System.`in`, BS)\n }\n\n private val char: Char\n private get() {\n while (bId == size) {\n size = try {\n `in`!!.read(buf)\n } catch (e: Exception) {\n return NC\n }\n if (size == -1) return NC\n bId = 0\n }\n return buf[bId++].toChar()\n }\n\n fun nextInt(): Int {\n var neg = false\n if (c == NC) c = char\n while (c < '0' || c > '9') {\n if (c == '-') neg = true\n c = char\n }\n var res = 0\n while (c >= '0' && c <= '9') {\n res = (res shl 3) + (res shl 1) + (c - '0')\n c = char\n }\n return if (neg) -res else res\n }\n}", "lang": "Kotlin", "bug_code_uid": "c2df1b41e1deba3e134b5a81c3c618ed", "src_uid": "0930c75f57dd88a858ba7bb0f11f1b1c", "apr_id": "f7cbbcec159aae9e169dbdfb704f5c99", "difficulty": 1700, "tags": ["brute force", "dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.853781512605042, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n readLine()\n val occs = IntArray(6)\n val groupA = readInts()\n val groupB = readInts()\n for (pos in groupA.indices)\n if ((groupA[pos] + groupB[pos]) and 1 == 1) return print(-1)\n for (performance in groupA) occs[performance]++\n for (performance in groupB) occs[performance]--\n val positive = occs.fold(0) { acc, i -> if (i > 0) acc + i else acc }\n val negative = occs.fold(0) { acc, i -> if (i < 0) acc - i else acc }\n print(if (positive == negative && positive % 2 == 0) positive / 2 else -1)\n}", "lang": "Kotlin", "bug_code_uid": "25334c270dbb70f656084bdfc421d664", "src_uid": "47da1dd95cd015acb8c7fd6ae5ec22a3", "apr_id": "fb798ff76acaa5177df3336d63cfb5f9", "difficulty": 1000, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9918840579710145, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.test.asserter\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val inp = InputReader(inputStream)\n val out = PrintWriter(outputStream)\n val solver = TaskB()\n solver.solve(inp, out)\n out.close()\n}\n\nclass TaskB {\n fun solve(inp: InputReader, out: PrintWriter) {\n val t = inp.nextInt()\n for (i in 1..t) {\n val a = inp.nextLong()\n val b = inp.nextLong()\n val d1 = a - b\n val d2 = a + b\n if (d1 == 1L) {\n if (isPrime(d2))\n out.println(\"YES\")\n else\n out.println(\"NO\")\n } else\n out.println(\"NO\")\n }\n }\n\n private fun isPrime(x: Long): Boolean {\n if (x == 1L)\n return false\n var d = 2L\n while (d * d <= x) {\n if (x % d == 0L)\n return false\n d++\n }\n return true\n }\n}\n\nclass InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return next().toLong()\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "52985983949eb4771b1637c471fab650", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "apr_id": "4c976e25d814b27c8d45c865f5ab1130", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8197381671701913, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.FileInputStream\nimport java.util.*\n\nobject programkt {\n @JvmStatic fun main(args: Array) {\n if (args.size == 1)\n System.setIn(FileInputStream(args[0]))\n val sc = Scanner(System.`in`)\n val t = Integer.parseInt(sc.nextLine())\n IntRange(1, t).forEach {\n val a = sc.nextLong()\n val b = sc.nextLong()\n println(if (a - b == 1L) \"YES\" else \"NO\")\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "94cd40e7c9417d8a8ae284d4e5347217", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "apr_id": "4d93316ff2f923aa9c0dba6968f16c56", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.47256438969764836, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val t = readLine()!!.toInt()\n for (test in 0 until t) {\n val (a, b) = readLine()!!.split(\" \").map{it.toLong()}\n val res = a * a - b * b\n var flag = true\n for (i in 2..Math.sqrt(res.toDouble()).toInt()) {\n if (res % i == 0L) {\n flag = false\n break\n }\n }\n if (flag) println(\"YES\") else println(\"NO\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "81050420aadb1c29a4e37406f12c6fec", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "apr_id": "b0d2495f231a4c7864ba85bdc51fd9cf", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5907172995780591, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "fun isPrime(n: Long): Boolean {\n var k: Long\n var upperBound = n / 2\n\n k = 3\n while (k <= upperBound) {\n upperBound = n / k\n if (n % k == 0L)\n return false\n k += 2\n }\n return true\n}\n\nfun main(args: Array) {\n val t = readLine()!!.toInt()\n for (test in 0 until t) {\n val (a, b) = readLine()!!.split(\" \").map{it.toLong()}\n val res = a * a - b * b\n if (isPrime(res)) println(\"YES\") else println(\"NO\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "e6ee705f0420de250e9d79d95c578d38", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "apr_id": "b0d2495f231a4c7864ba85bdc51fd9cf", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9897084048027445, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.sqrt\n\nfun main() {\n repeat(readLine()!!.toInt()) {\n val (a,b)= readLine()!!.split(\" \").map { it.toLong() }\n if(a - b > 1) {\n println(\"NO\")\n } else {\n var isPrime = true\n for (i in 3..sqrt((a+b).toDouble()).toInt() step 2) {\n if(i.rem(a+b) == 0L) {\n isPrime = false\n break\n }\n }\n if(isPrime) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n\n }\n\n\n }\n\n\n\n\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "9f46e7d5e8921d4afaef7661adf697f6", "src_uid": "5a052e4e6c64333d94c83df890b1183c", "apr_id": "ed233fdb804e3abcc599eb54ffa8599f", "difficulty": 1100, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.022857142857142857, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "kjn", "lang": "Kotlin", "bug_code_uid": "ff8192808ffd826aba81a2bc4d8eb4ea", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "cd1e4beae6ea9ab355f4f7fc06abc94e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.995085995085995, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.math.BigInteger\nimport java.util.Scanner\nfun main(){\n var s = Scanner(System.`in`);\n var k = s.nextLine();\n var m = s.nextInt();\n var kb = BigInteger(k);\n var lb = BigInteger(\"1\");\n var lob = BigInteger(\"10\")\n var ob = BigInteger(\"0\")\n while (m>0){\n if(kb%lob==ob){\n kb=kb/lob\n }\n else{\n kb -= lb}\n m--;\n\n }\nprint(kb);\n\n}", "lang": "Kotlin", "bug_code_uid": "4cfcc4498ed2373c39de7626dd6905ff", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "2ef86c68680e62d48361e82b4c6bb097", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8717948717948718, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val input = args.map { it.toInt() }\n var start = input[0]\n var count = input[1]\n\n while (count-- > 0) {\n if (start % 10 == 0) {\n start /= 10\n } else {\n start--\n }\n }\n\n println(start)\n}", "lang": "Kotlin", "bug_code_uid": "b603a69336e00052216a68624a8e6419", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "be7ab179bc8813540ed433608d066fed", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7849223946784922, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n var n:Int= readLine()!!.toInt()\n var k:Int= readLine()!!.toInt()\n for(i in 0 until k)\n {\n if (n%10==0) n=n/10\n else n=n-1\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "841661d4482a3f59e04b9049d0db66d7", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "b846ef613963d1c1d7e0c2ca380aa852", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9949494949494949, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val a = readLine()!!.split(\" \").map{ it.toInt() }.toMutableList()\n if (a[0] * 3 >= a[1]) {\n print(0)\n } else {\n print(a[0] * 3 - a[1])\n }\n}", "lang": "Kotlin", "bug_code_uid": "8a6f20cb9a8e8ee0028d9583ddd6f0a9", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "apr_id": "289d035535f94a130803127f8beaa589", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9215686274509803, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val (numExams, requiredSum) = readLine()!!.split(\" \").map(String::toInt)\n if (requiredSum <= 2* numExams) return print(numExams)\n print(3 * numExams - requiredSum)\n}", "lang": "Kotlin", "bug_code_uid": "7fea3cb3196bccb2a8bbbc033c352947", "src_uid": "5a5e46042c3f18529a03cb5c868df7e8", "apr_id": "1c88117f30da46c5cca5c35bd9b4150c", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9931389365351629, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readStrings() = readLn().split(\" \")\nfun readInts() = readStrings().map { it.toInt() }\n\ninline fun T.mapK(k: Int, f: (T) -> T): T {\n var res = this\n for (i in 1..k) {\n res = f(res)\n }\n return res\n}\n\nfun solve(s: String): String =\n (s.indices.let { it.first until it.last }).map {\n s.substring(it..it + 1)\n }.groupBy { it }\n .map { it.key to it.value.size }\n .maxBy { it.second }!!\n .first\n\nfun main() {\n readLine()\n val s = readLine()\n println(solve(s))\n}", "lang": "Kotlin", "bug_code_uid": "e52130da8ab072aac34d2c9dec7afc1f", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "5f63aaeae2bc6ea02a4862b8053d0fed", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.968236582694414, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nclass Main : Runnable {\n private val scanner: Scanner = Scanner(System.`in`)\n\n override fun run() {\n scanner.nextInt()\n val string = scanner.nextLine()\n val max =\n IntRange(0, string.length - 3)\n .groupingBy { string.substring(it, it + 2) }\n .eachCount()\n .maxBy { it.value }!!\n println(max.key)\n }\n\n}\n\nfun main() = Main().run()\n\n", "lang": "Kotlin", "bug_code_uid": "e06b37e943192f6d8ff2a038b35b5685", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "9e7d90e4439ff7e3c4f61268569d9cd3", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.986404833836858, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val length = readLine()!!\n val string = readLine()!!\n \tprintln(sol(length, string))\n}\n\nfun sol(length: Int, string: String): String{\n val array = Array(91, {IntArray(91)})\n for (i in 0..(length-2)){\n var beg = string[i].toInt()\n var end = string[i+1].toInt()\n\t\tarray[beg][end]++\n }\n var maxi = 0\n var l1 = 0\n var l2 = 0\n for (i in 41..90){\n for (j in 41..90){\n if (maxi < array[i][j]){\n maxi = array[i][j]\n l1=i\n l2=j\n }\n }\n }\n var p1 = l1.toChar()\n var p2 = l2.toChar()\n return \"$p1$p2\"\n}", "lang": "Kotlin", "bug_code_uid": "2b3d700edffcd3266c319241983a56b8", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "689dfc9b954595e1c48d85b1facaf74b", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.425531914893617, "equal_cnt": 23, "replace_cnt": 12, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 23, "bug_source_code": "import java.util.regex.Pattern\n\nfun twogram(): Pair?{\n val n = readLine()?.toInt() ?: 0\n val s = readLine().orEmpty()\n val chars = s.toList()\n if(chars.size == n) {\n val allPairs = chars.map { c ->\n chars.map {\n \"$it\" + \"$c\"\n }.distinct()\n }.flatten().distinct()\n val m = allPairs.map {\n val pattern = Pattern.compile(it) //case insensitive, use [g] for only lower\n val matcher = pattern.matcher(s)\n var count = 0\n while (matcher.find()) count++\n it to count\n }.maxBy { it.second }\n return m\n }else return \"\" to 0\n}", "lang": "Kotlin", "bug_code_uid": "95368ad23e2c0eb8db80581c9127b80d", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "6465c74e54e016561e8001042f6e40cd", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3996584116140051, "equal_cnt": 18, "replace_cnt": 10, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 18, "bug_source_code": "import java.util.regex.Pattern\n\n\n val n = readLine()?.toInt() ?: 0\n val s = readLine().orEmpty()\n val chars = s.toList()\n if(chars.size == n) {\n val allPairs = chars.map { c ->\n chars.map {\n \"$it\" + \"$c\"\n }.distinct()\n }.flatten().distinct()\n val m = allPairs.map {\n val pattern = Pattern.compile(it) //case insensitive, use [g] for only lower\n val matcher = pattern.matcher(s)\n var count = 0\n while (matcher.find()) count++\n it to count\n }.maxBy { it.second }\n println( m)\n }\n", "lang": "Kotlin", "bug_code_uid": "5190719324a225b2b55eb1b5f2a0b599", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "6465c74e54e016561e8001042f6e40cd", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9180602006688964, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "import java.util.Scanner\n\nfun main(args: Array) \n{ \n \n val map = mutableMapOf() \n val reader = Scanner(System.`in`)\n var n:Int = reader.nextInt()\n var s = reader.nextLine()\n \n var i:Int = 1\n while(i < n-1){\n \tval ch = s.get(i)\n \tval t1:String? = Character.toString(ch)\n \tval ch2 = s.get(i+1)\n \tval t2:String? = Character.toString(ch2)\n \tvar temp:String = t1+t2\n \tif(map.containsKey(temp)){\n \t\tmap.put(temp,map.get(temp)!!.plus(1))\n \t}else{\n \t\tmap.put(temp,1)\n \t}\n \ti++\n } \n var maxBy = map.maxBy { it -> it.value }\n println(maxBy!!.key)\n} ", "lang": "Kotlin", "bug_code_uid": "e91609ec6cd9caf0d2c8905fc0cc470f", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "b561bf7368e1e957d1968600d083ad54", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9162011173184358, "equal_cnt": 23, "replace_cnt": 0, "delete_cnt": 23, "insert_cnt": 0, "fix_ops_cnt": 23, "bug_source_code": "import java.util.*\n\nobject test {\n fun main(argv: Array) {\n val cin = Scanner(System.`in`)\n val len = cin.nextInt()\n val n:String = cin.next()\n val map = mutableMapOf()\n for (i in 0 until len - 1) {\n var temp = n.substring(IntRange(i,i+1))\n if(map.containsKey(temp))\n map[temp] = map[temp]!! + 1\n else map[temp] = 1\n }\n var MIN = 0\n var res = \"\"\n for ((key, value) in map) {\n if (MIN < value) {\n MIN = value\n res = key\n }\n }\n System.out.println(res)\n cin.close()\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "b3fe87eaf2bdcfd50abb7746e63b9cbc", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "56ec71a813b533f686d8241e92a87304", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9940019528525597, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.io.OutputStream\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.PrintWriter\nimport java.util.InputMismatchException\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author prakhar17252\n */\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = Main.InputReader(inputStream)\n val out = PrintWriter(outputStream)\n val solver = Main.BTwoGram()\n solver.solve(1, `in`, out)\n out.close()\n}\n\nobject Main {\n internal class BTwoGram {\n fun solve(testNumber: Int, `in`: InputReader, out: PrintWriter) {\n val n = `in`.nextInt()\n val s = `in`.nextString()\n\n val freq = Array(26) { IntArray(26) }\n\n for (i in 0 until n - 1) {\n freq[s.charAt(i) - 'A'][s.charAt(i + 1) - 'A']++\n }\n\n var ans = StringBuilder()\n var maxi = 0\n for (i in 0..25) {\n for (j in 0..25) {\n if (freq[i][j] > maxi) {\n maxi = freq[i][j]\n ans = StringBuilder()\n ans.append(('A'.toInt() + i).toChar())\n ans.append(('A'.toInt() + j).toChar())\n }\n }\n }\n\n out.println(ans.toString())\n }\n\n }\n\n internal class InputReader(private val stream: InputStream) {\n private val buf = ByteArray(1024)\n private var curChar: Int = 0\n private var numChars: Int = 0\n private val filter: InputReader.SpaceCharFilter? = null\n\n fun read(): Int {\n if (numChars == -1) {\n throw InputMismatchException()\n }\n if (curChar >= numChars) {\n curChar = 0\n try {\n numChars = stream.read(buf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (numChars <= 0) {\n return -1\n }\n }\n return buf[curChar++].toInt()\n }\n\n fun nextInt(): Int {\n var c = read()\n while (isSpaceChar(c)) {\n c = read()\n }\n var sgn = 1\n if (c == '-'.toInt()) {\n sgn = -1\n c = read()\n }\n var res = 0\n do {\n if (c < '0'.toInt() || c > '9'.toInt()) {\n throw InputMismatchException()\n }\n res *= 10\n res += c - '0'.toInt()\n c = read()\n } while (!isSpaceChar(c))\n return res * sgn\n }\n\n fun nextString(): String {\n var c = read()\n while (isSpaceChar(c)) {\n c = read()\n }\n val res = StringBuilder()\n do {\n if (Character.isValidCodePoint(c)) {\n res.appendCodePoint(c)\n }\n c = read()\n } while (!isSpaceChar(c))\n return res.toString()\n }\n\n fun isSpaceChar(c: Int): Boolean {\n return filter?.isSpaceChar(c) ?: isWhitespace(c)\n }\n\n interface SpaceCharFilter {\n fun isSpaceChar(ch: Int): Boolean\n\n }\n\n companion object {\n\n fun isWhitespace(c: Int): Boolean {\n return c == ' '.toInt() || c == '\\n'.toInt() || c == '\\r'.toInt() || c == '\\t'.toInt() || c == -1\n }\n }\n\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "30745986554721ca30598093cd8ad386", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "95067812c67f4b66e897ea521d3b8eed", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7523809523809524, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 5, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "fun main(args: Array) {\n val map = mutableMapOf()\n readLine()!!.let {\n (it.chunked(2) + it.drop(1).chunked(2))\n .filter { it.length == 2 }\n .forEach { twoGram -> map[twoGram] = 1 + (map[twoGram] ?: 0) }\n }\n println(map.maxBy { it.value }!!.key)\n}\n", "lang": "Kotlin", "bug_code_uid": "4ac91dfeea654753a76d77ad3ddd8d3b", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "8905e12877ee6122f2729e3447003ea2", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9953198127925117, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n readLine() // discard first line\n val string = readLine()\n val map = mutableMapOf()\n (string.chunked(2) + string.drop(1).chunked(2))\n .filter { it.length == 2 }\n .forEach { map[it] = 1 + (map[it] ?: 0) }\n println(map.maxBy { it.value }!!.key)\n}\n", "lang": "Kotlin", "bug_code_uid": "b6bc493789482b2d0839694f1546df65", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "8905e12877ee6122f2729e3447003ea2", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9596827495042961, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main(vararg args: String) {\n val (a, b) = readLine()!!.split(' ')\n print(getCount(a.toInt(), b))\n}\n\nprivate fun getCount(count: Int, str: String): String {\n val temp = HashMap()\n var maxCounted = 1\n var maxValue = \"\"\n (0 until count - 1).forEach { index ->\n val two = str.substring(index, index + 2)\n if(index == 0) {\n maxValue = two\n }\n val existed = temp[two]\n if (existed != null) {\n val newCount = existed.plus(1)\n if(maxCounted < newCount) {\n \tmaxCounted = existed.plus(1)\n maxValue = two\n }\n temp[two] = newCount\n } else {\n temp[two] = 1\n }\n }\n return maxValue\n}", "lang": "Kotlin", "bug_code_uid": "eaa9cc810a64c06faadf2e6a3c28d109", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "c8db0c05b4f925c5df8ef234ed916870", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9853273137697517, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.Integer.parseInt\nimport java.lang.Long.parseLong\nimport java.lang.Math.max\nimport java.lang.System.exit\n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\n\nobject B {\n\n internal var `in`: BufferedReader? = null\n internal var out: PrintWriter? = null\n internal var tok: StringTokenizer? = null\n\n @Throws(Exception::class)\n internal fun solve() {\n val n = scanInt()\n val s = scanString()\n val cnts = IntArray(26 * 26)\n var maxcnt = 0\n for (i in 0 until n - 1) {\n maxcnt = max(maxcnt, ++cnts[s[i] - 'A' + (s[i + 1] - 'A') * 26])\n }\n for (i in 0 until 26 * 26) {\n if (cnts[i] == maxcnt) {\n out!!.print(\"\" + (i % 26 + 'A'.toInt()).toChar() + (i / 26 + 'A'.toInt()).toChar())\n break\n }\n }\n }\n\n @Throws(IOException::class)\n internal fun scanInt(): Int {\n return parseInt(scanString())\n }\n\n @Throws(IOException::class)\n internal fun scanLong(): Long {\n return parseLong(scanString())\n }\n\n @Throws(IOException::class)\n internal fun scanString(): String {\n while (tok == null || !tok!!.hasMoreTokens()) {\n tok = StringTokenizer(`in`!!.readLine())\n }\n return tok!!.nextToken()\n }\n\n @JvmStatic\n fun main(args: Array) {\n try {\n `in` = BufferedReader(InputStreamReader(System.`in`))\n out = PrintWriter(System.out)\n solve()\n `in`!!.close()\n out!!.close()\n } catch (e: Throwable) {\n e.printStackTrace()\n exit(1)\n }\n\n }\n}", "lang": "Kotlin", "bug_code_uid": "41d8b9c8dc7fb5322420900849420b8d", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "4b32d70f674c5cc19aedb0776ee6278d", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9556737588652482, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport kotlin.collections.HashMap\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val input = scanner.nextLine().trim()\n\n var result: HashMap = HashMap()\n for(i in 0 until input.length - 1) {\n val j = i + 1\n val key = String(charArrayOf(input[i], input[j]));\n var amount = result.get(key)\n if (amount == null) {\n result.put(key, value = 1)\n } else {\n result.put(key, amount + 1)\n }\n }\n println(result.maxBy { it.value }!!.key)\n}", "lang": "Kotlin", "bug_code_uid": "d608ce139ac3e0a003161a2c4d5cb688", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "48de1f221c580fb90517f77662f7ff78", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9991055456171736, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package com.happypeople.codeforces.c1212\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\n\nfun main(args: Array) {\n try {\n B1212().run()\n } catch (e: Throwable) {\n println(\"\")\n e.printStackTrace()\n }\n}\n\nclass B1212 {\n fun run() {\n val sc = Scanner(systemIn())\n val n=sc.nextInt()\n val str=sc.next()\n val dmap = mutableMapOf()\n for(i in 0..str.length-2) {\n val twogram=str.substring(i..i+1)\n val old=dmap.getOrDefault(twogram, 0);\n dmap.set(twogram, old+1);\n }\n println(dmap.toList().sortedByDescending { (_, value) -> value }.first().first)\n }\n\n companion object {\n var inputStr: String? = null\n\n fun systemIn(): InputStream {\n if (inputStr != null)\n return ByteArrayInputStream(inputStr!!.toByteArray())\n else\n return System.`in`\n }\n\n var printLog = false\n fun log(str: String) {\n if (printLog)\n println(str)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "3c2b0e03dceca0ce18ca787e3be3b91b", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "7df8895e33328f686906df0a52ea9955", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.35793357933579334, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n fun readInt() = readLine()!!.toInt()\n print(min(readInt(), min(readInt(), readInt())) + 1)\n}", "lang": "Kotlin", "bug_code_uid": "fa0ed3d70ac3e7bc06daebf2c6da975f", "src_uid": "9266a69e767df299569986151852e7b1", "apr_id": "ded9388d556badc91ce0cafa516615ed", "difficulty": 1100, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9037267080745341, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nprivate fun readLn() = readLine()!! // string\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() //long\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map {it.toLong()} // list of longs\n\nval N = 5005 // 1e5.toInt()+5 //1e9.toInt() + 7\n\n\nfun main() {\n val b = readInt()\n val g = readInt()\n val n = readInt()\n println(min(n+1,min(b,g)+1))\n\n}", "lang": "Kotlin", "bug_code_uid": "6fde3cfbe69c74c5737af7e0193674e3", "src_uid": "9266a69e767df299569986151852e7b1", "apr_id": "9694909ff868a76516d2e330a5b2f1e8", "difficulty": 1100, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7329192546583851, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "import kotlin.math.min\n\nprivate fun readString() = readLine()!!\nprivate fun readInt() = readString().toInt()\nprivate fun readStrings() = readString().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main(){\n var b = readInt()\n var g = readInt()\n val n = readInt()\n var count = 0\n\n while(b > 0){\n val take = min(b,n)\n b -= take\n g -= n - take\n count++\n }\n while(g > 0){\n val take = min(g,n)\n g -= take\n count++\n }\n\n println(count)\n}\n", "lang": "Kotlin", "bug_code_uid": "7bedd23eb9f189d1a357315c8495f1f9", "src_uid": "9266a69e767df299569986151852e7b1", "apr_id": "aeb9dec71c442ba698c7e02488368c9f", "difficulty": 1100, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9951592356687898, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.*\nimport kotlin.random.Random.Default.nextInt\nimport kotlin.system.exitProcess\n\nconst val B = 31\nconst val MOD = 998244353\n\nfun readInt(): Int {\n var digit = System.`in`.read()\n while(digit <= 32) {\n digit = System.`in`.read()\n }\n\n val negative = digit == '-'.toInt()\n if (negative) {\n digit = System.`in`.read()\n }\n var res = 0\n while (digit in '0'.toInt()..'9'.toInt()) {\n res *= 10\n res += digit - '0'.toInt()\n digit = System.`in`.read()\n }\n return if (negative) -res else res\n}\n\nfun main() {\n val k = readLine()!!.toInt()\n\n val dp = Array(B) { Array(B) { Array(2) { 0L } } }\n\n dp[B - 1][0][1] = 1\n for(i in B - 1 downTo 1) {\n for(j in 0 until B) {\n for(p in 0..1) {\n if(dp[i][j][p] == 0L) continue\n\n// println(\"$i $j $p ${dp[i][j][p]}\")\n\n if(p == 0 || ((k shr (i - 1)) and 1) == 1) {\n// println(\"$i $j $p\")\n dp[i - 1][j + 1][p] = (dp[i - 1][j + 1][p] + dp[i][j][p]) % MOD\n }\n\n if(p == 0) {\n dp[i - 1][j][0] = (dp[i - 1][j][0] + dp[i][j][p] * (1 shl j)) % MOD\n } else if(j == 0) {\n val newp = if(((k shr (i - 1)) and 1) == 1) 0 else 1\n dp[i - 1][j][newp] = (dp[i - 1][j][newp] + dp[i][j][p]) % MOD\n } else if(((k shr (i - 1)) and 1) == 1) {\n dp[i - 1][j][0] = (dp[i - 1][j][0] + dp[i][j][p] * (1 shl (j - 1))) % MOD\n dp[i - 1][j][1] = (dp[i - 1][j][1] + dp[i][j][p] * (1 shl (j - 1))) % MOD\n } else {\n dp[i - 1][j][1] = (dp[i - 1][j][1] + dp[i][j][p] * (1 shl (j - 1))) % MOD\n }\n }\n }\n }\n\n var ans = 0L\n for(j in 0 until B) {\n for(p in 0..1) {\n ans = (ans + dp[0][j][p]) % MOD\n }\n }\n\n println(ans)\n}\n", "lang": "Kotlin", "bug_code_uid": "df43918b607d58b7a2d5eeb3e12f5e5f", "src_uid": "ead64d8e3134fa8f29881cb487e52f60", "apr_id": "144a80eec986e070790d6c3809e49f67", "difficulty": 2700, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8309859154929577, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "@ExperimentalStdlibApi\nfun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n var str = r.readLine()!!\n val len = str.length\n var upper = true\n for (i in 1..len - 1) {\n if (str[i].toInt() > 96) upper = false\n }\n if (!upper) {\n if (len == 1) println(str.toUpperCase())\n else println(str)\n } else{\n str = str.toLowerCase()\n println(str.capitalize(Locale.ROOT))\n }\n}", "lang": "Kotlin", "bug_code_uid": "95f8a0335785e4b6d78495bce7b0b5ff", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "9353eaadb30559169c62ff26093721b6", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.93048128342246, "equal_cnt": 14, "replace_cnt": 0, "delete_cnt": 14, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "fun main(args: Array) {\n var str = readLine()!!\n var c1 = str[0]\n str = str.substring(1)\n\n if (str.toUpperCase() === str) {\n str = str.toLowerCase()\n if (Character.toUpperCase(c1) == c1)\n c1 = Character.toLowerCase(c1)\n else\n c1 = Character.toUpperCase(c1)\n }\n println(c1 + str)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "7dce56ba61492dcd33e47a0c37b7e219", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "e4a1240310972465e6c6bc1a88efbc10", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8884509262908947, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val word = input.next()\n output.print(if (word.all { it.isUpperCase() } || (word.length > 1 && word.first().isLowerCase() && word.substring(1).all { it.isUpperCase() })) {\n word.toLowerCase().capitalize()\n } else {\n word\n })\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "c518541bfd83c0b8498026c7a85f8e93", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "4cf7f79ea5e432cac998a596ab244675", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9036004645760743, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val s: Scanner = Scanner(System.`in`)\n val str: String = s.next()\n if (str.length > 1) {\n if (isUpperCase(str.substring(1))) {\n print(invertCase(str))\n } else {\n print(str)\n }\n } else {\n print(str)\n }\n}\n\nfun isUpperCase(str: String): Boolean {\n var isUp: Boolean = true;\n str.forEach { c: Char ->\n if (!c.isUpperCase()) {\n isUp = false\n return@forEach\n }\n }\n return isUp\n}\n\nfun invertCase(c: Char): Char {\n if (c.isUpperCase()) {\n return c.toLowerCase();\n } else if (c.isLowerCase()) {\n return c.toUpperCase()\n } else {\n return c\n }\n}\n\nfun invertCase(str: String): String {\n val sb: StringBuilder = StringBuilder()\n str.forEach { c -> sb.append(invertCase(c)) }\n return sb.toString()\n}", "lang": "Kotlin", "bug_code_uid": "2e5aa8e859065065414a1489b198af13", "src_uid": "db0eb44d8cd8f293da407ba3adee10cf", "apr_id": "5dc3131ace70970724c3f52ebc90ce10", "difficulty": 1000, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9926088146728717, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.max\nimport kotlin.math.min\nimport kotlin.math.sqrt\n\nfun main(args : Array) {\n Thread { run() }.start()\n}\n\n\nfun run() {\n val scanner = Scanner(System.`in`)\n val a = scanner.nextInt()\n val b = scanner.nextInt()\n val c = scanner.nextInt()\n val res = (a / 3) + (b / 3) + (c / 3) + min(min(a % 3, b % 3), c % 3) + if ((a % 3) * (a % 3) + (b % 3) * (b % 3) + (c % 3) * (c % 3) == 8) 1 else 0\n println(res)\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun LongArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun BooleanArray.print() {\n println(Arrays.toString(this))\n}", "lang": "Kotlin", "bug_code_uid": "1158f98fb4e72b82bdfb72fbe53011f4", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "apr_id": "cf5483550e235be2c95c42afaac9e45b", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.44466403162055335, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\n/**\n * Created by Hamza on 07/11/2017.\n */\nfun main(args: Array) {\n var sc = Scanner(System.`in`)\n var r = sc.nextInt()\n var g = sc.nextInt()\n var b = sc.nextInt()\n println(\"${r / 3 + g / 3 + b / 3 + (r % 3 + b % 3 + g % 3) / 3}\")\n}", "lang": "Kotlin", "bug_code_uid": "1492c060247a10dbf90523d5ff7790e4", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "apr_id": "873a43dce9f0c00aa48f54cb73e94650", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6428571428571429, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "import java.io.BufferedInputStream\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(BufferedInputStream(System.`in`))\n\n var r = scanner.nextLong()\n var g = scanner.nextLong()\n var b = scanner.nextLong()\n\n val ones = Math.min(r, Math.min(g, b))\n var ans = ones\n r -= ans\n g -= ans\n b -= ans\n ans += r/3 + g/3 + b/3\n\n if(ones > 0 && (r == 2L || g == 2L || b == 2L)){\n --ans\n r += 1\n g += 1\n b += 1\n ans += r/3 + g/3 + b/3\n }\n\n\n print(ans)\n}", "lang": "Kotlin", "bug_code_uid": "ee113bdcfc1710503bce2117c320cbfd", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "apr_id": "6be71ebdaa88a6778f2a19e2820897ce", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.969743987587277, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedInputStream\nimport java.util.*\n\nfun main(args: Array) {\n val scanner = Scanner(BufferedInputStream(System.`in`))\n\n var r = scanner.nextLong()\n var g = scanner.nextLong()\n var b = scanner.nextLong()\n\n var ones = Math.min(r, Math.min(g, b))\n var ans = 0L\n r -= ones\n g -= ones\n b -= ones\n ans += r/3 + g/3 + b/3\n r %= 3\n g %= 3\n b %= 3\n\n while(ones > 0 && (r == 2L || g == 2L || b == 2L)){\n --ones\n r += 1\n g += 1\n b += 1\n ans += r/3 + g/3 + b/3\n r %= 3\n g %= 3\n b %= 3\n }\n\n\n //println(\"$r $g $b\")\n print(ans+ones)\n}", "lang": "Kotlin", "bug_code_uid": "7fff02aaf867d26cb71c9f01087719bd", "src_uid": "acddc9b0db312b363910a84bd4f14d8e", "apr_id": "6be71ebdaa88a6778f2a19e2820897ce", "difficulty": 1600, "tags": ["math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9961356805495921, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\n\nfun main() = (System.`in`.bufferedReader().run {\n val len = readLong()\n\n var clen = 1L\n val lens = LongArray(10) { 1 }\n var idx = 0\n while (clen < len) {\n clen /= lens[idx]\n lens[idx]++\n clen *= lens[idx++]\n }\n\n println(lens.mapIndexed { cidx, it -> \"codeforces\"[cidx].toString().repeat(it.toInt()) }.joinToString(\"\"))\n} to Unit).second\n\nprivate const val SPACE_INT = ' '.toInt()\nprivate const val ZERO_INT = '0'.toInt()\nprivate const val NL_INT = '\\n'.toInt()\n\n@Suppress(\"DuplicatedCode\")\nprivate fun BufferedReader.readInt(): Int {\n var ret = read()\n while (ret <= SPACE_INT) {\n ret = read()\n }\n val neg = ret == '-'.toInt()\n if (neg) {\n ret = read()\n }\n ret -= ZERO_INT\n var read = read()\n while (read >= ZERO_INT) {\n ret *= 10\n ret += read - ZERO_INT\n read = read()\n }\n while (read <= SPACE_INT && read != -1 && read != NL_INT) {\n mark(1)\n read = read()\n }\n if (read > SPACE_INT) {\n reset()\n }\n return if (neg) -ret else ret\n}\n\n@Suppress(\"DuplicatedCode\")\nprivate fun BufferedReader.readLong(): Long {\n var ret = read().toLong()\n while (ret <= SPACE_INT) {\n ret = read().toLong()\n }\n val neg = ret == '-'.toLong()\n if (neg) {\n ret = read().toLong()\n }\n ret -= ZERO_INT\n var read = read()\n while (read >= ZERO_INT) {\n ret *= 10\n ret += read - ZERO_INT\n read = read()\n }\n while (read <= SPACE_INT && read != -1 && read != NL_INT) {\n mark(1)\n read = read()\n }\n if (read > SPACE_INT) {\n reset()\n }\n return if (neg) -ret else ret\n}\n\n@Suppress(\"DuplicatedCode\")\nprivate fun BufferedReader.readWord(): String {\n var ret = read()\n while (ret <= SPACE_INT && ret != -1) {\n ret = read()\n }\n if (ret == -1) {\n return \"\"\n }\n var cb = CharArray(32)\n var idx = 0\n while (ret > SPACE_INT) {\n if (idx == cb.size) {\n cb = cb.copyOf(cb.size shl 1)\n }\n cb[idx++] = ret.toChar()\n ret = read()\n }\n while (ret <= SPACE_INT && ret != -1 && ret != NL_INT) {\n mark(1)\n ret = read()\n }\n if (ret > SPACE_INT) {\n reset()\n }\n return String(cb, 0, idx)\n}\n", "lang": "Kotlin", "bug_code_uid": "c451fdcf9615ae8ed1da05dece4c51a0", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "b20011eba6b6e164e053a5e0540448ce", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.19127205199628597, "equal_cnt": 23, "replace_cnt": 17, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 23, "bug_source_code": "fun main() {\n val a = readLine()!!.toDouble()\n val stringList = listOf(\"c\", \"o\", \"d\", \"e\", \"f\", \"o\", \"r\", \"c\", \"e\", \"s\")\n val printTimes = MutableList(10) {1}\n var index = 0\n\n while (printTimes.reduce { acc, i -> acc * i } < a ) {\n printTimes[index%10] += 1\n index += 1\n }\n\n for (i in 0..stringList.size-1) {\n val str = List(printTimes[i]) {stringList[i]}\n print(str.joinToString(\"\"))\n }\n}", "lang": "Kotlin", "bug_code_uid": "6beee67f7edc47c51d0f586e654e9879", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "df1468301be282c2572991ef66e7f0a7", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.0481203007518797, "equal_cnt": 13, "replace_cnt": 14, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 14, "bug_source_code": "\nimport kotlin.math.pow\nimport kotlin.math.round\n\nfun main() {\n val a = readLine()!!.toDouble()\n var base = 1.0\n while (base.pow(10) < a) {\n base += 1\n }\n \n val stringList = listOf(\"c\", \"o\", \"d\", \"e\", \"f\", \"o\", \"r\", \"c\", \"e\", \"s\")\n val printTimes = MutableList(10) {base.toInt()}\n \n \n val minTime = base.toInt()\n var index = 0\n var acc = base.pow(10)\n\n while (acc > a ) {\n printTimes[index] -= 1\n acc = acc / (minTime) * (minTime-1)\n index += 1\n\n }\n printTimes[index-1] = minTime\n \n for (i in 0..stringList.size-1) {\n val str = List(printTimes[i]) {stringList[i]}\n print(str.joinToString(\"\"))\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "d36c9b3fcb30ab97b081a3b02aa22480", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "df1468301be282c2572991ef66e7f0a7", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9825396825396825, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.lang.Math.pow\nimport java.lang.String.format\nimport java.util.*\nimport kotlin.math.*\nimport kotlin.system.exitProcess\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readLong() = readLn().toLong()\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of ints\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\n//var graph = Array(0) { mutableListOf()}\n//var n = 0\n\nfun main() {\n val k = readLong()\n var base = 1\n\n for (i in 1 until 100) {\n if (pow(i.toDouble(), 10.toDouble()) > k) {\n base = i - 1\n break\n }\n }\n\n val ar = Array(10) {base}\n\n for (i in 0 until 10) {\n if (i != 0) ar[i] += 1\n\n var m = 1L\n for (j in 0 until 10) {\n m *= ar[j]\n }\n if (m >= k) {\n// println(\"$base $i\")\n toStr(ar)\n return\n }\n }\n}\n\nfun toStr(ar: Array) {\n var s = \"codeforces\"\n var ans = mutableListOf()\n for (i in 0 until 10) {\n for (j in 0 until ar[i]) {\n ans.add(s[i])\n }\n }\n println(ans.joinToString(\"\"))\n}\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "e2a6b39f262be017e252c1e8f2fc0e63", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "993b1d8ee1c25a769717cdc62e05faf7", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9963898916967509, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.floor\nimport kotlin.math.pow\n\nfun main() {\n val n = readLine()!!.toLong()\n val c = floor(n.toDouble().pow(1 / 10)).toLong()\n val answer = LongArray(10) { c }\n var index = 0\n var number = 1L\n answer.forEach { number *= it }\n while (number < n) {\n answer[index++]++\n number = 1L\n answer.forEach { number *= it }\n }\n val s = \"codeforces\"\n val out = StringBuilder()\n answer.forEachIndexed { i, it ->\n repeat(it.toInt()) { out.append(s[i]) }\n }\n println(out.toString())\n}", "lang": "Kotlin", "bug_code_uid": "018a6a9362dd02334886fa36df1cfdb5", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "be8228e8e736bfe9cb16b9b2dfaf93f1", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6683046683046683, "equal_cnt": 10, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "import java.io.File\nimport java.util.*\nimport kotlin.math.floor\n\nfun doit(scanner: Scanner){\n var k = scanner.nextLong()\n print(\"codeforce\")\n while (k > 0){\n print(\"s\")\n k--\n }\n}\n\nfun main(args:Array){\n val mode = 1\n //val file = File(\"in.txt\")\n var scanner = Scanner(System.`in`) //else Scanner(file)\n //var t = scanner.nextInt()\n //while (t-- > 0){\n doit(scanner)\n //}\n}", "lang": "Kotlin", "bug_code_uid": "d0d374cd3f91e47902213754c7c10b03", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "1841f21221236a7f873e3c7508a95cd9", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9766763848396501, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "const val s = \"codeforces\"\nfun main() {\n val k = readLine()!!.toInt()\n var pos = 0\n val a = MutableList(10) { 0 }\n while (a.reduce { x, y -> x * y } < k) {\n a[pos]++\n pos = (pos + 1) % 10\n }\n var res = \"\"\n for (i in 0 until 10)\n repeat(a[i]) {\n res += s[i]\n }\n println(res)\n}", "lang": "Kotlin", "bug_code_uid": "3f3ac70589412582d5ad31df54f297b4", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "29c36ca5a40010b05b49b39ee99cfdeb", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9173457508731082, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun readInt() = readLine()!!.toInt()\n\nfun main() {\n val n = readInt()\n val counters = \"codeforces\".map { 1 }.toMutableList()\n while (counters.product() < n) {\n val idx = counters.indexOf(counters.min())\n counters[idx]++\n }\n println(\"codeforces\".mapIndexed { idx, c -> c.toString().repeat(counters[idx])}.joinToString(separator=\"\"))\n}\n\nprivate fun List.product(): Int = reduce(Int::times)\n", "lang": "Kotlin", "bug_code_uid": "ddc407e83b45231ab4762517634569f5", "src_uid": "8001a7570766cadcc538217e941b3031", "apr_id": "1fbd9a23d130e7b9066189b3a648beb3", "difficulty": 1500, "tags": ["greedy", "math", "brute force", "strings", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.20550458715596331, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main(){\n val n = readLine()!!.toInt()\n val l = List(11){0}.toMutableList()\n val m = List(11){0}.toMutableList()\n for (i in 1..10){\n val a = i * (i + 1) / 2\n l[i] = l[i-1] + a\n m[i] = m[i-1] + l[i]\n }\n println(\"${m[n]}\")\n}\n\n", "lang": "Kotlin", "bug_code_uid": "36369754d74d60a4b1047423fcdb82d5", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "apr_id": "7737aa3fe4cd62fe1210d7ca53254f8d", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9587109768378651, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val n = readLine()?.toInt() ?: 0\n val a = Array(n) {\n IntArray(n) { 1 }\n }\n\n println(findMax(a, 1, 1, n))\n}\n\nfun findMax(a: Array, startI: Int, startJ: Int, n: Int): Int {\n if (startI == n || startJ == n) {\n return 0\n }\n for (i in startI until n) {\n for (j in startJ until n) {\n a[i][j] = a[i - 1][j] + a[i][j - 1]\n findMax(a, i + 1, j + 1, n)\n }\n }\n return a[n - 1][n - 1]\n}", "lang": "Kotlin", "bug_code_uid": "8317b6bc24fc732f0fb92ee1e3393810", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "apr_id": "e93cbee3beba923952eb675758968b8b", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.996, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "/*\n* Name: A. Maximum in Table\n* Link: https://codeforces.com/problemset/problem/509/A\n*/\n\nfun main() {\n\n val x: Int = 5 //readLine()!!.toInt()\n val table: MutableList> = mutableListOf()\n val tmp: MutableList = mutableListOf()\n\n for (i in 0 until x)\n tmp.add(1)\n\n for (i in 0 until x)\n table.add(tmp)\n\n for (i in 1 until x)\n for (j in 1 until x)\n table[i][j] = table[i - 1][j] + table[i][j - 1]\n\n println(table[x - 1][x - 1])\n}", "lang": "Kotlin", "bug_code_uid": "7f3b61c03d054a8b142c961d777dcb8e", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "apr_id": "398febffb8e059b8136d95ff11884550", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8203592814371258, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n print((n..2*n-2).reduce{prod, e -> prod*e}/(1 until n).reduce{prod, e-> e*prod})\n}", "lang": "Kotlin", "bug_code_uid": "1e5af716ab2de8b7de98afd1f8909f20", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "apr_id": "c16726f878cbc237b00e61df2095ac5d", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9116022099447514, "equal_cnt": 13, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n if (n==1) print(1)\n else print((n..2*n-2).reduce{prod, e -> prod*e}/(1 until n).reduce{prod, e-> e*prod})\n}", "lang": "Kotlin", "bug_code_uid": "4d6383ea571a9535670517586e51aa28", "src_uid": "2f650aae9dfeb02533149ced402b60dc", "apr_id": "c16726f878cbc237b00e61df2095ac5d", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9822323462414578, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.InputStream\nimport java.io.PrintStream\nimport java.math.BigDecimal\nimport java.math.BigInteger\n\nprivate val MOD = 1e9.toLong() + 7\n\nval input = FastScanner()\n\nfun main(args: Array) {\n System.setOut(PrintStream(System.out.buffered(), false))\n\n val (h, m) = input.nextString()!!.split(':').map { it.toInt() }\n val time = h * 60 + m\n var ans = 0\n while (!palindrome(toStr(time + ans))) {\n ans++\n }\n\n println(ans)\n\n System.out.flush()\n}\n\nfun palindrome(s: String): Boolean {\n return s[0] == s[4] && s[1] == s[3]\n}\n\nfun toStr(time: Int): String {\n return String.format(\"%02d:%02d\", time / 60 % 24, time % 60)\n}\n\nfun String.toBigInteger() = BigInteger(this)\nfun String.toBigDecimal() = BigDecimal(this)\n\nclass FastScanner(private val input: InputStream = System.`in`) {\n private val sb = StringBuilder()\n private val buffer = ByteArray(4096)\n private var pos = 0\n private var size = 0\n\n fun nextString(): String? {\n var c = skipWhitespace()\n if (c < 0) return null\n\n return sb.run {\n setLength(0)\n\n do {\n append(c.toChar())\n c = read()\n } while (c > ' '.toInt())\n\n toString()\n }\n }\n\n fun nextLine(): String? {\n var c = read()\n if (c < 0) return null\n\n return sb.run {\n setLength(0)\n\n while (c >= 0 && c != '\\n'.toInt()) {\n append(c.toChar())\n c = read()\n }\n\n toString()\n }\n }\n\n fun nextLong(): Long {\n var c = skipWhitespace()\n\n val sign = if (c == '-'.toInt()) {\n c = read()\n -1\n } else 1\n\n var ans = 0L\n\n while (c > ' '.toInt()) {\n ans = ans * 10 + c - '0'.toInt()\n c = read()\n }\n\n return sign * ans\n }\n\n fun nextInt() = nextLong().toInt()\n fun nextDouble() = nextString()?.toDouble() ?: 0.0\n fun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO\n fun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO\n\n fun nextStrings(n: Int) = Array(n) { nextString() ?: \"\" }\n fun nextInts(n: Int) = IntArray(n) { nextInt() }\n fun nextLongs(n: Int) = LongArray(n) { nextLong() }\n fun nextDoubles(n: Int) = DoubleArray(n) { nextDouble() }\n fun nextBigIntegers(n: Int) = Array(n) { nextBigInteger() }\n fun nextBigDecimals(n: Int) = Array(n) { nextBigDecimal() }\n\n fun nextStrings(n: Int, m: Int) = Array(n) { nextStrings(m) }\n fun nextInts(n: Int, m: Int) = Array(n) { nextInts(m) }\n fun nextLongs(n: Int, m: Int) = Array(n) { nextLongs(m) }\n fun nextDoubles(n: Int, m: Int) = Array(n) { nextDoubles(m) }\n fun nextBigIntegers(n: Int, m: Int) = Array(n) { nextBigIntegers(m) }\n fun nextBigDecimals(n: Int, m: Int) = Array(n) { nextBigDecimals(m) }\n\n private fun skipWhitespace(): Int {\n while (true) {\n val c = read()\n if (c > ' '.toInt() || c < 0) return c\n }\n }\n\n private fun read(): Int {\n while (pos >= size) {\n if (size < 0) return -1\n size = input.read(buffer, 0, buffer.size)\n pos = 0\n }\n return buffer[pos++].toInt()\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "76d7020054127272a2dbad4e1f71a48b", "src_uid": "3ad3b8b700f6f34b3a53fdb63af351a5", "apr_id": "74320bd8ec75150a6254c875903e7937", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9923312883435583, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.Math.pow\n//***********************\nconst val threshold = 50\n\nfun brute(x: Long, y: Long): Char {\n val xy = pow(x.toDouble(), y.toDouble())\n val yx = pow(y.toDouble(), x.toDouble())\n return when {\n xy > yx -> '>'\n xy < yx -> '<'\n else -> '='\n }\n}\n\nfun solve(): Char {\n val (x, y) = readLine()!!\n .split(\" \")\n .map(String::toLong)\n return if (x == y) '='\n else if (x < threshold && y < threshold) brute(x, y)\n else if (x == 1L) '<'\n else if (y == 1L) '>'\n else if (x > y) '<'\n else if (y < x) '>'\n else '='\n}\n\nfun main(args: Array) { print(solve()) }", "lang": "Kotlin", "bug_code_uid": "c8a5ad4fdac9f7eee99a5319511c4752", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "957eb23de928b369512f6f7a855fc430", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.06855439642324888, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun myFunction() {\n val input = Scanner(System.`in`)\n val a = input.nextInt()\n val b = input.nextInt()\n if (a == b) {\n System.out.println(\"=\")\n } else {\n if (Math.log(a.toDouble()) > Math.log(b.toDouble())) System.out.println(\">\") else System.out.println(\"<\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "1f6f343786edc525253347af97354a00", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "4b14c69bcdff0e2b9542a8a555f6956d", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.40875912408759124, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n val a = input.nextInt()\n val b = input.nextInt()\n if (a == b) {\n System.out.println(\"=\")\n } else {\n if (Math.log(a.toDouble()) > Math.log(b.toDouble())) System.out.println(\">\") else System.out.println(\"<\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "3811a76907e81a0834dd43970b9d2db2", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "4b14c69bcdff0e2b9542a8a555f6956d", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8111888111888111, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.math.MathContext\nimport java.util.Scanner\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n val a = scan.nextInt()\n val b = scan.nextInt()\n if (a==b || (a==2 && b==4) || (a==4 && b==2)) print (\"=\")\n else if (a>b || a==0) print (\"<\")\n else print (\">\")\n}", "lang": "Kotlin", "bug_code_uid": "2cccf6c9e8585810c6309fd9ce18ff99", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "e0ef0ac41102267527f16ba45eac6c90", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7418655097613883, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "package codeforces\n\nimport java.util.*\n\nfun main (args: Array) {\n val sc = Scanner(System.`in`)\n val a = sc.nextInt()\n val b = sc.nextInt()\n\n val v = b * (Math.log10(a.toDouble()) / Math.log10(b.toDouble()))\n\n if (a == b) {\n println(\"=\")\n return\n }\n\n when {\n v < a -> println(\"<\")\n v > a -> println(\">\")\n else -> {\n println(\"=\")\n throw Exception(\"nope\")\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "c44ec1354713cbcd68b9eb6c2f8fc7f1", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "3b2c97083e238de45f1c7bf0f8e86d30", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9626556016597511, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.util.*\n\nfun main (args: Array) {\n val sc = Scanner(System.`in`)\n val a = sc.nextInt()\n val b = sc.nextInt()\n\n if (a == b) {\n println(\"=\")\n return\n }\n\n if (b == 1) {\n println(\">\")\n return\n }\n\n val v = b * (Math.log10(a.toDouble()) / Math.log10(b.toDouble()))\n\n when {\n v < a -> println(\"<\")\n v > a -> println(\">\")\n else -> {\n println(\"=\")\n throw Exception(\"nope\")\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "8b027e69da69a3445650b7948f6385aa", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "3b2c97083e238de45f1c7bf0f8e86d30", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8403908794788274, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import kotlin.math.log10\n\nfun main(args: Array) {\n val (x, y) = readLine()!!.split(\" \").map { it.toInt() }\n print(when {\n y / log10(y.toDouble()) > x / log10(x.toDouble()) + 1e-9 -> \"<\"\n y / log10(y.toDouble()) < x / log10(x.toDouble()) - 1e-9 -> \"<\"\n else -> \"=\"\n })\n}", "lang": "Kotlin", "bug_code_uid": "7833be61ddcdf77b425dab58bfb88789", "src_uid": "ec1e44ff41941f0e6436831b5ae543c6", "apr_id": "2ee0ba5f6c11454f82361c6961dcdbd1", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9975845410628019, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\nimport java.lang.Math;\nfun log(N:Int):Int\n{\n var c:Int=0\n var num=N\n while(num!=1)\n {\n num=num/2\n c++\n }\n return c\n }\nfun main()\n{\nvar scan=Scanner(System.`in`)\nvar a:Int=scan.nextInt()\nvar b:Int=scan.nextInt()\n var d:Double=Math.log(a*1.00)/a\n var e:Double=Math.log(b*1.00)*1.00/b*1.00\n println(\"$d $e\")\n if(d>e)\n println(\">\")\n else if(d b) {\n return a\n } else {\n return b\n }\n}\n\nfun main(args:Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val writer = BufferedWriter(OutputStreamWriter(System.out))\n \n val n = reader.readLine().toLong()\n val mn: Long = 1000000000 + 7\n\n var ans: Long = 1\n var minus: Long = 1\n for (i in 1..n) {\n\tans *= i\n\tans %= mn\n\tif (i.toInt() != 1) {\n\t minus *= 2\n\t minus %= mn\n\t}\n }\n\n ans -= minus\n\n writer.write(\"$ans\\n\")\n \n writer.flush()\n reader.close()\n writer.close()\n}\n", "lang": "Kotlin", "bug_code_uid": "126b5f059bd77266e1e2e96ff84e401b", "src_uid": "3dc1ee09016a25421ae371fa8005fce1", "apr_id": "999c20b9b7698110afe9de801ffa8aab", "difficulty": 1500, "tags": ["graphs", "dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9958592132505176, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main(atgs: Array){\n val sc = Scanner(System.`in`)\n val n: Int = 5\n var sum = 0\n var num = Array(100){0}\n for (i in 0 until n){\n var x = sc.nextInt()\n num[x]++\n sum += x\n }\n var ans = sum\n for (i in 1 until 100){\n if (num[i] > 1){\n if (num[i] == 2) ans = if (ans < sum-2*i) ans else sum-2*i\n else ans = if (ans < sum-3*i) ans else sum-3*i\n }\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "3f55ee305c4a5fc1a41348f43df29324", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "apr_id": "f7395896b10fec1870471dff84472388", "difficulty": 800, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9989200863930886, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n var sc = Scanner(System.`in`)\n var list = ArrayList()\n list.add(sc.nextInt())\n list.add(sc.nextInt())\n list.add(sc.nextInt())\n list.add(sc.nextInt())\n list.add(sc.nextInt())\n\n Collections.sort(list)\n\n var array = Array(100,{0})\n\n var i = 0\n while (imax){\n max = two\n }\n }else if (array[j]>=3){\n flag = true\n two+=3*j\n if (two>max){\n max = two\n }\n }\n j++\n }\n\n\n if (flag){\n println(list.sum()-max)\n }else{\n println(list.sum())\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "35ef6977bd26104942fd4091169b2f77", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a", "apr_id": "b009e3e0248f37d55156730c48cafa2b", "difficulty": 800, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9797421731123389, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n var (a, b) = readLine()!!.split(' ').map { it.toInt() }\n var count = 0L\n for (i in a..b){\n var digit = i.toString()\n for (i in digit){\n when(i){\n '0'->count+=6\n '1'->count+=2\n '2'->count+=5\n '3'->count+=5\n '4'->count+=4\n '5'->count+=5\n '6'->count+=6\n '7'->count+=3\n '8'->count+=7\n '6'->count+=6\n }\n }\n }\n println(count)\n}", "lang": "Kotlin", "bug_code_uid": "06e3ff5d4057b208ebca3d1150842559", "src_uid": "1193de6f80a9feee8522a404d16425b9", "apr_id": "1e4579cc7cb91e8f0a3904612bdf8b15", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9988950276243094, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner;\n\nfun main(args: Array) {\n var scan = Scanner(System.`in`);\n var area: Int = scan.nextInt();\n\n var sqrt: Int = Math.floor(Math.sqrt(area.toDouble())).toInt();\n var p: Int = sqrt * 4;\n var a: Int = sqrt * sqrt;\n var d: Int = area - a;\n if (area == a) {\n System.out.println(p);\n } else if (d < sqrt) {\n System.out.println(p + 2);\n } else {\n System.out.println(p+4);\n }\n}", "lang": "Kotlin", "bug_code_uid": "087a39581f6eb6b90fe59d14a5322e9a", "src_uid": "414cc57550e31d98c1a6a56be6722a12", "apr_id": "608bde0b648177cdcfa40ea2a27c4738", "difficulty": 1000, "tags": ["geometry", "math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6578014184397163, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val n = r.readLine()!!.toInt()\n val v = r.readLine()!!.split(\" \").map { it.toInt() }\n if (n == 1) {\n println(-1)\n } else {\n val before = v[n - 2]\n val mid = v[n - 1]\n when {\n mid in (before + 1)..14 -> println(\"UP\")\n mid > before && mid == 15 -> println(\"DOWN\")\n mid in 1 until before -> println(\"DOWN\")\n mid < before && mid == 0 -> println(\"UP\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "ba5a937862649c09cb3316f8294c2029", "src_uid": "8330d9fea8d50a79741507b878da0a75", "apr_id": "99b1d8632cd279217254627ab050d61f", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9263780278466527, "equal_cnt": 14, "replace_cnt": 11, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "import java.io.PrintWriter\nimport java.util.StringTokenizer\n\nfun main() {\n output {\n val n = readInt()\n\n var ans = ModInt(0)\n\n var pd = ModInt(1)\n\n for(i in 0..2*n) {\n ans += pd\n if(i >= n) pd -= C(i, n)\n pd *= 2\n }\n\n println(ans)\n }\n}\n\nprivate val _factorialMemo = mutableListOf(ModInt(1))\n\nfun Int.factorial() = run {\n while(this > _factorialMemo.lastIndex) {\n _factorialMemo.add(_factorialMemo.last() * _factorialMemo.size)\n }\n\n _factorialMemo[this]\n}\n\nfun P(n: Int, k: Int) = n.factorial() / (n-k).factorial()\nfun C(n: Int, k: Int) = n.factorial() / k.factorial() / (n-k).factorial()\n\nconst val BILLION7 = 1e9.toInt() + 7\nconst val MODINT_BASE = BILLION7\n\ninfix fun Int.umod(base: Int) =\n (this % base).let { if(it >= 0) it else it + base }\n\ninfix fun Long.umod(base: Long) =\n (this % base).let { if(it >= 0) it else it + base }\n\ninfix fun Long.umod(base: Int) =\n (this % base).let { if(it >= 0) it else it + base }\n\nfun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod).toInt()\n\nfun Int.powMod(exponent: Int, mod: Int): Int {\n var res = 1L\n var e = exponent\n var b = umod(mod).toLong()\n\n while(e > 0) {\n if(e and 1 == 1) {\n res = res * b % mod\n }\n e = e shr 1\n b = b * b % mod\n }\n return res.toInt()\n}\n\ninline fun Int.toModInt() = ModInt(this umod MODINT_BASE)\ninline fun Long.toModInt() = ModInt((this umod MODINT_BASE).toInt())\n\n/** note: Only use constructor for int within modulo range, otherwise use toModInt **/\ninline class ModInt(val int: Int) {\n companion object {\n /** can't seem to make these private or inlined without causing compiler issues */\n @JvmField val _invMemo = HashMap()\n fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }\n }\n\n inline operator fun plus(other: ModInt) = plus(other.int) // MODINT_BASE < 2^30\n inline operator fun plus(other: Int) = (int + other).toModInt() // careful of possible overflow\n inline operator fun inc() = plus(1)\n\n inline operator fun minus(other: ModInt) = minus(other.int)\n inline operator fun minus(other: Int) = (int - other).toModInt()\n inline operator fun dec() = minus(1)\n operator fun unaryMinus() = if(int == 0) this else ModInt(MODINT_BASE - int)\n\n inline operator fun times(other: ModInt) = times(other.int)\n inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODINT_BASE))\n\n fun pow(exponent: Int): ModInt {\n val e = if(exponent < 0) exponent umod MODINT_BASE - 1 else exponent // assumes MODINT_BASE is prime\n return ModInt(int.powMod(e, MODINT_BASE))\n }\n\n inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */\n\n fun inv_unmemoized(): ModInt {\n require(int != 0) { \"Can't invert/divide by 0\" }\n return pow(MODINT_BASE - 2) // assumes MODINT_BASE is prime\n }\n inline fun inv_memoized() = _invMemoized(this)\n\n operator fun div(other: ModInt) = times(other.inverse())\n inline operator fun div(other: Int) = div(other.toModInt())\n\n override fun toString() = int.toString()\n}\n\ninline class ModIntArray(val intArray: IntArray): Collection {\n inline operator fun get(i: Int) = ModInt(intArray[i])\n inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }\n\n override val size: Int get() = intArray.size\n inline val lastIndex get() = intArray.lastIndex\n\n override fun contains(element: ModInt): Boolean = any { it == element }\n\n override fun containsAll(elements: Collection): Boolean = elements.all(::contains)\n\n override fun isEmpty(): Boolean = intArray.isEmpty()\n\n override fun iterator(): Iterator = object: Iterator {\n var index = 0\n override fun hasNext(): Boolean = index < size\n override fun next(): ModInt = get(index++)\n }\n}\nfun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))\ninline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =\n ModIntArray(IntArray(capacity) { init(it).int })\n\nfun Iterable.sum() = fold(ModInt(0), ModInt::plus)\nfun Sequence.sum() = fold(ModInt(0), ModInt::plus)\nfun Iterable.product() = fold(ModInt(1), ModInt::times)\nfun Sequence.product() = fold(ModInt(1), ModInt::times)\n\n/** IO code start */\n@JvmField val _reader = System.`in`.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(System.out, false)\ninline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }\nfun iprintln(o: Any?) { println(o) } // immediate println for interactive, bypasses output{} blocks", "lang": "Kotlin", "bug_code_uid": "3a85a09e5e766ec5206d5bd01510accb", "src_uid": "a18833c987fd7743e8021196b5dcdd1b", "apr_id": "5e189f0676895cb13c9079dbc127a928", "difficulty": 1800, "tags": ["combinatorics", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9992088607594937, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.FileInputStream\nimport java.math.BigDecimal\nimport java.util.*\nimport kotlin.Comparator\n\nobject programkt {\n fun S(n0: Long): Long {\n var res = 0L\n var n = n0\n while (n > 0) {\n res += n % 10\n n = n / 10\n }\n return res\n }\n\n fun solveDumb(n: Long) =\n LongRange(0, n)\n .map { it -> Pair(S(it) + S(n - it), it) }\n .maxWith(\n object : Comparator> {\n override fun compare(o1: Pair, o2: Pair): Int {\n if (o1.first == o2.first)\n return o1.second.compareTo(o2.second)\n else\n return o1.first.compareTo(o2.first)\n }\n }\n )!!\n\n fun solve(n: Long): Long {\n if (n < 10)\n return n\n else {\n var n10 = 1L\n while (n10 * 10 <= n) {\n n10 *= 10\n }\n val a = n / n10 * n10 - 1\n val b = n - a\n return S(a) + S(b)\n }\n }\n\n @JvmStatic fun main(args: Array) {\n if (args.size == 1)\n System.setIn(FileInputStream(args[0]))\n //val sc = Scanner(System.`in`)\n\n LongRange(0, 100).forEach {\n println(\"$it \" + solveDumb(it))\n assert(solveDumb(it).first == solve(it))\n }\n\n println(solve(BigDecimal(readLine()).toLong()))\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "0c262fe12c3278cdaa20130552095053", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "apr_id": "43925c477e3fe6a3fe2a75541bd20716", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9520865533230294, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val n = readLine()\n val x = \"9\".repeat(n!!.length - 1)\n val y = (n.toBigInteger() - x.toBigInteger()).toString()\n println(x.map {it -> it.toString().toInt()}.reduce {s, sum -> s + sum}\n + y.map {it -> it.toString().toInt()}.reduce {s, sum -> s + sum})\n}\n", "lang": "Kotlin", "bug_code_uid": "61067dc645d3c7a9e0b6aac7a99aa741", "src_uid": "5c61b4a4728070b9de49d72831cd2329", "apr_id": "6fde15066d1a24825463244357a1c946", "difficulty": 1100, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5561613958560524, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "fun nod(a: Long, b: Long): Long =\n if (a % b != 0L) {\n nod(b, a % b)\n } else {\n b\n }\n\nfun main(args: Array) {\n var (a, b, x, y) = readLine()!!.split(\" \").map(String::toLong)\n if (a < b) {\n a += b\n b = a - b\n a -= b\n }\n if(x < y) {\n x += y\n y = x - y\n x -= y\n }\n val nodValue = nod(x, y)\n if(nodValue != 1L) {\n x /= nodValue\n y /= nodValue\n }\n println(if (a/x > b/y) b/y else a/x)\n}", "lang": "Kotlin", "bug_code_uid": "e52fd35ba5a70ab66c558cacf78b19d8", "src_uid": "907ac56260e84dbb6d98a271bcb2d62d", "apr_id": "be757d073952b2ccc0fb16caf0532bf4", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995808885163453, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.*\nfun main() {\n val fs = CodeForces.FastReader()\n var x = fs.nextInt()\n var y = fs.nextInt()\n var n = fs.nextInt()\n var a:Int=0\n var b:Int=0\n var min:Double = Double.MAX_VALUE\n for (i in 1..n) {\n var l = 0; var p = x\n var value:Double\n while (l <= p) {\n var k = (l+p)/2\n value = abs(x/y.toDouble() - k/i.toDouble())\n if(value < min && min-value > 0.0000000000001){\n min = value.also { a=k;b=i }\n }\n if(value > abs(x/y.toDouble() - (k-1)/i.toDouble())) p = k-1\n else l = k+1\n }\n }\n while (a % 2 == 0 && b % 2 == 0) {\n a /= 2\n b /= 2\n }\n println(\"$a/$b\")\n}\n\nclass CodeForces {\n internal class FastReader {\n private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private var st: StringTokenizer? = null\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreElements()) {\n try {\n st = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n }\n return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLine(): String {\n var str = \"\"\n try {\n str = br.readLine()\n } catch (e: IOException) {\n e.printStackTrace()\n }\n return str\n }\n\n fun readIntArray(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = nextInt()\n return a\n }\n\n fun readLongArray(n: Int): LongArray {\n val a = LongArray(n)\n for (i in 0 until n) a[i] = nextLong()\n return a\n }\n\n fun readDoubleArray(n: Int): DoubleArray {\n val a = DoubleArray(n)\n for (i in 0 until n) a[i] = nextDouble()\n return a\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "6cb4cdda882c0e567d9585e26d3933d8", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "apr_id": "2b8e3ff4b8e778100a8edbd01a6f88f9", "difficulty": 1700, "tags": ["brute force", "implementation", "two pointers"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9010615711252654, "equal_cnt": 17, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 0, "fix_ops_cnt": 16, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.*\n\nfun main() {\n val fs = CodeForces.FastReader()\n var x = fs.nextInt()\n var y = fs.nextInt()\n var n = fs.nextInt()\n var a:Int=0\n var b:Int=0\n var min:Double = Double.MAX_VALUE\n for (i in 1..n) {\n var last = min\n for (j in x downTo 0) {\n if (min >= abs(x / y.toDouble() - (j / i.toDouble()))) {\n min = abs(x/y.toDouble() - (j/i.toDouble()))\n a=j\n b=i\n if(min < abs(x / y.toDouble() - ((j-1) / i.toDouble()))) break\n }\n }\n }\n while (a % 2 == 0 && b % 2 == 0) {\n a /= 2\n b /= 2\n }\n println(\"$a/$b\")\n}\n\nclass CodeForces {\n internal class FastReader {\n private var br: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n private var st: StringTokenizer? = null\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreElements()) {\n try {\n st = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n }\n return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLine(): String {\n var str = \"\"\n try {\n str = br.readLine()\n } catch (e: IOException) {\n e.printStackTrace()\n }\n return str\n }\n\n fun readIntArray(n: Int): IntArray {\n val a = IntArray(n)\n for (i in 0 until n) a[i] = nextInt()\n return a\n }\n\n fun readLongArray(n: Int): LongArray {\n val a = LongArray(n)\n for (i in 0 until n) a[i] = nextLong()\n return a\n }\n\n fun readDoubleArray(n: Int): DoubleArray {\n val a = DoubleArray(n)\n for (i in 0 until n) a[i] = nextDouble()\n return a\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "e053f4a8169a2285d1860cd4e4ae3007", "src_uid": "827bc6f120aff6a6f04271bc84e863ee", "apr_id": "2b8e3ff4b8e778100a8edbd01a6f88f9", "difficulty": 1700, "tags": ["brute force", "implementation", "two pointers"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8389316729477306, "equal_cnt": 28, "replace_cnt": 17, "delete_cnt": 2, "insert_cnt": 8, "fix_ops_cnt": 27, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val R = ni()\n val G = ni()\n var H = 0\n while((H + 1) * (H + 2) / 2 <= R + G) H++\n val N = R\n val dp = Array(H + 1){\n val size = if (it == H) 0\n else H * (H + 1) / 2 - it * (it + 1) / 2\n IntArray(size + 1)\n }\n debug{\"N:$N H:$H\"}\n dp[H][0] = 1\n for (i in H - 1 downTo 0) {\n for (j in dp[i].indices) {\n if (j < dp[i + 1].size) dp[i][j] += dp[i + 1][j]\n val nj = j - (i + 1)\n if ((dp[i + 1].indices).contains(nj)) {\n dp[i][j] += dp[i + 1][nj]\n }\n if (dp[i][j] > MOD) dp[i][j] -= MOD\n }\n debug(dp[i])\n }\n var ans = 0L\n val remain = R + G - H * (H + 1) / 2\n for (r in 0 .. remain) {\n val j = N - r\n ans += dp[0][j]\n }\n out.println(ans % MOD)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "59372003283d9b241a733f3ec35acb8e", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "apr_id": "ad008ac97e9a519238bea0c742afff18", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8356700358656668, "equal_cnt": 30, "replace_cnt": 18, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 29, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val R = ni()\n val G = ni()\n var H = 0\n while((H + 1) * (H + 2) / 2 <= R + G) H++\n val N = R\n val dp = Array(H + 1){\n val size = if (it == H) 0\n else H * (H + 1) / 2 - it * (it + 1) / 2\n IntArray(size + 1)\n }\n debug{\"N:$N H:$H\"}\n dp[H][0] = 1\n for (i in H - 1 downTo 0) {\n for (j in dp[i].indices) {\n if (j < dp[i + 1].size) dp[i][j] += dp[i + 1][j]\n val nj = j - (i + 1)\n if ((dp[i + 1].indices).contains(nj)) {\n dp[i][j] += dp[i + 1][nj]\n }\n if (dp[i][j] > MOD) dp[i][j] -= MOD\n }\n debug(dp[i])\n }\n var ans = 0L\n val remain = R + G - H * (H + 1) / 2\n for (r in 0 .. remain) {\n val j = N - r\n if (dp[0].indices.contains(j)) ans += dp[0][j]\n }\n out.println(ans % MOD)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "83166e6980759d43b2c6b9f6b3da9ad3", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "apr_id": "ad008ac97e9a519238bea0c742afff18", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9926868044515104, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val R = ni()\n val G = ni()\n var H = 0\n while((H + 1) * (H + 2) / 2 <= R + G) H++\n val N = min(R, G)\n var cur = IntArray(1_000_000)\n var next = IntArray(1_000_000)\n cur[0] = 1\n var sum = 0L\n for (i in H - 1 downTo 0) {\n val size = min(N, H * (H + 1) / 2 - i * (i + 1) / 2)\n val nsize = min(N, H * (H + 1) / 2 - (i + 1) * (i + 2) / 2)\n for (j in 0 .. size) {\n next[j] = 0\n if (j <= nsize) next[j] += cur[j]\n val nj = j - (i + 1)\n if ((0 .. nsize).contains(nj)) {\n next[j] += cur[nj]\n }\n if (next[j] > MOD) next[j] -= MOD\n }\n// debug(next.take(10).toLongArray())\n val tmp = cur\n cur = next\n next = tmp\n sum += size\n }\n debug{\"sum:$sum\"}\n var ans = 0L\n val remain = R + G - H * (H + 1) / 2\n for (r in 0 .. remain) {\n val j = N - r\n if (cur.indices.contains(j)) ans += cur[j]\n }\n out.println(ans % MOD)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "b9a8d54e9d01b811aaa9adc397b72330", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "apr_id": "ad008ac97e9a519238bea0c742afff18", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8785201546107123, "equal_cnt": 18, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 17, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.PriorityQueue\nimport java.util.SortedMap\nimport java.util.StringTokenizer\nimport java.util.TreeMap\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n val r0 = readInt()\n val g0 = readInt()\n\n var D = HashMap()\n D.add(r0, g0, ModInt(1))\n\n for(h in 1..200000) {\n val Di = HashMap()\n for((state, v) in D) {\n var (r, g) = state\n if(r < h) r = 0\n if(g < h) g = 0\n if(r != 0) Di.add(r-h, g, v)\n if(g != 0) Di.add(r, g-h, v)\n }\n if(Di.isEmpty()) break\n D = Di\n }\n\n val ans = D.values.sum()\n\n println(ans.int)\n}\n\nfun MutableMap.add(r: Int, g: Int, v: ModInt) {\n val state = State(r, g)\n this[state] = (this[state] ?: ModInt(0)) + v\n}\n\ndata class State(val r: Int, val g: Int) {\n val hash = r.bitConcat(g).hash().toInt()\n override fun hashCode(): Int = hash\n}\n\nfun splitmix64(seed: Long): Long {\n var x = seed - 7046029254386353131\n x = (x xor (x ushr 30)) * -4658895280553007687\n x = (x xor (x ushr 27)) * -7723592293110705685\n return (x xor (x ushr 31))\n}\n@JvmField val nonce64 = random.nextLong()\nfun Long.hash() = splitmix64(nonce64 xor this)\n\nfun Int.bitConcat(other: Int) = toLong().shl(32) or other.toLong().and(0xffff_ffff)\n\nconst val BILLION7 = 1e9.toInt() + 7\nconst val MODINT_BASE = BILLION7\nconst val MODINT_TOTIENT = MODINT_BASE - 1 // assumes MODINT_BASE is prime\n\ninline infix fun Int.umod(base: Int) = Math.floorMod(this, base)\ninline infix fun Long.umod(base: Long) = Math.floorMod(this, base)\ninline infix fun Long.umod(base: Int) = Math.floorMod(this, base.toLong()).toInt()\n\nfun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod)\n\nfun Int.powMod(exponent: Int, mod: Int): Int {\n if(exponent < 0) error(\"Inverse not implemented\")\n var res = 1L\n var e = exponent\n var b = umod(mod).toLong()\n\n while(e > 0) {\n if(e and 1 == 1) {\n res = res * b % mod\n }\n e = e shr 1\n b = b * b % mod\n }\n return res.toInt()\n}\n\ninline fun Int.toModInt() = ModInt(this umod MODINT_BASE)\ninline fun Long.toModInt() = ModInt(this umod MODINT_BASE)\n\n/** note: Only use constructor for int within modulo range, otherwise use toModInt **/\ninline class ModInt(val int: Int) {\n companion object {\n /** can't seem to make these private or inlined without causing compiler issues */\n @JvmField val _invMemo = HashMap()\n fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }\n }\n\n operator fun plus(other: ModInt) = // MODINT_BASE < 2^30\n (int + other.int).let { if(it >= MODINT_BASE) ModInt(it - MODINT_BASE) else ModInt(it) }\n inline operator fun plus(other: Int) = plus(other.toModInt())\n operator fun inc() = if(int == MODINT_BASE - 1) ModInt(0) else ModInt(int + 1)\n\n operator fun minus(other: ModInt) =\n (int - other.int).let { if(it < 0) ModInt(it + MODINT_BASE) else ModInt(it) }\n inline operator fun minus(other: Int) = minus(other.toModInt())\n operator fun dec() = if(int == 0) ModInt(MODINT_BASE - 1) else ModInt(int - 1)\n operator fun unaryMinus() = if(int == 0) this else ModInt(MODINT_BASE - int)\n\n inline operator fun times(other: ModInt) = times(other.int)\n inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODINT_BASE))\n\n fun pow(exponent: Int): ModInt {\n val e = if(exponent < 0) {\n require(int != 0) { \"Can't invert/divide by 0\" }\n exponent umod MODINT_TOTIENT\n } else exponent\n return ModInt(int.powMod(e, MODINT_BASE))\n }\n\n fun pow(exponent: Long) = if(int == 0) when {\n exponent > 0 -> this\n exponent == 0L -> ModInt(1)\n else -> error(\"Can't invert/divide by 0\")\n } else pow(exponent umod MODINT_TOTIENT)\n\n inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */\n\n fun inv_unmemoized(): ModInt {\n require(int != 0) { \"Can't invert/divide by 0\" }\n return pow(MODINT_TOTIENT - 1)\n }\n inline fun inv_memoized() = _invMemoized(this)\n\n operator fun div(other: ModInt) = times(other.inverse())\n inline operator fun div(other: Int) = div(other.toModInt())\n\n override inline fun toString() = int.toString()\n}\n\ninline class ModIntArray(val intArray: IntArray): Collection {\n inline operator fun get(i: Int) = ModInt(intArray[i])\n inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }\n\n override inline val size: Int get() = intArray.size\n inline val lastIndex get() = intArray.lastIndex\n inline val indices get() = intArray.indices\n\n override inline fun contains(element: ModInt): Boolean = element.int in intArray\n\n override fun containsAll(elements: Collection): Boolean = elements.all(::contains)\n\n override inline fun isEmpty(): Boolean = intArray.isEmpty()\n\n override fun iterator(): Iterator = object: Iterator {\n var index = 0\n override fun hasNext(): Boolean = index < size\n override fun next(): ModInt = get(index++)\n }\n\n fun sum() = indices.sumByModInt(::get)\n fun product() = indices.productByModInt(::get)\n\n fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))\n fun copyOf() = copyOf(size)\n}\nfun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))\ninline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =\n ModIntArray(IntArray(capacity) { init(it).int })\n\ninline fun Iterable.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Iterable.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }\ninline fun Sequence.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }\ninline fun Sequence.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }\nfun Iterable.sum() = sumByModInt { it }\nfun Sequence.sum() = sumByModInt { it }\nfun Iterable.product() = productByModInt { it }\nfun Sequence.product() = productByModInt { it }\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}", "lang": "Kotlin", "bug_code_uid": "f6ed22afac7f003780cffb55244b3e29", "src_uid": "34b6286350e3531c1fbda6b0c184addc", "apr_id": "b85c25a4c4f4512cb4af92daf2267cce", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9626769626769627, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.abs\n\n\nfun main() {\n val r = System.`in`.bufferedReader()\n //val s = StringBuilder()\n //val n = r.readLine()!!.toInt()\n //val l = r.readLine()!!.split(\" \").map { it.toInt() }\n //val n = r.readLine()!!.toInt()\n val (a, b, s) = r.readLine()!!.split(\" \").map { it.toLong() }.sorted()\n println(if ((s-a-b)%2==0L && s>= abs(a)+ abs(b)) \"Yes\" else \"No\")\n}", "lang": "Kotlin", "bug_code_uid": "0ad0900366e90e801415f53a396965ef", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "apr_id": "b94239a8baab6de94f523b921c714824", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8194444444444444, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.abs\n\nfun main() {\n var (a, b, s) = readLine()!!.split(\" \").map { it.toInt() }\n if (abs(a) + abs(b) < s) {\n println(\"NO\")\n } else {\n println(\"YES\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "c367250d42cabdf42ec7ea5eadba5483", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "apr_id": "00f829ce259be0f23805ed1cbd467822", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9823321554770318, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val s = Scanner(System.`in`)\n val a = IntArray(2, { s.nextInt() }).sum()\n val b = s.nextInt()\n val res = when {\n a == b || (a < b && (b - a).rem(2) == 0) -> \"Yes\"\n else -> \"No\"\n }\n print(res)\n}", "lang": "Kotlin", "bug_code_uid": "a375ce82c6c8fc0cb7089a4dac02eeac", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "apr_id": "e189c03f5682000d0bdef410dee7c0ae", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6836734693877551, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n val (a, b, s) = readLongs()\n print(if (s >= a + b && (s - a - b) % 2 == 0L) \"Yes\" else \"No\")\n}", "lang": "Kotlin", "bug_code_uid": "cf44fd3c503bb3a44746ea6ed2368fb1", "src_uid": "9a955ce0775018ff4e5825700c13ed36", "apr_id": "2a5478c220a29a1891a24eabee84766b", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9976525821596244, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nfun readInts(separator: Char = ' ') = readLine()?.split(separator)?.map(String::toInt)\nfun readLongs(separator: Char = ' ') = readLine()?.split(separator)?.map(String::toLong)\n\n\nfun main() {\n val (c1) = readInts()!!\n val (c2) = readInts()!!\n val (c3) = readInts()!!\n val (c4) = readInts()!!\n println(if(c1==c4 && (c1>1 || c3==0)) 1 else 0)\n}", "lang": "Kotlin", "bug_code_uid": "57a363481138258efe87a5619e7bb556", "src_uid": "b99578086043537297d374dc01eeb6f8", "apr_id": "5ce1532a085a17f03d26aaeae86605a3", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9539877300613497, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val cntA = scanner.nextInt()\n val cntB = scanner.nextInt()\n val cntC = scanner.nextInt()\n val cntD = scanner.nextInt()\n\n if (cntA == cntD) {\n print(\"1\")\n }\n else {\n print(\"0\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "1080ccb7e4b53582edb45d09ea9f7030", "src_uid": "b99578086043537297d374dc01eeb6f8", "apr_id": "cef836ab70c5e5d21f0ba7b4f6df264a", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9997132205334098, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nval MAX_N = (1e6 + 10).toInt()\nval INF = (1e9 + 7).toInt()\nval MOD = (1e9 + 7).toInt()\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n val c1 = reader.nextInt()\n val c2 = reader.nextInt()\n val c3 = reader.nextInt()\n val c4 = reader.nextInt()\n\n writer.println(if (c1 != c4 || c1 == 0 && c3 > 1) \"0\" else \"1\")\n}\n\nclass InputReader(stream: InputStream) {\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n repeat(count) { a[it] = nextLong() }\n return a\n }\n}", "lang": "Kotlin", "bug_code_uid": "f9a7043816303c72a79e997619569ada", "src_uid": "b99578086043537297d374dc01eeb6f8", "apr_id": "d6fca16ffb282d33983eedc8814231ab", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9915824915824916, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val ll = readInt()\n val lr = readInt()\n val rl = readInt()\n val rr = readInt()\n\n val ans = ll == rr && (ll == 0) == (rl == 0)\n\n println(if(ans) 1 else 0)\n}\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readStringSeq() = readLn().splitToSequence(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readIntSeq() = readStringSeq().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readDoubleSeq() = readStringSeq().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }\nfun readLongSeq() = readStringSeq().map { it.toLong() }\n\nclass Output {\n val outputSb = StringBuilder()\n fun print(o: Any?) { outputSb.append(o) }\n fun println() { outputSb.append('\\n') }\n fun println(o: Any?) { outputSb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(outputSb) }\n}\ninline fun output(block: Output.()->Unit) { Output().apply(block).nowPrint() }", "lang": "Kotlin", "bug_code_uid": "c528485ac19399a282f2bdf3b695627c", "src_uid": "b99578086043537297d374dc01eeb6f8", "apr_id": "8b832b80d5d79c6643069a34d0f5ba3c", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8897742363877822, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.PrintWriter\nimport java.util.*\n\nfun main() {\n val sc = Scanner(System.`in`)\n val pw = PrintWriter(System.out)\n val cnt1 = sc.nextInt()\n val cnt2 = sc.nextInt()\n val cnt3 = sc.nextInt()\n val cnt4 = sc.nextInt()\n if (cnt1 == cnt4) {\n println(1)\n }else{\n println(0)\n }\n pw.close()\n}\n", "lang": "Kotlin", "bug_code_uid": "448a7afd8260527bf125a68836ed9ec2", "src_uid": "b99578086043537297d374dc01eeb6f8", "apr_id": "b395f3c0a286e73c3c426b8f230636c2", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4520686175580222, "equal_cnt": 11, "replace_cnt": 11, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 11, "bug_source_code": "fun main(args: Array) {\n val groupBus = readLine()!!.trim().split(\" \").map {it.trim().toInt()}.toIntArray()\n val groupnums = readLine()!!.trim().split(\" \").map {it.trim().toInt()}.toIntArray()\n var countbuses = 0\n var carry=0\n var count =1\n for (i in 0 until groupBus[0]-1){\n carry=groupnums[i]\n for (j in i+1 until groupBus[0]){\n carry+=groupnums[j]\n if (carry>groupBus[1])break\n count++\n }\n countbuses++\n if (count == groupBus[0])break\n }\n println(countbuses)\n}", "lang": "Kotlin", "bug_code_uid": "1fb4cbd8f8a780560e5668f43cb0b612", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "apr_id": "531c00a947ef66777267fd3a1f522a38", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.44673539518900346, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "\nfun main(){\n var (n,m) = readLine()!!.split(\" \").map { it.toInt() }\n var list = readLine()!!.split(\" \").map { it.toInt() }.sum()\n\n if (list%m==0){\n println(list/m)\n }else{\n println(list/m+1)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "4d191d8dac741330349c347eb5182e9b", "src_uid": "5c73d6e3770dff034d210cdd572ccf0f", "apr_id": "35fc7769edb77057f8d97d944074c372", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9269882659713168, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readString() = readLn().trim()\nprivate fun readInt() = readLn().toInt()\nprivate fun readLong() = readLn().toLong()\nprivate val regSpace = \"\\\\s+\".toRegex()\nprivate fun readSomeInts(): List {\n return readLn().trim().split(regSpace).map { it.toInt() }\n}\nprivate fun readSomeLongs(): List {\n return readLn().trim().split(regSpace).map { it.toLong() }\n}\n\nfun main() {\n val n = readLong()\n val half = n / 2\n val phalf = fact2(1, half - 1)\n val f2 = fact2(half + 1, n) / 2 / (phalf * half)\n val result: Long = f2 * phalf * phalf\n println(result)\n}\n\nfun fact2(bgn: Long, end: Long): Long {\n return (bgn..end).reduceOrNull { acc, b -> acc * b }!!\n}\n", "lang": "Kotlin", "bug_code_uid": "3998d7b357781705f2b253d6bf162951", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "apr_id": "a836ba692e20fa1c06fe49091bc5fce2", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.908843537414966, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val n = readInt()\n println(fact(n) / fact(n / 2).square() * fact(n / 2 - 1).square() / 2)\n}\n\nfun Int.square() = this * this\n\nfun fact(n: Int): Int = if (n < 2) 1 else fact(n - 1) * n\n\nfun readInt() = readLine()!!.toInt()\nfun readInts() = readLine()!!.split(' ').map { it.toInt() }\nfun readIntArray() = readInts().toIntArray()\n", "lang": "Kotlin", "bug_code_uid": "eed6c4ab2d24962ee518cfee39747614", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "apr_id": "6f3d84f48904312a185f516c30fc5a55", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.03522645578720345, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n val people = readInt()\n if(people == 2) println(1)\n else println(fact((people / 2).toLong() * 2))\n}\n\nfun fact(num: Long) : Long {\n return if(num == 1L) 1\n else fact(num - 1) * num\n}\n\n// region Technolib\n/*\n Author: Timofey Chicherin (TimDev, TwMicro)\n Collaborators: [no]\n License: Apache License 2.0\n GitHub: https://github.com/twmicro/technolib/\n*/\n\nvar toPrint = \"\"\n/*\n readLines -\n Reads a count of lines\n*/\n\n// Simple variant\nfun readLines(count: Int): MutableList {\n val lines = mutableListOf()\n for (i in 0 until count) lines.add(readLine()!!)\n return lines\n}\n\n// Inline variant, works like forEach\ninline fun readLines(count: Int, action: (String) -> Unit): MutableList {\n val lines = mutableListOf()\n for (i in 0 until count) {\n lines.add(readLine()!!)\n action.invoke(lines.last())\n }\n return lines\n}\n\n\n/*\n readMultiLineIntList -\n Reads a count of lines and converts it to MutableList\n*/\n\n// Simple variant\nfun readMultiLineIntList(count: Int): MutableList {\n val lines = mutableListOf()\n for (i in 0 until count) lines.add(readLine()!!.toInt())\n return lines\n}\n\n// Inline variant, works like forEach\ninline fun readMultiLineIntList(count: Int, action: (Int) -> Unit): MutableList {\n val lines = mutableListOf()\n for (i in 0 until count) {\n lines.add(readLine()!!.toInt())\n action.invoke(lines.last())\n }\n return lines\n}\n\n\n/*\n readIntList -\n Reads single line of integers\n*/\n\n// Simple variant\nfun readIntList(seperator: String = \" \"): MutableList = readLine()!!.split(seperator).toIntList()\n\n// Inline variant, works like forEach\nfun readIntList(seperator: String = \" \", action: (Int) -> Unit) = readIntList(seperator).forEach(action)\n\n/*\n List.toIntList -\n Converts string list to int list\n*/\n\nfun List.toIntList(): MutableList {\n val result = mutableListOf()\n forEach {\n result.add(it.toInt())\n }\n return result\n}\n\n/*\n order(ln) -\n Adds text to print stack. Don't forget to use drop() or dropln() in the end of your program!\n (ln) - adds \\n to the end of text\n*/\n\nfun order(text: String) {\n toPrint += text\n}\n\nfun orderln(text: String) {\n toPrint += text + \"\\n\"\n}\n\n/*\n drop(ln) -\n Prints all the text from the print stack\n*/\nfun drop() = print(toPrint)\nfun dropln() = println(toPrint)\n\n/*\n readInt -\n Shortcut for readLine()!!.toInt()\n*/\nfun readInt(): Int = readLine()!!.toInt()\n// endregion", "lang": "Kotlin", "bug_code_uid": "50a0754928a8a1520431e98296d7a763", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "apr_id": "481899b650ceb1f18844e77f5474b0be", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7217537942664418, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nfun main() {\n val reader = Scanner(System.`in`)\n val n:Int = reader.nextInt()\n\n var res:Long = 1\n for (k in 1..n/2-1) res *= k\n res *= res\n\n for (k in 1..n/2) {\n res /= k\n }\n \n for (k in n/2+1..n) {\n res *= k\n }\n\n\n res /= 2;\n println(res)\n}\n", "lang": "Kotlin", "bug_code_uid": "8fae03aac97e6e3309e3ef96d7d3310e", "src_uid": "ad0985c56a207f76afa2ecd642f56728", "apr_id": "b11d2b06e5165e020dc2a9adb7ff0c62", "difficulty": 1300, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9991683991683992, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.*\nimport java.awt.geom.*\nimport java.io.*\nimport java.math.*\nimport java.text.*\nimport java.util.*\nimport java.util.regex.*\n\n/*\n\t\t\t br = new BufferedReader(new FileReader(\"input.txt\"));\n\t\t\t pw = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n\t\t\t br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n */\n\n private var br: BufferedReader? = null\n private var st: StringTokenizer? = null\n private var pw: PrintWriter? = null\n\n @Throws(IOException::class)\n fun main(args: Array) {\n br = BufferedReader(InputStreamReader(System.`in`))\n pw = PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n val qq = 1\n //int qq = Integer.MAX_VALUE;\n //int qq = readInt();\n\n /*\nreminders: arrays of objects are problematic, prefer ArrayList instead\n\t\t */\n for (casenum in 1..qq) {\n val n = readLong()\n val k = readInt()\n val all = ArrayList()\n var i: Long = 1\n while (i * i <= n) {\n if (n % i == 0L) {\n all.add(i)\n if (i * i != n) all.add(n / i)\n }\n i++\n }\n Collections.sort(all)\n if (k < all.size)\n pw!!.println(all[k])\n else\n pw!!.println(-1)\n }\n exitImmediately()\n }\n\n private fun exitImmediately() {\n pw!!.close()\n System.exit(0)\n }\n\n @Throws(IOException::class)\n private fun readLong(): Long {\n return java.lang.Long.parseLong(readToken())\n }\n\n @Throws(IOException::class)\n private fun readDouble(): Double {\n return java.lang.Double.parseDouble(readToken())\n }\n\n @Throws(IOException::class)\n private fun readInt(): Int {\n return Integer.parseInt(readToken())\n }\n\n @Throws(IOException::class)\n private fun readLine(): String? {\n val s = br!!.readLine()\n if (s == null) {\n exitImmediately()\n }\n st = null\n return s\n }\n\n @Throws(IOException::class)\n private fun readToken(): String {\n while (st == null || !st!!.hasMoreTokens()) {\n st = StringTokenizer(readLine()!!.trim { it <= ' ' })\n }\n return st!!.nextToken()\n }\n", "lang": "Kotlin", "bug_code_uid": "206f635ab566456c640ff4e79c6f3aca", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "cf19c68ec5a4b2c789e0505e5a61d355", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9918211559432933, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val args = readStrings().iterator()\n val n = args.next().toLong()\n val k = args.next().toInt()\n\n val ans = n.divisors().elementAtOrElse(k-1) { -1 }\n\n println(ans)\n}\n\nfun Long.divisors() = sequence {\n val n = this@divisors\n if(n <= 0) return@sequence\n val tail = mutableListOf()\n\n for(p in sequenceOf(1L, 2L) + (3..Long.MAX_VALUE step 2)) {\n val sq = p * p\n if(sq > n) break\n if(n % p == 0L) {\n yield(p)\n if(sq != n) tail.add(n / p)\n }\n }\n\n yieldAll(tail.asReversed())\n}\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readStringSeq() = readLn().splitToSequence(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readIntSeq() = readStringSeq().map { it.toInt() }\nfun readIntArray(size: Int) = readIntSeq().iterator().let { i -> IntArray(size) { i.next() } }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readDoubleSeq() = readStringSeq().map { it.toDouble() }\nfun readDoubleArray(size: Int) = readDoubleSeq().iterator().let { i -> DoubleArray(size) { i.next() } }\nfun readLongs() = readStrings().map { it.toLong() }\nfun readLongSeq() = readStringSeq().map { it.toLong() }\nfun readLongArray(size: Int) = readLongSeq().iterator().let { i -> LongArray(size) { i.next() } }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println() { sb.append('\\n') }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit) { Output().apply(block).nowPrint() }", "lang": "Kotlin", "bug_code_uid": "90eba6f55bea08f98bea247191567cdc", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "c3f0be1d4e392802ed85c63599d4f334", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.22021364009860311, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "package A\n\nimport java.util.*\n\n/**\n * Created by nuts on 2/8/17.\n */\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val a = input.nextInt()\n val b = input.nextInt()\n var j: Int = 0\n for(i in 1..a) {\n if(a % i == 0) {\n if(++j == b) {\n print(i)\n return\n }\n }\n }\n print(-1)\n}\n", "lang": "Kotlin", "bug_code_uid": "dfa511de8f8fcc5707e8fe3ecfec1526", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "54c31e37f61d9132f6f77846f804b8de", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8913467794404685, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "import java.lang.Math.sqrt\nimport java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val a: Long = input.nextLong()\n var b: Long = input.nextLong()\n b -= 1\n val array1 = ArrayList()\n val array2 = ArrayList()\n val sqrt = sqrt(a.toDouble()).toLong()\n for(i in 1..sqrt) {\n if(a % i == 0L) {\n array1.add(i)\n array2.add(a / i)\n }\n }\n if(b > array1.size) {\n b -= (array1.size)\n if(b < array2.size) {\n b = array2.size - 1 - b\n print(array2[b.toInt()])\n return\n }\n } else {\n print(array1[b.toInt()])\n return\n }\n print(-1)\n}\n", "lang": "Kotlin", "bug_code_uid": "4d47fc8025d149dcd8a50691abe1be41", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "54c31e37f61d9132f6f77846f804b8de", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4386252045826514, "equal_cnt": 16, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*\n\n/**\n * Created by nuts on 2/8/17.\n */\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val a: Long = input.nextLong()\n val b: Long = input.nextLong()\n var j: Long = 0\n for(i in 1..a) {\n if(a % i == 0L) {\n if(++j == b) {\n print(i)\n return\n }\n }\n }\n print(-1)\n}\n", "lang": "Kotlin", "bug_code_uid": "502acd19e94cb2afcabc5c3fdae5845d", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "54c31e37f61d9132f6f77846f804b8de", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.876117496807152, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.lang.Math.sqrt\nimport java.util.*\n\nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val a: Long = input.nextLong()\n var b: Long = input.nextLong()\n b -= 1\n val array1 = ArrayList()\n val array2 = ArrayList()\n val sqrt = sqrt(a.toDouble()).toLong()\n for(i in 1..sqrt) {\n if(a % i == 0L) {\n array1.add(i)\n if(a != 1L)\n array2.add(a / i)\n }\n }\n if(b >= array1.size) {\n b -= (array1.size)\n if(b < array2.size) {\n b = array2.size - 1 - b\n print(array2[b.toInt()])\n return\n }\n } else {\n print(array1[b.toInt()])\n return\n }\n print(-1)\n}\n", "lang": "Kotlin", "bug_code_uid": "2ba939e8690d8a0da130b4012bbd67a0", "src_uid": "6ba39b428a2d47b7d199879185797ffb", "apr_id": "54c31e37f61d9132f6f77846f804b8de", "difficulty": 1400, "tags": ["math", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9609467455621302, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n var (n, k) = readInts()\n val sol = mutableListOf()\n loop@ while (sol.size < k - 1) {\n for (i in 2..n)\n if (n % i == 0) {\n sol.add(i)\n n /= i\n continue@loop\n }\n return print(-1)\n }\n sol.add(n)\n print(sol.joinToString(\" \"))\n}", "lang": "Kotlin", "bug_code_uid": "bec2d2404b731316586ebe9ec6edf5a1", "src_uid": "bd0bc809d52e0a17da07ccfd450a4d79", "apr_id": "fd4e7dea2d3929403d7fc079b16a5564", "difficulty": 1100, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9817518248175182, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val (n, k) = readLine()!!.split(\" \").map(String::toInt)\n var tmp = n\n var d = 2\n val dividers = ArrayList()\n while (tmp >= d) {\n while (tmp % d == 0) {\n tmp /= d\n dividers.add(d)\n }\n d++\n }\n if (dividers.size >= k) {\n print(\"${dividers.subList(0, dividers.size - k + 1).fold(1) { a, b -> a * b }} \")\n dividers.subList(dividers.size - k + 1, dividers.size).forEach { print(\"$it \") }\n } else {\n println(-1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "d38a81c746bf1e2758606b88107693f6", "src_uid": "bd0bc809d52e0a17da07ccfd450a4d79", "apr_id": "b287d40a0cedd8e6add9f38da12099b9", "difficulty": 1100, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.36727272727272725, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val (n, m) = readLine()!!.split(' ').map { it.toInt() }\n\n var f = 1 to 1\n for (i in 1 until n + m) {\n f = f.second to (f.first + f.second) % 1000000007\n }\n\n println(f.second)\n}", "lang": "Kotlin", "bug_code_uid": "66e73d47ca5ae7be83d9180cf9d4e175", "src_uid": "0f1ab296cbe0952faa904f2bebe0567b", "apr_id": "1ee826cb1ec1822695684a7239f287e1", "difficulty": 1700, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9978059310637696, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport java.util.TreeMap\nimport java.util.TreeSet\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln // immediate println for interactive\n\nfun main() {\n output {\n val n = readInt()\n val m = readInt()\n\n val F = ModIntArray(n+m+1)\n F[0] = ModInt(1)\n F[1] = ModInt(1)\n\n for(i in 2..F.lastIndex) {\n F[i] = F[i-1] + F[i-2]\n }\n\n val ans = (F[n] + F[m] - 1) * 2\n\n println(ans)\n }\n}\n\nconst val BILLION7 = 1e9.toInt() + 7\nconst val MODINT_BASE = 998244353\nconst val MODINT_TOTIENT = MODINT_BASE - 1 // assumes MODINT_BASE is prime\n\ninline infix fun Int.umod(base: Int) = Math.floorMod(this, base)\ninline infix fun Long.umod(base: Long) = Math.floorMod(this, base)\ninline infix fun Long.umod(base: Int) = Math.floorMod(this, base.toLong()).toInt()\n\nfun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod)\n\nfun Int.powMod(exponent: Int, mod: Int): Int {\n var res = 1L\n var e = exponent\n var b = umod(mod).toLong()\n\n while(e > 0) {\n if(e and 1 == 1) {\n res = res * b % mod\n }\n e = e shr 1\n b = b * b % mod\n }\n return res.toInt()\n}\n\ninline fun Int.toModInt() = ModInt(this umod MODINT_BASE)\ninline fun Long.toModInt() = ModInt(this umod MODINT_BASE)\n\n/** note: Only use constructor for int within modulo range, otherwise use toModInt **/\ninline class ModInt(val int: Int) {\n companion object {\n /** can't seem to make these private or inlined without causing compiler issues */\n @JvmField val _invMemo = HashMap()\n fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }\n }\n\n inline operator fun plus(other: ModInt) = plus(other.int) // MODINT_BASE < 2^30\n inline operator fun plus(other: Int) = (int + other).toModInt() // careful of possible overflow\n inline operator fun inc() = plus(1)\n\n inline operator fun minus(other: ModInt) = minus(other.int)\n inline operator fun minus(other: Int) = (int - other).toModInt()\n inline operator fun dec() = minus(1)\n operator fun unaryMinus() = if(int == 0) this else ModInt(MODINT_BASE - int)\n\n inline operator fun times(other: ModInt) = times(other.int)\n inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODINT_BASE))\n\n fun pow(exponent: Int): ModInt {\n val e = if(exponent < 0) exponent umod MODINT_TOTIENT else exponent\n return ModInt(int.powMod(e, MODINT_BASE))\n }\n\n fun pow(exponent: Long) = pow(exponent umod MODINT_TOTIENT)\n\n inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */\n\n fun inv_unmemoized(): ModInt {\n require(int != 0) { \"Can't invert/divide by 0\" }\n return pow(MODINT_TOTIENT - 1)\n }\n inline fun inv_memoized() = _invMemoized(this)\n\n operator fun div(other: ModInt) = times(other.inverse())\n inline operator fun div(other: Int) = div(other.toModInt())\n\n override fun toString() = int.toString()\n}\n\ninline class ModIntArray(val intArray: IntArray): Collection {\n inline operator fun get(i: Int) = ModInt(intArray[i])\n inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }\n\n override val size: Int get() = intArray.size\n inline val lastIndex get() = intArray.lastIndex\n inline val indices get() = intArray.indices\n\n override fun contains(element: ModInt): Boolean = any { it == element }\n\n override fun containsAll(elements: Collection): Boolean = elements.all(::contains)\n\n override fun isEmpty(): Boolean = intArray.isEmpty()\n\n override fun iterator(): Iterator = object: Iterator {\n var index = 0\n override fun hasNext(): Boolean = index < size\n override fun next(): ModInt = get(index++)\n }\n}\nfun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))\ninline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =\n ModIntArray(IntArray(capacity) { init(it).int })\n\nfun Iterable.sum() = fold(ModInt(0), ModInt::plus)\nfun Sequence.sum() = fold(ModInt(0), ModInt::plus)\nfun Iterable.product() = fold(ModInt(1), ModInt::times)\nfun Sequence.product() = fold(ModInt(1), ModInt::times)\n\n/** IO code start */\n@JvmField val _reader = System.`in`.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(System.out, false)\ninline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()", "lang": "Kotlin", "bug_code_uid": "c3256588d62c0c6a3fdc9ac183c78bf6", "src_uid": "0f1ab296cbe0952faa904f2bebe0567b", "apr_id": "531212cdb8349e899495baf82f04abc8", "difficulty": 1700, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.927536231884058, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (x1, x2) = readInts()\n val n = minOf(x1, x2)\n val m = maxOf(x1, x2)\n val fib = LongArray(m)\n fib[0] = 1\n fib[1] = 1\n for(i in 2 until m) {\n fib[i] = (fib[i - 1] + fib[i - 2]) % mod\n }\n val f0 = LongArray(n + 1)\n f0[1] = fib[m - n + 1]\n for (i in 2..n) {\n f0[i] = (f0[i - 1] + fib[i - 2] + fib[m - n + i - 2]) % mod\n }\n println((f0[n] * 2) % mod)\n}\n\nprivate val mod = 1000000007L\n\nprivate fun readString() = readLine()!!\n\nprivate fun readInt() = readString().toInt()\n\nprivate fun readInts() = readString().split(\" \").map { it.toInt() }\n\nprivate fun readLong() = readString().toLong()\n\nprivate fun readLongs() = readString().split(\" \").map { it.toLong() }\n", "lang": "Kotlin", "bug_code_uid": "21f779a563cb1b0415350ea95592c98f", "src_uid": "0f1ab296cbe0952faa904f2bebe0567b", "apr_id": "df53ac4e050f3ee966ad81b6f848342a", "difficulty": 1700, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9977246871444824, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val numStones = readInts()\n var bestSol = 0L\n for (hole in 0 until 14) {\n val initialStonesInHole = numStones[hole]\n val stonesEach = initialStonesInHole / 14\n val extraStones = initialStonesInHole % 14\n var sol = 0L\n for (otherHole in hole + 1..hole + extraStones) {\n val stonesInHole = numStones[otherHole % 14].toLong() + stonesEach + 1\n if (stonesInHole and 1 == 0L) sol += stonesInHole\n }\n for (otherHole in hole + extraStones..hole + 13) {\n val stonesInHole = numStones[otherHole % 14].toLong() + stonesEach\n if (stonesInHole and 1 == 0L) sol += stonesInHole\n }\n if (stonesEach and 1 == 0) sol += stonesEach\n if (sol > bestSol) bestSol = sol\n }\n print(bestSol)\n}\n", "lang": "Kotlin", "bug_code_uid": "899ac3a694e3cd4a13f255c441b1a402", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "apr_id": "95e5460f61b3e107fb2d0f2d6013e6df", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.988976377952756, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val a = System.`in`.reader().readText().split(' ').map(String::toLong)\n println(a.mapIndexed { i, l ->\n a.mapIndexed { j, m ->\n if (i == j) m / 14\n else m + (l + (i - j + 14).rem(14)) / 14\n }.filter { it.rem(2) == 0L }.sum()\n }.max())\n}", "lang": "Kotlin", "bug_code_uid": "e3ee7baae0340a3bff4dbec52658ed43", "src_uid": "1ac11153e35509e755ea15f1d57d156b", "apr_id": "6df984d81cd89f87a0d153cdf9e140f5", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8791666666666667, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.Scanner\nfun main(args:Array){\n var (n, m, a) = readLine()!!.split(' ').map (String::toInt)\n var l:Long = n/a\n var w:Long = m/a\n if(n%a > 0)l = l+1\n if(m%a > 0)w = w+1\n\n print(l*w)\n}\n ", "lang": "Kotlin", "bug_code_uid": "64fcf245762246338aaf168089657154", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "b060f69c7c12a8d8021e7bbc3b6aa206", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9642857142857143, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val s = Scanner(System.`in`).useDelimiter(\" \")\n val n = s.nextInt()\n val m = s.nextInt()\n val a = s.nextInt()\n val h = n / a + (if (n % a == 0) 0 else 1)\n val w = m / a + (if (m % a == 0) 0 else 1)\n System.out.print(h * w)\n}", "lang": "Kotlin", "bug_code_uid": "4bea572ce96ddfa76f2297f4ae95e14b", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "9491932a711d2fa05e9c72239bc0dc85", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8796498905908097, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "//problem of codeforces 1A\nimport java.util.*\nfun main(args: Array)\n{\n val sc=Scanner(System.`in`)\n var n=sc.nextLine().toInt()\n var m=sc.nextLine().toInt()\n var a=sc.nextLine().toInt()\n var ans1: Long\n var ans2:Long\n if(n%a==0)\n {\n ans1= (n/a).toLong()\n }\n else\n {\n ans1=1+(n/a).toLong()\n }\n if(m%a==0)\n {\n ans2=(m/a).toLong()\n }\n else\n {\n ans2=1+(m/a).toLong()\n }\nprint(r1*r2)\n\n}", "lang": "Kotlin", "bug_code_uid": "2ae5752dc5b695307943222f5ec0f8c9", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "8019c91f863047e1aaa5c9eeb282303f", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8888888888888888, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "//problem of codeforces 1A\nimport java.util.*\nfun main(args: Array)\n{\n val sc=Scanner(System.`in`)\n var n=sc.nextLine().toInt()\n var m=sc.nextLine().toInt()\n var a=sc.nextLine().toInt()\n var ans1: Long\n var ans2:Long\n if(n%a==0)\n {\n ans1= (n/a).toLong()\n }\n else\n {\n ans1=1+(n/a).toLong()\n }\n if(m%a==0)\n {\n ans2=(m/a).toLong()\n }\n else\n {\n ans2=1+(m/a).toLong()\n }\nprint(ans1*ans2)\n\n}", "lang": "Kotlin", "bug_code_uid": "8b9ad07f21714e27bdea6b99c585e6a3", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "8019c91f863047e1aaa5c9eeb282303f", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.720164609053498, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n val (n, m, a) = readLine()!!.split(\" \").map { it.toInt() }\n var k = 0\n var t = 0\n while (a * k < n) k++\n while (a * t < m) t++\n println(k * t)\n}", "lang": "Kotlin", "bug_code_uid": "b090d6f886856b0980322aa8b2b10240", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "f6b7abae7fc9ce3578e3e51e4b2eeaf7", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.1895551257253385, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.trim().toInt()\n val m = readLine()!!.trim().toInt()\n val a = readLine()!!.trim().toInt()\n\n println((n - a) + (m - a))\n}\n", "lang": "Kotlin", "bug_code_uid": "3f421e4db16eba23976d74d89ae46626", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "30cb77f7aa8b78bc96d5fb9b82f76a23", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8663282571912013, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n val inputList: List = readInts()\n var l = inputList[0]/ inputList[2]\n var w = inputList[1]/ inputList[2]\n\n if(inputList[0] % inputList[2] != 0) l++\n if(inputList[1] % inputList[2] != 0) w++\n\n print(l * w)\n}", "lang": "Kotlin", "bug_code_uid": "9dded18711722ccf52bc16611408af54", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "2a54f4cbb6ed97854ee07be0179fc982", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.015463917525773196, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "1A_Theatre_Square.kt", "lang": "Kotlin", "bug_code_uid": "b9a915d88678b192d9531546d384ce6b", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "d48e3e66ff22cbb055231b2a491ceb3e", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.620384047267356, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.math.BigDecimal\nimport java.math.RoundingMode\n\nfun main() {\n val (n: BigDecimal, m: BigDecimal, a: BigDecimal) = readLine()!!\n .split(\"\\\\s\".toRegex())\n .map { it.toBigDecimal().setScale(0, RoundingMode.CEILING) }\n .toTypedArray()\n\n println(n.divide(a).setScale(0, RoundingMode.CEILING).multiply(m.divide(a).setScale(0, RoundingMode.CEILING)))\n}\n", "lang": "Kotlin", "bug_code_uid": "5b48c0ac9b63a71be25b66b2475de1e2", "src_uid": "ef971874d8c4da37581336284b688517", "apr_id": "bb3f64f3b4149825490f364953a9e03c", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9923882017126546, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n var n = reader.nextInt()\n var a = reader.nextInt()\n var b = reader.nextInt()\n\n if (a > b) {\n val t = a\n a = b\n b = t\n }\n\n if (a % 2 == 1 && b % 2 == 0 && a + 1 == b) {\n writer.print(1)\n return\n }\n\n var ans = 1\n while (n != 1) {\n a = a / 2 + a % 2\n b = b / 2 + b % 2\n n /= 2\n ans++\n\n if (a % 2 == 1 && b % 2 == 0 && a + 1 == b) {\n break\n }\n }\n\n writer.println(if (n == 2) \"Final!\" else ans)\n}\n\nclass InputReader(stream: InputStream) {\n val reader: BufferedReader\n var tokenizer: StringTokenizer? = null\n\n init {\n reader = BufferedReader(InputStreamReader(stream), 32768)\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "14f29adc78224e26c7eed5078b64988b", "src_uid": "a753bfa7bde157e108f34a28240f441f", "apr_id": "cd7693dceb79ef19e61352dcb9539772", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7718526663001649, "equal_cnt": 18, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 11, "fix_ops_cnt": 17, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numTeams, team1, team2) = readInts()\n val (minorTeam, majorTeam) = team1 minmax team2\n var numRounds = 0\n var nt = numTeams\n while (nt > 1) {\n numRounds++\n nt = nt shr 1\n }\n val queue = ArrayDeque>()\n queue.add(numRounds to numTeams / 2)\n while (queue.isNotEmpty()) {\n val (round, limit) = queue.removeLast()\n if (limit in minorTeam until majorTeam) return print(if (round == numRounds) \"Final!\" else round)\n queue.add(round - 1 to limit / 2)\n queue.add(round - 1 to limit + limit / 2)\n }\n}\n\nprivate infix fun Int.minmax(team2: Int) = if (this <= team2) this to team2 else team2 to this\n", "lang": "Kotlin", "bug_code_uid": "16755aee23c2d642fd643cda1c745603", "src_uid": "a753bfa7bde157e108f34a28240f441f", "apr_id": "710ef8b5c8f17db87b324eede07ffdf8", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8053763440860215, "equal_cnt": 17, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 11, "fix_ops_cnt": 16, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n val (numTeams, team1, team2) = readInts()\n val (minorTeam, majorTeam) = team1 minmax team2\n var numRounds = 0\n var nt = numTeams\n while (nt > 1) {\n numRounds++\n nt = nt shr 1\n }\n val queue = ArrayDeque>()\n queue.add(numRounds to numTeams / 2)\n while (queue.isNotEmpty()) {\n val (round, limit) = queue.removeFirst()\n if (limit in minorTeam until majorTeam) return print(if (round == numRounds) \"Final!\" else round)\n if (round == 1) return print(1)\n queue.add(round - 1 to limit / 2)\n queue.add(round - 1 to limit + limit / 2)\n }\n}\n\nprivate infix fun Int.minmax(team2: Int) = if (this <= team2) this to team2 else team2 to this\n", "lang": "Kotlin", "bug_code_uid": "3049bb221f239e0c7d8acd5fe8773dcd", "src_uid": "a753bfa7bde157e108f34a28240f441f", "apr_id": "710ef8b5c8f17db87b324eede07ffdf8", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984350547730829, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.*\n\nfun main(args: Array){\n\tval inpt = readLine().toString().split(\" \")\n\tval N = inpt[0]\n\tval A: Int = inpt[1].toInt()\n\tval B: Int = inpt[2].toInt()\n\tval rounds = round(log(N.toDouble(), 2.0)).toInt()\n\tval result = fround(A,B,rounds)\n\tif (result == rounds){\n\t\tprintln(\"Final!\")\n\t}else{\n\t\tprintln(result)\n\t}\n}\n\nfun fround(A: Int,B: Int,rounds: Int): Int{\n\tvar meetRound: Int = 0\n\tvar tmpA: Int\n\tvar tmpB: Int\n\n\tfor (i in rounds downTo 1){\n\t\ttmpA = ceil(A/(2.0.pow(i-1))-0.01).toInt()\n\t\ttmpB = ceil(B/(2.0.pow(i-1))-0.01).toInt()\n\t\tif (abs(tmpA - tmpB) >= 1){\n\t\t\tmeetRound = i\n\t\t\tbreak\n\t\t}\n\t}\n\treturn(meetRound)\n}\n", "lang": "Kotlin", "bug_code_uid": "68e0dae031b0d7b052946f0d9e5b9685", "src_uid": "a753bfa7bde157e108f34a28240f441f", "apr_id": "a0589fde73392583896f66598b1e3bdc", "difficulty": 1200, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9821826280623608, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n var sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var a = sc.nextInt()\n var b = sc.nextInt()\n var c = sc.nextInt()\nval min = mins(a,b,c)\n var res = 0\n if (n == 0) res=0\n else if ( n == 1 ) res = Math.min(a,b)\n else res = min * (n-2) + Math.min(a,b)\n\nprintln(res)\n}\nfun mins ( a : Int , b: Int , c :Int): Int {\n var min = Math.min(a,b)\n return Math.min(min,c)\n}", "lang": "Kotlin", "bug_code_uid": "57dcddf7d15f594fdfbf9f1e76efa6e0", "src_uid": "6058529f0144c853e9e17ed7c661fc50", "apr_id": "5bff55ea0db750ece11c80bc3b47b452", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9663551401869159, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n val n = readLine()!!.toInt()\n val numbers = readLine()!!.split(' ').map { it.toInt() }\n\n val answer = arrayListOf>()\n\n for (x in numbers) {\n var found = false\n\n for (y in answer) {\n if (x % y.first() == 0 || y.all { it % x == 0 }) {\n y.add(x)\n found = true\n }\n }\n\n if (!found) {\n answer.add(TreeSet().apply { add(x) })\n }\n }\n\n println(answer.size)\n}", "lang": "Kotlin", "bug_code_uid": "f8079d5403be83aa7c2aeb3e122ea872", "src_uid": "63d9b7416aa96129c57d20ec6145e0cd", "apr_id": "9db607ac301dce34feb11b11bb9b81ff", "difficulty": 800, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.254957507082153, "equal_cnt": 10, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "fun main() {\n val (n, index) = readLine()!!.split(\" \")\n val finalList = (1..n.toLong()).partition { it % 2L == 1L }\n val s=finalList.first+finalList.second\n println(s[index.toInt()-1])\n}", "lang": "Kotlin", "bug_code_uid": "2f1e2467e3a7f19180f7558818bd81ec", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "9ddd0f59ff3fcf110c12a24522b52d2d", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9921104536489151, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val number = readLine()!!.split(\" \").map { it.toInt() }\n val n = number.first()\n val i = number.last()\n when {\n n % 2 == 0 -> {\n val mid = n / 2\n if (i <= mid)\n println((2 * i) -1)\n else\n println(2 * (i - mid))\n }\n else -> {\n val mid = (n / 2) + 1\n if (i <= mid)\n println((2 * i) -1)\n else\n println(2 * (i - mid))\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "15d81accf31ba45c3671cef690b61936", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "9ddd0f59ff3fcf110c12a24522b52d2d", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.32967032967032966, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n var help = 1\n var delta = 0\n for(i in 0 until k) {\n if (help + (i - delta) * 2 > n) {\n help = 2\n delta = i\n }\n if (i == k - 1) {\n print(help + (i - delta) * 2)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "00f9e471168781adc2c3a1ae804d5420", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "096a643097bc4b1d9b89b795c352d28f", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.947209653092006, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "fun main(args : Array) {\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n var ans = 0\n var last = 0\n if (n % 2 == 0)\n last = n / 2\n\n else\n last = n / 2 + 1\n\n if (k > last) {\n ans = (k - last) * 2\n }\n else {\n ans = k * 2 - 1\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "027032e028c180b9e5aab309ca98f3ba", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "75b5f42e70136adc5a28a7a5b8e37281", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5974683544303797, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "fun main(args: Array) {\n val (n, i) = readLine()!!.split(\" \").map(String::toInt)\n val arr = IntArray(n)\n var k = 0\n for(j in 1..n step 2) arr[k++] = j\n for(j in 2..n step 2) arr[k++] = j\n println(arr[i-1])\n}", "lang": "Kotlin", "bug_code_uid": "146506133b830fa5a89338a83ec87006", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "9111a29763bda71f9529e36fe5bd1edb", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6022471910112359, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 6, "insert_cnt": 0, "fix_ops_cnt": 13, "bug_source_code": "fun main(args: Array) {\n val (n, i) = readLine()!!.split(\" \").map(String::toLong)\n var k : Long = 0\n for(j in 1..n step 2) if((++k) == i) {\n println(j)\n return;\n }\n for(j in 2..n step 2) if((++k) == i) {\n println(j)\n return;\n }\n}", "lang": "Kotlin", "bug_code_uid": "023f5953127e4e0bbc6934eb12e84f88", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "9111a29763bda71f9529e36fe5bd1edb", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5467800729040098, "equal_cnt": 20, "replace_cnt": 12, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 19, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n var (n,k) = readLine()!!.split(' ').map { it.toInt() }\n\n if (n%2==0){\n if (k<=n/2){\n println(k+k-1)\n }else{\n println(k-n/2+k-n/2)\n }\n }else{\n if (k<=n/2+1){\n println(k+k-1)\n }else{\n println(k-n/2-1+k-n/2-1)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "34a97945ad16f4ed930b6a311096a6f4", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "04740db9b17b789527bddbc0fb9d60c0", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.util.ArrayList\n\nfun main(args:Array) {\n val temp= readLine()!!.split(\" \")\n val n:Long= temp[0].toLong()\n val k:Long= temp[1].toLong()\n var arr=ArrayList()\n for (i in 1..n step 2){\n arr.add(i)\n }\n for (i in 2..n step 2){\n arr.add(i)\n }\n println(arr[k.toInt()-1])\n}", "lang": "Kotlin", "bug_code_uid": "15b6d851a4dae701d11c8b69b921d0f5", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "4edefd6377cb6533468422c527b5894c", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.24686192468619247, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "#include \n#include \nusing namespace std;\n\nint main()\n{\n unsigned long long n,k,j=0;\n\n cin>>n>>k;\nif(n%2!=0)\n n++;\nint c=0;\nif(k>n/2)\nc=2*(k-n/2);\nelse\n c=2*k-1;\n cout<) {\n val (n,k)=readInts()\n if (k<=(n+1)/2) {\n println(k*2-1)\n } else {\n println(2*(k-(n+1)/2))\n }\n}", "lang": "Kotlin", "bug_code_uid": "74d6fc3eba9459d96245489c0e3bbb85", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "2725513483e3998f6f6af75cb2a01f34", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6345903771131339, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val (length, index) = reader.readLine().split(' ').map { it.toInt() }\n val range = (1..length step 2).toMutableList()\n range.addAll(2..length step 2)\n println(range[index - 1])\n}", "lang": "Kotlin", "bug_code_uid": "d5b0b245fccdcbed94c6e319196d68f8", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "482723af21d0fda28492d7592931be56", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5110204081632653, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val (length, index) = reader.readLine().split(' ').map { it.toLong() }\n val perSize = length / 2 + length % 2\n var indexator = 1L\n val result = if (index <= perSize) { //\u041d\u0435\u0447\u0435\u0442\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430\n var number = 0L\n for (i in 1..length step 2) {\n if (indexator == index) {\n number = i\n }\n indexator++\n }\n number\n } else { //\u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0447\u0435\u0442\u043d\u044b\u043c\u0438\n var number = 0L\n for (i in 2..length step 2) {\n if (indexator == index - perSize) {\n number = i\n }\n indexator++\n }\n number\n }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "1760b899b6aa8aeec3e8edda1db71a95", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "482723af21d0fda28492d7592931be56", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9847908745247148, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n var (n, k) = readLine()!!.split(' ').map { it.toInt() }\n val middle = if (n % 2 == 0) n / 2 else n / 2 + 1\n if (k > middle) {\n k -= middle\n println(k * 2)\n }\n else {\n println(k * 2 - 1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "ccfa4729fa427f461da9b6247035e561", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "c9f713826229dd25f8995c9fc28e68c9", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9881956155143339, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "\nimport java.util.*\n\n/**\n * Created by AoEiuV020 on 2017/06/09.\n */\nfun main(vararg args: String) {\n val (n, k) = readLine()!!.split(' ').map { it.toInt() }\n val m = (n + 1) / 2\n print(if (k > m) 2 * (k - m) else 2 * k - 1)\n //print(((2 * (k - m)).takeIf { k > m } ?: (2 * k - 1)))\n}\n", "lang": "Kotlin", "bug_code_uid": "06e999b8fdc2e81d71e13acf490bef6c", "src_uid": "1f8056884db00ad8294a7cc0be75fe97", "apr_id": "0953ccd77d06a7b35aa1fa76d11a1abc", "difficulty": 900, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9468599033816425, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val (a, b) = reader.readLine()!!.split(' ').map(String::toLong)\n println(a * b / 2 * 2)\n}", "lang": "Kotlin", "bug_code_uid": "d4e86109dd7c431ef307e460ee6c7a3b", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "f94629dbd7dc173d4dedd4a7209fc9ea", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.98, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (a, b) = readLine()!!.split(' ').map(String::toLong)\n println(a * b / 2 * 2)\n}", "lang": "Kotlin", "bug_code_uid": "ec596b467dd3f1608abb78f792922b52", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "f94629dbd7dc173d4dedd4a7209fc9ea", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9174560216508796, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.*\n\n/**\n * Created by AoEiuV020 on 2017/05/09.\n */\nfun main(vararg args: String) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val m = scanner.nextInt()\n print(when {\n n == 1 -> m / 2\n m == 1 -> n / 2\n n % 2 == 0 || m %2 == 0 -> n / 2 * m\n else -> n / 2 * m + m / 2\n })\n }\n", "lang": "Kotlin", "bug_code_uid": "6a3a0bd06156cee9d3babd3bdd567196", "src_uid": "e840e7bfe83764bee6186fcf92a1b5cd", "apr_id": "6d6567a4af75ea83e6290fecd86d49be", "difficulty": 800, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9216799091940976, "equal_cnt": 15, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 8, "fix_ops_cnt": 14, "bug_source_code": "fun main() {\n val list = readLine()!!.split(\" \").map { it.toInt() }\n val q = list[0] / list[1]\n val rem = list[0] % list[1]\n val d=list[0] - list[1]\n if (list[1] == 1) {\n val a = list[0] * (list[0] - 1) / 2\n println(\"$a $a\")\n }\n else if (d == 1)\n println(\"1 1\")\n else{\n val max=d*(d+1)/2\n val min=((list[1]-rem)*(q)*(q-1)/2)+(rem)*(q)*(q+1)/2\n println(\"$min $max\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "4868014e650a0c2f3b508a26fa8e5292", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "apr_id": "d4a9cc747576c6be8aa086f019847672", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8901098901098901, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 4, "insert_cnt": 2, "fix_ops_cnt": 11, "bug_source_code": "//package codeforces.greedyAlgorithm\n\nimport java.math.BigDecimal\nimport java.util.function.Consumer\n\nfun main() {\n val (peopleNumber, teamsNumber) = readLine()!!.split(\" \").map { it.toInt() }\n\n countMinMaxNumbers(\n BigDecimal(peopleNumber),\n BigDecimal(teamsNumber),\n minVal = { value -> print(\"$value \") },\n maxVal = { value -> print(\"$value\") }\n )\n}\n\nfun countMinMaxNumbers(peopleNumber: BigDecimal, teamsNumber: BigDecimal, minVal: Consumer, maxVal: Consumer) {\n val minTeam = peopleNumber / teamsNumber\n val remains = peopleNumber % teamsNumber\n\n if (remains == 0.toBigDecimal()) {\n val pairCount = minTeam.getPairCombNumb()\n val pairSum = pairCount * teamsNumber\n\n minVal.accept(pairSum)\n } else {\n val sumWithRem = remains * (minTeam + 1.toBigDecimal()).getPairCombNumb()\n val sumOfMain = (teamsNumber - remains) * minTeam.getPairCombNumb()\n val totalSum = sumWithRem + sumOfMain\n\n minVal.accept(totalSum)\n }\n\n val maxTeam = peopleNumber - (teamsNumber - 1.toBigDecimal())\n maxVal.accept(maxTeam.getPairCombNumb())\n}\n\nfun BigDecimal.getPairCombNumb() = (this * (this - 1.toBigDecimal())) / 2.toBigDecimal()", "lang": "Kotlin", "bug_code_uid": "2d504fd19ca1389d3b92619778aec8e2", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "apr_id": "8e6098c59a064e3d24ad62aba022742a", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9937759336099585, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.math.round\n\nfun main(){\n var scanner = Scanner(System.`in`)\n var n = scanner.nextLong()\n var m = scanner.nextLong()\n print(findMin(n,m))\n print(\" \")\n println(findMax(n,m))\n}\n\nfun findMin(n:Long,m:Long):Long{\n if(n%m==0L){\n return findMax(n/m,1)*m\n }\n else{\n var rest = n%m\n return findMax(n/m,1)*(m-rest) + findMax(n/m + 1,1)*rest\n }\n}\nfun findMax(n:Long,m:Long):Long{\n return (n-m +1)*m / 2\n}", "lang": "Kotlin", "bug_code_uid": "b0e571cab574186c0dbc131bbb715396", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "apr_id": "4b69c97899c1d343721c603cc6d1c1ea", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9089128305582762, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\nimport kotlin.math.round\n\nfun main(){\n var scanner = Scanner(System.`in`)\n var n = scanner.nextLong()\n var m = scanner.nextLong()\n print(findMin(n,m))\n print(\" \")\n println(findMax(n,m))\n}\n\nfun findMin(n:Long,m:Long):Long{\n if(n%m==0L){\n return findMax(n/m,1)*m\n }\n else{\n var rest = n%m\n return findMax(n/m,1)*(m-rest) + findMax(n/m + 1,1)*rest\n }\n}\nfun findMax(n:Long,m:Long):Long{\n var max:Long = 0\n for(i in 1..(n-m)){\n max += i\n }\n return max\n}", "lang": "Kotlin", "bug_code_uid": "365a38064118c0aa1cf45c93078ab468", "src_uid": "a081d400a5ce22899b91df38ba98eecc", "apr_id": "4b69c97899c1d343721c603cc6d1c1ea", "difficulty": 1300, "tags": ["math", "combinatorics", "greedy", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9620695682572977, "equal_cnt": 12, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*\nimport java.util.*\n\nclass Main internal constructor(inputStream: InputStream, val out: PrintWriter) {\n companion object {\n val ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n }\n\n private val br = BufferedReader(InputStreamReader(inputStream))\n private var st = StringTokenizer(\"\")\n\n internal fun hasNext(): Boolean {\n while (!st.hasMoreTokens()) {\n val readLine = br.readLine() ?: return false\n st = StringTokenizer(readLine)\n }\n return true\n }\n\n private operator fun next() =\n if (hasNext()) st.nextToken()!!\n else throw RuntimeException(\"No tokens\")\n\n internal fun nline() =\n if (hasNext()) st.nextToken(\"\\n\")\n else throw RuntimeException(\"No tokens\")\n\n private fun ni() = next().toInt()\n private fun nii() = Pair(ni(), ni())\n private fun niii() = Triple(ni(), ni(), ni())\n private fun nia(n: Int) = IntArray(n) { ni() }\n private fun nia(m: Int, n: Int) = Array(m) { nia(n) }\n\n private fun nl() = next().toLong()\n private fun nll() = Pair(nl(), nl())\n private fun nlll() = Triple(nl(), nl(), nl())\n private fun nla(n: Int) = LongArray(n, { nl() })\n private fun nla(m: Int, n: Int) = Array(m) { nla(n) }\n\n private fun nd() = next().toDouble()\n private fun ndd() = Pair(nd(), nd())\n private fun nddd() = Triple(nd(), nd(), nd())\n private fun nda(n: Int) = DoubleArray(n) { nd() }\n private fun nda(m: Int, n: Int) = Array(m) { nda(n) }\n\n inline fun log(name: String, block: () -> Unit) {\n if (!ONLINE_JUDGE) {\n p(\"#$name: \")\n block()\n flush()\n }\n }\n\n inline fun log() = log(\"\") { pln() }\n inline fun log(message: Any?, name: String = \"\") = log(name) { pln(message) }\n inline fun log(arr: IntArray?, name: String = \"\") = log(name) { pln(arr) }\n inline fun log(arr: LongArray?, name: String = \"\") = log(name) { pln(arr) }\n inline fun log(arr: DoubleArray?, name: String = \"\") = log(name) { pln(arr) }\n inline fun log(arr: Array?, name: String = \"\") = log(name) { pln(arr) }\n inline fun log(stack: Stack?, name: String = \"\") = log(name) { pln(stack) }\n inline fun log(list: List?, name: String = \"\") = log(name) { pln(list) }\n\n //prefix print\n inline fun prep(prefix: Boolean, separator: String, message: Any?) {\n if (prefix) {\n p(separator)\n }\n p(message)\n }\n\n inline fun p(message: Any?) = this.also { out.print(message) }\n\n inline fun p(arr: IntArray?, separator: String = \" \") = this.also {\n arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(arr: LongArray?, separator: String = \" \") = this.also {\n arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(arr: DoubleArray?, separator: String = \" \") = this.also {\n arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(arr: Array?, separator: String = \" \") = this.also {\n arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(list: List?, separator: String = \" \") = this.also {\n list?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(stack: Stack?, separator: String = \" \") = this.also {\n stack?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun pln() = this.also { out.println() }\n inline fun pln(message: Any?) = p(message).pln()\n inline fun pln(arr: IntArray?, separator: String = \" \") = p(arr, separator).pln()\n inline fun pln(arr: LongArray?, separator: String = \" \") = p(arr, separator).pln()\n inline fun pln(arr: DoubleArray?, separator: String = \" \") = p(arr, separator).pln()\n inline fun pln(list: List?, separator: String = \" \") = p(list, separator).pln()\n inline fun pln(arr: Array?, separator: String = \" \") = p(arr, separator).pln()\n inline fun pln(stack: Stack?, separator: String = \" \") = p(stack, separator).pln()\n\n inline fun flush() = out.flush()\n\n //////////////////////////////////////\n\n fun run() {\n val n = ni()\n var answer = 1\n var itr = 1\n var k = 0\n var d = 0\n var set = TreeSet();\n var flag = true;\n for (i in 1..n) {\n k = 0\n d = i\n flag = true;\n while (d > 0) {\n if (d % 2 == 0 && flag) {\n k++\n d /= 2\n continue\n } else\n if (d % 2 == 0) {\n d/=2\n continue\n } else {\n k--\n }\n d /= 2\n }\n if (k == -1) set.add(i)\n }\n for (i in set) if (n % i == 0) answer = i\n out.print(answer)\n }\n\n}\n\n//////////////////////////////////////\nfun main(args: Array) {\n val inp = File(\"input.txt\")\n if (Main.ONLINE_JUDGE || !inp.isFile) {\n val a = Main(System.`in`, PrintWriter(BufferedOutputStream(System.out)))\n a.run()\n a.flush()\n a.out.close()\n } else {\n val t = Main(FileInputStream(\"input.txt\"), PrintWriter(BufferedOutputStream(System.out)))\n while (t.hasNext()) {\n val name = t.nline()\n t.log(\"##### Test $name #####\")\n val startTime = System.currentTimeMillis()\n t.run()\n val endTime = System.currentTimeMillis()\n t.log(endTime - startTime, \"Total Time\")\n t.log()\n t.flush()\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "171e7ee71c9ace0723808d3a54c67ce6", "src_uid": "339246a1be81aefe19290de0d1aead84", "apr_id": "8b54d2cfab45be4b0878d21059ece943", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.970298769771529, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "\\import java.io.*\nimport java.util.*\n\nclass Main internal constructor(inputStream: InputStream, val out: PrintWriter) {\n companion object {\n val ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n }\n\n private val br = BufferedReader(InputStreamReader(inputStream))\n private var st = StringTokenizer(\"\")\n\n internal fun hasNext(): Boolean {\n while (!st.hasMoreTokens()) {\n val readLine = br.readLine() ?: return false\n st = StringTokenizer(readLine)\n }\n return true\n }\n\n private operator fun next() =\n if (hasNext()) st.nextToken()!!\n else throw RuntimeException(\"No tokens\")\n\n internal fun nline() =\n if (hasNext()) st.nextToken(\"\\n\")\n else throw RuntimeException(\"No tokens\")\n\n private fun ni() = next().toInt()\n private fun nii() = Pair(ni(), ni())\n private fun niii() = Triple(ni(), ni(), ni())\n private fun nia(n: Int) = IntArray(n) { ni() }\n private fun nia(m: Int, n: Int) = Array(m) { nia(n) }\n\n private fun nl() = next().toLong()\n private fun nll() = Pair(nl(), nl())\n private fun nlll() = Triple(nl(), nl(), nl())\n private fun nla(n: Int) = LongArray(n, { nl() })\n private fun nla(m: Int, n: Int) = Array(m) { nla(n) }\n\n private fun nd() = next().toDouble()\n private fun ndd() = Pair(nd(), nd())\n private fun nddd() = Triple(nd(), nd(), nd())\n private fun nda(n: Int) = DoubleArray(n) { nd() }\n private fun nda(m: Int, n: Int) = Array(m) { nda(n) }\n\n inline fun log(name: String, block: () -> Unit) {\n if (!ONLINE_JUDGE) {\n p(\"#$name: \")\n block()\n flush()\n }\n }\n\n inline fun log() = log(\"\") { pln() }\n inline fun log(message: Any?, name: String = \"\") = log(name) { pln(message) }\n inline fun log(arr: IntArray?, name: String = \"\") = log(name) { pln(arr) }\n inline fun log(arr: LongArray?, name: String = \"\") = log(name) { pln(arr) }\n inline fun log(arr: DoubleArray?, name: String = \"\") = log(name) { pln(arr) }\n inline fun log(arr: Array?, name: String = \"\") = log(name) { pln(arr) }\n inline fun log(stack: Stack?, name: String = \"\") = log(name) { pln(stack) }\n inline fun log(list: List?, name: String = \"\") = log(name) { pln(list) }\n\n //prefix print\n inline fun prep(prefix: Boolean, separator: String, message: Any?) {\n if (prefix) {\n p(separator)\n }\n p(message)\n }\n\n inline fun p(message: Any?) = this.also { out.print(message) }\n\n inline fun p(arr: IntArray?, separator: String = \" \") = this.also {\n arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(arr: LongArray?, separator: String = \" \") = this.also {\n arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(arr: DoubleArray?, separator: String = \" \") = this.also {\n arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(arr: Array?, separator: String = \" \") = this.also {\n arr?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(list: List?, separator: String = \" \") = this.also {\n list?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun p(stack: Stack?, separator: String = \" \") = this.also {\n stack?.fold(false, { prefix, t -> prep(prefix, separator, t); true })\n }\n\n inline fun pln() = this.also { out.println() }\n inline fun pln(message: Any?) = p(message).pln()\n inline fun pln(arr: IntArray?, separator: String = \" \") = p(arr, separator).pln()\n inline fun pln(arr: LongArray?, separator: String = \" \") = p(arr, separator).pln()\n inline fun pln(arr: DoubleArray?, separator: String = \" \") = p(arr, separator).pln()\n inline fun pln(list: List?, separator: String = \" \") = p(list, separator).pln()\n inline fun pln(arr: Array?, separator: String = \" \") = p(arr, separator).pln()\n inline fun pln(stack: Stack?, separator: String = \" \") = p(stack, separator).pln()\n\n inline fun flush() = out.flush()\n\n //////////////////////////////////////\n\n fun run() {\n val n = ni()\n var answer = 1\n var itr = 1\n var k = 0\n var d = 0\n var set = TreeSet();\n var flag = true;\n for (i in 1..n) {\n k = 0\n d = i\n flag = true;\n while (d > 0) {\n if (d % 2 == 0 && flag) {\n k++\n } else\n { if (d % 2 == 0) {\n flag=false;\n } else {\n k--\n }\n }\n d /= 2\n }\n if (k == -1&&flag) set.add(i)\n }\n for (i in set) if (n % i == 0) answer = i\n out.print(answer)\n }\n\n}\n\n//////////////////////////////////////\nfun main(args: Array) {\n val inp = File(\"input.txt\")\n if (Main.ONLINE_JUDGE || !inp.isFile) {\n val a = Main(System.`in`, PrintWriter(BufferedOutputStream(System.out)))\n a.run()\n a.flush()\n a.out.close()\n } else {\n val t = Main(FileInputStream(\"input.txt\"), PrintWriter(BufferedOutputStream(System.out)))\n while (t.hasNext()) {\n val name = t.nline()\n t.log(\"##### Test $name #####\")\n val startTime = System.currentTimeMillis()\n t.run()\n val endTime = System.currentTimeMillis()\n t.log(endTime - startTime, \"Total Time\")\n t.log()\n t.flush()\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "1e94dc614c7f59b6a7d9066c285525e9", "src_uid": "339246a1be81aefe19290de0d1aead84", "apr_id": "8b54d2cfab45be4b0878d21059ece943", "difficulty": 1000, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.43403205918618987, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "fun main()\n{\n val ph=\"qwertyuiopasdfghjkl;zxcvbnm,./\"\n var dir = readLine().toString()\n var a = readLine().toString()\n for(index in 0..(a.length-1))\n {\n if(dir=='R')\n a[incdex].set(ph.indexOf[a[index]-1)\n else\n a[incdex].set(ph.indexOf(a[index)+1)\n }\n println(a)\n}", "lang": "Kotlin", "bug_code_uid": "0d7d4ba440540a1614d2f50b988a526f", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "apr_id": "2905550d7a10e1b5cfa61e0f283a5e71", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9981916817359855, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args:Array) {\n val a=\"qwertyuiopsdfghjkl;zxcvbnm,./\"\n val LR= readLine()!!\n var x= readLine()!!\n var result=\"\"\n var f=1\n if(LR==\"R\")\n f*=-1\n for(i in 0 until x.length){\n result+=a[a.indexOf(x[i])+f]\n }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "dad2dbfb3c5b4aab4765d045095228e5", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "apr_id": "ef9802ff3f832c49dbd1ed60d258eb69", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9801587301587301, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.lang.AssertionError\nimport java.util.*\n \nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n \nprivate fun myAssert(x: Boolean) {\n if (!x) {\n throw AssertionError()\n }\n}\n\nfun main(args: Array) {\n// var s = Scanner(System.`in`)\n var cmd = readLn()\n var line = readLn()\n var map = mutableMapOf()\n var keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\"\n if (cmd == \"R\") {\n for (i in 1..keyboard.length - 1) {\n map[keyboard[i]] = keyboard[i - 1]\n }\n for (i in 0..line.length - 1) {\n print(\"${map[line[i]]}\")\n }\n print(\"\\n\")\n } else {\n for (i in 0..keyboard.length - 2) {\n map[keyboard[i]] = keyboard[i + 1]\n }\n for (i in 0..line.length - 1) {\n print(\"${map[line[i]]}\\n\")\n }\n print(\"\\n\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "f7816da2aa1dcf2fb52c5c6efa71aad1", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6", "apr_id": "8d9d40d986c986e4bbecb0b0bb9ed3f4", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9703652653342523, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "\nfun main() {\n solve()\n}\n\nprivate fun solve() {\n val n = readLong()\n\n if (n == 1L) {\n println(1)\n return\n }\n var counter = 1\n\n var i = 1\n var ans = 0L\n while (i <= n) {\n if (i + counter >= n) {\n ans = 1 + (n - i)\n }\n\n i += counter\n counter++\n }\n println(ans)\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // li\nprivate fun readLongs() = readStrings().map { it.toLong() } // li", "lang": "Kotlin", "bug_code_uid": "d2d4eb6c9d3f37fc915febe9bb55b85f", "src_uid": "1db5631847085815461c617854b08ee5", "apr_id": "9d24c5f6fc0b471b25c2fac801654964", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9829816201497618, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "\nfun main() {\n solve()\n}\n\nprivate fun solve() {\n val n = readLong()\n\n if (n == 1L) {\n println(1)\n return\n }\n var counter = 1\n\n var i = 1\n var ans = 0L\n while (i <= n) {\n if (i + counter >= n) {\n ans = 1 + (n - i)\n break\n }\n\n i += counter\n counter++\n }\n println(ans)\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // li\nprivate fun readLongs() = readStrings().map { it.toLong() } // li", "lang": "Kotlin", "bug_code_uid": "781081ed9fde2dd716447648e197912d", "src_uid": "1db5631847085815461c617854b08ee5", "apr_id": "9d24c5f6fc0b471b25c2fac801654964", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9567307692307693, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.sqrt\n\nfun main() {\n fun readLong() = readLine()!!.toLong()\n\n val n = readLong() - 1\n val x = ((sqrt((1 + 8 * n).toFloat()) - 1) / 2).toInt()\n print(1 + n - (x * (x + 1) / 2))\n}", "lang": "Kotlin", "bug_code_uid": "d1d0de3c86e3b5e0962e0a9b875ca485", "src_uid": "1db5631847085815461c617854b08ee5", "apr_id": "036bb4cd4b4b88d66b22ad577825c211", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9975274525489055, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.lang.Math.*\nimport java.math.BigInteger\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\nimport kotlin.math.sqrt\n\ntypealias IndexPair = Pair\ntypealias IntIndexPair = IndexPair\ntypealias IntIntPair = Pair\n\ntypealias IntMatrix = Array\ntypealias LongMatrix = Array\n\ntypealias ListArray = Array>\n\ntypealias Graph = IntMatrix\n\ntypealias Edge = Pair\ntypealias EdgeArray = Array\ntypealias WeightedGraph = Array\n\ntypealias TotalEdge = Triple\ntypealias TotalEdgeArray = Array\n\nfun init() { }\n\nconst val MODULO = 1000 * 1000 * 1000 + 7\n\nfun solve() {\n val n = readLong() - 1\n\n val nearestRoot = sqrt(n * 2.0).toLong()\n val sum = nearestRoot * (nearestRoot + 1) / 2\n\n val answer = n - sum\n out.println(answer + 1)\n}\n\nfun stress() {\n val rnd = Random(1234)\n\n for (it in 0 until 100) {\n val expected = brute()\n val actual = fast()\n\n if (expected != actual) {\n System.err.println(\"Gotcha!\")\n System.err.println(\"$expected $actual\")\n\n break\n }\n }\n}\n\n\nfun fast() {\n\n}\n\nfun brute() {\n\n}\n\nfun Long.mod() : Long {\n var result = this % MODULO\n if (result < 0) result += MODULO\n return result\n}\n\ninfix fun Long.add(other : Long) = (this + other).mod()\ninfix fun Long.sub(other : Long) = this add -other.mod()\ninfix fun Long.mult(other : Long) = (this.mod() * other.mod()).mod()\n\nfun Long.even() = (this and 1L) == 0L\nfun Long.odd() = !even()\n\nfun Int.even() = (this and 1) == 0\nfun Int.odd() = !even()\n\ninfix fun Long.binpow(power : Long) : Long {\n if (power == 0L) return 1L\n\n val half = binpow(power shl 1)\n\n var result = half mult half\n if (power.odd()) {\n result = result mult this\n }\n\n return result\n}\n\nval stepsXY = arrayOf(\n arrayOf(0, -1),\n arrayOf(0, 1),\n arrayOf(-1, 0),\n arrayOf(1, 0)\n)\n\n\n\nclass IndexedWeightedGraph(private val n : Int, private val edges: TotalEdgeArray) {\n\n private val graph : Graph\n\n private fun buildGraphForEdges(\n edgeFilter : (index : Int, edge : TotalEdge) -> Boolean = { _, _ -> true }\n ) : Graph {\n val builder = GraphBuilder()\n edges\n .forEachIndexed { index, edge ->\n if (edgeFilter(index, edge)) {\n val (first, second, _ ) = edge\n\n builder.addDirectedEdge(first, index)\n builder.addDirectedEdge(second, index)\n }\n }\n\n return builder.build(n)\n }\n\n init {\n graph = buildGraphForEdges()\n }\n\n var root : Int = -1\n lateinit var inTree : BooleanArray\n lateinit var tree : Graph\n\n fun kruskalTree(root : Int) : Long {\n this.root = root\n\n inTree = BooleanArray(edges.size) { false }\n\n val dsu = DSU(n)\n\n edges\n .mapIndexed { index, (_, _, w) -> index to w }\n .sortedBy { it.second }\n .forEach {\n val edge = edges[it.first]\n inTree[it.first] = dsu.union(edge.first, edge.second)\n }\n\n tree = buildGraphForEdges { index, _ -> inTree[index] }\n\n return edges\n .mapIndexed { index, (_, _, w) -> if (inTree[index]) w.toLong() else 0L }\n .sum()\n }\n\n private fun to(from : Int, index : Int) : Int {\n val edge = edges[index]\n return if (from == edge.first) edge.second else edge.first\n }\n\n fun buildLca() {\n calculateTimes()\n calculateParents()\n calculatePathInfo()\n }\n\n lateinit var timesIn : IntArray\n lateinit var timesOut : IntArray\n private var time = -1\n\n private fun calculateTimes() {\n timesIn = IntArray(n) { -1 }\n timesOut = IntArray(n) { -1 }\n this.time = 0\n\n timeDfs(root)\n }\n\n private fun timeDfs(from : Int, parent : Int = -1) {\n timesIn[from] = time++\n\n for (index in tree[from]) {\n val to = to(from, index)\n if (to == parent) continue\n\n timeDfs(to, from)\n }\n\n timesOut[from] = time++\n }\n\n lateinit var parents : Array\n private val maxBit = 19\n\n private fun calculateParents() {\n parents = Array(maxBit) { IntArray(n) { -1 } }\n\n parentDfs(root, root)\n\n for (bit in 0 until maxBit - 1) {\n for (v in 0 until n) {\n val parent = parents[bit][v]\n parents[bit + 1][v] = parents[bit][parent]\n }\n }\n }\n\n private fun parentDfs(from : Int, parent : Int = -1) {\n parents[0][from] = parent\n\n for (index in tree[from]) {\n val to = to(from, index)\n if (to == parent) continue\n\n parentDfs(to, from)\n }\n }\n\n lateinit var maxEdges : Array\n\n private fun calculatePathInfo() {\n maxEdges = Array(maxBit) { IntArray(n) { -1 } }\n\n for (v in 0 until n){\n for (index in tree[v]) {\n val to = to(v, index)\n if (to == parents[0][v]) continue\n\n maxEdges[0][to] = edges[index].third\n }\n }\n\n for (bit in 0 until maxBit - 1) {\n for (v in 0 until n) {\n val parent = parents[bit][v]\n maxEdges[bit + 1][v] = max(\n maxEdges[bit][v],\n maxEdges[bit][parent]\n )\n }\n }\n }\n\n fun getOnPath(a : Int, b : Int) : Int {\n var answer = Int.MIN_VALUE\n\n answer = max(answer, getOnLcaPath(a, b))\n answer = max(answer, getOnLcaPath(b, a))\n\n return answer\n }\n\n private fun getOnLcaPath(start : Int, other : Int) : Int {\n var answer = Int.MIN_VALUE\n\n if (timesIn[start] <= timesIn[other] && timesOut[other] <= timesOut[start]) {\n return answer\n }\n\n var v = start\n for (bit in maxBit - 1 downTo 0) {\n val parent = parents[bit][v]\n if (timesIn[parent] > timesIn[other] || timesOut[other] > timesOut[parent]) {\n answer = max(answer, maxEdges[bit][v])\n v = parent\n }\n }\n\n answer = max(answer, maxEdges[0][v])\n\n return answer\n }\n}\n\nfun yesNo(yes : Boolean) {\n out.println(if (yes) \"YES\" else \"NO\")\n}\n\nfun run() {\n init()\n solve()\n out.close()\n}\n\nfun main(args: Array) {\n run()\n}\n\nval ONLINE_JUDGE = !File(\"input.txt\").exists()\n\nval input = BufferedReader(\n if (ONLINE_JUDGE) InputStreamReader(System.`in`) else FileReader(\"input.txt\")\n)\nval out =\n if (ONLINE_JUDGE) PrintWriter(System.out)\n else PrintWriter(\"output.txt\")\n\nfun readStrings(separator: String = \" \", emptyWords: Boolean = false) : Array {\n val line = input.readLine()\n\n val list = ArrayList()\n var builder = StringBuilder()\n\n for (i in 0..line.length) {\n if (i == line.length || separator.contains(line[i])) {\n if (emptyWords || builder.isNotEmpty()) {\n list.add(builder.toString())\n builder = StringBuilder()\n }\n } else {\n builder.append(line[i])\n }\n }\n\n return list.toTypedArray()\n}\n\nfun readString(separator: String = \" \") =\n readStrings(separator).first()\n\nfun readInts(separator: String = \" \") =\n readStrings(separator).map(String::toInt).toIntArray()\n\nfun readDecreasedInts(separator : String = \" \") =\n readInts(separator).map { it - 1 }.toIntArray()\n\nfun readSortedInts(separator: String = \" \") : IntArray {\n val a = readInts(separator)\n\n val aInteger = Array(a.size) { a[it] }\n Arrays.sort(aInteger)\n\n return aInteger.toIntArray()\n}\n\nfun readInt(separator: String = \" \") =\n readInts(separator).first()\n\nfun readLongs(separator: String = \" \") =\n readStrings(separator).map(String::toLong).toLongArray()\n\nfun readLong(separator: String = \" \") =\n readLongs(separator).first()\n\nfun readDoubles(separator: String = \" \") =\n readStrings(separator).map(String::toDouble).toDoubleArray()\n\nfun readDouble(separator: String = \" \") =\n readDoubles(separator).first()\n\nfun readBigIntegers(separator: String = \" \") =\n readStrings(separator).map { BigInteger(it) }.toTypedArray()\n\nfun readBigInteger(separator: String = \" \") =\n readBigIntegers(separator).first()\n\nfun readTree(n : Int, indexing : Int = 1) =\n readGraph(n, n - 1, true, indexing)\n\nfun readGraph(n: Int, m : Int,\n undirected : Boolean = true,\n indexing : Int = 1) : Graph {\n val builder = GraphBuilder()\n\n for (i in 1..m) {\n var (from, to) = readInts()\n\n from -= indexing\n to -= indexing\n\n if (undirected) builder.addEdge(from, to)\n else builder.addDirectedEdge(from, to)\n }\n\n return builder.build(n)\n}\n\nfun readWeightedGraph(n : Int, m : Int,\n undirected : Boolean = true,\n indexing : Int = 1) : WeightedGraph {\n val builder = GraphBuilder()\n\n for (i in 1..m) {\n var (from, to, weight) = readInts()\n\n from -= indexing\n to -= indexing\n\n if (undirected) builder.addEdge(from, to, weight)\n else builder.addDirectedEdge(from, to, weight)\n }\n\n return builder.buildWeighted(n)\n}\n\nfun readTotalEdges(m : Int, indexing : Int = 1) =\n TotalEdgeArray(m) {\n var (from, to, w) = readInts()\n\n from -= indexing\n to -= indexing\n\n Triple(from, to, w)\n }\n\nclass GraphBuilder {\n\n private val froms = ArrayList()\n private val tos = ArrayList()\n private val weights = ArrayList()\n\n fun addEdge(from : Int, to : Int, weight : Int = 1) {\n addDirectedEdge(from, to, weight)\n addDirectedEdge(to, from, weight)\n }\n\n fun addDirectedEdge(from : Int, to : Int, weight : Int = 1) {\n froms.add(from)\n tos.add(to)\n weights.add(weight)\n }\n\n private fun calculateFromSizes(n : Int) : IntArray {\n val sizes = IntArray(n) { 0 }\n froms.forEach { ++sizes[it] }\n return sizes\n }\n\n fun build(n : Int) : Graph {\n val sizes = calculateFromSizes(n)\n\n val graph = Graph(n) { IntArray(sizes[it]) { 0 } }\n\n for (i in 0 until n) {\n sizes[i] = 0\n }\n\n for (i in 0 until froms.size) {\n val from = froms[i]\n val to = tos[i]\n\n graph[from][sizes[from]++] = to\n }\n\n return graph\n }\n\n fun buildWeighted(n : Int) : WeightedGraph {\n val sizes = calculateFromSizes(n)\n\n val graph = WeightedGraph(n) { EdgeArray(sizes[it]) { -1 to 0 } }\n\n for (i in 0 until n) {\n sizes[i] = 0\n }\n\n for (i in 0 until froms.size) {\n val from = froms[i]\n val to = tos[i]\n val weight = weights[i]\n\n graph[from][sizes[from]++] = to to weight\n }\n\n return graph\n }\n}\n\nfun gcd(a : Int, b : Int) : Int =\n if (a == 0) b else gcd(b % a, a)\n\nfun gcd(a : Long, b : Long) : Long =\n if (a == 0L) b else gcd(b % a, a)\n\nfun getDivisors(x : Int) : MutableList {\n val divisors = ArrayList()\n\n var d = 1\n while (d * d <= x) {\n if (x % d == 0) {\n if (d != 1) divisors.add(d)\n if (x != d) divisors.add(x / d)\n }\n\n ++d\n }\n\n return divisors\n}\n\nfun getPrimeDivisors(xx : Int) : MutableList {\n val divisors = ArrayList()\n\n var d = 2\n var x = xx\n while (d * d <= x) {\n if (x % d == 0) {\n divisors.add(d)\n while (x % d == 0) {\n x /= d\n }\n }\n\n ++d\n }\n\n if (x > 1) divisors.add(x)\n\n return divisors\n}\n\nfun checkIndex(index : Int, size : Int) =\n 0 <= index && index < size\n\nfun checkCell(x : Int, n : Int, y : Int, m : Int) =\n checkIndex(x, n) && checkIndex(y, m)\n\nfun toChar(index : Int, start : Char) =\n (index + start.toInt()).toChar()\n\nclass DSU {\n\n var sizes : IntArray\n var ranks : IntArray\n var parents : IntArray\n\n constructor(n : Int)\n : this(\n IntArray(n) { 1 }\n )\n\n constructor(sizes : IntArray) {\n val size = sizes.size\n this.sizes = sizes\n this.ranks = IntArray(size) { 1 }\n this.parents = IntArray(size) { it }\n }\n\n operator fun get(v : Int) : Int {\n val parent = parents[v]\n if (parent == v) return v\n parents[v] = get(parent)\n return parents[v]\n }\n\n fun union(aUniting : Int, bUniting : Int) : Boolean {\n var a = get(aUniting)\n var b = get(bUniting)\n\n if (a == b) return false\n\n if (ranks[a] < ranks[b]) {\n val tmp = a\n a = b\n b = tmp\n }\n\n parents[b] = a\n sizes[a] += sizes[b]\n if (ranks[a] == ranks[b]) ++ranks[a]\n\n return true\n }\n\n fun size(v : Int) : Int = sizes[get(v)]\n}\n\nclass FenwickTree(n : Int) {\n\n val size = n + 1\n val tree = LongArray(size) { 0L }\n\n fun update(index : Int, delta : Int) {\n var x = index + 1\n while (x < size) {\n tree[x] = tree[x] + delta\n x += x and -x\n }\n }\n\n operator fun get(start : Int, end : Int) =\n get(end) - get(start - 1)\n\n operator fun get(index : Int) : Long {\n var result : Long = 0\n\n var x = index + 1\n while (x > 0) {\n result += tree[x]\n x -= x and -x\n }\n\n return result\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "2fcb951bf3e61938d47de796be8df446", "src_uid": "1db5631847085815461c617854b08ee5", "apr_id": "1f404440598b98adcf1a7972677d27db", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9826897470039947, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.ArrayList\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n var n = ir.nextInt()\n val res = IntArray(3)\n val max = IntArray(3)\n\n for (i in 0..2) {\n res[i] = ir.nextInt()\n n -= res[i]\n max[i] = ir.nextInt()\n }\n\n for (i in 0..2)\n if (max[i] - res[i] < n) {\n res[i] = max[i]\n n = n - max[i] + res[i]\n } else {\n res[i] += n\n break\n }\n\n for (i in 0..2)\n pw.print(\"${res[i]} \")\n\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextFloat(): Float {\n return java.lang.Float.parseFloat(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "5492b8545173b80c1aedb091ab38f1ee", "src_uid": "3cd092b6507079518cf206deab21cf97", "apr_id": "2f7cb85853f72bb77eed68239af1aa12", "difficulty": 1100, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7975646879756468, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.max\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val (n, a, b, c) = readInts()\n\n var ans = Int.MIN_VALUE\n for (i in 0.rangeTo(n / a + 1)) {\n for (j in 0.rangeTo(n / b + 1)) {\n for (k in 0.rangeTo(n / c + 1)) {\n val sum = i * a + j * b + k * c\n if (sum == n) {\n ans = max(i + j + k, ans)\n }\n }\n }\n }\n println(ans)\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "619efe0fa6072562eadb4d1b85854d1f", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "5cfdf62a75c9dcb3b45b98d60e3811ee", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8465608465608465, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val (n, a, b, c) = readLine()!!.split(' ').map { it.toInt() }\n val r = IntArray(n + 1)\n\n r[a] = 1\n r[b] = 1\n r[c] = 1\n\n fun pr(p: Int) = if (p > 0 && r[p] > 0) r[p] + 1 else -1\n\n for (i in 1..n) {\n r[i] = arrayOf(r[i], pr(i - a) , pr(i - b), pr(i - c)).max()!!\n }\n\n println(r[n])\n}", "lang": "Kotlin", "bug_code_uid": "1b48392dfee84e591fa7580a0baa2026", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "31ebd3a68866cdf5b556de9f13943fdb", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9559164733178654, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "package com.example.myapplication\n\nimport java.util.*\n\nfun main() {\n val n: Int\n val a: Int\n val b: Int\n val c: Int\n\n with(Scanner(System.`in`)) {\n n = nextInt()\n a = nextInt()\n b = nextInt()\n c = nextInt()\n }\n\n val max1 = maxOf(a, b, c)\n val max2 = if (max1 == a) maxOf(b, c) else if (max1 == b) maxOf(a, c) else maxOf(a, b)\n val max3 = minOf(a, b, c)\n\n var result = 4000\n\n for(i1 in n / max1 downTo 0) {\n val remains1 = n - i1 * max1\n if (remains1 == 0 && i1 == 1) continue\n for(i2 in remains1 / max2 downTo 0) {\n val remains2 = remains1 - i2 * max2\n if (remains2 == 0 && i1 == 0 && i2 ==1) continue\n if (remains2 % max3 == 0 && i1 + i2 + remains2 / max3 != 1) {\n result = minOf(i1 + i2 + remains2 / max3, result)\n }\n }\n }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "89a838eff557eb064f054b8f75cdb5a9", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "aa7712f9211b1ecb1b80ff33a5539780", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6784741144414169, "equal_cnt": 32, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 23, "fix_ops_cnt": 32, "bug_source_code": "// 4/18/2020 4:20 PM\n// https://codeforces.com/problemset/problem/189/A\n\n//package p189\n\nimport java.util.*\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nlateinit var lengthOptions: Array\n\n// TODO: fix it because it's taking too long on test#38:\n// 3999 2 2 3999\n\nfun main() {\n val (len, a, b, c) = readInts()\n lengthOptions = arrayOf(a, b, c).distinct().sorted().toTypedArray()\n\n val pq = PriorityQueue()\n pq.add(RibbonConfiguration(len, 1))\n\n var maxPieces = 1\n while (!pq.isEmpty() && pq.peek().maxPieces >= maxPieces) {\n val top = pq.poll()\n\n if (top.remainingLength == 0) {\n maxPieces = maxOf(top.nPieces - 1, maxPieces)\n } else if (top.remainingLength % lengthOptions[0] == 0) {\n pq.add(RibbonConfiguration(0, top.nPieces + (top.remainingLength / lengthOptions[0])))\n } else {\n for (length in lengthOptions) {\n if (top.remainingLength - length >= 0)\n pq.add(RibbonConfiguration(top.remainingLength - length, top.nPieces + 1))\n }\n\n }\n }\n println(maxPieces)\n}\n\n// OK this is spectacularly too slow\n// maybe some sort of priority queue to weed out unpromising candidates?\n// we know the best answer is going to be mostly with smallest cuts\n// so we need a cost function or something like that... let's make it nCuts + n / min(a, b, c)\n\n// https://codereview.stackexchange.com/questions/175291/minimum-priority-queue-implementation-in-kotlin\n// https://docs.oracle.com/javase/7/docs/api/java/util/PriorityQueue.html\n// NB: how to use java objects in kotlin???\n\n//fun getMaxCuts(n: Int, a: Int, b: Int, c: Int): Int {\n// return getMaxCuts(n, a, b, c, 0)\n//}\n//\n//fun getMaxCuts(n: Int, a: Int, b: Int, c: Int, nCuts: Int) : Int {\n// if (n < 0)\n// return 0\n// if (n == 0)\n// return nCuts\n// return maxOf(\n// getMaxCuts(n-a, a, b, c, nCuts + 1),\n// getMaxCuts(n-b, a, b, c, nCuts + 1),\n// getMaxCuts(n-c, a, b, c, nCuts + 1))\n//}\n\nclass RibbonConfiguration(val remainingLength: Int, val nPieces: Int) : Comparable {\n val maxPieces = nPieces + (remainingLength / lengthOptions[0]) - 1\n\n override operator fun compareTo(other: RibbonConfiguration): Int {\n // make it opposite b/c java has LEAST pq by default\n return compareValues(other.maxPieces, maxPieces)\n }\n\n override fun toString(): String {\n return \"$nPieces piece w/ $remainingLength left ($maxPieces max)\"\n }\n\n\n\n}", "lang": "Kotlin", "bug_code_uid": "3a26d4a08013f8f2333085236828a49c", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "6bb4d13530b641451959b7d05381c319", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9758551307847082, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val (n, a, b, c) = readLine()!!.split(\" \").map { it.toInt() }\n println(ex1(n, a, b, c))\n}\n\nfun ex1(n: Int, a: Int, b: Int, c: Int): Int {\n var answer = 0\n for (ia in 0..n) {\n for (ib in 0..n) {\n val num = n - ib * b - ia * a\n if (num < 0) break\n if (num % c == 0) {\n val ic = num / c\n answer = max(answer, ia + ib + ic)\n }\n }\n }\n\n return answer\n}", "lang": "Kotlin", "bug_code_uid": "d0697b1287307711c744329c551fa886", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "b9ffaa84e1280669fb0c77722816d40c", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7103781174577635, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "/**\n * Created by yaroslav.ovcharenko on 11/28/16.\n */\nfun main(args: Array) {\n// val input = listOf(\"5\", \"5\", \"3\", \"2\").map(String::toInt)\n// val input = listOf(\"7\", \"5\", \"5\", \"2\").map(String::toInt)\n// val input = listOf(\"10\", \"1\", \"9\", \"123\").map(String::toInt)\n val input = readLine()!!.split(\" \").map(String::toInt)\n println(getAnswer(input).toString())\n}\n\nfun getAnswer(inputRaw: List):Int {\n val length = inputRaw[0]\n\n val inputSorted = inputRaw.subList(1, inputRaw.size).sorted()\n val a = inputSorted[0]\n val b = inputSorted[1]\n val c = inputSorted[2]\n if (a == 1 || b==1 || c==1) return length\n if (a == length && b==length && c==length) return 1\n return getNumOfPieces(a, b, c, length)\n}\n\nfun getNumOfPieces(a:Int, b:Int, c:Int, length:Int):Int {\n if(length == 0) return 0\n if(length < 0) return Int.MIN_VALUE\n if (length % a == 0) return length/a //a is smallest\n return listOf(\n 1+getNumOfPieces(a, b, c, length-a),\n 1+getNumOfPieces(a, b, c, length-b),\n 1+getNumOfPieces(a, b, c, length-c))\n .max()!!\n}", "lang": "Kotlin", "bug_code_uid": "e55d5deb19148c6170e621fe2bd02bb3", "src_uid": "062a171cc3ea717ea95ede9d7a1c3a43", "apr_id": "66b41a5d881f193a2ede52005828c609", "difficulty": 1300, "tags": ["dp", "brute force"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5264586160108549, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "fun main(){\n val s = readLine()!!\n var repeat = 0\n for (i in 0..s.length-1){\n for (j in (i+1)..s.length -1) {\n if (s[i].compareTo(s[j]) == 0) repeat++\n }\n }\n if ((s.length - repeat) % 2 == 0) println(\"CHAT WITH HER!\") else println(\"IGNORE HIM!\")\n}\n", "lang": "Kotlin", "bug_code_uid": "d638837d425c11d5802c187a5229fc7b", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "b36a2bde2d0eab78094953e0f42ae55f", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9415584415584416, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package com.test\n\nfun main() {\n println(if (hashSetOf().apply { addAll(readLine()!!.toList()) }.size % 2 == 0) \"CHAT WITH HER!\" else \"IGNORE HIM!\")\n}\n\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "3c3a204d5bf465cf94946f7f6f6a7440", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "4cdb192b69c3359ed1b0a5c6799fdf25", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.32421680755842863, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "\nfun main(){\n val input = readLine()\n val listChar = mutableListOf()\n input!!.forEach {\n if(!listChar.contains(it.toString())){\n listChar += it.toString()\n }\n }\n if(listChar.size and 1 == 0){\n // the number of distinct chars is even\n println(\"IGNORE HIM!\")\n }\n else{\n // the number of distinct chars is odd\n println(\"CHAT WITH HER!\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "a6e5b3461a0e55657b7caa1087d0c54d", "src_uid": "a8c14667b94b40da087501fd4bdd7818", "apr_id": "f05f07a7a0dded63037945fb3016dea2", "difficulty": 800, "tags": ["strings", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9621061029118468, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n var x = scanner.nextLong()\n var y = scanner.nextLong()\n val m = scanner.nextLong()\n\n if (x <= 0 && y <= 0) {\n if (checkExcellent(x, y, m)) {\n System.out.println(0)\n } else {\n System.out.println(-1)\n }\n return\n }\n\n if (x < y) {\n val temp = x\n x = y\n y = temp\n }\n\n var ans: Long = 0\n\n //System.out.println(\"$x $y\")\n\n if (y < 0) {\n val tmp = x - y\n ans += tmp / x\n y += ans * x\n }\n\n if (checkExcellent(x, y, m)) {\n System.out.println(ans)\n return\n }\n\n while (true) {\n if (x < y) {\n x += y\n ans++\n if (checkExcellent(x, y, m)) {\n System.out.println(ans)\n return\n }\n } else {\n y += x\n ans++\n if (checkExcellent(x, y, m)) {\n System.out.println(ans)\n return\n }\n }\n }\n\n\n}\n\nfun checkExcellent(x: Long, y: Long, m: Long): Boolean {\n return Math.max(x, y) >= m\n}\n\n\nenum class Type {\n OPEN, CLOSE\n}", "lang": "Kotlin", "bug_code_uid": "477f6f59db35e9602728bb680e98d202", "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821", "apr_id": "9406e73432d861f240e2b7b1971c7aaa", "difficulty": 1600, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.792572463768116, "equal_cnt": 15, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 13, "fix_ops_cnt": 14, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n\n var x = scanner.nextLong()\n var y = scanner.nextLong()\n val m = scanner.nextLong()\n\n if (x <= 0 && y <= 0) {\n if (checkExcellent(x, y, m)) {\n System.out.println(0)\n } else {\n System.out.println(-1)\n }\n return\n }\n\n var ans: Long = 0\n\n while (true) {\n if (x= m\n}\n\n\nenum class Type {\n OPEN, CLOSE\n}", "lang": "Kotlin", "bug_code_uid": "8b430da25a6731a3f1d62fdfe974ffde", "src_uid": "82026a3c3d9a6bda2e2ac6e14979d821", "apr_id": "9406e73432d861f240e2b7b1971c7aaa", "difficulty": 1600, "tags": ["math", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.17204301075268819, "equal_cnt": 11, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n var (P, Y) = arrayOf(nextInt(), nextInt())\n while(Y >= 0 && firstDivisor(Y) <= P) Y--;\n println(Y)\n}\n\nfun firstDivisor(y: Int) : Int {\n for(i in 2..y/2)\n if(y % i == 0)\n return i\n return y\n}", "lang": "Kotlin", "bug_code_uid": "6877387ae7d655853f75ae26f7bb38ca", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "apr_id": "ae78ad0c4d61603a200633a5e06b2122", "difficulty": 1400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.1519756838905775, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)) {\n var (P, Y) = arrayOf(nextInt(), nextInt())\n var x = -1\n while(Y >= P) {\n if(firstDivisor(Y) > P)\n x = Y\n Y--\n };\n println(x)\n}\n\nfun firstDivisor(y: Int) : Int {\n for(i in 2..y/2)\n if(y % i == 0)\n return i\n return y\n}", "lang": "Kotlin", "bug_code_uid": "8af5333e142de3301ec9fb3fed88c2e3", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "apr_id": "ae78ad0c4d61603a200633a5e06b2122", "difficulty": 1400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9875424688561721, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.system.exitProcess\n\nfun main(){\n var s = readLine()!!.split(' ')\n var p = s[0].toInt()\n var y = s[1].toInt()\n for(x in y downTo p + 1) {\n var ok = true\n for(i in 2 until x){\n if(x % i == 0){\n ok = false\n break\n }\n if(i * i >= x) break\n }\n if(ok){\n print(x)\n exitProcess(0)\n }\n }\n print(-1)\n}\n", "lang": "Kotlin", "bug_code_uid": "4ed4a0e88062c8e15047d6d12111601a", "src_uid": "b533203f488fa4caf105f3f46dd5844d", "apr_id": "f5cd7ad6e2d0948342b626e3812a99d8", "difficulty": 1400, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.700990099009901, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate val regSpace = \"\\\\s+\".toRegex()\n\nprivate fun readSomeInts(): List {\n val line = readLn().trim()\n val strlst = line.split(regSpace)\n return strlst.map { it.toInt() }\n}\n\nfun main() {\n val a = readInt()\n val s = \"$a\"\n val ls = s.map { c -> c.toInt() }\n val lsum = ls.sum()\n val mod4 = lsum % 4\n val inum = if (mod4 == 0) a else a + 4 - mod4\n\n println(\"$inum\")\n\n}\n", "lang": "Kotlin", "bug_code_uid": "b70eca2d2056e82f2e1485a7736630b2", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "3b14773f1588c9983ae57ca90b1cee6c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9431643625192012, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n var n = r.readLine()!!.toInt()\n //val v = r.readLine()!!.split(\" \").map { it.toInt() }\n fun ok(int: Int):Boolean = int.toString().split(\" \").filter { it.length>0 }.map { it.toInt() }.sum()%4==0\n while (!ok(n)) n++\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "3684c9bc92925eb50a01892f3e7bf485", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "6c0ab5ba18638d2a34bf3df703514e8a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.99609375, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n var a = readLine()!!.toInt()\n while (true) {\n val n = ++a\n var s = 0\n n.toString().forEach { s += it.toInt() }\n if (s % 4 == 0) {\n println(n)\n return\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "8338472761bb0029f1351c0b2fbb5561", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "df38c819b7cbf47bc6e3d9ebd570869d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9978070175438597, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args:Array) {\n\n println(interestingNumber(Integer.parseInt(readLine())))\n\n\n\n}\n\n\nfun interestingNumber( n : Int): Int {\n\n if (sum(n)%4==0 )\n return n\n else {\n\n for (i in n..1000) {\n if (sum(i)% 4 == 0 )\n return i\n\n }\n }\n return -1\n\n}\n\n\nfun sum( n : Int):Int{\n var sum : Int=0\n var i : Int = n\n while (i!=0){\n sum +=(i%10)\n i /=10\n }\n return sum\n\n}", "lang": "Kotlin", "bug_code_uid": "2c3915a63c44c439e317b8c36d575e53", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "f24bb87629c1f96c059d3f85ea06ca49", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4300578034682081, "equal_cnt": 4, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n\n val n = readLine()!!\n\n val s = n.toCharArray().map { it.toString().toInt() }.toIntArray()\n\n\n if (s.sum() % 4 == 0) {\n println(n)\n } else {\n\n while (s.sum() % 4 != 0) {\n val v = s[s.size - 1]\n s[s.size - 1] = v + 1\n }\n\n var res = 0\n var p = 1\n for (i in 0 until s.size) {\n res += p * s[s.size - i -1]\n p *= 10\n }\n println(res)\n\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "eb8a4daf1b48cd65f449c8326a77b03f", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "c78c9e98d87f6e9217fb26ad8140edbb", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9239766081871345, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.stream.IntStream.range\n\nfun main() {\n\n val n = readLine()!!\n\n val s = n.toCharArray().map { it.toString().toInt() }.toIntArray()\n\n\n if (s.sum() % 4 == 0) {\n println(n)\n } else {\n\n val nn = n.toInt()\n val l = range(0, 10).map { it + nn }.toArray()!!\n\n val filter = l.filter { it.toString().toCharArray().map { c -> c.toString().toInt() }.sum() % 4 == 0 }\n println(filter.first())\n\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "349a57148821c7968e590b4e8c71e455", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "c78c9e98d87f6e9217fb26ad8140edbb", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9180327868852459, "equal_cnt": 7, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n while(sumNum(n)%4 != 0) n++;\n println(n)\n}\n\nfun sumNum(n: Int): Int {\n var sum = 0;\n while(n > 0) {\n sum += n%10\n n /= 10\n }\n return sum\n}", "lang": "Kotlin", "bug_code_uid": "1a3d7389815123f46bc68e1f7b544dae", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7", "apr_id": "e34f0524e978074051aa1b51ff20ef02", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5806451612903226, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 6, "fix_ops_cnt": 13, "bug_source_code": "fun main(args: Array) {\n val (n,m)=readLine()!!.split(' ').take(2).map { it.toInt() }\n val x = readLine()!!.toInt().dec()\n val (r, c) = n - 2 * x to m - 2 * x\n val ans =\n if (r<0 || c<0)\n 0\n else\n ((r / 2) * ((c+1)/ 2)) + ((r - (r / 2)) * (if (c > 1) (c / 2) else 1))\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "f615b44853cee563166fd6d09b3df45b", "src_uid": "fa1ef5f9bceeb7266cc597ba8f2161cb", "apr_id": "a70a7a4ea0d596b1b82e4f94ea155770", "difficulty": 1600, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.18125960061443933, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import utils.io.FastScanner\n\nprivate val MOD = 1e9.toInt() + 7\n\nprivate val input = FastScanner()\n\nfun main(args: Array) = input.run {\n val n = nextInt()\n val a = nextInts(n)\n val max = a.max()!!\n println(Math.max(0, max - 25))\n}\n", "lang": "Kotlin", "bug_code_uid": "e070584b1a320dabe38c1e44cffdb71e", "src_uid": "ef657588b4f2fe8b2ff5f8edc0ab8afd", "apr_id": "72bdbe358474ff6e8f7cf1edd2d3fe77", "difficulty": 800, "tags": ["greedy", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.08903757076685538, "equal_cnt": 78, "replace_cnt": 61, "delete_cnt": 8, "insert_cnt": 10, "fix_ops_cnt": 79, "bug_source_code": "import java.awt.Point;\nimport java.io.*;\nimport java.util.*;\nimport java.math.BigInteger;\n\npublic class EasyNum {\n static boolean[] primes;\n static int[] memo;\n static int mod = (1<<30);\n public static void main(String[] args) {\n MyReader mr = new MyReader();\n\n int a = mr.nextInt();\n int b = mr.nextInt();\n int c = mr.nextInt();\n\n memo = new int[a*b*c+1];\n primes = new boolean[a*b*c+1];\n\n initPrimes();\n\n int res = 0;\n\n for (int i = 1; i <= a; i++)\n for(int j = 1; j<=b;j++)\n for(int k = 1; k<=c ;k++){\n int val = i*j*k;\n if(memo[val] == 0){\n memo[val] = findDiv(val);\n }\n\n res+=memo[val];\n res%=mod;\n }\n\n\n System.out.println(res);\n\n\n }\n\n private static int findDiv(int val) {\n int res = 1;\n for (int i = 2;i<=val;i++){\n if(primes[i] && val%i == 0){\n int count = 0;\n while (val%i == 0){\n count++;\n val/=i;\n }\n\n res=res*(count+1);\n }\n }\n\n return res;\n }\n\n private static void initPrimes() {\n Arrays.fill(primes,true);\n int n = primes.length;\n for (int i = 2; i < n; i++) {\n if (primes[i]){\n for (int j = 2; j*i < n ; j+=i) {\n primes[j*i] = false;\n }\n }\n }\n }\n\n static class MyReader {\n BufferedReader br;\n StringTokenizer st;\n\n MyReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n\n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (Exception e) {\n e.printStackTrace();\n }\n }\n\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\n return Double.parseDouble(next());\n }\n\n String nextLine() {\n String res = \"\";\n try {\n res = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n return res;\n }\n\n Integer[] nextIntArray(int n) {\n Integer[] arr = new Integer[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextInt();\n }\n\n return arr;\n }\n\n Long[] nextLongArray(int n) {\n Long[] arr = new Long[n];\n for (int i = 0; i < n; i++) {\n arr[i] = nextLong();\n }\n\n return arr;\n }\n\n String[] nextStringArray(int n) {\n String[] arr = new String[n];\n for (int i = 0; i < n; i++) {\n arr[i] = next();\n }\n return arr;\n }\n }\n\n static void swap(int[] arr, int i, int j) {\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "bd03e68af1bf092587a7384c7828894d", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "apr_id": "4d1a78aca5f5143dfdf5d8ffa3a7e7fe", "difficulty": 1300, "tags": ["number theory", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5097276264591439, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "import java.util.*\n const val MOD = 1073741824\nfun div( n:Int):Int\n{\n var c:Int=0\n for( i in 1 until n+1)\n {\n if(n%i==0)\n {\n c++\n }\n }\n return c\n}\n\n fun main(args: Array) {\n var s=Scanner(System.`in`)\n var i: Int\n var j: Int\n var k: Int\n val a: Int\n val b: Int\n val c: Int\n var ans: Long\n a = s.nextInt()\n b = s.nextInt()\n c = s.nextInt()\n\n ans = 0\n i = 1\n while (i <= a) {\n j = 1\n while (j <= b) {\n k = 1\n while (k <= c) {\n ans += div(i * j * k)\n k++\n }\n j++\n }\n i++\n }\n print(ans % MOD)\n }\n", "lang": "Kotlin", "bug_code_uid": "2690a305251ebebbea9cc7f70a3d39d9", "src_uid": "4fdd4027dd9cd688fcc70e1076c9b401", "apr_id": "5b072d1e0949113aa42f2b9e8eb61a6c", "difficulty": 1300, "tags": ["number theory", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6956521739130435, "equal_cnt": 9, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "fun main(vararg args: String) {\n val (n, a, b, c) = readLine()!!.split(' ').map { it.toInt() }\n println(when (4 - n % 4) {\n 3 -> listOf(3*a, a+b, c).min()\n 2 -> listOf(2*a, b, 2*c).min()\n 1 -> listOf(a, b+c).min()\n else -> 0\n })\n}\n", "lang": "Kotlin", "bug_code_uid": "3fd30df36b656461072009948b9e3b98", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "apr_id": "6fd3109ea8a63816bd473dd873649eed", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9857549857549858, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n fun readLongs(): List {\n return readLine()!!.split(\" \").map(String::toLong)\n }\n\n val (n, a, b, c) = readLongs()\n when (n % 4) {\n 0L -> print(0)\n 1L -> print(min(3 * a, min(a + b, c)))\n 2L -> print(min(2 * a, min(b, 2*c)))\n 3L -> print(min(a, b+c))\n }\n}", "lang": "Kotlin", "bug_code_uid": "1704d3af2af7bc561f327070d6db0b57", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8", "apr_id": "27e40fed299308fc58603ccd11f0bab9", "difficulty": 1300, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9960159362549801, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nval reader = Scanner(System.`in`)\nfun main(args: Array){\n val k = reader.nextBigInteger()\n val l = reader.nextBigInteger()\n\n var i = 1\n var po = k.pow(i)\n\n while (po < l)\n {\n po = k.pow(++i)\n if(po == l)\n {\n println(\"YES\")\n print(i-1)\n return\n }\n }\n\n print(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "562745f2ae8976ca7d303e607da01c2f", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46", "apr_id": "047bb34b20cc43a773df9cd2a7173291", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8482731858750485, "equal_cnt": 10, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.StringTokenizer\n\nval mod = (1e9 + 7).toInt()\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n\n val n = sc.nextLong()\n val m = sc.nextLong()\n val k = sc.nextInt()\n\n if (n == 1L) {\n if (k == 1) {\n println(1)\n }\n if (k == -1) {\n if (m % 2 == 1L) println(1)\n else println(0)\n }\n return\n }\n\n if (m == 1L) {\n if (k == 1) {\n println(1)\n }\n if (k == -1) {\n if (n % 2 == 1L) println(1)\n else println(0)\n }\n return\n }\n\n println(pow(pow(2, m - 1), n - 1))\n}\n\nfun pow(x: Long, y: Long): Long {\n var y = y\n\n var res = 1L\n var deg = x\n while (y > 0) {\n if (y % 2 == 1L) {\n res = (res * deg) % mod\n }\n deg = (deg * deg) % mod\n y /= 2\n }\n\n\n return res\n}\n\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "66cc77707c2fdcbf411bbb8766e044fd", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "4154509dcfc6e06d99e047dc9f20a7d6", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9982409850483729, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.StringTokenizer\n\nval mod = (1e9 + 7).toInt()\n\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n\n val n = sc.nextLong()\n val m = sc.nextLong()\n val k = sc.nextInt()\n\n if (k == -1 && (n + m) % 2 == 1L) {\n println(0)\n return\n }\n\n\n println(pow(pow(2, m - 1), n - 1))\n\n}\n\nfun pow(x: Long, y: Long): Long {\n var y = y % (mod - 1)\n\n var res = 1L\n var deg = x\n while (y > 0) {\n if (y % 2 == 1L) {\n res = (res * deg) % mod\n }\n deg = (deg * deg) % mod\n y /= 2\n }\n\n return res\n}\n\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n", "lang": "Kotlin", "bug_code_uid": "0006ac9250c32d00cd2db399a15aaeb3", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "4154509dcfc6e06d99e047dc9f20a7d6", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9974795211090107, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\n\nval modulo : Long = 1000000007L\n\ntailrec fun modPow(n : Long, m : Long) : Long {\n if(m == 0L) return 1\n if(m == 1L) return n % modulo\n val vur = if(m % 2L == 0L) 1L else n % modulo\n val a = modPow(n,m / 2) % modulo;\n return (vur % modulo * a % modulo * a % modulo) % modulo\n}\n\nfun solve() {\n var n = nextLong()\n var m = nextLong()\n var k = nextInt()\n if(k == -1 && (n % 2) + (m % 2) != 0L){\n pw.println(0)\n }else pw.println(modPow(modPow(2, n - 1), m - 1))\n}\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextLine() = if(hasNext()) st.nextToken(\"\\n\")!! else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n,{nextInt()})\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nval br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nval pw = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "5b472ed8487b20ca4e09bbd3d8794c8a", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "de74a37626e12e420900487d485816ac", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.780502949394598, "equal_cnt": 11, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 11, "bug_source_code": "import java.io.*\nimport java.util.*\n\nvar modulo : Long = 1000000007L\n\nfun modPow(n : Long, m : Long) : Long {\n if(m == 0L) return 1\n if(m == 1L) return n % 1000000007\n else if(m % 2L != 0L) return (n % 1000000007 * modPow(n,m / 2) % 1000000007 * modPow(n , m / 2) % 1000000007) % 1000000007\n else return (modPow(n,m / 2) % 1000000007 * modPow(n, m / 2) % 1000000007) % 1000000007\n}\n\nfun solve() {\n var n = nextLong()\n var m = nextLong()\n if(m == 1L) {\n pw.println(modPow(2,n - 1))\n }else {\n pw.println(modPow(modPow(2, n - 1), m - 1))\n }\n}\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextLine() = if(hasNext()) st.nextToken(\"\\n\")!! else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n,{nextInt()})\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nval br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nval pw = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}\n", "lang": "Kotlin", "bug_code_uid": "88099ffb80e9dbe2804f26e593cbe89a", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "de74a37626e12e420900487d485816ac", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9585762503835532, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.io.*\nimport java.util.*\n\nval modulo : Long = 1000000007L\n\ntailrec fun modPow(n : Long, m : Long) : Long {\n if(m == 0L) return 1\n if(m == 1L) return n % modulo\n val vur = if(m % 2L == 0L) 1L else n % modulo\n val a = modPow(n,m / 2) % modulo;\n return (vur % modulo * a % modulo * a % modulo) % modulo\n}\n\nfun solve() {\n var n = nextLong()\n var m = nextLong()\n if(n > m) {\n var temp = m;\n m = n;\n n = temp;\n }\n var k = nextInt()\n if(k == -1 && m + n % 2 == 0L){\n pw.println(0)\n }else pw.println(modPow(2, (n - 1) % modulo * (m - 1) % modulo)\n}\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextLine() = if(hasNext()) st.nextToken(\"\\n\")!! else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n,{nextInt()})\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nval br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nval pw = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "beb8946dbab631be9a82f329ccb6f998", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "de74a37626e12e420900487d485816ac", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8106995884773662, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.io.FileInputStream\n\n\nval MOD : Long = 1000000007L\nconst val mod : Int = (1e9 + 7).toInt();\n\n\nfun main(args: Array) {\n// System.setIn(FileInputStream(\"./B/input3\"));\n\n val (nRow, nCol, k) = readLine()!!.split(' ').map(String::toLong)\n\n if (nRow < 2 || nCol < 2) {\n println(1)\n return\n }\n\n if (k == -1L) {\n if ((nRow + nCol) % 2 == 1L) {\n println(0)\n return\n }\n }\n\n val dofRow = (nRow - 1)\n val dofCol = (nCol - 1)\n\n// val x1 = qpow(2, dofCol)\n// val x2 = qpow(x1, dofRow)\n val x1 = powmod(2, dofCol)\n val x2 = powmod(x1, dofRow)\n println(x2)\n}\n\nfun qpow(x: Long, exp: Long) : Long {\n var exp_ = exp % (MOD - 1)\n var res : Long = 1L\n var mult = x\n while (exp_ > 0) {\n if (exp_ % 2 == 1L) {\n res = (res * mult) % MOD\n }\n mult = (mult * mult) % MOD\n exp_ /= 2\n }\n return res % MOD\n}\n\n\nfun powmod(x: Long, y: Long) : Long {\n var ret = 1L;\n var y_ = y % (mod - 1)\n var x_ = x\n while( y_ > 0){\n if(1 == (y_ % 2).toInt()) {\n ret = (ret * x_) % mod\n }\n y_ /= 2\n x_ = (x_ * x_) % mod;\n }\n return ret;\n}", "lang": "Kotlin", "bug_code_uid": "31cf5eee4923bc12e16c69a3bf9179ca", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "ca236bab5c5a6128ec89084065d2aff5", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.38526315789473686, "equal_cnt": 18, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 6, "fix_ops_cnt": 18, "bug_source_code": "import java.io.FileInputStream\n\nval MOD : Long = 1000000007\n\nfun runningFromIntelliJ(): Boolean {\n val classPath = System.getProperty(\"java.class.path\")\n return classPath.contains(\"idea_rt.jar\")\n}\n\nfun main(args: Array) {\n if (runningFromIntelliJ())\n System.setIn(FileInputStream(\"./B/input4\"));\n\n val (nRow, nCol, k) = readLine()!!.split(' ').map(String::toLong)\n\n if (nRow < 2 || nCol < 2) {\n println(1)\n return\n }\n\n val dofRow = (nRow - 1) % MOD\n val dofCol = (nCol - 1) % MOD\n val dofTotal = (dofCol * dofRow) % MOD\n\n var res : Long = 1\n for (i in 1..dofTotal) {\n res = (res * 2) % MOD\n }\n\n println(res)\n}\n", "lang": "Kotlin", "bug_code_uid": "72a31b411cbedee6c1aaf6a4f5a81159", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "ca236bab5c5a6128ec89084065d2aff5", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.38493723849372385, "equal_cnt": 18, "replace_cnt": 8, "delete_cnt": 4, "insert_cnt": 6, "fix_ops_cnt": 18, "bug_source_code": "import java.io.FileInputStream\n\nval MOD : Long = 1000000007\n\n//fun runningFromIntelliJ(): Boolean {\n// val classPath = System.getProperty(\"java.class.path\")\n// return classPath.contains(\"idea_rt.jar\")\n//}\n\nfun main(args: Array) {\n// if (runningFromIntelliJ())\n// System.setIn(FileInputStream(\"./B/input4\"));\n\n val (nRow, nCol, k) = readLine()!!.split(' ').map(String::toLong)\n\n if (nRow < 2 || nCol < 2) {\n println(1)\n return\n }\n\n val dofRow = (nRow - 1) % MOD\n val dofCol = (nCol - 1) % MOD\n val dofTotal = (dofCol * dofRow) % MOD\n\n var res : Long = 1\n for (i in 1..dofTotal) {\n res = (res * 2) % MOD\n }\n\n println(res)\n}\n", "lang": "Kotlin", "bug_code_uid": "3104b83c4f7be70196cb40d2b83dc0ae", "src_uid": "6b9eff690fae14725885cbc891ff7243", "apr_id": "ca236bab5c5a6128ec89084065d2aff5", "difficulty": 1800, "tags": ["math", "combinatorics", "number theory", "constructive algorithms"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8425965210012728, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nfun main(args : Array) {\n val (a1, b1) = readLine()!!.split(':')\n val (a2, b2) = readLine()!!.split(':')\n var h1 = a1.toInt()\n var m1 = b1.toInt()\n var h2 = a2.toInt()\n var m2 = b2.toInt()\n\n var d = 0\n var t = 0\n var hn = 0\n var mn = 0\n if(h1==h2){\n d = m2 - m1\n }\n else{\n d = 60*(h2 - h1)+m2-m1\n }\n\n t = d/2\n\n hn = t/60\n mn = t%60\n\n if(mn+m1==60){\n h1 = h1+hn+1\n if(h1<10){\n print(0)\n print(h1)\n print(':')\n print(\"00\")\n }\n else{\n print(h1)\n print(':')\n print(\"00\")\n }\n }\n else{\n h1 = h1 + hn\n if(h1<10){\n print(0)\n print(h1)\n print(':')\n }\n else{\n print(h1)\n print(':')\n }\n if(mn+m1<10){\n print(0)\n print(mn+m1)\n }\n else{\n print(mn+m1)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "efb76a86b49c5481f9705eee76841368", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "dd6986d872a4285353e70fac335f1e2f", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9975845410628019, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main()\n{\n val (x,y) = readLine()!!.split(\":\").map { it.toInt() }\n val (i,j) = readLine()!!.split(\":\").map { it.toInt() }\n val z = ((i-x)*60+j-y)/2\n var (z1,z2) = listOf(x+z.div(60) + (y+z%60)/60,(y+z%60)%60)\n if (z1<9)\n {\n print(\"0${z1}:\")\n }\n else\n {\n print(\"${z1}:\")\n }\n if (z2<9)\n {\n print(\"0${z2}\")\n }\n else\n {\n print(\"$z2\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "eba1e694349aa10c46749f12a0b083fb", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "912ad950840b27e4fc0ebb73cfb34690", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9228650137741047, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val n = r.readLine()!!.toInt()\n val (a, b) = r.readLine()!!.split(\":\").map { it.toInt() }\n val (c, d) = r.readLine()!!.split(\":\").map { it.toInt() }\n val mid = ((a*60+b)+(c*60+d))/2\n val x = mid/60\n val y = mid%60\n println(\"$x:$y\")\n}", "lang": "Kotlin", "bug_code_uid": "251fbe24d5e67ac7e8fa27c05de4d1d4", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "2da68f0cf67b904471845873e7d9f964", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.851340373679935, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n val a = input.next()\n val b = input.next()\n val (hoursA, minutesA) = a.split(':')\n val (hoursB, minutesB) = b.split(':')\n\n val difMinutes = ((minutesB.toInt() - minutesA.toInt()) + (hoursB.toInt() - hoursA.toInt()) * 60) / 2\n\n val hours = hoursA.toInt() + difMinutes / 60\n val minute = minutesA.toInt() + difMinutes % 60\n val resHours = if (hours < 10) \"0$hours\" else hours.toString()\n val resMinute = if (minute < 10) \"0$minute\" else minute.toString()\n\n println(\"$resHours:$resMinute\")\n}\n", "lang": "Kotlin", "bug_code_uid": "272f244356dbce7e0797382fa4d54f8b", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "7f31409dad8cd5a72d2cf98fa3e8380a", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9956140350877193, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n\n var mid = 0;\n var (h, m) = readLine()!!.split(':').map { it.toInt() }\n mid += h * 60 + m\n\n\n var s = readLine()!!\n h = s.split(':').component1().toInt()\n m = s.split(':').component2().toInt()\n\n mid += h * 60 + m\n //println(\"$h $m $mid\")\n mid /= 2\n //println(mid)\n h = mid / 60\n m = mid % 60\n\n if (h in 1..9) print (\"0\")\n print(\"$h:\")\n if (m in 1..9) print (\"0\")\n print(m)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "b0825f69e0f1dbcb10c4e01b6d8dc818", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "cca00f35378e869fcdb7f6d3485bdca5", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8714596949891068, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main() {\n val scan = Scanner(System.`in`)\n val s1 = scan.next()\n val s2 = scan.next()\n\n val h1 = s1.split(\":\")[0].toInt()\n val m1 = s1.split(\":\")[1].toInt()\n\n val h2 = s2.split(\":\")[0].toInt()\n val m2 = s2.split(\":\")[1].toInt()\n\n val hDiff = (h2 - h1) / 2\n val hLeft = (h2 - h1) % 2\n\n\n //h1 + diff :\n //11:56\n//\n val hourDiff = if (hLeft == 1) 60 else 0\n var mDiff = (m2 - m1 + hourDiff)/ 2\n val hExtra = if (mDiff >= 60){\n mDiff -= 60\n 1\n } else {\n 0\n }\n\n\n val hResult = h1 + hDiff + hExtra\n val mResult = m1 + mDiff\n\n val hResultFormatted = if (hResult < 10) \"0$hResult\" else hResult.toString()\n val mResultFormatted = if (mResult < 10) \"0$mResult\" else mResult.toString()\n\n println(\"$hResultFormatted:$mResultFormatted\")\n}", "lang": "Kotlin", "bug_code_uid": "540db72a0ac54ee0a89057443868b8bf", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "b48fb352a0df9a2e9cfbb46380005d6b", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9824120603015075, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val (sh, sm) = readLine()!!.split(':').map { it.toInt() }\n val (eh, em) = readLine()!!.split(':').map { it.toInt() }\n\n val dm = ((eh - sh) * 60 + (em - sm)) / 2\n val hh = sh + (dm / 60)\n val mm = sm + (dm % 60)\n val hhs = if (hh < 10) \"0$hh\" else hh.toString()\n val mms = if (mm < 10) \"0$mm\" else mm.toString()\n println(\"$hhs:$mms\")\n}", "lang": "Kotlin", "bug_code_uid": "5d7bcf234ab91699f1b79c663f6ef7a6", "src_uid": "f7a32a8325ce97c4c50ce3a5c282ec50", "apr_id": "12b46403b2180123424a3601c19dd2aa", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.99597747385358, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun readLn()=readLine()!!\nprivate fun readInt()=readLn().toInt()\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInts() = readStrings().map { it.toInt() }\nfun readLongs()=readStrings().map{it.toLong()}\nprivate fun lolilover() = println()\nfun max(x : Int, y : Int) : Int{\n if(x > y)return x\n else return y\n}\n\nfun min(x : Long, y : Long) : Long{\n if(x < y)return x\n else return y\n}\n\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val Q = readLine()!!.toLong()\n for (i in 1..Q){\n val(a) = readLine()!!.toLong()\n println((a-1)/2)\n }\n}", "lang": "Kotlin", "bug_code_uid": "80fba9fa9dd156f7b8f49dd36f6abe91", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "78e2912181022e50995a3c93826eda6f", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7913043478260869, "equal_cnt": 17, "replace_cnt": 3, "delete_cnt": 14, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*\n\nobject B {\n @JvmStatic\n fun main(args: Array) {\n val `in` = Scanner(System.`in`)\n val n = `in`.nextInt()\n for (i in 0 until n) {\n val t = `in`.nextLong()\n if (t <= 2) {\n println(0)\n } else {\n println(if (t % 2 == 0L) t / 2 - 1 else t / 2)\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "bb50b69590cc5f9ffa79408155cbee23", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "20a55e5c1867e2072604b9be50825c29", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9271523178807947, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n\nobject Main {\n @JvmStatic\n fun programkt(args: Array) {\n val scanner = Scanner(System.`in`)\n var t = scanner.nextInt()\n while (t-- > 0) {\n val n = Math.max(0, scanner.nextInt() - 2)\n println(n - 2 - (n - 2) / 2)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "3e8910d8f8999f5d648d7970213a308a", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "6cf5acf4247606ac33c96f9f71c7f6d2", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9900596421471173, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n repeat(readLine()!!.toInt()) {\n val n = readLine()!!.toInt()\n var ans = 0\n if (n and 1) \n ans = n / 2\n else\n ans = n / 2 - 1\n if (ans < 0) ans = 0\n println(ans)\n }\n}", "lang": "Kotlin", "bug_code_uid": "51e99a0c234463f151f4229a726fb055", "src_uid": "b69170c8377623beb66db4706a02ffc6", "apr_id": "0080b416e50001bd67482356b0fc8a1a", "difficulty": null, "tags": ["math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8867924528301887, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(){\n readLine()!!\n val s = readLine()!!\n\n var d = 0\n for (c in s){\n if (d==0) d=1\n if (c=='+'){\n d++\n }else{\n d--\n }\n\n }\n println(d)\n}", "lang": "Kotlin", "bug_code_uid": "b7fb8ea86a33fafd1673e2f9b3cb5bf3", "src_uid": "a593016e4992f695be7c7cd3c920d1ed", "apr_id": "ff7bc6f296206c4e86cf03d971c2e59f", "difficulty": 800, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9996824388694824, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nprivate val MOD = 1_000_000_007L\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val N = ni()\n var best = Array(2){LongArray(N + 10)}\n var next = Array(2){LongArray(N + 10)}\n best[0][0] = 1\n\n for (i in 0 until N) {\n Arrays.fill(next[0], 0)\n Arrays.fill(next[1], 0)\n for (j in 0 .. N) {\n for (s in 0 until 2) { // reflexive\u3092\u6e80\u305f\u3055\u306a\u3044\n for (k in 0 until 2) { // \u8ffd\u52a0\u3059\u308b\u304b\n for (l in 0 until 2) { // \u9023\u7d50\u3059\u308b\u304b\n if (k == 0 && l == 1) continue\n val nj = if (k == 1 && l == 0) j + 1 else j\n val ns = if (s == 0 && k == 1) 0 else 1\n val c = if (l == 1) j else 1\n next[ns][nj] = (next[ns][nj] + best[s][j] * c) % MOD\n }\n }\n }\n }\n val tmp = best\n best = next\n next = tmp\n }\n\n debug(best[0])\n debug(best[1])\n\n out.println(best[1].sum() % MOD)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "2ddb90487df53d4a1ec16c1cfe47a98c", "src_uid": "aa2c3e94a44053a0d86f61da06681023", "apr_id": "01f62c695f13917077caff083939d0a2", "difficulty": 1900, "tags": ["dp", "math", "combinatorics"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.927536231884058, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n val arr: List = readLine()!!.split(' ').map(String::toInt)\n\n var cnt = 0\n for (i in 0 until n) {\n if (arr[i] >= arr[k] && arr[k] > 0)\n cnt++\n }\n println(cnt)\n}", "lang": "Kotlin", "bug_code_uid": "7d3b7bbf27d3daa5c335dffdfe9d796e", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "2a18e2976f0f535384a4c6c51c4a69a8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984025559105432, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInt() = readLn().toInt()\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLong() = readLn().toLong()\nprivate fun readLongs() = readStrings().map { it.toLong() }\nprivate fun readDouble() = readLn().toDouble()\nprivate fun readDoubles() = readStrings().map { it.toDouble() }\n\nfun main(args: Array) {\n val (n, k) = readInts()\n val list = readInts().toList()\n val value = list[k]\n if (value != 0)\n println(list.lastIndexOf(value) + 1)\n else\n println(list.indexOf(0))\n}", "lang": "Kotlin", "bug_code_uid": "40655a5b8714dbceb5737c7b20c4bd8c", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "96b003bbb52eb283672ff2a1c6bc1953", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9742310889443059, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "package olimpiad.codeforce\n\n\nfun main(){\n val (a, b) = readLine()!!.split(' ').map { it.toInt() }\n val arr = readLine()!!.split(' ').map { it.toInt() }\n\n if (arr[b]>0){\n var f = false\n for (i in b until a){\n if (arr[i]0){\n println(i+1)\n f=true\n break\n }\n }\n if (!f) println(0)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "54fb6948ea3db3128128e8d7b113861e", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "5c6389eb5a7447c47698d109d00e2352", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9974468085106383, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nfun main(){\n val (a, b) = readLine()!!.split(' ').map { it.toInt() }\n val arr = readLine()!!.split(' ').map { it.toInt() }\n\n if (arr[b]>0){\n var f = false\n for (i in b until a){\n if (arr[i]0){\n println(i+1)\n f=true\n break\n }\n }\n if (!f) println(0)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "14d50a5b12a43f6b5f06b7176636b953", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "5c6389eb5a7447c47698d109d00e2352", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8715728715728716, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 7, "insert_cnt": 2, "fix_ops_cnt": 14, "bug_source_code": "fun main(args: Array) {\n\n var input = readLine()!!\n\n val first = input.trim().split(\" \")\n\n val n = first[0].toInt()\n val k = first[1].toInt()\n\n if (first.size > 2) {\n println(\"wrong n and k\")\n return\n }\n\n if (n !in 1..50 || k !in 1..50 || k > n) {\n println(\"wrong n or k\")\n return\n }\n\n input = readLine()!!\n\n val results = input.trim().split(\" \")\n \n val kResult = results[k].toInt()\n\n if (kResult <= 0) {\n println(0);\n\n } else {\n\n val count = k + (k until n)\n .map { results[it].toInt() }\n .takeWhile { it == kResult && it > 0 }\n .count()\n\n println(count)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "f11d2ed99ac77ed4b11f637c234bf6a0", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "973f0f53b9b8ffce740cafc82fafe8e0", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8960205391527599, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main(args: Array) {\n val reader: BufferedReader = BufferedReader(InputStreamReader(System.`in`))\n val (n, k) = reader.readLine().split(' ').map { it.toInt() }\n val ax = reader.readLine().split(' ').map { it.toInt() }\n val result = ax.count { it >= ax[k] && ax[k] > 0 }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "dcec591e761bf23e44ace4336193858a", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "c5e97593f13636a324c1adaf716d086d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9920634920634921, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n val (n, k) = readLine()!!.split(\" \").map(String::toInt)\n val scores = readLine()!!.split(\" \").map(String::toInt)\n val targetScore = scores[k]\n println(scores.count { it > max(0, targetScore - 1) })\n}\n", "lang": "Kotlin", "bug_code_uid": "81d985e3d1b28f447c2de2fcf483866b", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "fdeab7ebac577fee68317f7dc93a6a6b", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.940809968847352, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n\n var fLine = readLine()!!\n var arr = fLine.split(\" \")\n var count = 0\n\n var sLine = readLine()!!\n var arr2 = sLine.split(\" \")\n\n for(i in arr2.indices){\n if(arr2[i].toInt() >= arr2[arr[1].toInt()].toInt() && arr2[i].toInt()>0){\n count++\n }\n }\n\n print(count)\n}", "lang": "Kotlin", "bug_code_uid": "7488a5c05501c7c012f981c4a4cc9a80", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "70729afd93ca01a436535ad864824aac", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.974934036939314, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\n\nfun main() {\n val (n, k) = readInts()\n\n val scores = readInts()\n var scoreMin = scores[k - 1]\n if (scoreMin == 0) scoreMin = scores.last { it > 0 }\n\n println(scores.lastIndexOf(scoreMin) + 1)\n}\n", "lang": "Kotlin", "bug_code_uid": "c9698393e4b8c0f0842f740f08f7e73d", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "a20eceb57720648a139a87256f253861", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6330097087378641, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 3, "fix_ops_cnt": 11, "bug_source_code": "private fun readInts() = readLine()!!.split(' ').map { it.toInt() }\n\nfun main() {\n val (_, k) = readInts()\n val a = readInts()\n var i = 0\n var s = 0\n while (a[i] >= a[k-1] && a[i++] > 0) {\n s++\n }\n println(s)\n}", "lang": "Kotlin", "bug_code_uid": "f00cd6b7823979074aa62c40ae556953", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "6a6652d0b7f05ec0a55b72f53f03d165", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9952456418383518, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "\n\nfun main(args: Array) {\n val strArray = readLine()!!.split(\" \")\n val k = strArray.elementAt(1).toInt()\n\n val points = readLine()!!.split(\" \").map { it.toInt() }\n\n var count = 0\n points.map {\n if (it > 0 && it >= points[k]) {\n count++\n }\n }\n\n println(count)\n}", "lang": "Kotlin", "bug_code_uid": "5b05015a4f95a2098a3c2f3bc40110de", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "2af0efc499fa76067e1477eab5388c21", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9989847715736041, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single long\nprivate fun readDouble() = readLn().toDouble() // single double\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of longs\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of doubles\nprivate fun readIntsArr() = ArrayList(readInts()) // ArrayList of ints\n\nprivate val MX = 200005\nprivate val MOD = 1000000007\nprivate val SZ = 1 shl 18\nprivate val INF = (1e18).toLong()\n\nprivate fun add(a: Int, b: Int) = (a + b) % MOD // from tourist :o\nprivate fun sub(a: Int, b: Int) = (a - b + MOD) % MOD\nprivate fun mul(a: Int, b: Int) = ((a.toLong() * b) % MOD).toInt()\n\n\nprivate fun solve(){\n val nk = ArrayList(readInts())\n val n = nk[0]\n val k = nk[1]\n var a = -1\n var s = 0\n\n val aaas = ArrayList(readInts())\n for(i in 0 until aaas.size){\n if (i < k-1) {\n if (aaas[i] != 0) s++\n continue\n }\n if (i == k-1){\n if (aaas[i] != 0) s++\n a = aaas[i]\n continue\n }\n if (a != aaas[i])break\n if (aaas[i] != 0) s++\n }\n\n println(\"$s\")\n}\n\nfun main(){\n val t = 3 // # of test cases\n for (i in 1..t) {\n solve()\n }\n}", "lang": "Kotlin", "bug_code_uid": "ce7217cbb6093d5acb74fa61721241c9", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "57a19a7b609686e51b1c89268a998a6a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9941060903732809, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(){\n val (n,k) = readLine()!!.split(\" \").map { it.toInt() }\n val a = readLine()!!.split(\" \").map { it.toInt() }\n var ans = 0\n for(i in 0 until n){\n if (a[i]>=a[k]&&a[i]!=0){\n ans++\n }\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "8f49b26fb3ad8c540091d361bcb4d5fd", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "5ffe6de27ebd8b8f9937663753b72fe3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9912663755458515, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (n, k) = readLine()!!.split(\" \").map { it.toInt() }\n var count = 0\n val list = readLine()!!.split(\" \").map { it.toInt() }\n list.forEach { if (it >= list[k] && it > 0) count++ }\n println(count)\n}", "lang": "Kotlin", "bug_code_uid": "b80de3a19260bccb65598ea9a9d230a2", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "0e20904b592291ab23ea84e25aa6b8eb", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9936708860759493, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n var n = 0\n var k = 0\n\n readLine()!!.split(\" \").run {\n n = get(0).toInt()\n k = get(1).toInt()\n }\n\n val s = readLine()!!.split(\" \")\n val m = s[k].toInt()\n\n print(s.map { it.toInt() }\n .takeWhile { it > 0 && it >= m }\n .size)\n}", "lang": "Kotlin", "bug_code_uid": "4bead925a32462a8c0d3cc51c89a2af3", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "d7aceeb34c856ec531988527ef5cb4d3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9951338199513382, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val k = scanner.nextInt()\n val a = mutableListOf()\n repeat(n) {\n a.add(scanner.nextInt())\n }\n\n var advanced = 0\n for (i in 0 until n) {\n if (a[i] > 0) {\n if (a[i] >= a[k]) {\n advanced += 1\n }\n }\n }\n\n println(advanced)\n}", "lang": "Kotlin", "bug_code_uid": "b2953f22b0168c2f2065fd50842c22ef", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "85bf4d5733cd22277151debae78cda6f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7540983606557377, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 9, "bug_source_code": "import java.util.Scanner\n\nfun main() {\n\n var scan = Scanner(System.`in`)\n\n var n = scan.nextInt()\n var k = scan.nextInt()\n var arr : Array = Array(n, {0})\n\n for(cntr in 0 until n)\n {\n var buf = scan.nextInt()\n arr[cntr] = buf\n }\n\n var winCount : Int = 0\n var watch : Int = 0\n\n for(cntr in 0 until n)\n {\n if(arr[cntr] >=arr[k]) winCount++\n if(arr[cntr] <=0)\n watch++\n }\n if(watch == n) winCount = 0\n println(winCount)\n}", "lang": "Kotlin", "bug_code_uid": "1fb365ca257cb84377d75a242917fded", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "53c019a447799df392b3462ccdf72a7e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7924528301886793, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n\tval input = readLine()!!.split(' ')\n\tval a = readLine()!!.split(' ')\n\n\tval n = input[0].toInt()\n\tval k = input[1].toInt()\n\t\n\tvar r = 0\n\n\tfor (i in 0 until k) {\n\t\tif (a[i] >= k) r++\n\t\telse break\n\t}\n\n\tprintln(r)\n}", "lang": "Kotlin", "bug_code_uid": "b289a2e032739162037ab5e2cdff3504", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "518606db58a9d3456760f8533af51d27", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7633587786259542, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n\tval input = readLine()!!.split(' ')\n\tval n = input[0].toInt()\n\tval k = input[1].toInt()\n\t\n\tvar r = 0\n\n\tfor (i in 0 until k) {\n\t\tval a = readLine()!!.toInt()\n\t\tif (a >= k) r++\n\t\telse break\n\t}\n\n\tprintln(r)\n}", "lang": "Kotlin", "bug_code_uid": "d2074d3c1194f9a98b1830ad3c408d66", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "518606db58a9d3456760f8533af51d27", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9337748344370861, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n val s = Scanner(System.`in`)\n val n = s.nextInt()\n println(n <= s.nextInt() && n <= s.nextInt())\n}", "lang": "Kotlin", "bug_code_uid": "745f31f0cd40e7d19ce067e421e5221c", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "db6ff06fb83ddfece00d5f98b926e958", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9184149184149184, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n\n var text = readLine()!!\n val split = text.split(' ')\n if (split[1]>=split[0]&&split[2]>=split[0])\n {\n print(\"Yes\")\n }\n else print(\"No\")\n\n}", "lang": "Kotlin", "bug_code_uid": "6263d536906303ed0b675f8879032ae2", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "95f360aa3a0e29e683eba37f0e8ec814", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995185363505056, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val N = ni()\n val M = ni()\n val K = ni()\n val ok = N >= min(M, K)\n if (ok) out.println(\"Yes\")\n else out.println(\"No\")\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n, offset) { ni() }\n }\n\n private inline fun map(n: Int, offset: Int = 0, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i + offset)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun pair(a: A, b: B) = RPair(a, b)\ndata class RPair(val _1: A, val _2: B)\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "d723de6ef0850b77226502403abb9a22", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "ed23eb5f971cb9522c1a0166f94206ab", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9612403100775194, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val input = readLine()!!.split(\" \").map{Integer.parseInt(it)}\n if (input[0] <= input[1] + input[2]) {\n println(\"Yes\")\n } else {\n println(\"No\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "d6239ac7d1cd1ba763ddf954c1cb69ec", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "7415258a35329d64b52732e06be2ce84", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.939297124600639, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (n,m,k) = readLine()!!.split(\" \")\n\n if (n > m || n > k) {\n println(\"No\")\n } else {\n println(\"Yes\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "0f9c9c0a650e9810e715e06c4267b002", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "37afabd7c323da20947976749f453d4a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9892933618843683, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun solve() {\n val (n, m, k) = readLine()!!.split(\" \").map { it.toInt() }\n\n if(n > m && n > k) println(\"No\")\n else println(\"Yes\")\n}\n\nfun main(args: Array) {\n val t = 1\n for (i in 1..t) {\n solve()\n }\n}", "lang": "Kotlin", "bug_code_uid": "74da0b418ed952d022a5d809ddfc1481", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "d10ebf1809d15fb37d31833513583535", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9924812030075187, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (n, m, k) = readLine()!!.split(\" \").map { it.toInt() }\n if (m >= n && k >= n) print(\"Yes\") else print(\"Mo\")\n}", "lang": "Kotlin", "bug_code_uid": "ef0570bb06282ced1b1cc0a056d03571", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "709d2412e1f85a95604613e39eec8f27", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9937888198757764, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n\tval (n,a,b) = readLine()!!.split(' ')\n\tif(n.toInt() < a.toInt() && n.toInt() < b.toInt()) println(\"YES\") else println(\"NO\")\n\t}\n", "lang": "Kotlin", "bug_code_uid": "26341b7adff835f0838c472e8a76c109", "src_uid": "6cd07298b23cc6ce994bb1811b9629c4", "apr_id": "6c5602bb60cc0db7a31de4fe51d73fe6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7452574525745257, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val (s, n) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val n = r.readLine()!!.toInt()\n val (a, b, c) = r.readLine()!!.split(\" \").map { it.toLong() }\n println(if ((b-a)%c==0L) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "8c605daec5f93042adf7a2d5a5fdea62", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "c832147268962772e35529948fd87a26", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9623529411764706, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val (s, n) = r.readLine()!!.split(\" \").map { it.toInt() }\n //val n = r.readLine()!!.toInt()\n val (a, b, c) = r.readLine()!!.split(\" \").map { it.toLong() }\n when {\n c == 0L && a != b -> println(\"NO\")\n c == 0L -> println(\"YES\")\n else -> println(if ((b - a) % c == 0L) \"YES\" else \"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "16ab674310e886131d553c76a634b29b", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "c832147268962772e35529948fd87a26", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9963253070302679, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.StringTokenizer\nimport java.util.Stack\nimport java.util.TreeMap\n\nobject programkt {\n interface Scanner {\n fun changeInputStream(inputStream: InputStream)\n fun nextInt(): Int\n fun nextLong(): Long\n fun nextDouble(): Double\n fun nextChar(): Char\n fun nextString(): String\n fun nextLine(): String\n fun nextBigInteger(): BigInteger\n fun nextBigDecimal(): BigDecimal\n }\n\n abstract class Task {\n //KT Extensions\n fun > min(a: T, b: T) = if (a > b) b else a\n fun > max(a: T, b: T) = if (a < b) b else a\n fun abs(a: Int) = if (a > 0) a else -(a)\n fun abs(a: Long) = if (a > 0) a else -(a)\n fun abs(a: Float) = if (a > 0) a else -(a)\n fun abs(a: Double) = if (a > 0) a else -(a)\n operator fun Iterable.invoke(function: (it: T) -> Unit) { this.forEach(function) }\n private fun String.prefix(pi: Array): Array {\n pi[0] = 0\n (1 until this.length) {\n var j = pi[it - 1]\n while (j > 0 && this[it] != this[j]) {\n j = pi[j - 1]\n }\n if(this[it] == this[j]) {\n j++\n }\n pi[it] = j\n }\n return pi\n }\n private fun String.kmpFind(pattern: String): Int {\n val m = pattern.length\n val dfa = Array(256) { IntArray(m) }\n dfa[pattern[0].toInt()][0] = 1\n var x = 0\n var j = 1\n while (j < m) {\n for (c in 0 until 256) {\n dfa[c][j] = dfa[c][x] // Copy mismatch cases.\n }\n dfa[pattern[j].toInt()][j] = j + 1 // Set match case.\n x = dfa[pattern[j].toInt()][x] // Update restart state.\n j++\n }\n\n val n = this.length\n var i: Int = 0\n j = 0\n while (i < n && j < m) {\n j = dfa[this[i].toInt()][j]\n i++\n }\n if (j == m) return i - m // found\n return n // not found\n }\n fun fuckExceptions(invoker: () -> Unit) = try { invoker.invoke() } catch (_: Throwable) {}\n\n enum class EdgeType {\n DIRECTED,\n UNDIRECTED\n }\n data class Vertex>(\n val data: T\n ) {\n override fun toString(): String = \"V:$data\"\n }\n data class Edge>(\n var source: Vertex,\n var destination: Vertex,\n val weight: Double?\n )\n interface Graphable> {\n fun createVertex(data: T): Vertex\n fun add(type: EdgeType, source: Vertex, destination: Vertex, weight: Double? = 0.0)\n fun weight(source: Vertex, destination: Vertex): Double?\n fun edges(source: Vertex): MutableList>?\n }\n class AdjacencyList>: Graphable {\n var adjacencyMap: MutableMap, MutableList>> = mutableMapOf()\n\n private fun addDirectedEdge(source: Vertex, destination: Vertex, weight: Double?) {\n adjacencyMap[source]?.add(Edge(source = source, destination = destination, weight = weight))\n }\n\n private fun addUndirectedEdge(source: Vertex, destination: Vertex, weight: Double?) {\n addDirectedEdge(source, destination, weight)\n addDirectedEdge(destination, source, weight)\n }\n\n override fun createVertex(data: T): Vertex {\n val vertex = Vertex(data = data)\n adjacencyMap[vertex] ?: run {\n adjacencyMap[vertex] = mutableListOf()\n }\n return vertex\n }\n\n override fun add(type: EdgeType, source: Vertex, destination: Vertex, weight: Double?) = when(type) {\n EdgeType.DIRECTED -> addDirectedEdge(source, destination, weight)\n EdgeType.UNDIRECTED -> addUndirectedEdge(source, destination, weight)\n }\n\n override fun weight(source: Vertex, destination: Vertex): Double? {\n adjacencyMap[source]?.forEach {\n if(it.destination == destination) return it.weight\n }\n return null\n }\n\n override fun edges(source: Vertex): MutableList>? = adjacencyMap[source]\n\n override fun toString(): String {\n var result = \"\"\n for ((vertex, edges) in adjacencyMap) {\n var edgeString = \"\"\n for ((index, edge) in edges.withIndex()) {\n edgeString += if (index != edges.count() - 1) \"${edge.destination}, \"\n else \"${edge.destination}\"\n }\n result += \"$vertex ---> [ $edgeString ] \\n\"\n }\n return result\n }\n\n fun depthFirstSearch(start: Vertex, end: Vertex): Stack> {\n val visited: HashSet> = hashSetOf()\n val stack: Stack> = Stack()\n stack.push(start)\n visited.add(start)\n\n var currentVertex = stack.peek()\n loop@while (currentVertex != null && currentVertex != end) {\n val neighbors = edges(currentVertex)\n if(neighbors != null && neighbors.count() > 0) {\n for(edge in neighbors) {\n if(!visited.contains(edge.destination)) {\n visited.add(edge.destination)\n stack.push(edge.destination)\n currentVertex = stack.peek()\n continue@loop\n }\n }\n } else {\n stack.pop()\n currentVertex = stack.peek()\n continue\n }\n\n stack.pop()\n currentVertex = stack.peek()\n }\n\n return stack\n }\n\n fun breadthFirstSearch() {\n\n }\n\n fun floydWarshallAlgorythm(): Pair, Array> {\n val nVertices = this.adjacencyMap.size\n\n val weights = Array(nVertices) { Array(nVertices-1) { 0.0 } }\n this.adjacencyMap\n .asSequence()\n .map { it.value }\n .withIndex()\n .forEach { (index, weightsOfVertex) ->\n weightsOfVertex.asSequence()\n .withIndex()\n .forEach { (weightIndex, weight) ->\n weights[index][weightIndex] = weight.weight!!\n }\n }\n\n val dist = Array(nVertices) { DoubleArray(nVertices) { Double.POSITIVE_INFINITY } }\n for (w in weights) dist[(w[0] - 1).toInt()][(w[1] - 1).toInt()] = w[2]\n val next = Array(nVertices) { IntArray(nVertices) }\n for (i in 0 until next.size) {\n for (j in 0 until next.size) {\n if (i != j) next[i][j] = j + 1\n }\n }\n for (k in 0 until nVertices) {\n for (i in 0 until nVertices) {\n for (j in 0 until nVertices) {\n if (dist[i][k] + dist[k][j] < dist[i][j]) {\n dist[i][j] = dist[i][k] + dist[k][j]\n next[i][j] = next[i][k]\n }\n }\n }\n }\n return dist to next\n }\n }\n\n fun > TreeMap>.toAdjacencyList(type: EdgeType): AdjacencyList {\n val list = AdjacencyList()\n\n this.keys.forEach { list.createVertex(it) }\n this.entries\n .asSequence()\n .withIndex()\n .forEach { (x, edge) ->\n val vertex = list.createVertex(edge.key)\n edge.value\n .asSequence()\n .withIndex()\n .forEach { (y, weight) ->\n if(weight != .0 && y != x)\n list.add(type, vertex, list.createVertex(this.keys.elementAt(y)), weight)\n }\n }\n return list\n }\n\n open class Point, Y: Comparable>(open var x: X, open var y: Y) {\n operator fun component1() = x\n operator fun component2() = y\n override fun equals(other: Any?): Boolean = when {\n other == null -> false\n other !is Point<*, *> -> false\n other.x != this.x -> false\n other.y != this.y -> false\n else -> true\n }\n }\n\n class IntPoint(override var x: Int, override var y: Int): Point(x, y) {\n operator fun plus(point: IntPoint) = IntPoint(this.x + point.x, this.y + point.y)\n operator fun minus(point: IntPoint) = IntPoint(this.x - point.x, this.y - point.y)\n operator fun div(point: IntPoint) = IntPoint(this.x / point.x, this.y / point.y)\n operator fun times(point: IntPoint) = IntPoint(this.x * point.x, this.y * point.y)\n\n operator fun plus(coefficient: Int) = IntPoint(this.x + coefficient, this.y + coefficient)\n operator fun minus(coefficient: Int) = IntPoint(this.x - coefficient, this.y - coefficient)\n operator fun div(coefficient: Int) = IntPoint(this.x / coefficient, this.y / coefficient)\n operator fun times(coefficient: Int) = IntPoint(this.x * coefficient, this.y * coefficient)\n\n fun distanceTo(point: IntPoint) = Math.sqrt(((this.x - point.x) * (this.x - point.x) + (this.y-point.y) * (this.y - point.y)).toDouble())\n }\n class LongPoint(override var x: Long, override var y: Long): Point(x, y) {\n constructor(x: Int, y: Int): this(x.toLong(), y.toLong())\n\n operator fun plus(point: LongPoint) = LongPoint(this.x + point.x, this.y + point.y)\n operator fun minus(point: LongPoint) = LongPoint(this.x - point.x, this.y - point.y)\n operator fun div(point: LongPoint) = LongPoint(this.x / point.x, this.y / point.y)\n operator fun times(point: LongPoint) = LongPoint(this.x * point.x, this.y * point.y)\n\n operator fun plus(coefficient: Long) = LongPoint(this.x + coefficient, this.y + coefficient)\n operator fun plus(coefficient: Int) = LongPoint(this.x + coefficient, this.y + coefficient)\n operator fun minus(coefficient: Long) = LongPoint(this.x - coefficient, this.y - coefficient)\n operator fun minus(coefficient: Int) = LongPoint(this.x - coefficient, this.y - coefficient)\n operator fun div(coefficient: Long) = LongPoint(this.x / coefficient, this.y / coefficient)\n operator fun div(coefficient: Int) = LongPoint(this.x / coefficient, this.y / coefficient)\n operator fun times(coefficient: Long) = LongPoint(this.x * coefficient, this.y * coefficient)\n operator fun times(coefficient: Int) = LongPoint(this.x * coefficient, this.y * coefficient)\n\n fun distanceTo(point: LongPoint) = Math.sqrt(((this.x - point.x) * (this.x - point.x) + (this.y-point.y) * (this.y - point.y)).toDouble())\n }\n open class DoublePoint(override var x: Double, override var y: Double): Point(x, y) {\n constructor(x: Int, y: Int): this(x.toDouble(), y.toDouble())\n constructor(x: Long, y: Long): this(x.toDouble(), y.toDouble())\n\n operator fun plus(point: DoublePoint) = DoublePoint(this.x + point.x, this.y + point.y)\n operator fun minus(point: DoublePoint) = DoublePoint(this.x - point.x, this.y - point.y)\n operator fun div(point: DoublePoint) = DoublePoint(this.x / point.x, this.y / point.y)\n operator fun times(point: DoublePoint) = DoublePoint(this.x * point.x, this.y * point.y)\n\n operator fun plus(coefficient: Double) = DoublePoint(this.x + coefficient, this.y + coefficient)\n operator fun plus(coefficient: Long) = DoublePoint(this.x + coefficient, this.y + coefficient)\n operator fun plus(coefficient: Int) = DoublePoint(this.x + coefficient, this.y + coefficient)\n operator fun minus(coefficient: Double) = DoublePoint(this.x - coefficient, this.y - coefficient)\n operator fun minus(coefficient: Long) = DoublePoint(this.x - coefficient, this.y - coefficient)\n operator fun minus(coefficient: Int) = DoublePoint(this.x - coefficient, this.y - coefficient)\n operator fun div(coefficient: Double) = DoublePoint(this.x / coefficient, this.y / coefficient)\n operator fun div(coefficient: Long) = DoublePoint(this.x / coefficient, this.y / coefficient)\n operator fun div(coefficient: Int) = DoublePoint(this.x / coefficient, this.y / coefficient)\n operator fun times(coefficient: Double) = DoublePoint(this.x * coefficient, this.y * coefficient)\n operator fun times(coefficient: Long) = DoublePoint(this.x * coefficient, this.y * coefficient)\n operator fun times(coefficient: Int) = DoublePoint(this.x * coefficient, this.y * coefficient)\n\n fun distanceTo(point: DoublePoint) = Math.sqrt(((this.x - point.x) * (this.x - point.x) + (this.y-point.y) * (this.y - point.y)))\n fun polarAngle(): Double {\n val minPolarAngle = Math.atan2(y, x)\n return if(minPolarAngle < 0) minPolarAngle + 2 * Math.PI else minPolarAngle\n }\n }\n class Vector(x: Double, y: Double): DoublePoint(x, y) {\n constructor(x: Int, y: Int): this(x.toDouble(), y.toDouble())\n constructor(x: Long, y: Long): this(x.toDouble(), y.toDouble())\n\n fun length() = Math.sqrt(x*x + y*y)\n fun angleTo(vector: Vector): Double {\n val temp = this * vector\n return Math.acos((temp.x + temp.y) / this.length() / vector.length())\n }\n }\n //End KT Extensions\n\n abstract fun solve(scanner: Scanner, printer: PrintWriter)\n }\n\n class FastScanner: Scanner {\n var inputStream: InputStream? = null\n override fun changeInputStream(inputStream: InputStream) {\n this.inputStream = inputStream\n this.bufferedReader = BufferedReader(InputStreamReader(inputStream))\n }\n\n private lateinit var bufferedReader: BufferedReader\n private var stringTokenizer: StringTokenizer? = null\n\n private fun nextToken(): String? {\n while (stringTokenizer == null || !stringTokenizer!!.hasMoreTokens())\n stringTokenizer = StringTokenizer(bufferedReader.readLine() ?: return null)\n return stringTokenizer!!.nextToken()\n }\n\n override fun nextInt() = nextToken()!!.toInt()\n override fun nextLong() = nextToken()!!.toLong()\n override fun nextDouble() = nextToken()!!.toDouble()\n override fun nextChar() = bufferedReader.read().toChar()\n override fun nextString() = nextToken()!!\n override fun nextLine() = bufferedReader.readLine()!!\n override fun nextBigInteger() = BigInteger(nextToken()!!)\n override fun nextBigDecimal() = BigDecimal(nextToken()!!)\n }\n\n class TaskBuilder {\n private var task: Task? = null\n private var inputStream: InputStream? = null\n private var outputStream: OutputStream? = null\n private var scanner: Scanner? = null\n\n fun useInputSource(inputStream: InputStream): TaskBuilder {\n this.inputStream = inputStream\n return this\n }\n\n fun useOutputSource(outputStream: OutputStream): TaskBuilder {\n this.outputStream = outputStream\n return this\n }\n\n fun useInputFile(inputFileName: String): TaskBuilder {\n this.inputStream = FileInputStream(File(inputFileName))\n return this\n }\n\n fun useOutputFile(outputFileName: String): TaskBuilder {\n this.outputStream = FileOutputStream(File(outputFileName))\n return this\n }\n\n fun useScanner(scanner: Scanner): TaskBuilder {\n this.scanner = scanner\n return this\n }\n\n\n fun solveTask(task: Task): TaskBuilder {\n this.task = task\n return this\n }\n\n fun run() {\n when {\n task == null -> throw NullPointerException(\"Task cannot be null!\")\n inputStream == null -> throw NullPointerException(\"Input cannot be null!\")\n outputStream == null -> throw NullPointerException(\"Output cannot be null!\")\n scanner == null -> throw NullPointerException(\"Scanner cannot be null!\")\n }\n scanner!!.changeInputStream(inputStream!!)\n val printer = PrintWriter(outputStream)\n TaskRunnable(task!!, scanner!!, printer).run()\n\n inputStream!!.close()\n printer.close()\n }\n\n class TaskRunnable(\n private val task: Task,\n private val scanner: Scanner,\n private val printer: PrintWriter\n ) {\n fun run() {\n task.solve(scanner, printer)\n }\n }\n }\n\n @JvmStatic\n fun main(args: Array) = TaskBuilder()\n// .useInputSource(BufferedInputStream(FileInputStream(\"area1.in\")))\n// .useOutputSource(BufferedOutputStream(FileOutputStream(\"area1.out\")))\n .useInputSource(System.`in`)\n .useOutputSource(System.out)\n .useScanner(FastScanner())\n .solveTask(TaskF())\n .run()\n\n class TaskA: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val length = scanner.nextInt()\n val numbers = Array(length) { scanner.nextInt() }\n\n var maxOnesCount = -1\n\n (0 until length) { i ->\n (i until length) { j ->\n var currentCountOfOnes = 0\n (0 until length) {\n currentCountOfOnes += if((it in (i..j) && 1 - numbers[it] == 1) || (it !in (i..j) && numbers[it] == 1)) 1 else 0 }\n maxOnesCount = max(maxOnesCount, currentCountOfOnes)\n }\n }\n\n printer.println(maxOnesCount)\n }\n\n }\n\n class TaskD: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val length = scanner.nextLong()\n (length until 2 * length) { printer.print(\"$it \") }\n }\n\n }\n\n class TaskE: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val length = scanner.nextInt()\n val lineLengths = Array(length) { scanner.nextInt() }\n lineLengths.sort()\n for(it in (2 until length))\n if(lineLengths[it-2] + lineLengths[it-1] > lineLengths[it]) {\n printer.println(\"YES\")\n return\n }\n printer.println(\"NO\")\n }\n\n }\n\n class TaskF: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val (start, check, delta) = scanner.nextLine()\n .split(\" \")\n .map { it.toLong() }\n when {\n check < start -> printer.println(\"NO\")\n delta == 0L && start == check -> printer.println(\"YES\")\n (check - start) % delta == 0L -> printer.println(\"YES\")\n else -> printer.println(\"NO\")\n }\n }\n\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "f48ef79cdd15ebcc7db7d3026f7427fa", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "2e70dae0d207adc9fcec5565149ccd85", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.998286886234769, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.math.BigDecimal\nimport java.math.BigInteger\nimport java.util.StringTokenizer\nimport java.util.Stack\nimport java.util.TreeMap\n\nobject programkt {\n interface Scanner {\n fun changeInputStream(inputStream: InputStream)\n fun nextInt(): Int\n fun nextLong(): Long\n fun nextDouble(): Double\n fun nextChar(): Char\n fun nextString(): String\n fun nextLine(): String\n fun nextBigInteger(): BigInteger\n fun nextBigDecimal(): BigDecimal\n }\n\n abstract class Task {\n //KT Extensions\n fun > min(a: T, b: T) = if (a > b) b else a\n fun > max(a: T, b: T) = if (a < b) b else a\n fun abs(a: Int) = if (a > 0) a else -(a)\n fun abs(a: Long) = if (a > 0) a else -(a)\n fun abs(a: Float) = if (a > 0) a else -(a)\n fun abs(a: Double) = if (a > 0) a else -(a)\n operator fun Iterable.invoke(function: (it: T) -> Unit) { this.forEach(function) }\n private fun String.prefix(pi: Array): Array {\n pi[0] = 0\n (1 until this.length) {\n var j = pi[it - 1]\n while (j > 0 && this[it] != this[j]) {\n j = pi[j - 1]\n }\n if(this[it] == this[j]) {\n j++\n }\n pi[it] = j\n }\n return pi\n }\n private fun String.kmpFind(pattern: String): Int {\n val m = pattern.length\n val dfa = Array(256) { IntArray(m) }\n dfa[pattern[0].toInt()][0] = 1\n var x = 0\n var j = 1\n while (j < m) {\n for (c in 0 until 256) {\n dfa[c][j] = dfa[c][x] // Copy mismatch cases.\n }\n dfa[pattern[j].toInt()][j] = j + 1 // Set match case.\n x = dfa[pattern[j].toInt()][x] // Update restart state.\n j++\n }\n\n val n = this.length\n var i: Int = 0\n j = 0\n while (i < n && j < m) {\n j = dfa[this[i].toInt()][j]\n i++\n }\n if (j == m) return i - m // found\n return n // not found\n }\n fun fuckExceptions(invoker: () -> Unit) = try { invoker.invoke() } catch (_: Throwable) {}\n\n enum class EdgeType {\n DIRECTED,\n UNDIRECTED\n }\n data class Vertex>(\n val data: T\n ) {\n override fun toString(): String = \"V:$data\"\n }\n data class Edge>(\n var source: Vertex,\n var destination: Vertex,\n val weight: Double?\n )\n interface Graphable> {\n fun createVertex(data: T): Vertex\n fun add(type: EdgeType, source: Vertex, destination: Vertex, weight: Double? = 0.0)\n fun weight(source: Vertex, destination: Vertex): Double?\n fun edges(source: Vertex): MutableList>?\n }\n class AdjacencyList>: Graphable {\n var adjacencyMap: MutableMap, MutableList>> = mutableMapOf()\n\n private fun addDirectedEdge(source: Vertex, destination: Vertex, weight: Double?) {\n adjacencyMap[source]?.add(Edge(source = source, destination = destination, weight = weight))\n }\n\n private fun addUndirectedEdge(source: Vertex, destination: Vertex, weight: Double?) {\n addDirectedEdge(source, destination, weight)\n addDirectedEdge(destination, source, weight)\n }\n\n override fun createVertex(data: T): Vertex {\n val vertex = Vertex(data = data)\n adjacencyMap[vertex] ?: run {\n adjacencyMap[vertex] = mutableListOf()\n }\n return vertex\n }\n\n override fun add(type: EdgeType, source: Vertex, destination: Vertex, weight: Double?) = when(type) {\n EdgeType.DIRECTED -> addDirectedEdge(source, destination, weight)\n EdgeType.UNDIRECTED -> addUndirectedEdge(source, destination, weight)\n }\n\n override fun weight(source: Vertex, destination: Vertex): Double? {\n adjacencyMap[source]?.forEach {\n if(it.destination == destination) return it.weight\n }\n return null\n }\n\n override fun edges(source: Vertex): MutableList>? = adjacencyMap[source]\n\n override fun toString(): String {\n var result = \"\"\n for ((vertex, edges) in adjacencyMap) {\n var edgeString = \"\"\n for ((index, edge) in edges.withIndex()) {\n edgeString += if (index != edges.count() - 1) \"${edge.destination}, \"\n else \"${edge.destination}\"\n }\n result += \"$vertex ---> [ $edgeString ] \\n\"\n }\n return result\n }\n\n fun depthFirstSearch(start: Vertex, end: Vertex): Stack> {\n val visited: HashSet> = hashSetOf()\n val stack: Stack> = Stack()\n stack.push(start)\n visited.add(start)\n\n var currentVertex = stack.peek()\n loop@while (currentVertex != null && currentVertex != end) {\n val neighbors = edges(currentVertex)\n if(neighbors != null && neighbors.count() > 0) {\n for(edge in neighbors) {\n if(!visited.contains(edge.destination)) {\n visited.add(edge.destination)\n stack.push(edge.destination)\n currentVertex = stack.peek()\n continue@loop\n }\n }\n } else {\n stack.pop()\n currentVertex = stack.peek()\n continue\n }\n\n stack.pop()\n currentVertex = stack.peek()\n }\n\n return stack\n }\n\n fun breadthFirstSearch() {\n\n }\n\n fun floydWarshallAlgorythm(): Pair, Array> {\n val nVertices = this.adjacencyMap.size\n\n val weights = Array(nVertices) { Array(nVertices-1) { 0.0 } }\n this.adjacencyMap\n .asSequence()\n .map { it.value }\n .withIndex()\n .forEach { (index, weightsOfVertex) ->\n weightsOfVertex.asSequence()\n .withIndex()\n .forEach { (weightIndex, weight) ->\n weights[index][weightIndex] = weight.weight!!\n }\n }\n\n val dist = Array(nVertices) { DoubleArray(nVertices) { Double.POSITIVE_INFINITY } }\n for (w in weights) dist[(w[0] - 1).toInt()][(w[1] - 1).toInt()] = w[2]\n val next = Array(nVertices) { IntArray(nVertices) }\n for (i in 0 until next.size) {\n for (j in 0 until next.size) {\n if (i != j) next[i][j] = j + 1\n }\n }\n for (k in 0 until nVertices) {\n for (i in 0 until nVertices) {\n for (j in 0 until nVertices) {\n if (dist[i][k] + dist[k][j] < dist[i][j]) {\n dist[i][j] = dist[i][k] + dist[k][j]\n next[i][j] = next[i][k]\n }\n }\n }\n }\n return dist to next\n }\n }\n\n fun > TreeMap>.toAdjacencyList(type: EdgeType): AdjacencyList {\n val list = AdjacencyList()\n\n this.keys.forEach { list.createVertex(it) }\n this.entries\n .asSequence()\n .withIndex()\n .forEach { (x, edge) ->\n val vertex = list.createVertex(edge.key)\n edge.value\n .asSequence()\n .withIndex()\n .forEach { (y, weight) ->\n if(weight != .0 && y != x)\n list.add(type, vertex, list.createVertex(this.keys.elementAt(y)), weight)\n }\n }\n return list\n }\n\n open class Point, Y: Comparable>(open var x: X, open var y: Y) {\n operator fun component1() = x\n operator fun component2() = y\n override fun equals(other: Any?): Boolean = when {\n other == null -> false\n other !is Point<*, *> -> false\n other.x != this.x -> false\n other.y != this.y -> false\n else -> true\n }\n }\n\n class IntPoint(override var x: Int, override var y: Int): Point(x, y) {\n operator fun plus(point: IntPoint) = IntPoint(this.x + point.x, this.y + point.y)\n operator fun minus(point: IntPoint) = IntPoint(this.x - point.x, this.y - point.y)\n operator fun div(point: IntPoint) = IntPoint(this.x / point.x, this.y / point.y)\n operator fun times(point: IntPoint) = IntPoint(this.x * point.x, this.y * point.y)\n\n operator fun plus(coefficient: Int) = IntPoint(this.x + coefficient, this.y + coefficient)\n operator fun minus(coefficient: Int) = IntPoint(this.x - coefficient, this.y - coefficient)\n operator fun div(coefficient: Int) = IntPoint(this.x / coefficient, this.y / coefficient)\n operator fun times(coefficient: Int) = IntPoint(this.x * coefficient, this.y * coefficient)\n\n fun distanceTo(point: IntPoint) = Math.sqrt(((this.x - point.x) * (this.x - point.x) + (this.y-point.y) * (this.y - point.y)).toDouble())\n }\n class LongPoint(override var x: Long, override var y: Long): Point(x, y) {\n constructor(x: Int, y: Int): this(x.toLong(), y.toLong())\n\n operator fun plus(point: LongPoint) = LongPoint(this.x + point.x, this.y + point.y)\n operator fun minus(point: LongPoint) = LongPoint(this.x - point.x, this.y - point.y)\n operator fun div(point: LongPoint) = LongPoint(this.x / point.x, this.y / point.y)\n operator fun times(point: LongPoint) = LongPoint(this.x * point.x, this.y * point.y)\n\n operator fun plus(coefficient: Long) = LongPoint(this.x + coefficient, this.y + coefficient)\n operator fun plus(coefficient: Int) = LongPoint(this.x + coefficient, this.y + coefficient)\n operator fun minus(coefficient: Long) = LongPoint(this.x - coefficient, this.y - coefficient)\n operator fun minus(coefficient: Int) = LongPoint(this.x - coefficient, this.y - coefficient)\n operator fun div(coefficient: Long) = LongPoint(this.x / coefficient, this.y / coefficient)\n operator fun div(coefficient: Int) = LongPoint(this.x / coefficient, this.y / coefficient)\n operator fun times(coefficient: Long) = LongPoint(this.x * coefficient, this.y * coefficient)\n operator fun times(coefficient: Int) = LongPoint(this.x * coefficient, this.y * coefficient)\n\n fun distanceTo(point: LongPoint) = Math.sqrt(((this.x - point.x) * (this.x - point.x) + (this.y-point.y) * (this.y - point.y)).toDouble())\n }\n open class DoublePoint(override var x: Double, override var y: Double): Point(x, y) {\n constructor(x: Int, y: Int): this(x.toDouble(), y.toDouble())\n constructor(x: Long, y: Long): this(x.toDouble(), y.toDouble())\n\n operator fun plus(point: DoublePoint) = DoublePoint(this.x + point.x, this.y + point.y)\n operator fun minus(point: DoublePoint) = DoublePoint(this.x - point.x, this.y - point.y)\n operator fun div(point: DoublePoint) = DoublePoint(this.x / point.x, this.y / point.y)\n operator fun times(point: DoublePoint) = DoublePoint(this.x * point.x, this.y * point.y)\n\n operator fun plus(coefficient: Double) = DoublePoint(this.x + coefficient, this.y + coefficient)\n operator fun plus(coefficient: Long) = DoublePoint(this.x + coefficient, this.y + coefficient)\n operator fun plus(coefficient: Int) = DoublePoint(this.x + coefficient, this.y + coefficient)\n operator fun minus(coefficient: Double) = DoublePoint(this.x - coefficient, this.y - coefficient)\n operator fun minus(coefficient: Long) = DoublePoint(this.x - coefficient, this.y - coefficient)\n operator fun minus(coefficient: Int) = DoublePoint(this.x - coefficient, this.y - coefficient)\n operator fun div(coefficient: Double) = DoublePoint(this.x / coefficient, this.y / coefficient)\n operator fun div(coefficient: Long) = DoublePoint(this.x / coefficient, this.y / coefficient)\n operator fun div(coefficient: Int) = DoublePoint(this.x / coefficient, this.y / coefficient)\n operator fun times(coefficient: Double) = DoublePoint(this.x * coefficient, this.y * coefficient)\n operator fun times(coefficient: Long) = DoublePoint(this.x * coefficient, this.y * coefficient)\n operator fun times(coefficient: Int) = DoublePoint(this.x * coefficient, this.y * coefficient)\n\n fun distanceTo(point: DoublePoint) = Math.sqrt(((this.x - point.x) * (this.x - point.x) + (this.y-point.y) * (this.y - point.y)))\n fun polarAngle(): Double {\n val minPolarAngle = Math.atan2(y, x)\n return if(minPolarAngle < 0) minPolarAngle + 2 * Math.PI else minPolarAngle\n }\n }\n class Vector(x: Double, y: Double): DoublePoint(x, y) {\n constructor(x: Int, y: Int): this(x.toDouble(), y.toDouble())\n constructor(x: Long, y: Long): this(x.toDouble(), y.toDouble())\n\n fun length() = Math.sqrt(x*x + y*y)\n fun angleTo(vector: Vector): Double {\n val temp = this * vector\n return Math.acos((temp.x + temp.y) / this.length() / vector.length())\n }\n }\n //End KT Extensions\n\n abstract fun solve(scanner: Scanner, printer: PrintWriter)\n }\n\n class FastScanner: Scanner {\n var inputStream: InputStream? = null\n override fun changeInputStream(inputStream: InputStream) {\n this.inputStream = inputStream\n this.bufferedReader = BufferedReader(InputStreamReader(inputStream))\n }\n\n private lateinit var bufferedReader: BufferedReader\n private var stringTokenizer: StringTokenizer? = null\n\n private fun nextToken(): String? {\n while (stringTokenizer == null || !stringTokenizer!!.hasMoreTokens())\n stringTokenizer = StringTokenizer(bufferedReader.readLine() ?: return null)\n return stringTokenizer!!.nextToken()\n }\n\n override fun nextInt() = nextToken()!!.toInt()\n override fun nextLong() = nextToken()!!.toLong()\n override fun nextDouble() = nextToken()!!.toDouble()\n override fun nextChar() = bufferedReader.read().toChar()\n override fun nextString() = nextToken()!!\n override fun nextLine() = bufferedReader.readLine()!!\n override fun nextBigInteger() = BigInteger(nextToken()!!)\n override fun nextBigDecimal() = BigDecimal(nextToken()!!)\n }\n\n class TaskBuilder {\n private var task: Task? = null\n private var inputStream: InputStream? = null\n private var outputStream: OutputStream? = null\n private var scanner: Scanner? = null\n\n fun useInputSource(inputStream: InputStream): TaskBuilder {\n this.inputStream = inputStream\n return this\n }\n\n fun useOutputSource(outputStream: OutputStream): TaskBuilder {\n this.outputStream = outputStream\n return this\n }\n\n fun useInputFile(inputFileName: String): TaskBuilder {\n this.inputStream = FileInputStream(File(inputFileName))\n return this\n }\n\n fun useOutputFile(outputFileName: String): TaskBuilder {\n this.outputStream = FileOutputStream(File(outputFileName))\n return this\n }\n\n fun useScanner(scanner: Scanner): TaskBuilder {\n this.scanner = scanner\n return this\n }\n\n\n fun solveTask(task: Task): TaskBuilder {\n this.task = task\n return this\n }\n\n fun run() {\n when {\n task == null -> throw NullPointerException(\"Task cannot be null!\")\n inputStream == null -> throw NullPointerException(\"Input cannot be null!\")\n outputStream == null -> throw NullPointerException(\"Output cannot be null!\")\n scanner == null -> throw NullPointerException(\"Scanner cannot be null!\")\n }\n scanner!!.changeInputStream(inputStream!!)\n val printer = PrintWriter(outputStream)\n TaskRunnable(task!!, scanner!!, printer).run()\n\n inputStream!!.close()\n printer.close()\n }\n\n class TaskRunnable(\n private val task: Task,\n private val scanner: Scanner,\n private val printer: PrintWriter\n ) {\n fun run() {\n task.solve(scanner, printer)\n }\n }\n }\n\n @JvmStatic\n fun main(args: Array) = TaskBuilder()\n// .useInputSource(BufferedInputStream(FileInputStream(\"area1.in\")))\n// .useOutputSource(BufferedOutputStream(FileOutputStream(\"area1.out\")))\n .useInputSource(System.`in`)\n .useOutputSource(System.out)\n .useScanner(FastScanner())\n .solveTask(TaskF())\n .run()\n\n class TaskA: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val length = scanner.nextInt()\n val numbers = Array(length) { scanner.nextInt() }\n\n var maxOnesCount = -1\n\n (0 until length) { i ->\n (i until length) { j ->\n var currentCountOfOnes = 0\n (0 until length) {\n currentCountOfOnes += if((it in (i..j) && 1 - numbers[it] == 1) || (it !in (i..j) && numbers[it] == 1)) 1 else 0 }\n maxOnesCount = max(maxOnesCount, currentCountOfOnes)\n }\n }\n\n printer.println(maxOnesCount)\n }\n\n }\n\n class TaskD: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val length = scanner.nextLong()\n (length until 2 * length) { printer.print(\"$it \") }\n }\n\n }\n\n class TaskE: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val length = scanner.nextInt()\n val lineLengths = Array(length) { scanner.nextInt() }\n lineLengths.sort()\n for(it in (2 until length))\n if(lineLengths[it-2] + lineLengths[it-1] > lineLengths[it]) {\n printer.println(\"YES\")\n return\n }\n printer.println(\"NO\")\n }\n\n }\n\n class TaskF: Task() {\n override fun solve(scanner: Scanner, printer: PrintWriter) {\n val (start, check, delta) = scanner.nextLine()\n .split(\" \")\n .map { it.toLong() }\n when {\n check < start && delta > 0 -> printer.println(\"NO\")\n check > start && delta < 0 -> printer.println(\"NO\")\n delta == 0L && start == check -> printer.println(\"YES\")\n (check - start) % delta == 0L -> printer.println(\"YES\")\n else -> printer.println(\"NO\")\n }\n }\n\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "8eff040a410f343e4a9078d0e328f3a5", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "2e70dae0d207adc9fcec5565149ccd85", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9255813953488372, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val initial = reader.nextLong()\n val desired = reader.nextLong()\n val seq = reader.nextLong()\n if (desired - initial == 0L) {\n println(\"YES\")\n return\n }\n if ((desired - initial) % seq == 0L && ((desired - initial) / seq) > 0)\n println(\"YES\")\n else println(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "54a4c4950aa64b397182967c271fd56f", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "7f7d19cc988f867c03d44a3837daae44", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9988940499889405, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.PrintWriter\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\nimport kotlin.math.*\n\nval n = 0\nval m = 0\nfun valid(i: Int, j: Int): Boolean {\n return i in 0 until n && j in 0 until m\n}\n\nfun sumRow(arr: IntArray): Int {\n var sum = 0\n for (element in arr) sum += element\n return sum\n}\n\nfun sumCol(twoDArr: Array, colNumber: Int): Int {\n var sum = 0\n for (element in twoDArr) {\n sum += element[colNumber]\n }\n return sum\n}\n\n@JvmField\nval INPUT = System.`in`\n@JvmField\nval OUTPUT = System.out\n\n@JvmField\nval _reader = INPUT.bufferedReader()\n\nfun readLine(): String? = _reader.readLine()!!\nfun readLn() = _reader.readLine()!!\n@JvmField\nvar _tokenizer: StringTokenizer = StringTokenizer(\"\")\n\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\n\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }.toMutableList().toLongArray()\n\n@JvmField\nval _writer = PrintWriter(OUTPUT, false)\n\ninline fun output(block: PrintWriter.() -> Unit) {\n _writer.apply(block).flush()\n}\n\nfun printArr(arr: IntArray, start: Int, end: Int) {\n for (i in start..end) {\n print(\"${arr[i]} \")\n }\n println()\n}\n\nfun printArr(arr: LongArray, start: Int, end: Int) {\n for (i in start..end) {\n print(\"${arr[i]} \")\n }\n println()\n}\n\nfun main() {\n val (a, b, c) = readLongs(3)\n if (a == b) println(\"YES\")\n else if (a < b && c > 0) if (c == 1L) println(\"YES\") else println(if ((b - a) % c == 0L) \"YES\" else \"NO\")\n else if (a > b && c < 0) if (c == -1L) println(\"NO\") else println(if ((b - a) % c == 0L) \"YES\" else \"NO\")\n else println(\"NO\")\n //TODO(\"KYS\")\n}\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "758c3807415020e3ea7d6d08fbaa780a", "src_uid": "9edf42c20ddf22a251b84553d7305a7d", "apr_id": "1582e8213a0e2bb4f42ab08ee9f3c476", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8043647700701481, "equal_cnt": 21, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 19, "fix_ops_cnt": 21, "bug_source_code": "fun main() {\n val (a, b) = readLine()!!.split(\" \").map { it.toInt() }\n val (c, d) = readLine()!!.split(\" \").map { it.toInt() }\n when {\n a % 2 == 0 && b % 2 == 0 && c % 2 == 0 && d % 2 != 0 -> print(-1)\n c % 2 == 0 && d % 2 == 0 && a % 2 == 0 && b % 2 != 0 -> print(-1)\n else -> {\n var first = b\n var second = d\n while (first != second) {\n if (first < second) first += a else second += c\n }\n print(first)\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "ad9ccca1c55c1331ad51dc4257e43170", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "apr_id": "defe471954a1bbcb0c874d16052136f5", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9995636998254799, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\ntailrec fun gcd(a: Int, b: Int): Int {\n if (a != 0 && b != 0) {\n if (a > b) return gcd(a % b, b)\n else return gcd(b % a, a)\n }\n\n return a + b\n}\n\nfun gcde(a: Int, b: Int): Triple {\n if (a == 0) {\n return Triple(b, 0, 1)\n }\n\n val (d, x1, y1) = gcde(b % a, a)\n\n return Triple(d, y1 - (b / a) * x1, x1)\n}\n\nfun DataReader.solve(out: PrintWriter) {\n val b = nextInt()\n val a = nextInt()\n val d = nextInt()\n val c = nextInt()\n\n val q = c - a\n val (g) = gcde(b, -d)\n\n if (q % g != 0) {\n out.println(-1)\n return\n }\n\n for (i in 1..100000000) {\n val w = a + i * b - c\n\n if (w >= 0 && w % d == 0) {\n out.println(w + c)\n return\n }\n }\n\n//\n// val p = q / g\n//\n// val (g1, x, y) = gcde(b / g, -d / g)\n//\n// val (xr, yr) = x * p to y * p\n\n\n\n throw RuntimeException(\":(\")\n}\n\nfun Boolean.toYesNo() = if (this) \"YES\" else \"NO\"\n\nclass DataReader(private val reader: BufferedReader) {\n var st : StringTokenizer? = null\n companion object {\n fun createFromFile(name: String) = DataReader(BufferedReader(FileReader(name)))\n }\n\n fun next() : String? {\n while (st == null || !st!!.hasMoreTokens()) {\n val s = reader.readLine() ?: return null\n st = StringTokenizer(s)\n }\n\n return st?.nextToken()\n }\n\n fun nextToken() = next()!!\n\n fun nextInt() = nextToken().toInt()\n fun nextLong() = nextToken().toLong()\n fun readIntArray(n: Int) : IntArray {\n val result = IntArray(n)\n result.indices.forEach { i -> result[i] = nextInt() }\n return result\n }\n\n fun readLongArray(n: Int) : LongArray {\n val result = LongArray(n)\n result.indices.forEach { i -> result[i] = nextLong() }\n return result\n }\n\n fun nextLine() = reader.readLine()\n}\n\nfun main(args: Array) {\n val r: Reader\n val out: PrintWriter\n if (System.getProperty(\"ONLINE_JUDGE\") == null) {\n r = FileReader(\"input.txt\")\n out = PrintWriter(\"output.txt\")\n } else {\n r = InputStreamReader(System.`in`)\n out = PrintWriter(System.out)\n }\n\n DataReader(BufferedReader(r)).solve(out)\n out.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "e77a2cbbee0a32325684f373ac276b0f", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "apr_id": "6e9b732cda83a7a8d9de3ab111c888d3", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9812855980471928, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import ds.*\nimport nt.*\nimport java.io.*\nimport java.util.*\nimport java.math.*\n\n//val inp = BufferedReader(FileReader ( \"input.txt\" ) )\nval inp = BufferedReader(InputStreamReader(System.`in`))\n\n\nfun solve() : Int {\n\tval a = ( inp.readLine() ?: return 1 ).split(\" \").map{ it.toInt() }\n\tval b = ( inp.readLine() ?: return 1 ).split(\" \").map{ it.toInt() }\n\tvar curA = a[1]\n\tvar curB = b[1]\n\tfor ( i in 1..1000000 ) {\n\t\tif ( curA == curB ) {\n\t\t\tprintln ( \"\" + curA )\n\t\t\treturn 0\n\t\t}\n\t\tif ( curA < curB ) curA += a[0]\n\t\telse curB += b[0]\n\t}\n\tprintln ( \"-1\" )\n\treturn 0\n}\n\nfun main ( args : Array ) {\n\twhile (solve()==0);\n}\n", "lang": "Kotlin", "bug_code_uid": "cc166b8e1d2e1208f11cf83d4a60a905", "src_uid": "158cb12d45f4ee3368b94b2b622693e7", "apr_id": "ed4b494276aaeec539def38ac5711fd7", "difficulty": 1200, "tags": ["math", "brute force", "number theory"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7709750566893424, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var N = 0\n for (i in n downTo 0){\n if (n % 2 == 0){\n N++\n n /= 2\n }\n }\n print(N)\n }", "lang": "Kotlin", "bug_code_uid": "964d714c8bb66ecca78a023511c9a345", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "edb82816c49e1245137b00a229689d49", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9295774647887324, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var N = 0\n for (i in n downTo 1){\n if (n % 2 == 1)\n N++\n n /= 2\n }\n print(N)\n }", "lang": "Kotlin", "bug_code_uid": "6a48655db1ab90e498557a92624201c3", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "edb82816c49e1245137b00a229689d49", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.41005802707930367, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "//package tasks.t579a\n\nimport kotlin.math.*\n\nfun main(args: Array) {\n readLine()!!.toDouble().let {\n val res = it - 2.0.pow(log2(it).toInt()) + 1\n println(res.toInt())\n }\n}", "lang": "Kotlin", "bug_code_uid": "8ca2eeac4c2418eb9f4c3eb27bc3f3c1", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "4380629d1984e8f3a0be21e55edfd5f6", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5263157894736842, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val x = br.readLine().toInt()\n val pow = findClosestPow(x)\n val rem = x - pow\n println(1 + rem)\n}\n\nfun findClosestPow (x: Int): Int{\n tailrec fun go (i: Int, acc: Int): Int =\n if (acc == x) acc\n else if (acc > x) acc/2\n else go(i + 1, acc*2)\n return go(0, 1)\n}", "lang": "Kotlin", "bug_code_uid": "e83d21f08ee7f416a7fd889c64ce403f", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "632979a42ca411216b613b0b30e53607", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8571428571428571, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n println(readLine()!!.count { it == '1' })\n}", "lang": "Kotlin", "bug_code_uid": "c66e0cc011232ff16ef517c8e745bf9b", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "66d8afc539af6001660fe41d0a49466d", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.608, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "//package codeforces\n\nimport java.io.BufferedReader\nimport java.io.InputStreamReader\n\n\nfun main() {\n val In = BufferedReader(InputStreamReader(System.`in`))\n val n = In.readLine()!!.toInt()\n if(n<1)\n println(0)\n\n var res = 1\n for (i in 0..8*Integer.BYTES) {\n var current = 1 shl i\n if(current > n)\n break\n res = i\n }\n println((n - Math.pow(2.0, res.toDouble()) + 1).toInt())\n}", "lang": "Kotlin", "bug_code_uid": "ff7a29e73154d8f6262a7d3ab5c9cc33", "src_uid": "03e4482d53a059134676f431be4c16d2", "apr_id": "25d413bb903acb704ede3c6562cc933a", "difficulty": 1000, "tags": ["bitmasks"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3782696177062374, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun main()\n{\n // ismail moussi Test Kotlin kotlin\n val num=readLine()!!.toInt()\n var count=1\n var count2=0\n var range=0\n while(count max2) {\n ansMax = max1\n\n nmax -= (max1 * k1)\n val max22 = min(a2, nmax / k2)\n ansMax += max22\n } else {\n ansMax = max2\n\n nmax -= (max2 * k2)\n val max22 = min(a1, nmax / k1)\n ansMax += max22\n }\n\n\n var ansMin = 0\n// var nMin = n\n// if (k1 > k2) {\n// var k = min(a1, nMin / k1)\n// ansMin += k\n// nMin -= k * k1\n//\n// k = min(a2, nMin / k2)\n// ansMin += k\n// } else {\n// var k = min(a2, nMin / k2)\n// ansMin += k\n// nMin -= k * k2\n//\n// k = min(a1, nMin / k1)\n// ansMin += k\n// }\n\n// var kart = (n / (a1 + a2))\n// var t1 = kart\n// var t2 = kart\n//\n// if (k1 < t1) {\n// t2 += t1 - k1\n// } else {\n// if (k2 < t2) {\n// t1 += t2 - k2\n// }\n// }\n//\n// if (t1 >= k1) {\n// ansMin += a1\n// }\n// if (t2 >= k2) {\n// ansMin += a2\n// }\n\n\n var m = ArrayList()\n for (i in 1..a1) m.add(k1)\n for (i in 1..a2) m.add(k2)\n\n var key = false\n while (!key) {\n key = true\n for (i in 0 until m.size) {\n val k = m[i]\n if (k <= 1) continue\n n--\n if (n < 1) {\n key = true\n break\n }\n m[i]--\n key = false\n }\n }\n\n\n ansMin = max(0,min(n, a1 + a2))\n\n print(\"$ansMin $ansMax\")\n}", "lang": "Kotlin", "bug_code_uid": "a8c69bbb2e84c474de04094d30b2f233", "src_uid": "2be8e0b8ad4d3de2930576c0209e8b91", "apr_id": "9b1789f5b5c436f99a423c71fe2e4086", "difficulty": 1000, "tags": ["greedy", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9486486486486486, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package my.demo\n\nimport kotlin.text.*\nfun main(){\n val x = readLine()\n var cnt: Int = 0\n var buang: Int = 0\n for(i in x.toString()){\n if(i=='a')\n cnt += 1\n }\n var n :Int = x.toString().length\n var half: Double = n/2.0\n while(half>=cnt)\n {\n buang+=1\n half=(n-buang)/2.0\n }\n var ans:Int =n-buang\n println(ans)\n return\n}\n", "lang": "Kotlin", "bug_code_uid": "9dd86ac08fc38b8ac0c827ae1d2ca121", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "a58318513fd42056a7f02c7fd31fcf3e", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6049382716049383, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val line = readLine()!!.toCharArray()\n val n = line.size\n var a = 0;\n for (i in 0 until n)\n if (line[i] == 'a')\n a++\n\n if (a > n / 2)\n print(n)\n else\n print(++a)\n\n}", "lang": "Kotlin", "bug_code_uid": "a70471ba8ef8dc0436ba3086f04d29da", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "9d8490efa05775d15e5aa9e63e57e1a1", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9652777777777778, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val input = Scanner(System.`in`)\n while (input.hasNext()) {\n val s = input.next()\n val len = s.length\n var res = 0\n for (elem in s.toCharArray()) {\n if (elem == 'a') {\n res++\n }\n }\n res *= 2\n if (res > len) {\n println(len)\n } else {\n println(len - res)\n }\n }\n input.close()\n}", "lang": "Kotlin", "bug_code_uid": "9c1d3038bc88e0eb8c28e4736a5f49f6", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "f969753130e6c7f94f02354fcfde7fea", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9875706214689266, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n while (input.hasNext()) {\n val s = input.next()\n val len = s.length\n var res = 0\n for (elem in s.toCharArray()) {\n if (elem == 'a') {\n res++\n }\n }\n res *= 2\n if (res > len) {\n println(len)\n } else {\n println(len - res)\n }\n }\n input.close()\n}\n", "lang": "Kotlin", "bug_code_uid": "f8044ee96441b6bfd485d6b180508db6", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "f969753130e6c7f94f02354fcfde7fea", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9975031210986267, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val s = readLn()\n\n val ans = maxOf(s.length, 2 * s.count { it == 'a' } - 1)\n\n println(ans)\n}\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit)\n { Output().apply(block).nowPrint() }\n", "lang": "Kotlin", "bug_code_uid": "1fe0ec1dcea55405837c079a1f7e73c8", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "87e84e99a4b59a9953afe8c560781424", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.14814814814814814, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "fun suma(s:String):Int{\n var count=0\n for(i in s.indices)\n {\n if(s[i]=='a')\n {\n count++\n }\n }\n return count\n}\nfun main()\n{\n val s :String= readLine()!!\n var count=0\n //var siize=(s.length/2)+1\n var i=0\n var test=0\n var su=suma(s)\n if(s.length==1)\n {\n print(1)\n return\n }\n if(suma(s)>s.length/2)\n {\n print(s.length)\n return\n }else\n {\n while(su<(s.length/2))\n {\n if(s[test]!='a')\n {\n su++\n }\n }\n }\n print(su)\n}", "lang": "Kotlin", "bug_code_uid": "8873125061c28d123c96e814e0931847", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "1d5434109ef41b42cf800b76cdc73b60", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9760956175298805, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val x = readLine()!!\n var aScore = 0\n for(i in 0 until x.length){\n when{\n (x[i] == 'a') ->aScore++\n }\n }\n if(aScore > x.length-aScore) println(x.length) else println(aScore+1)\n}", "lang": "Kotlin", "bug_code_uid": "55af163dda9bcdbd010f604e17ee4201", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "d4974c5c750bc92a037cffa3dc107d0a", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9045871559633027, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\nprivate fun readLong() = readLn().toLong()\nprivate fun readDouble() = readLn().toDouble()\nprivate fun readStrings() = readLn().split(' ')\nprivate fun readInts() = readStrings().map { it.toInt() }\nprivate fun readLongs() = readStrings().map { it.toLong() }\nprivate fun readDoubles() = readStrings().map { it.toDouble() }\n\nfun main() {\n val s = readLn()\n val cntA = s.count { it == 'a' }\n println(if (cntA > s.length / 2) s.length else if (cntA == 1) 1 else cntA + 1)\n}\n", "lang": "Kotlin", "bug_code_uid": "1b01547f3f4e94f9bd1b29a8bff2e07e", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219", "apr_id": "937b7cc269bff6b5b179ff7595bbdbbe", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.943089430894309, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val m = readLine()!!.toInt()\n var t = 0\n var maks = 0\n for (i in 1..n)\n {\n val a = readLine()!!.toInt()\n t+=a\n if (a > maks)\n maks = a\n }\n var mini = (t+m)/n\n if (mini * n < t+m)\n mini++\n println(\"$mini ${maks+m}\")\n}", "lang": "Kotlin", "bug_code_uid": "8702e5a9c9501e1eb39f90970dcb22d7", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "apr_id": "7c9678ce3b6d69befaa7db103851e282", "difficulty": 1100, "tags": ["implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9424778761061947, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val m = scanner.nextInt()\n val a = mutableListOf()\n while (scanner.hasNextInt()) {\n a.add(scanner.nextInt())\n }\n\n a.sortByDescending { it }\n val firstValue = a[0] + m\n for (i in 0 until m) {\n a.sortBy { it }\n a[0]++\n }\n print(a[0])\n print(\" \")\n print(firstValue)\n}\n", "lang": "Kotlin", "bug_code_uid": "9ff3cbe310a049d86083c9e48fa71017", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "apr_id": "8f79f6bbfecfd123c4a73f103583b1cf", "difficulty": 1100, "tags": ["implementation", "binary search"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9676025917926566, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val m = scanner.nextInt()\n val a = mutableListOf()\n while (scanner.hasNextInt()) {\n a.add(scanner.nextInt())\n }\n\n a.sortByDescending { it }\n val firstValue = a[0] + m\n for (i in 0 until m) {\n a.sortBy { it }\n a[0]++\n }\n print(a[0])\n print(\" \")\n print(firstValue)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "2cae2e02a21c206cc3ee563be3239356", "src_uid": "78f696bd954c9f0f9bb502e515d85a8d", "apr_id": "8f79f6bbfecfd123c4a73f103583b1cf", "difficulty": 1100, "tags": ["implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9899665551839465, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.*\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val str = scanner.next()\n if (str.reversed() == scanner.next())\n println(\"YES\")\n else\n println(\"NO\")\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\n\n//class Pair(var a: Int, var b: Int): Comparable {\n// override fun compareTo(other: Pair): Int {\n// return b - a - other.b + other.a\n// }\n//}", "lang": "Kotlin", "bug_code_uid": "d31c6f92c66b6e1f701b538cc887b1ed", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "da60620b984741cc139a155115c3240f", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8243243243243243, "equal_cnt": 14, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 11, "fix_ops_cnt": 14, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val s1 = r.readLine()!!\n val s2 = r.readLine()!!\n val len = s1.length\n var correct = true\n (0..len-1).forEach { \n if (s1[it]!=s2[len-1-it]) correct = false\n }\n println(if (correct) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "994b48a20b3af3bac9cb59a69c930e42", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "d0cb25e8885cdd69060fc217659dbcbe", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8228404099560761, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array) {\n var S = readLine()!!\n var s = readLine()!!\n var n = s.length-1\n var c = true\n for (i in 0..n){\n if (S[i] == s[n-i])\n c = true\n else\n c = false\n }\n if (c == true)\n print(\"YES\")\n else\n print(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "a6a85cade910fac7ec74fc5d8b57db6f", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "952c5d1ad07f242c41595d59d08d4469", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8626865671641791, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n var S = readLine()!!\n var s = readLine()!!\n var n = s.length-1\n var c = 0\n for (i in 0..n){\n if (S[i] == s[n-i])\n c ++\n else\n c --\n }\n if (c == n+1)\n print(\"YES\")\n else\n print(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "805a27bf74861e4a45c1733129d06be1", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "952c5d1ad07f242c41595d59d08d4469", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9136786188579017, "equal_cnt": 12, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 11, "fix_ops_cnt": 12, "bug_source_code": "\n// https://codeforces.com/problemset/problem/41/A\n\n\nfun main(args: Array) {\n val word = readLn()\n val translation = readLn()\n\n var correct = true\n for ((index, value) in word.withIndex()) {\n if (value != translation[translation.length - 1 - index]) {\n correct = false\n }\n }\n\n if (correct) {\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings(del: String = \" \") = readLn().split(del) // list of strings\nprivate fun readInts(del: String = \" \") = readStrings(del).map { it.toInt() } // list of ints", "lang": "Kotlin", "bug_code_uid": "d287cf8f445301c3abe259e71e8deeae", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "0b1aca633759212bbd7778aea239caaa", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9240506329113924, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.util.*\nfun main() {\n val sc = Scanner(System.`in`)\n val s = sc.nextLine()\n if(s==s.reversed()) print(\"YES\") else print(\"NO\")\n}\n\n", "lang": "Kotlin", "bug_code_uid": "9ffbfcfffef99d67f0f65a198ded35c6", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "81f7d3e081db24764c7ccaf1bbdd042e", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7823050058207218, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args:Array){\n val word = readLine()!!\n val translateWord = readLine()!!\n\n var isTrueTranslate = true\n\n for(i in 0.. word.lastIndex){\n if (word[i] != translateWord[translateWord.lastIndex - i]){\n isTrueTranslate = false\n }\n }\n\n if (isTrueTranslate){\n print(\"YES\")\n } else {\n print(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "5fb5b595f29737acc2e0cd7e077d6056", "src_uid": "35a4be326690b58bf9add547fb63a5a5", "apr_id": "1c05d412461310b2be629db802685921", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9985677456316242, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readString() = readLn().trim()\nprivate fun readInt() = readLn().toInt()\nprivate fun readLong() = readLn().toLong()\nprivate val regSpace = \"\\\\s+\".toRegex()\nprivate fun readSomeInts(): List {\n return readLn().trim().split(regSpace).map { it.toInt() }\n}\nprivate fun readSomeLongs(): List {\n return readLn().trim().split(regSpace).map { it.toLong() }\n}\n\ndata class Point(val row: Int, val col: Int)\n\nfun main() {\n val (n, m) = readSomeInts()\n\n fun neighbors(p: Point): List {\n val acc = mutableListOf()\n if (p.row > 0) {\n acc.add(Point(p.row - 1, p.col))\n }\n if (p.col > 0) {\n acc.add(Point(p.row, p.col - 1))\n }\n if (p.col < m - 1) {\n acc.add(Point(p.row, p.col + 1))\n }\n if (p.row < n - 1) {\n acc.add(Point(p.row + 1, p.col))\n }\n return acc\n }\n\n val field = mutableListOf().apply {\n repeat(n) {\n val s = readString()\n this.add(s)\n }\n }.toList()\n\n fun hasWolf(p: Point) = field[p.row][p.col] == 'W'\n\n val wolfNotHangry = Array(n) { BooleanArray(m) }\n \n var countEatenPigs = 0\n for (i in 0 until n) {\n for (j in 0 until m) {\n if (field[i][j] == 'P') {\n val pigPt = Point(i, j)\n val anyWolf = neighbors(pigPt)\n .firstOrNull { pt -> hasWolf(pt) && wolfNotHangry[pt.row][pt.col] }\n if (anyWolf != null) {\n wolfNotHangry[anyWolf.row][anyWolf.col] = true\n countEatenPigs++\n }\n }\n }\n }\n println(countEatenPigs)\n}\n", "lang": "Kotlin", "bug_code_uid": "0fefaf27d45adf94f87881348462bacb", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "apr_id": "5d4de131c251815421629fb51eaf6b77", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9774099753970029, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val table = Table()\n\n val notEatenPig: (Cell) -> Boolean = { it is PigCell && !it.eaten }\n\n // eat variant pig\n fun eatPig(nearbyCount: Int): Int {\n println(\"eat for $nearbyCount pigs\")\n var eatCount = 0\n table.forEachIndexed { x, y, cell ->\n if (cell is WolfeCell && !cell.eat) {\n val nearbyPigs = table.nearby(x, y, notEatenPig)\n if (nearbyPigs.size == nearbyCount) {\n cell.eat = true\n (nearbyPigs.first() as PigCell).eaten = true\n eatCount += 1\n println(\"wolf on ($x, $y) eat pig\")\n }\n }\n }\n return eatCount\n }\n\n println((1..4).fold(0) { acc, count -> acc + eatPig(count) })\n}\n\nclass Table {\n private val matrix: List>\n private val n: Int\n private val m: Int\n\n init {\n readLine()!!.split(\" \")\n .map(String::toInt)\n .also {\n n = it[0]\n m = it[1]\n }\n\n matrix = (0 until n).map {\n readLine()!!.toCharArray().take(m)\n .map {\n when (it) {\n 'P' -> PigCell()\n 'W' -> WolfeCell()\n '.' -> EmptyCell\n else -> throw IllegalArgumentException(\"Unknown animal\")\n }\n }\n }\n }\n\n fun forEachIndexed(action: (x: Int, y: Int, cell: Cell) -> Unit) {\n matrix.forEachIndexed { i, row ->\n row.forEachIndexed { j, cell -> action(i, j, cell) }\n }\n }\n\n private fun inRange(x: Int, y: Int) = x in 0 until n && y in 0 until m\n\n fun nearby(x: Int, y: Int, predicate: (Cell) -> Boolean): List {\n return listOf(\n Pair(x - 1, y), // left\n Pair(x + 1, y), // right\n Pair(x, y - 1), // top\n Pair(x, y + 1) // bottom\n )\n .filter { (x, y) -> inRange(x, y) }\n .map { (x, y) -> matrix[x][y] }\n .filter(predicate)\n }\n}\n\nsealed class Cell\n\ndata class PigCell(\n var eaten: Boolean = false\n) : Cell()\n\ndata class WolfeCell(\n var eat: Boolean = false\n) : Cell()\n\nobject EmptyCell : Cell()", "lang": "Kotlin", "bug_code_uid": "247b7f92cf8c6ee49fc0e98584a65d0b", "src_uid": "969b24ed98d916184821b2b2f8fd3aac", "apr_id": "6ea3642487774ad5774c3d990c099c7b", "difficulty": 1100, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9984, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.FileInputStream\nimport java.util.*\n\nobject program {\n @JvmStatic fun main(args: Array) {\n if (args.size == 1)\n System.setIn(FileInputStream(args[0]))\n val sc = Scanner(System.`in`)\n sc.nextLine()\n val all = sc.nextLine()\n var eights = all.filter { it == '8' }.count()\n var others = all.length - eights\n var numbers = 0\n while (eights > 0) {\n eights--\n IntRange(1, 10).forEach {\n if (others > 0)\n others--\n else\n eights--\n }\n if (numbers < 0 || eights < 0)\n break\n numbers++\n }\n println(numbers)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "4cc801c8c725eb929068b04c2794d005", "src_uid": "259d01b81bef5536b969247ff2c2d776", "apr_id": "71b8d143232627bb28afdda9c476ec8a", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9899665551839465, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n var n = readLine()!!.toInt()\n var digits = readLine()!!.count {it == '8'}\n println(minOf(n / 8, digits))\n}\n", "lang": "Kotlin", "bug_code_uid": "d003195d3470381bc524294de69b3d0c", "src_uid": "259d01b81bef5536b969247ff2c2d776", "apr_id": "c3881b76e15998e6a3ee52424eaf5940", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9998432356168678, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport java.util.Scanner\n\nfun sum(a: Int, b: Int): Int {\n return a + b\n}\n \nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val l = input.nextInt()\n val r = input.nextInt()\n val ans = 0\n val x: IntArray = intArrayOf(0, 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 64, 72, 81, 96, 108, 128, 144, 162, 192, 216, 243, 256, 288, 324, 384, 432, 486, 512, 576, 648, 729, 768, 864, 972, 1024, 1152, 1296, 1458, 1536, 1728, 1944, 2048, 2187, 2304, 2592, 2916, 3072, 3456, 3888, 4096, 4374, 4608, 5184, 5832, 6144, 6561, 6912, 7776, 8192, 8748, 9216, 10368, 11664, 12288, 13122, 13824, 15552, 16384, 17496, 18432, 19683, 20736, 23328, 24576, 26244, 27648, 31104, 32768, 34992, 36864, 39366, 41472, 46656, 49152, 52488, 55296, 59049, 62208, 65536, 69984, 73728, 78732, 82944, 93312, 98304, 104976, 110592, 118098, 124416, 131072, 139968, 147456, 157464, 165888, 177147, 186624, 196608, 209952, 221184, 236196, 248832, 262144, 279936, 294912, 314928, 331776, 354294, 373248, 393216, 419904, 442368, 472392, 497664, 524288, 531441, 559872, 589824, 629856, 663552, 708588, 746496, 786432, 839808, 884736, 944784, 995328, 1048576, 1062882, 1119744, 1179648, 1259712, 1327104, 1417176, 1492992, 1572864, 1594323, 1679616, 1769472, 1889568, 1990656, 2097152, 2125764, 2239488, 2359296, 2519424, 2654208, 2834352, 2985984, 3145728, 3188646, 3359232, 3538944, 3779136, 3981312, 4194304, 4251528, 4478976, 4718592, 4782969, 5038848, 5308416, 5668704, 5971968, 6291456, 6377292, 6718464, 7077888, 7558272, 7962624, 8388608, 8503056, 8957952, 9437184, 9565938, 10077696, 10616832, 11337408, 11943936, 12582912, 12754584, 13436928, 14155776, 14348907, 15116544, 15925248, 16777216, 17006112, 17915904, 18874368, 19131876, 20155392, 21233664, 22674816, 23887872, 25165824, 25509168, 26873856, 28311552, 28697814, 30233088, 31850496, 33554432, 34012224, 35831808, 37748736, 38263752, 40310784, 42467328, 43046721, 45349632, 47775744, 50331648, 51018336, 53747712, 56623104, 57395628, 60466176, 63700992, 67108864, 68024448, 71663616, 75497472, 76527504, 80621568, 84934656, 86093442, 90699264, 95551488, 100663296, 102036672, 107495424, 113246208, 114791256, 120932352, 127401984, 129140163, 134217728, 136048896, 143327232, 150994944, 153055008, 161243136, 169869312, 172186884, 181398528, 191102976, 201326592, 204073344, 214990848, 226492416, 229582512, 241864704, 254803968, 258280326, 268435456, 272097792, 286654464, 301989888, 306110016, 322486272, 339738624, 344373768, 362797056, 382205952, 387420489, 402653184, 408146688, 429981696, 452984832, 459165024, 483729408, 509607936, 516560652, 536870912, 544195584, 573308928, 603979776, 612220032, 644972544, 679477248, 688747536, 725594112, 764411904, 774840978, 805306368, 816293376, 859963392, 905969664, 918330048, 967458816, 1019215872, 1033121304, 1073741824, 1088391168, 1146617856, 1162261467, 1207959552, 1224440064, 1289945088, 1358954496, 1377495072, 1451188224, 1528823808, 1549681956, 1610612736, 1632586752, 1719926784, 1811939328, 1836660096, 193491763 )\n for (i in x){\n \tif (i in l..r) { // equivalent of 1 <= i && i <= 10\n \t\tx[0]=1+x[0]\n\t}\n }\n println(x[0])\n}", "lang": "Kotlin", "bug_code_uid": "d0daef51fc704400fb6d6d3326dac645", "src_uid": "05fac54ed2064b46338bb18f897a4411", "apr_id": "f5c00088fec275d7710e5bee1e7630f9", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9993734335839599, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport java.util.Scanner\n\nfun sum(a: Int, b: Int): Int {\n return a + b\n}\n \nfun main(args: Array) {\n val input = Scanner(System.`in`)\n val l = input.nextInt()\n val r = input.nextInt()\n val ans = 0\n val x: IntArray = intArrayOf(0, 326\n1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 64, 72, 81, 96, 108, 128, 144, 162, 192, 216, 243, 256, 288, 324, 384, 432, 486, 512, 576, 648, 729, 768, 864, 972, 1024, 1152, 1296, 1458, 1536, 1728, 1944, 2048, 2187, 2304, 2592, 2916, 3072, 3456, 3888, 4096, 4374, 4608, 5184, 5832, 6144, 6561, 6912, 7776, 8192, 8748, 9216, 10368, 11664, 12288, 13122, 13824, 15552, 16384, 17496, 18432, 19683, 20736, 23328, 24576, 26244, 27648, 31104, 32768, 34992, 36864, 39366, 41472, 46656, 49152, 52488, 55296, 59049, 62208, 65536, 69984, 73728, 78732, 82944, 93312, 98304, 104976, 110592, 118098, 124416, 131072, 139968, 147456, 157464, 165888, 177147, 186624, 196608, 209952, 221184, 236196, 248832, 262144, 279936, 294912, 314928, 331776, 354294, 373248, 393216, 419904, 442368, 472392, 497664, 524288, 531441, 559872, 589824, 629856, 663552, 708588, 746496, 786432, 839808, 884736, 944784, 995328, 1048576, 1062882, 1119744, 1179648, 1259712, 1327104, 1417176, 1492992, 1572864, 1594323, 1679616, 1769472, 1889568, 1990656, 2097152, 2125764, 2239488, 2359296, 2519424, 2654208, 2834352, 2985984, 3145728, 3188646, 3359232, 3538944, 3779136, 3981312, 4194304, 4251528, 4478976, 4718592, 4782969, 5038848, 5308416, 5668704, 5971968, 6291456, 6377292, 6718464, 7077888, 7558272, 7962624, 8388608, 8503056, 8957952, 9437184, 9565938, 10077696, 10616832, 11337408, 11943936, 12582912, 12754584, 13436928, 14155776, 14348907, 15116544, 15925248, 16777216, 17006112, 17915904, 18874368, 19131876, 20155392, 21233664, 22674816, 23887872, 25165824, 25509168, 26873856, 28311552, 28697814, 30233088, 31850496, 33554432, 34012224, 35831808, 37748736, 38263752, 40310784, 42467328, 43046721, 45349632, 47775744, 50331648, 51018336, 53747712, 56623104, 57395628, 60466176, 63700992, 67108864, 68024448, 71663616, 75497472, 76527504, 80621568, 84934656, 86093442, 90699264, 95551488, 100663296, 102036672, 107495424, 113246208, 114791256, 120932352, 127401984, 129140163, 134217728, 136048896, 143327232, 150994944, 153055008, 161243136, 169869312, 172186884, 181398528, 191102976, 201326592, 204073344, 214990848, 226492416, 229582512, 241864704, 254803968, 258280326, 268435456, 272097792, 286654464, 301989888, 306110016, 322486272, 339738624, 344373768, 362797056, 382205952, 387420489, 402653184, 408146688, 429981696, 452984832, 459165024, 483729408, 509607936, 516560652, 536870912, 544195584, 573308928, 603979776, 612220032, 644972544, 679477248, 688747536, 725594112, 764411904, 774840978, 805306368, 816293376, 859963392, 905969664, 918330048, 967458816, 1019215872, 1033121304, 1073741824, 1088391168, 1146617856, 1162261467, 1207959552, 1224440064, 1289945088, 1358954496, 1377495072, 1451188224, 1528823808, 1549681956, 1610612736, 1632586752, 1719926784, 1811939328, 1836660096, 1934917632 )\n for (i in x){\n \tif (i in l..r) { // equivalent of 1 <= i && i <= 10\n \t\tx[0]=1+x[0]\n\t}\n }\n println(x[0])\n}", "lang": "Kotlin", "bug_code_uid": "1f135d7cb4ee2b85d0ed3895c7f93ae9", "src_uid": "05fac54ed2064b46338bb18f897a4411", "apr_id": "f5c00088fec275d7710e5bee1e7630f9", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9335548172757475, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val numToLine = mapOf('0' to \"O-|-OOOO\", '1' to \"O-|O-OOO\", '2' to \"O-|OO-OO\", '3' to \"O-|OOO-O\", '4' to \"O-|OOOO-\",\n '5' to \"-O|-OOOO\", '6' to \"-O|O-OOO\", '7' to \"-O|OO-OO\", '6' to \"-O|OOO-O\", '6' to \"-O|OOOO-\")\n for (c in readLine()!!.reversed()) println(numToLine[c]!!)\n}", "lang": "Kotlin", "bug_code_uid": "7f74875a33dddc96ceef66379f88989c", "src_uid": "c2e3aced0bc76b6484360563355d23a7", "apr_id": "c764013db1b6105771857743b6f27bab", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9994093325457767, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package challenge.codeb\n\nimport java.io.File\nimport java.io.IOException\nimport java.util.StringTokenizer\nimport java.io.InputStreamReader\nimport java.io.BufferedReader\n\nval debugCode = false\n\nfun debugCode(str: String) {\n if (debugCode) {\n println(str)\n }\n}\n\nfun solve(arr: IntArray): Int {\n arr.sort()\n var result = 0\n var i = 0\n while (i < arr.size) {\n result += Math.abs(arr[i]- arr[i+1])\n i += 2\n }\n return result\n}\n\nfun main(args: Array) {\n val scan = FastReader(\"1.txt\")\n val n = scan.nextInt()\n val arr = IntArray(n, {scan.nextInt()} )\n println(solve(arr))\n}\n\n\nclass FastReader(val input: String) {\n var br: BufferedReader\n var st: StringTokenizer? = null\n\n init {\n if (!debugCode) {\n br = BufferedReader(InputStreamReader(System.`in`))\n } else {\n br = BufferedReader(InputStreamReader(File(input).inputStream()))\n }\n }\n\n operator fun next(): String {\n while (st == null || !st!!.hasMoreElements()) {\n try {\n st = StringTokenizer(br.readLine())\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n }\n return st!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLine(): String {\n var str = \"\"\n try {\n str = br.readLine()\n } catch (e: IOException) {\n e.printStackTrace()\n }\n\n return str\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "7382cbd5fbfe56be36f9eb7719d9d9b6", "src_uid": "55485fe203a114374f0aae93006278d3", "apr_id": "b5d6caa7171d54bb6d5e93358f09167c", "difficulty": 800, "tags": ["sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9573863636363636, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.utils.Scanner\n\n fun main(args:Array) {\n var sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var m = sc.nextInt()\n var result = 0\n while (m > n)\n {\n if (m % 2 == 0)\n {\n m = m / 2\n result++\n }\n else\n {\n m++\n result++\n }\n }\n if (n > m)\n {\n result += Math.abs(n - m)\n }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "4bfac32a22855b968742644e0baf8302", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "e82917764fb39d096348aeab247b77f8", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.3884462151394422, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.util.ArrayDeque\n\nprivate fun nextLine() = readLine()!!\nprivate fun nextInt() = nextLine().toInt()\nprivate fun nextToks() = nextLine().split(\" \")\nprivate fun nextInts() = nextToks().map{it.toInt()}\n\ndata class State(val num: Int, val cost: Int)\n\nfun main() {\n val (n, m) = nextInts()\n val queue = ArrayDeque()\n queue.add(State(n, 0))\n while (true) {\n val (num, cost) = queue.remove()\n if (num == m) {\n println(cost)\n break\n }\n queue.add(State(num * 2, cost + 1))\n if (num > 0) queue.add(State(num - 1, cost + 1)) \n }\n}\n", "lang": "Kotlin", "bug_code_uid": "77f3abbf35e21eb9a2c19fd7a8ecbb96", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "ab31b82e699fc5399cb831c955993509", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "MEMORY_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3182618907809748, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 12, "bug_source_code": "import kotlin.math.*\n\nprivate fun nextLine() = readLine()!!\nprivate fun nextInt() = nextLine().toInt()\nprivate fun nextToks() = nextLine().split(\" \")\nprivate fun nextInts() = nextToks().map{it.toInt()}\n\ndata class Result(val ans: Int, val ok: Boolean, val newBound: Int)\n\nfun h(x: Int, m: Int): Int {\n if (x >= m) return x - m\n val log2r = log2(m.toDouble() / x)\n return (2 * ceil(log2r) - floor(log2r)).roundToInt()\n}\n\nfun ida(x: Int, m: Int, cost: Int, bound: Int): Result {\n val fx = cost + h(x, m)\n if (fx > bound) return Result(-1, false, fx)\n if (x == m) return Result(cost, true, -1)\n val (redAns, redFound, redBound) = ida(x*2, m, cost+1, bound)\n if (x == 1) return Result(redAns, redFound, redBound)\n val (blueAns, blueFound, blueBound) = ida(x-1, m, cost+1, bound)\n return when {\n !redFound && !blueFound -> Result(-1, false, minOf(redBound, blueBound))\n !redFound -> Result(blueAns, true, -1)\n !blueFound -> Result(redAns, true, -1)\n else -> Result(minOf(redAns, blueAns), true, -1)\n }\n}\n\nfun main() {\n val (n, m) = nextInts()\n var bound = h(n,m)\n while (true) {\n val (ans, found, newBound) = ida(n, m, 0, bound)\n if (found) {\n println(ans)\n break\n }\n bound = newBound\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "57b628f6108364ec23d3d378279dab46", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "ab31b82e699fc5399cb831c955993509", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9457875457875458, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.lang.StringBuilder\nimport java.util.*\n\nfun PrintWriter.solve(sc: FastScanner) {\n val n = sc.nextInt()\n val m = sc.nextInt()\n val que: Queue> = ArrayDeque()\n que.add(n to 0)\n val visited = Array(100000) { false }\n visited[n] = true\n while (que.count() > 0) {\n val (t, step) = que.poll()\n if (t == m) {\n println(step)\n return\n }\n if (t < m) {\n que.add(2 * t to step + 1)\n visited[2 * t] = true\n }\n if (t > 1) {\n que.add(t - 1 to step + 1)\n visited[t - 1] = true\n }\n }\n}\n\nfun main(args: Array) {\n val writer = PrintWriter(System.out, false)\n writer.solve(FastScanner(System.`in`))\n writer.flush()\n}\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}", "lang": "Kotlin", "bug_code_uid": "ea0682957ab5aa4b0cfb0059fe80ad9f", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "56fadc4230396a5c1fc56d94ac0175a6", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9015235971757711, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.lang.StringBuilder\nimport java.util.*\n\nfun PrintWriter.solve(sc: FastScanner) {\n val n = sc.nextInt()\n val m = sc.nextInt()\n val que: Queue> = ArrayDeque()\n que.add(n to 0)\n val visited = Array(100000) { false }\n visited[n] = true\n while (que.count() > 0) {\n val (t, step) = que.poll()\n if (t == m) {\n println(step)\n return\n }\n if (t < m) {\n que.add(2 * t to step + 1)\n visited[2 * t] = true\n }\n que.add(t - 1 to step + 1)\n visited[t - 1] = true\n }\n}\n\nfun main(args: Array) {\n val writer = PrintWriter(System.out, false)\n writer.solve(FastScanner(System.`in`))\n writer.flush()\n}\n\nclass FastScanner(s: InputStream) {\n private var st = StringTokenizer(\"\")\n private val br = BufferedReader(InputStreamReader(s))\n\n fun next(): String {\n while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())\n\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextLine() = br.readLine()\n fun nextDouble() = next().toDouble()\n fun ready() = br.ready()\n}", "lang": "Kotlin", "bug_code_uid": "1e801383e57bed2d1cce3e92d49cc461", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "56fadc4230396a5c1fc56d94ac0175a6", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7471264367816092, "equal_cnt": 12, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 12, "bug_source_code": "\nfun main(args: Array)\n{\n var count:Int = 0\n var n:Int = readLine()!!.toInt()\n var m:Int = readLine()!!.toInt()\n var temp:Int = n\n if(n >= m) {\n println(message = n - m)\n return\n }\n while(temp != m)\n {\n when {\n (temp*2)-m >= 2 -> temp--\n temp-m == 1 -> temp--\n else -> temp *= 2\n }\n count++\n }\n println(message = count)\n}", "lang": "Kotlin", "bug_code_uid": "d7f75310c8342f59e4e0b7ef5db3792b", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "dbdacb6e4c41d11a8148cfcba8941ce6", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7212453156529259, "equal_cnt": 20, "replace_cnt": 9, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 20, "bug_source_code": "// 7/9/2020 2:44 PM\n\n// https://codeforces.com/problemset/problem/520/B\n\n//package p520\n\nimport java.util.*\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val (n, m) = readInts()\n print(getMinimumClicks(n, m))\n}\n\nclass ClickSequence(val currentDisplay: Int, val target: Int, val currentClicks: Int) : Comparable {\n private val predictedClicks = getNaiveClicks(currentDisplay, target) + currentClicks\n\n override fun compareTo(other: ClickSequence): Int {\n return this.predictedClicks.compareTo(other.predictedClicks)\n }\n}\n\nfun getNaiveClicks(currentDisplay: Int, target: Int) : Int {\n if (currentDisplay >= target)\n return currentDisplay - target\n else {\n return 1 + getNaiveClicks(2*currentDisplay, target)\n }\n}\n\nfun getMinimumClicks(displayNumber: Int, targetNumber: Int) : Int {\n if (displayNumber >= targetNumber)\n return displayNumber - targetNumber\n\n val pq = PriorityQueue()\n pq.add(ClickSequence(displayNumber - 1, targetNumber, 1))\n pq.add(ClickSequence(displayNumber * 2, targetNumber, 1))\n\n var curElement = pq.poll()\n while (curElement.currentDisplay != curElement.target) {\n pq.add(ClickSequence(curElement.currentDisplay - 1, curElement.target, curElement.currentClicks + 1))\n pq.add(ClickSequence(curElement.currentDisplay * 2, curElement.target, curElement.currentClicks + 1))\n curElement = pq.poll()\n }\n\n return curElement.currentClicks\n}", "lang": "Kotlin", "bug_code_uid": "9c87a8fc2a5acfef9be0983d0a186f03", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "b0965e15a0d57051fe37bcad69d28767", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.29394812680115273, "equal_cnt": 5, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import kotlin.math.min\n\nfun main(args: Array) {\n val (n, m) = readLine()!!.split(\" \").map { it.toLong() }\n println(find(n, m, 0))\n}\n\nvar best = Long.MAX_VALUE\n\nfun find(n : Long, m : Long, steps : Int) : Long{\n if (m <= n){\n best = min(steps + n - m, best)\n return best\n }\n\n if (steps < best){\n return min(find( n * 2, m, steps + 1), find(n - 1, m, steps + 1) )\n }else return best\n}", "lang": "Kotlin", "bug_code_uid": "d0f47873eda80f0b386055366ff85ff7", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "d05fde707eed76fe57b05baa004e9782", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6544, "equal_cnt": 12, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.LinkedHashSet\nimport kotlin.math.abs\n\nfun main(){\n var scanner = Scanner(System.`in`)\n var n = scanner.nextInt()\n var m = scanner.nextInt()\n var counts=0\n while(n (abs(n*2)-m) && n>2){\n n = (n-1)*2\n counts+=2\n }\n else if((n-1)*2-m == 0){\n n = (n-1)*2\n counts+=2\n }\n else if((n-1)*2 < n*2 && n>2 ){\n n--\n counts++\n }\n else{\n n *= 2\n counts +=1\n }\n }\n if(n>=m){\n while(n!=m){\n n--\n counts++\n }\n }\n println(counts)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "91a5b65b181532fd3de62aee9f946572", "src_uid": "861f8edd2813d6d3a5ff7193a804486f", "apr_id": "2e921d99d2a41f941cc81d3031b728cc", "difficulty": 1400, "tags": ["dfs and similar", "greedy", "shortest paths", "math", "implementation", "graphs"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9841269841269841, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n val n = ir.nextInt()\n val m = ir.nextInt()\n val res = Math.min(n - m, m)\n\n pw.print(res)\n\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextFloat(): Float {\n return java.lang.Float.parseFloat(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "dd6f02bd1c4fd9201a494d0007296edc", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "apr_id": "6cc1c9833f7aa01aab4a22185e28f5b5", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.02318840579710145, "equal_cnt": 2, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "const val hello = \"hello\"", "lang": "Kotlin", "bug_code_uid": "0c0da728f77d7d249e0dffb6c7856975", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "apr_id": "1173c2f0035758cf92a0ada0305b389d", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4946564885496183, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n\n val line = readLine()\n\n val split = line!!.split(\" \")\n\n val allCats = Integer.valueOf(split[0])\n val leftCats = Integer.valueOf(split[1])\n\n solve(allCats, leftCats)\n}\n\nprivate fun solve(allCats: Int, leftCats: Int) {\n if (leftCats == 0 || leftCats == 1) {\n println(1)\n return\n }\n var arr = MutableList(1) { allCats - 1 }\n\n for (i in 2..leftCats) {\n val biggestGroup = arr.max()\n val splitCats = when {\n biggestGroup == 1 -> listOf()\n biggestGroup == 2 -> listOf(1)\n biggestGroup!!.rem(2) == 1 -> listOf(biggestGroup.div(2), biggestGroup.div(2))\n biggestGroup.rem(2) == 0 -> listOf(biggestGroup.div(2) - 1, biggestGroup.div(2))\n else -> listOf()\n }\n\n arr.remove(biggestGroup)\n arr.addAll(splitCats.toList())\n }\n\n println(arr.size)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "912089821e74a5eaebb7bb451c2acfd6", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "apr_id": "4082df7d8de2814cc107f496f1135dc5", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9972451790633609, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\n\nfun main() {\n val scan = Scanner(System.`in`)\n val cats = scan.nextInt()\n val leftCats = scan.nextInt()\n\n if(cats == leftCats){\n println(0)\n } else if (leftCats == 0){\n println(0)\n } else {\n val catDiff = cats - leftCats\n if (catDiff > leftCats) {\n println(leftCats)\n } else {\n println(catDiff)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "5b44b6bf071eac525412fc28ac3184e7", "src_uid": "c05d0a9cabe04d8fb48c76d2ce033648", "apr_id": "c9b00ad1caf3d065ecfa4f6cb720e761", "difficulty": 900, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9956958393113343, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import peace.n\nimport java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.math.ceil\nimport kotlin.math.floor\nimport kotlin.math.log2\nimport kotlin.math.sqrt\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n val k = scanner.nextInt()\n val arr = IntArray(n) { scanner.nextInt() }\n var res = 0\n for (i in arr) {\n if (i > k)\n break\n res++\n }\n if (res == n) {\n print(n)\n return\n }\n for (i in arr.reversed()) {\n if (i > k)\n break\n res++\n }\n println(res)\n}\n\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\n//class Pair(var a: Int, var b: Int): Comparable {\n// override fun compareTo(other: Pair): Int {\n// return b - a - other.b + other.a\n// }\n//}", "lang": "Kotlin", "bug_code_uid": "ff44faff20b281e735bb9d8cae3e1654", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "apr_id": "7d86527ae0f8ff785b1743be1bd82269", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9233716475095786, "equal_cnt": 3, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val (n,m) = readLine()!!.trim().split(' ').map{it.toInt()}\n val ps = readLine()!!.trim().split(' ').map{it.toInt()}\n val r = ps.takeWhile { it<=m }.count() + ps.takeLastWhile { it<=m }.count()\n println(r)\n}", "lang": "Kotlin", "bug_code_uid": "3041747d463c1f3e50037048b7a6c401", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "apr_id": "70cf62154b9f0546a555d2be45aa657e", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9043358568479009, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n taskA999()\n}\n\nfun taskA999() {\n val input0 = readLine()!!\n .split(' ')\n .map { Integer.parseInt(it) }\n .toCollection(ArrayList())\n val a = readLine()!!\n .split(' ')\n .map { Integer.parseInt(it) }\n .toCollection(ArrayList())\n val n = input0[0]\n val k = input0[1]\n\n var result = 0\n var maxI = 0\n loop1@ for (i in 0 until n) {\n if (a[i] <= k) {\n result++\n } else {\n maxI = i\n break@loop1\n }\n }\n if (maxI != 0 && maxI != n-1)\n (n-1 downTo maxI)\n .takeWhile { a[it] <= k }\n .forEach { result++ }\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "c099e47bc995a42f642efe54656272d8", "src_uid": "ecf0ead308d8a581dd233160a7e38173", "apr_id": "1b6a19db1845440f5401cd217650d5df", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7682276229994073, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "fun main(vararg args: String) {\n val n = readLine()!!.toInt()\n val crush = readLine()!!.split(' ').map { it.toInt() }\n val visited = Array(n) { false }\n val circles = mutableListOf()\n for (i in 0 until n) {\n var count = 0\n var p = i\n while (!visited[p]) {\n visited[p] = true\n p = crush[p] - 1\n ++count\n }\n if (p == i) {\n if (count > 1) circles += count\n } else {\n println(-1)\n return\n }\n }\n var r = when (circles.size) {\n 0 -> 1\n 1 -> circles[0]\n else -> {\n fun nod(a: Int, b: Int): Int = if (b == 0) a else nod(b, a % b)\n val nod = circles.reduce(::nod)\n circles.reduce { a, b -> a / nod * b / nod } * nod\n }\n }\n if (r % 2 == 0) r /= 2\n println(r)\n}\n", "lang": "Kotlin", "bug_code_uid": "b4953faf931bc31dc49f87ad0a976eee", "src_uid": "149221131a978298ac56b58438df46c9", "apr_id": "a3be870971e7751ab5650436231cd173", "difficulty": 1600, "tags": ["math", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9949579831932773, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n var n = r.readLine()!!.toInt()\n val v = r.readLine()!!.split(\" \").map { it.toInt() }\n val ans = IntArray(1000) { 0 }\n for (i in 0..999){\n ans[i] += v[i%7]\n }\n (1..999).forEach { ans[it] +=ans[it-1] }\n fun b(x:Int):Int{\n var le = 0\n var ri = 1000\n while (le le = mi+1\n ans[mi]>=x -> ri = mi\n }\n }\n return le%7+1\n }\n println(b(n))\n}", "lang": "Kotlin", "bug_code_uid": "a2416d5b7517a7b4547b17a0a3b75e18", "src_uid": "007a779d966e2e9219789d6d9da7002c", "apr_id": "1f9a34e385dd9df7efa54e2a724c9761", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9949494949494949, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val pages = readLine()!!.toInt()\n val days = readLine()!!.splitToIntArray()\n val useful = days.indices.filter { days[it] > 0 }\n\n var cur = -1\n var done = 0\n\n while (done < pages) {\n cur = (cur + 1) % useful.size\n done += days[useful[cur]]\n }\n\n println(cur + 1)\n}\n\nprivate fun String.toLettersList(): List {\n return toCharArray().map { it.toString() }\n}\n\nprivate fun String.splitToIntArray(): IntArray {\n val n = length\n if (n == 0) return IntArray(0) // EMPTY\n var res = IntArray(4)\n var m = 0\n var i = 0\n while (true) {\n var cur = 0\n var neg = false\n var c = get(i) // expecting number, IOOB if there is no number\n if (c == '-') {\n neg = true\n i++\n c = get(i) // expecting number, IOOB if there is no number\n }\n while (true) {\n val d = c.toInt() - '0'.toInt()\n require(d >= 0 && d <= 9) { \"Unexpected character '$c' at $i\" }\n require(cur >= Integer.MIN_VALUE / 10) { \"Overflow at $i\" }\n cur = cur * 10 - d\n require(cur <= 0) { \"Overflow at $i\" }\n i++\n if (i >= n) break\n c = get(i)\n if (c == ' ') break\n }\n if (m >= res.size) res = res.copyOf(res.size * 2)\n res[m++] = if (neg) cur else (-cur).apply { require(this >= 0) { \"Overflow at $i\" } }\n if (i >= n) break\n i++\n }\n if (m < res.size) res = res.copyOf(m)\n return res\n}", "lang": "Kotlin", "bug_code_uid": "86f5d16fd895390eb885ca533c6889be", "src_uid": "007a779d966e2e9219789d6d9da7002c", "apr_id": "bde644647b40c3c9ac9a164f7690bd20", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6579027201941551, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "@file:Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\", \"OVERRIDE_BY_INLINE\")\n\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.*\nimport kotlin.random.*\nimport kotlin.collections.sort as _sort\nimport kotlin.collections.sortDescending as _sortDescending\nimport kotlin.io.println as iprintln\n\n/** @author Spheniscine */\nfun main() { _writer.solve(); _writer.flush() }\nfun PrintWriter.solve() {\n uuuuuval n = readInt()\n val P = IntArray(n) { readInt() - 1 }\n val A = readIntArray(n)\n\n val Q = IntArray(n)\n for(i in 0 until n) { Q[P[i]] = i }\n\n val t = PropagatingSegmentTree(n-1).apply {\n var acc = 0L\n build {\n acc += A[it]\n acc\n }\n }\n\n var ans = t.query(0, n-2)\n for(i in 0 until n) {\n val q = Q[i]\n t.update(q, n-2, -A[q].toLong())\n t.update(0, q-1, A[q].toLong())\n\n ans = min(ans, t.query(0, n-2))\n }\n\n println(ans)\n}\n\nclass PropagatingSegmentTree(\n val size: Int\n) {\n inline fun combiner(a: Long, b: Long): Long = min(a, b)\n inline fun updateCombiner(a: Long, b: Long): Long = a + b\n inline fun updater(t: Long, u: Long): Long = t + u\n\n private inline fun treeSize() = if(size == 0) 0 else Integer.highestOneBit(size.shl(2) - 1)\n\n private val tree = LongArray(treeSize()) { Long.MAX_VALUE }\n private val lazy = LongArray(tree.size)\n\n fun build(list: LongArray) {\n if(size == 0) return\n build(list, 1, 0, size-1)\n }\n\n fun build(generator: (Int) -> Long) { build(LongArray(size, generator)) }\n\n private inline fun mid(low: Int, high: Int) = (low + high) shr 1\n private fun build(list: LongArray, node: Int, a: Int, b: Int) {\n if(a == b) {\n tree[node] = list[a]\n return\n }\n\n build(list, node shl 1, a, mid(a, b))\n build(list, node shl 1 or 1, 1 + mid(a, b), b)\n updateNode(node)\n }\n\n private inline fun updateNode(i: Int) {\n tree[i] = combiner(tree[i shl 1], tree[i shl 1 or 1])\n }\n\n fun update(first: Int, last: Int, value: Long) {\n update(1, 0, size-1, first, last, value)\n }\n fun update(range: IntRange, value: Long) {\n update(range.first, range.last, value)\n }\n\n private inline fun updateLazy(i: Int, u: Long) {\n lazy[i] = updateCombiner(lazy[i], u)\n }\n\n private fun propagate(node: Int, a: Int, b: Int) {\n tree[node] = updater(tree[node], lazy[node])\n if(a != b) {\n updateLazy(node shl 1, lazy[node])\n updateLazy(node shl 1 or 1, lazy[node])\n }\n lazy[node] = 0L\n }\n\n private fun update(node: Int, a: Int, b: Int, i: Int, j: Int, u: Long) {\n if(lazy[node] != 0L) {\n propagate(node, a, b)\n }\n\n if(a > b || a > j || b < i) return\n\n if(a >= i && b <= j) {\n lazy[node] = u\n propagate(node, a, b)\n return\n }\n\n update(node shl 1, a, mid(a, b), i, j, u)\n update(node shl 1 or 1, 1 + mid(a, b), b, i, j, u)\n\n updateNode(node)\n }\n\n fun query(first: Int, last: Int) =\n query(1, 0, size-1, first, last)\n fun query(range: IntRange) =\n query(range.first, range.last)\n\n private fun query(node: Int, a: Int, b: Int, i: Int, j: Int): Long {\n if(a > b || a > j || b < i) return Long.MAX_VALUE\n if(lazy[node] != 0L) {\n propagate(node, a, b)\n }\n\n if(a >= i && b <= j) {\n return tree[node]\n }\n\n val l = query(node shl 1, a, mid(a, b), i, j)\n val r = query(node shl 1 or 1, 1 + mid(a, b), b, i, j)\n\n return combiner(l, r)\n }\n}\n\n/** IO code start */\n//@JvmField val INPUT = File(\"input.txt\").inputStream()\n//@JvmField val OUTPUT = File(\"output.txt\").outputStream()\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\n@JvmField val _reader = INPUT.bufferedReader()\nfun readLine(): String? = _reader.readLine()\nfun readLn() = _reader.readLine()!!\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\n\n/** shuffles and sort overrides to avoid quicksort attacks */\nprivate inline fun _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {\n // Fisher-Yates shuffle algorithm\n for (i in size - 1 downTo 1) {\n val j = rnd.nextInt(i + 1)\n val temp = get(i)\n set(i, get(j))\n set(j, temp)\n }\n}\n\n@JvmField var _random: Random? = null\nval random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }\n\nfun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun IntArray.sort() { shuffle(); _sort() }\nfun IntArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun LongArray.sort() { shuffle(); _sort() }\nfun LongArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\nfun DoubleArray.sort() { shuffle(); _sort() }\nfun DoubleArray.sortDescending() { shuffle(); _sortDescending() }\n\nfun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)\ninline fun CharArray.sort() { _sort() }\ninline fun CharArray.sortDescending() { _sortDescending() }\n\ninline fun > Array.sort() = _sort()\ninline fun > Array.sortDescending() = _sortDescending()\ninline fun > MutableList.sort() = _sort()\ninline fun > MutableList.sortDescending() = _sortDescending()\n\nfun `please stop removing these imports IntelliJ`() {\n iprintln(max(1, 2))\n}", "lang": "Kotlin", "bug_code_uid": "676691bdf51aeef3c15566bfca6445e8", "src_uid": "2e44c8aabab7ef7b06bbab8719a8d863", "apr_id": "4f50990606acf1385de50d9cc8632b8d", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9914836396234872, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package templates\n\nimport java.io.BufferedReader\nimport java.io.File\nimport java.io.PrintWriter\n\nfun main(args: Array) {\n val onlineJudge = System.getProperty(\"ONLINE_JUDGE\") == \"true\"\n val input = if (onlineJudge) System.`in`.bufferedReader() else File(\"input.txt\").bufferedReader()\n val output = if (onlineJudge) PrintWriter(System.out.writer(), true) else PrintWriter(File(\"output.txt\"))\n\n solve(input, output)\n\n output.flush()\n output.close()\n}\n\nprivate fun String.words() = split(\" \")\n\nprivate fun String.toInts() = split(\" \").map { it.toInt() }\nprivate fun String.toLongs() = split(\" \").map { it.toLong() }\n\nfun dayToInt(s: String) = when (s) {\n \"monday\" -> 0\n \"tuesday\" -> 1\n \"wednesday\" -> 2\n \"thursday\" -> 3\n \"friday\" -> 4\n \"saturday\" -> 5\n \"sunday\" -> 6\n else -> throw IllegalArgumentException()\n}\n\nprivate fun solve(input: BufferedReader, output: PrintWriter) {\n val d1 = dayToInt(input.readLine())\n val d2 = dayToInt(input.readLine())\n\n if (listOf(28, 30, 31).any { (d1 + it) % 7 == d2 })\n output.println(\"YES\") else\n output.println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "707a4299c363e484827471dd4933e06b", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35", "apr_id": "f30087a588ce278f6df9bb4cd7d20732", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9739130434782609, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.math.BigInteger\n\nfun main(args: Array) {\n val p = readLine()!!.toInt()\n val m = readLine()!!.toBigInteger()\n print(m % BigInteger.TWO.pow(p))\n}", "lang": "Kotlin", "bug_code_uid": "e4a2fcb60b1e4585fcbae9bf6f82079f", "src_uid": "c649052b549126e600691931b512022f", "apr_id": "31d3873725395890c5c4b956e29c6287", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3803418803418803, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n fun readLong() = readLine()!!.toLong()\n\n var n = readLong()\n var m = readLong()\n var multiplier = 1L\n var sol = 0L\n while (n-- > 0L) {\n sol += (m % 2) * multiplier\n m /= 2\n multiplier *= 2\n }\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "1f6ec3191acc547ef852cbe703e35ceb", "src_uid": "c649052b549126e600691931b512022f", "apr_id": "3b3733732be1b25482df468050a7899b", "difficulty": 900, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.09391304347826086, "equal_cnt": 22, "replace_cnt": 11, "delete_cnt": 5, "insert_cnt": 6, "fix_ops_cnt": 22, "bug_source_code": "#include \n//#include \n\n#define all(x) (x.begin(), x.end())\n#define sor(x) sort(all(x))\n#define rev(x) reverse(all(x))\n#define pb push_back\n#define pp pop_back\n#define sqr(x) (x) * (x)\n#define F first\n#define S second\n#define N 222222\n#define INF 1000000021\n#define MOD 1000000007\n#define Z size()\n#define I insert\n#define M(a, b) make_pair(a,b)\n#define T(a, b, c) make_pair(a, make_pair(b, c))\n#define forn(x) for (int i = 1; i <= n; i ++)\n\nusing namespace std;\n//using namespace __gnu_pbds;\n\ntypedef long double ld;\ntypedef long long ll;\ntypedef pair pii;\ntypedef pair pll;\ntypedef vector vi;\ntypedef vector vll;\ntypedef set sl;\n//typedef tree, rb_tree_tag,tree_order_statistics_node_update> indexed_set;\n\n//int yil[13] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\nint main()\n{\n\tint a, b, c; \n\tcin >> a >> b >> c;\n\tcout << min(a, min(b - 1, c - 2)) * 3 + 3;\n\n\n\tgetchar();\n\tgetchar();\n\treturn 0;\n}", "lang": "Kotlin", "bug_code_uid": "baf48cd839243cac686695351a77e015", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "620705931cfa99101822687697e15500", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.3107344632768362, "equal_cnt": 26, "replace_cnt": 15, "delete_cnt": 6, "insert_cnt": 4, "fix_ops_cnt": 25, "bug_source_code": "fun christmasOrnament(orns: MutableList): Int {\n var blue = if (orns[1] > orns[2]) orns[2] - 1 else orns[1]\n return (blue downTo 0).firstOrNull { it in 0..orns[2] && it in 0..orns[0] }?.let { it * 3 } ?: 6\n}", "lang": "Kotlin", "bug_code_uid": "9b80c0029abba4c931a8392005514dfd", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "5a5accb373e00fdf781b5498d5eef0b3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.2857142857142857, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "fun main() {\n val first = readLine()!!.toInt()\n val second = readLine()!!.toInt()\n val third = readLine()!!.toInt()\n if (second >= first + 1) {\n if (third >= first + 2) {\n println(3 * (first + 1))\n } else {\n println(3 * (third - 1))\n }\n } else {\n if (third >= second + 1) {\n println(3 * second)\n } else {\n println(3 * (third - 1))\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "08cc81e56d631964a57f57290ed8df58", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "35446134312a03dc30f1dc2167cd3229", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8177339901477833, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val minStart = args.map(String::toInt).mapIndexed { index, int -> int - index }.min()!!\n val result = minStart * 3 + 3\n print(result)\n}\n", "lang": "Kotlin", "bug_code_uid": "573f7b1929359272cdeb1455f38983b2", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "cf1d45cd9feeb54fab64769f4383f3b6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9380165289256198, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readStrings() = readLn().split(\" \")\nprivate fun readInt() = readLn().toInt()\nprivate fun readInts() = readStrings().map { it.toInt() }\n\nfun main(){\n var y : Int = 0\n var b : Int = 0\n var r : Int = 0\n\n val(y, b, r) = readInts()\n\n var ans : Int = 0 \n\n if( y+1 <= b && y+2 <= r && 3*y+3 > ans ) ans = 3*y+3\n\n if( b-1 <= y && b+1 <= r && 3*b > ans ) ans = 3*b\n\n if( r-2 <= y && r-1 <= b && 3*r-3 > ans ) ans = 3*r-3\n\n println(\"$ans\") \n\n \n\n}", "lang": "Kotlin", "bug_code_uid": "fa637866640e7f8620925db3a9ee1d54", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "b601cc6abce5db1adae25f6a716f3fd0", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.05492730210016155, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "#include\n#include\nusing namespace std;\nint main(){\n\tios::sync_with_stdio(0);\n\tcin.tie(0);\n\tcout.tie(0);\n\tint y,b,r;\n\tcin>>y>>b>>r;\n\tint blues=min(y+1,b);\n\tint reds=min(blues+1,r);\n\tcout<<(reds-1)*3;\n return 0;\n}", "lang": "Kotlin", "bug_code_uid": "53808b99b385bceb84e832e1039985db", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "03e2131afda0c6320e028e3090310906", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9784735812133072, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val base = listOf(0, 1, 2)\n val baseSum = base.sum()\n val numbers = readLine()?.split(' ', limit = 2)?.map { it -> it.toInt() } ?: base\n val low = numbers.zip(base, Int::minus).min() ?: - baseSum\n print(low * base.size + baseSum)\n}\n", "lang": "Kotlin", "bug_code_uid": "c904ad5b4df3298cfe82e3680a4951c0", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "882b8637dbcd82a643b11b141dc9d2c8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9885931558935361, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//package b\n\nimport a.nline\nimport java.io.PrintWriter\nimport java.util.*\n\nfun solve() {\n val (y, b, r) = na()\n val u = Math.min(Math.min(y+1, b), r-1)\n out.println(u*3)\n}\n\nval out = PrintWriter(System.out)\n\nfun main(args: Array) {\n solve()\n out.flush()\n}\n\nfun nline() = readLine()!!\nfun ni() = nline().toInt()\nfun nl() = nline().toLong()\nfun nd() = nline().toDouble()\nfun nas() = nline().split(\" \")\nfun na() = nas().map { it.toInt() }\nfun nal() = nas().map { it.toLong() }\n\nfun tr(x: Any) = System.err.println(x)\nfun tr(x: IntArray) = System.err.println(Arrays.toString(x))\nfun tr(x: Array) = System.err.println(Arrays.deepToString(x))\n", "lang": "Kotlin", "bug_code_uid": "293c3ec870a52bdee2a8842ed5b57812", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "5700aa87a26f46413133b95ba7715aa6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9669811320754716, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.security.InvalidAlgorithmParameterException\n\n/**\n * Created by patrick on 31.08.19.\n * (c) Patrick Scheibe 2019\n */\n\nfun main() {\n contest1212problemB()\n}\n\nfun contest1212problemB() {\n val n = readLine()!!.toInt()\n val s = readLine()!!.substring(0, n)\n val grams = mutableListOf()\n for (i in 0..n - 2) {\n if (s[i] <= s[i + 1]) {\n grams.add(s.substring(i,i+2))\n }\n }\n val maxElm = grams.groupingBy { it }.eachCount().maxBy { it.value }\n if (maxElm != null) {\n print(maxElm.key)\n } else {\n throw InvalidAlgorithmParameterException(\"No max ngram. Shouldn't happen\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "b1414b18840620ab272459caeba41bf0", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "4b626b75a21ee9441b1f195e1ecc5a40", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9050279329608939, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val str = sc.nextLine()\n\n var mm = mutableMapOf()\n var maxa = 0\n var res = \"\"\n for (i in 0 until n-1) {\n ++mm[\"${str[i]}${str[i+1]}\"]\n }\n for ((key, value) in mm) {\n if (value > maxa) {\n maxa = value\n res = key\n }\n }\n println(res)\n\n\n}", "lang": "Kotlin", "bug_code_uid": "773ebd34fd5276c0fa70f42e4fc60281", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "c3b55f2b3b20097d690a4362cbf72448", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9957264957264957, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val str = sc.nextLine()\n\n var mm = mutableMapOf()\n var maxa = 0\n var res = \"\"\n for (i in 0 until n-1) {\n val temp = str.substring(i, i+2)\n mm[temp] = (mm[temp] ?: 0)+1\n }\n for ((key, value) in mm) {\n if (value > maxa) {\n maxa = value\n res = key\n }\n }\n println(res)\n\n\n}", "lang": "Kotlin", "bug_code_uid": "90bbae810937ecb555518d6a34a1f8f4", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "c3b55f2b3b20097d690a4362cbf72448", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7639311043566362, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "/**\n * You can edit, run, and share this code. \n * play.kotlinlang.org \n */\nimport java.util.Scanner\nfun main() {\n \n val reader = Scanner(System.`in`)\n var size:Int=reader.nextInt()\n var s:String=reader.next()\n var i=0\n var mx=0\n var f:String=\"\"\n while(i) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = Scanner(inputStream)\n val out = PrintWriter(outputStream)\n solve(1, `in`, out)\n out.close()\n}\n\nfun solve(testNumber: Int, `in`: Scanner, out: PrintWriter) {\n val n = `in`.nextInt()\n val s = `in`.next()\n val m = HashMap()\n var ans = \"\"\n var ans_x = 0\n for (i in 0 until n - 1) {\n val ss = s.substring(i, i + 2)\n val x = m.getOrDefault(ss, 0)\n m.put(ss, x + 1)\n if (x + 1 > ans_x) {\n ans = ss\n ans_x = x + 1\n }\n }\n out.println(ans)\n}\n\n\n", "lang": "Kotlin", "bug_code_uid": "b5428d199de5c053be453ce4bb9fa9d6", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "61861a6a88ae2318624b45bf9f41ea38", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.47988295537673736, "equal_cnt": 9, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "package io.github.fabiomaciel\n\nobject programkt{\n//object TwoGram {\n @JvmStatic\n fun main(vararg args: String){\n val n = readLine()!!.toInt()\n val str = readLine()!!\n val result = exec(n, str)\n println(result)\n }\n\n fun exec(n: Int, str: String): String {\n var tg= Pair(0, \"\")\n for(i in 0 until n-2){\n val match = str.substring(i, i+2)\n val times = match.toRegex().findAll(str).count()\n if(times > tg.first)\n tg = Pair(times, match)\n }\n return tg.second\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "6e05591cc00c16911ad6418451b81f3c", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "09cccecde83159493be31a4a378855fa", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9387755102040817, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args:Array){\n\tvar str = readline()!!;\n var tm = mutableMapOf(); \n for(i in 0..str.length-2){\n var tc = str[i].toString() + str[i+1].toString();\n tm[tc]=tm.getOrDefault(tc,0)+1;\n }\n var r = tm.maxBy({it.value});\n println(r?.key)\n}", "lang": "Kotlin", "bug_code_uid": "f305d9f227c19cc7eb92658905154112", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "9cab643c2e57612f2a6be9ed3e0ed2f3", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9212962962962963, "equal_cnt": 27, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 17, "fix_ops_cnt": 27, "bug_source_code": " fun main(){\n readLine();\n val characters = readLine()!!;\n \n var best_count = -1;\n var best_index = -1;\n \n var i = 0;\n while(i < characters.length - 1){\n var count = 0;\n \n val reference1 = characters.get(i);\n val reference2 = characters.get(i + 1);\n \n var j = i;\n while(j < characters.length - 1){\n val character1 = characters.get(j);\n val character2 = characters.get(j + 1);\n \n if(character1 == reference1 && character2 == reference2){\n count = count + 1;\n }\n \n j = j + 1;\n }\n \n if(count > best_count){\n best_count = count;\n best_index = index;\n }\n \n i = i + 1;\n }\n \n println(characters.substring(best_index, best_index + 2));\n }", "lang": "Kotlin", "bug_code_uid": "55cc208c6dafbe4d2d7f20eace093b79", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "9d3dcc8ce7f8fc06bfccca7dec0c7893", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9793103448275862, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.Scanner\nfun main(args: Array){\n val input = Scanner(System.`in`)\n var pituus = input.nextInt()\n var teksti = readLine()!!\n var maksimi: Int = 0\n var kirjaimet: String = \"\"\n for(i in 0..(teksti.length-2)){\n var kaksi: String = \"\" + teksti[i] + teksti[i+1]\n var luku: Int = 0\n for(j in 0..(teksti.length-2)){\n var uudetkaksi: String = \"\" + teksti[j] + teksti[j+1]\n if(kaksi.equals(uudetkaksi)){\n luku += 1\n }\n }\n if(luku > maksimi){\n maksimi = luku\n kirjaimet = kaksi\n }\n }\n println(kirjaimet)\n}", "lang": "Kotlin", "bug_code_uid": "f8ede183288b198145b9ac37fce62bd6", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "38e1d831f8f2c1bf4aef2bb61373c18a", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9338842975206612, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner;\n\nfun main() {\n val input = Scanner(System.`in`);\n\n var n = input.nextInt();\n var str = readLine()!!\n\n var mp = mutableMapOf();\n\n for(i in 0..(n-2)) {\n var s = (str?.get(i)?.toString()) + str?.get(i+1)?.toString();\n if (mp.containsKey(s)) {\n mp[s] = mp.getValue(s)+1;\n } else {\n mp.put(s, 1);\n }\n }\n\n var ans: String = \"\";\n var num: Int = 0;\n\n for((str, count) in mp) {\n if (count > num) {\n num = count;\n ans = str;\n }\n }\n println(ans);\n}\n", "lang": "Kotlin", "bug_code_uid": "bfc1fa5b797f67c2033f459a8d03e09c", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "a5cad3c84b97e835472ffc705d6a3b4c", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9671504965622613, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun parseStrings() = readLn().split(\" \") // list of strings\nprivate fun parseInts() = parseStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val n = readInt()\n val s = readLn()\n val m = hashMapOf()\n var cur: String\n for (i in 0..n - 2) {\n cur = s[i].toString() + s[i + 1]\n for (j in i + 1..n - 2) {\n if (cur == s[j].toString() + s[j + 1]) {\n m[cur] = m.getOrDefault(cur, 1) + 1\n }\n }\n }\n println(m.maxBy { it.value }!!.key)\n}", "lang": "Kotlin", "bug_code_uid": "a518277c7e1bfe513edabd7eeb1d72e1", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "f5680a7d4fc8ef10e9b8473216ff6b12", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7250650477016479, "equal_cnt": 20, "replace_cnt": 10, "delete_cnt": 4, "insert_cnt": 5, "fix_ops_cnt": 19, "bug_source_code": "import java.util.Scanner\nfun main(args: Array) {\n //creating Scanner object\n val read = Scanner(System.`in`)\n\n \n var num1 = read.nextInt()\n var num2 = readLine()\n val myMap: Map\n var x:Int = 1\n while(x < num1){\n var str = num2.subSequence(x-1 ,x+1)\n x++\n myMap[str]++\n }\n var fre:Int = 0\n var final_str = \"\"\n for(itr in myMap.asIterable()){ \n if(itr1.value > fre){\n fre = iter1.value\n final_str = iter1.key\n }\n }\n print(final_str)\n \n\n\n}", "lang": "Kotlin", "bug_code_uid": "8a441549d4717a3480065536631d4eda", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "44c1f5ab387384a2c427e00e01990fbb", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.55625, "equal_cnt": 14, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner\nfun main(args: Array) {\n //creating Scanner object\n val read = Scanner(System.`in`)\n \n \n var num1 = read.nextInt()\n var num2 = readLine()!!\n val myMap = mutableMapOf()\n var x:Int = 1\n while(x < num1){\n var str = \"${num2.get(x-1)}${num2.get(x)}\"\n x++\n if(myMap.containsKey(str)){\n myMap.merge(str , 1 , Int::plus)\n }else{\n myMap.plus(Pair(str, 1))\n }\n }\n var fre:Int = 0\n var final_str = \"\"\n for(itr in myMap.iterator()){ \n if(itr.value > fre){\n fre = itr.value\n final_str = itr.key\n }\n }\n print(final_str)\n \n \n \n}", "lang": "Kotlin", "bug_code_uid": "8cd4b554eaa801054f0043d74043e0db", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "44c1f5ab387384a2c427e00e01990fbb", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9981132075471698, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val n = readInt()\n val s = readLn()\n val map = HashMap()\n for (i in 1 until s.length-1) {\n val sub = s[i].toString() + s[i + 1].toString()\n map[sub] = map.getOrDefault(sub, 0) + 1\n }\n println(map.maxBy { it.value }!!.key)\n}", "lang": "Kotlin", "bug_code_uid": "2b05b0ea8b03d675a5454290d641834e", "src_uid": "e78005d4be93dbaa518f3b40cca84ab1", "apr_id": "3df7a3950580e92675d438d4acf16379", "difficulty": 900, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9712569712569713, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun solve() {\n var n = nextInt()\n var k = nextInt()\n var a = nextArray(k)\n var total = a.sum()\n var dordneferlik = n\n var ikineferlik = 2 * n\n for (i in a.indices){\n while (a[i] >= 3 && dordneferlik > 0) {\n dordneferlik--\n var minus = Math.min(a[i],4)\n a[i] -= minus\n total -= minus\n }\n }\n for (i in a.indices) {\n if(a[i] % 2 == 1) {\n if(dordneferlik > 0) {\n dordneferlik--\n ikineferlik++\n total--\n a[i]--\n }else break\n }\n }\n if (dordneferlik > 1) {\n for (i in a.indices) {\n if(dordneferlik >= 2) {\n dordneferlik -= 2\n ikineferlik += 2\n total -= 2\n }else break\n }\n }\n if(dordneferlik == 1) ikineferlik++\n for (i in a.indices) {\n if(a[i] % 2 == 1) {\n ikineferlik--\n total--\n a[i]--\n }\n ikineferlik -= a[i] / 2\n total -= a[i]\n }\n if(ikineferlik < 0 || dordneferlik < 0 || total > 0) pw.print(\"NO\")\n else pw.print(\"YES\")\n\n}\n\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextLine() = if(hasNext()) st.nextToken(\"\\n\") else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n,{nextInt()})\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nval br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nval pw = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "5378b8b912d20484e214cf8619d596af", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "apr_id": "28d72d4acbfddaf1fd1d7e285c79f1ec", "difficulty": 1900, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9454468265760985, "equal_cnt": 13, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 12, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun solve() {\n var n = nextInt()\n var k = nextInt()\n var a = nextArray(k)\n var total = a.sum()\n var dordneferlik = n\n var ikineferlik = 2 * n\n for (i in a.indices){\n while (a[i] >= 4 && dordneferlik > 0) {\n dordneferlik--\n var minus = Math.min(a[i],4)\n a[i] -= minus\n total -= minus\n }\n }\n for (i in a.indices) {\n if(a[i] % 2 == 1) {\n if(dordneferlik > 0) {\n dordneferlik--\n ikineferlik++\n total--\n a[i]--\n }else break\n }\n }\n while (dordneferlik > 1) {\n for (i in a.indices) {\n if (a[i] % 2 > 0) {\n if(dordneferlik >= 2) {\n dordneferlik -= 2\n ikineferlik += 2\n total -= 2\n }else break\n }\n }\n }\n if(dordneferlik == 1) ikineferlik++\n for (i in a.indices) {\n if(a[i] % 2 == 1) {\n ikineferlik--\n total--\n a[i]--\n }\n ikineferlik -= a[i] / 2\n total -= a[i]\n }\n if(ikineferlik < 0 || dordneferlik < 0 || total > 0) pw.print(\"NO\")\n else pw.print(\"YES\")\n\n}\n\n\nfun hasNext() : Boolean {\n while (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine() ?: return false)\n return true\n}\n\nfun next() = if(hasNext()) st.nextToken()!! else throw RuntimeException(\"No tokens\")\n\nfun nextInt() = next().toInt()\n\nfun nextLong() = next().toLong()\n\nfun nextLine() = if(hasNext()) st.nextToken(\"\\n\") else throw RuntimeException(\"No tokens\")\n\nfun nextArray(n : Int) = IntArray(n,{nextInt()})\n\nval ONLINE_JUDGE = System.getProperty(\"ONLINE_JUDGE\") != null\n\nval br = when(ONLINE_JUDGE) {\n true -> BufferedReader(InputStreamReader(System.`in`))\n else -> BufferedReader(FileReader(\"in.txt\"))\n}\n\nval pw = when(ONLINE_JUDGE) {\n true -> PrintWriter(BufferedWriter(OutputStreamWriter(System.out)))\n else -> PrintWriter(BufferedWriter(FileWriter(\"out.txt\")))\n}\n\nvar st = StringTokenizer(\"\")\n\nfun main(args: Array) {\n var start = System.currentTimeMillis()\n solve()\n pw.close()\n br.close()\n if(!ONLINE_JUDGE)\n System.err.println(\"${System.currentTimeMillis() - start} ms\")\n}", "lang": "Kotlin", "bug_code_uid": "7ec677dfc8ceba94bb70e74a5179450d", "src_uid": "d1f88a97714d6c13309c88fcf7d86821", "apr_id": "28d72d4acbfddaf1fd1d7e285c79f1ec", "difficulty": 1900, "tags": ["greedy", "brute force", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9902642559109874, "equal_cnt": 12, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 11, "bug_source_code": "import java.util.*\n\n/**\n * \u0422\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u0440\u044f\u043c\u043e\u0439\n */\nfun taskA() {\n val s = Scanner(System.`in`)\n val n = s.nextInt()\n val desiredDiameter = s.nextInt()\n val numbers = Array(n, { _ -> 0 })\n\n for (i in 0..n-1) {\n numbers[i] = s.nextInt()\n }\n\n numbers.sort()\n\n var from = 0\n var to = 0\n var optimalRemoved = Int.MAX_VALUE\n while (to <= numbers.lastIndex) {\n val d = numbers[to] - numbers[from]\n\n if (d <= desiredDiameter) {\n optimalRemoved = minOf(from + (numbers.size - to - 1), optimalRemoved)\n }\n\n if (d <= desiredDiameter) {\n to++\n } else {\n from++\n }\n }\n\n println(optimalRemoved)\n}\n\n/**\n * \u041d\u0430\u0448\u0430 \u0422\u0430\u043d\u044f \u0433\u0440\u043e\u043c\u043a\u043e \u043f\u043b\u0430\u0447\u0435\u0442\n */\nfun taskB() {\n val s = Scanner(System.`in`)\n val n = s.nextInt()\n val k = s.nextInt()\n val subPrice = s.nextInt()\n val divPrice = s.nextInt()\n\n var curN = n\n var totalPrice = 0\n while (curN != 1) {\n val r = curN % k\n when {\n k == 1 -> {\n totalPrice = (curN - 1) * subPrice\n curN = 1\n }\n r == 0 -> {\n val subTotal = subPrice * (curN/k) * (k-1)\n if (subTotal < divPrice) {\n totalPrice += subTotal\n } else {\n totalPrice += divPrice\n }\n curN /= k\n }\n else -> {\n totalPrice += subPrice * r\n curN -= r\n\n // ugly check if curN under k so we could get zero\n if (curN == 0) {\n curN = 1\n totalPrice -= subPrice\n }\n }\n }\n }\n println(totalPrice)\n}\n\nfun main(args: Array) {\n taskB()\n}\n", "lang": "Kotlin", "bug_code_uid": "0e7932fb6af95dded2d73dee53ddda1d", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "apr_id": "8a20eefb0e50cb73fdcde4c067d0faf1", "difficulty": 1400, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.49290515309932786, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.math.BigInteger\n\nfun main() {\n fun readLong() = readLine()!!.toLong()\n\n var x = readLong()\n val divisor = readLong()\n val subtractCost = readLong()\n val divideCost = readLong()\n var cost = BigInteger.ZERO\n val mod = x % divisor\n if (mod != 0L) {\n cost += BigInteger.valueOf(mod * subtractCost)\n x -= mod\n }\n while (x >= divisor && divideCost <= subtractCost * (x - x/divisor)) {\n cost += BigInteger.valueOf(divideCost)\n x /= divisor\n }\n cost += BigInteger.valueOf(subtractCost * (x - 1))\n print(cost.toString())\n}", "lang": "Kotlin", "bug_code_uid": "97441f93ee849ace960d934eb9fdfa3c", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "apr_id": "cac91cd103f83a7e9d1931dbf0aea8a2", "difficulty": 1400, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9297994269340975, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.math.BigInteger\nimport kotlin.math.min\n\nfun main() {\n fun readLong() = readLine()!!.toLong()\n\n var x = readLong()\n val divisor = readLong()\n val subtractCost = readLong()\n val divideCost = readLong()\n var cost = BigInteger.ZERO\n while (x >= divisor) {\n val mod = x % divisor\n if (mod != 0L) {\n cost += BigInteger.valueOf(mod * subtractCost)\n x -= mod\n } else {\n cost += BigInteger.valueOf(min(divideCost, subtractCost * (x - x/divisor)))\n x /= divisor\n }\n }\n cost += BigInteger.valueOf(subtractCost * (x - 1))\n print(cost.toString())\n}", "lang": "Kotlin", "bug_code_uid": "24ae5afc59b59dba34bc9a998c441f2c", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "apr_id": "cac91cd103f83a7e9d1931dbf0aea8a2", "difficulty": 1400, "tags": ["dp", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.40865384615384615, "equal_cnt": 14, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 14, "bug_source_code": "fun main(args:Array) {\n val (n,k,A,B) = (1..4).map{ readLine()!!.toLong() }\n \n // 1\u3067\u5168\u90e8\u6d88\u5316\u3059\u308b\u3068\u304d\u306e\u30b3\u30b9\u30c8\n val step1 = (n-1)*A\n\n // deviable\u306e\u6642\u3001\u7a4d\u6975\u7684\u306b\u5272\u3063\u3066\u3044\u304f\u30a2\u30d7\u30ed\u30fc\u30c1\n \n var minus1 = 0\n var devides1 = 0\n var start = n\n while(true) {\n if( start%k == 0L ) {\n start = start/k \n devides1 ++\n } else {\n start --\n minus1++\n }\n if( start == 1L ) break\n }\n //println( \"${minus1} ${devides1}\" )\n val step2 = minus1*A + devides1*B\n println( listOf(step1, step2).min())\n}", "lang": "Kotlin", "bug_code_uid": "0f89cf6c9c0696f23c2a7bb0b3d5bd4f", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "apr_id": "24cfeaab49e36fd17b641965ec3d2e8e", "difficulty": 1400, "tags": ["dp", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4372594303310239, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "fun main(args:Array) {\n val (n,k,A,B) = (1..4).map{ readLine()!!.toLong() }\n \n // 1\u3067\u5168\u90e8\u6d88\u5316\u3059\u308b\u3068\u304d\u306e\u30b3\u30b9\u30c8\n val step1 = (n-1)*A\n\n // deviable\u306e\u6642\u3001\u7a4d\u6975\u7684\u306b\u5272\u3063\u3066\u3044\u304f\u30a2\u30d7\u30ed\u30fc\u30c1\n \n // k\u306e\u500d\u6570\u30ea\u30b9\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3001\u30b8\u30e3\u30f3\u30d7\u8a08\u7b97\u3092\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\n\n var minus1 = 0L\n var devides1 = 0L\n var start = n \n while(true) {\n start = start/k \n println(\"a $start\")\n devides1 ++\n minus1 += start%k\n if( start < k ) {\n //minus1 += start - 1\n break\n }\n }\n //println( \"${minus1} ${devides1}\" )\n val step2 = (minus1)*A + (devides1)*B\n println( listOf(step1, step2).min())\n}", "lang": "Kotlin", "bug_code_uid": "fa7a73b0a2c155c74d552d1818fe9023", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "apr_id": "24cfeaab49e36fd17b641965ec3d2e8e", "difficulty": 1400, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9314616019818331, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "fun main(arg: Array){\n\tval n = readLine()!!.toInt()\n\tval k = readLine()!!.toInt()\n\tval A = readLine()!!.toInt()\n\tval B = readLine()!!.toInt()\n\tvar x = n\n\tvar cost = 0\n\twhile(x > 1){\n\t\t//println(\"Cost: $cost. X: $x. Remainder: ${x.rem(k)}\")\n\t\tif(x.rem(k) != 0){\n\t\t//\tprintln(\"Substract for ${x.rem(k) * A}\")\n\t\t\tcost += if(x>k) x.rem(k)*A else A*(x-1)\n\t\t\tx -= if(x>k) x.rem(k) else x-1\n\t\t}else{\n\t\t\tif (B < (A*(x-x/k))){\n\t\t//\t\tprintln(\"Divide\")\n\t\t\t\tcost += B\n\t\t\t\tx = x/k\n\t\t\t}else{\n\t\t//\t\tprintln(\"Substract\")\n\t\t\t\tcost += A*(x-x/k)\n\t\t\t\tx = x/k\n\t\t\t}\n\t\t}\n\t}\n\tprintln(cost)\n}\n", "lang": "Kotlin", "bug_code_uid": "027e6c8ca7068234824d806691f75f5d", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "apr_id": "2989df976574b71295a0264baaf48ca5", "difficulty": 1400, "tags": ["dp", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9607201309328969, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main(arg: Array){\n\tval n = readLine()!!.toLong()\n\tval k = readLine()!!.toLong()\n\tval A = readLine()!!.toLong()\n\tval B = readLine()!!.toLong()\n\tvar x = n\n\tvar cost: Long = 0\n\twhile(x > 1){\n\t\t//println(\"Cost: $cost. X: $x. Remainder: ${x.rem(k)}\")\n\t\tif(x.rem(k) != 0L){\n\t\t//\tprintln(\"Substract for ${x.rem(k) * A}\")\n\t\t\tcost += if(x>k) x.rem(k)*A else A*(x-1)\n\t\t\tx -= if(x>k) x.rem(k) else x-1\n\t\t}else{\n\t\t\tif (B < (A*(x-x/k))){\n\t\t//\t\tprintln(\"Divide\")\n\t\t\t\tcost += B\n\t\t\t\tx = x/k\n\t\t\t}else{\n\t\t//\t\tprintln(\"Substract\")\n\t\t\t\tcost += A*(x-x/k)\n\t\t\t\tx = x/k\n\t\t\t}\n\t\t}\n\t}\n\tprintln(cost)\n}\n", "lang": "Kotlin", "bug_code_uid": "1906768ff0b0cf2eab761feb94b56c20", "src_uid": "f838fae7c98bf51cfa0b9bd158650b10", "apr_id": "2989df976574b71295a0264baaf48ca5", "difficulty": 1400, "tags": ["dp", "greedy"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9914772727272727, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "package contest612\n\n\nvar n: Int = 0\nvar lights = emptyList()\n\n\nvar save = Array(102) { Array(102) { Array(102) { IntArray(2) { -1 } } } }\nfun dp(index: Int, odd: Int, even: Int, isOdd: Boolean): Int {\n if (index >= lights.size) {\n return 0\n }\n val oddIndex: Int = if (isOdd) 0 else 1\n if (save[index][odd][even][oddIndex] != -1) return save[index][odd][even][oddIndex]\n var min = Int.MAX_VALUE\n if (lights[index] == 0) {\n if (odd > 0) {\n min = Math.min(min, getCom(isOdd, true) + dp(index + 1, odd - 1, even, true))\n }\n if (even > 0) {\n min = Math.min(min, getCom(isOdd, false) + dp(index + 1, odd, even - 1, false))\n }\n } else {\n val curIsOdd = lights[index] % 2 != 1\n min = getCom(isOdd, curIsOdd) + dp(index + 1, odd, even, curIsOdd)\n }\n save[index][odd][even][oddIndex] = min\n return min\n}\n\nfun getCom(odd: Boolean, odd2: Boolean): Int {\n return if (odd == odd2) {\n 0\n } else {\n 1\n }\n}\n\n\nfun main(args: Array) {\n n = readLine()!!.toInt()\n lights = readLine()!!.split(' ').map { it.toInt() }\n var odd = (n + 1) / 2\n var even = n / 2\n lights.forEach {\n if (it != 0) {\n if(it%2==0)even--\n else odd --\n }\n }\n val ans = Math.min(\n dp(0,odd, even, true),\n dp(0,odd, even, false)\n )\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "301feef5d74d71b50cdba44797cc2f81", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "77a9ead6dbb63aa9ffdf6bc1dee3bfbd", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.13694507148231752, "equal_cnt": 52, "replace_cnt": 39, "delete_cnt": 6, "insert_cnt": 7, "fix_ops_cnt": 52, "bug_source_code": "import java.util.*\n\nfun main() {\n val n = readLine()!!.toInt()\n if (n == 1) {\n println(0)\n return\n }\n val tokenizer = StringTokenizer(readLine()!!)\n val p = IntArray(n) { tokenizer.nextToken().toInt() }\n var answer = 0\n for (j in 1 until n) {\n if (p[j] != 0 && p[j - 1] != 0 && (p[j] + p[j - 1]) % 2 != 0) {\n answer++\n }\n }\n //println(\"alpha $answer\")\n val remOdd = mutableSetOf()\n val remEven = mutableSetOf()\n for (j in 1..n) {\n if (j % 2 == 0) {\n remEven.add(j)\n } else {\n remOdd.add(j)\n }\n }\n for (a in p) {\n remEven.remove(a)\n remOdd.remove(a)\n }\n val evenLengths = mutableListOf()\n val oddLengths = mutableListOf()\n var j = 0\n while (true) {\n while (j < n - 1 && (p[j] == 0 || p[j + 1] != 0)) {\n j++\n }\n if (j == n - 1) {\n break\n }\n //println(\"j = $j\")\n var left = p[j] % 2\n j++\n while (j < n && p[j] == 0) {\n j++\n }\n if (j == n) {\n break\n }\n //println(\"now j = $j\")\n var right = p[j] % 2\n if (left == right) {\n j--\n val chosenRem = if (right == 0) remEven else remOdd\n val otherRem = if (right == 1) remEven else remOdd\n while (p[j] == 0) {\n if (chosenRem.isNotEmpty()) {\n p[j] = chosenRem.first()\n chosenRem.remove(p[j])\n } else {\n p[j] = otherRem.first()\n otherRem.remove(p[j])\n answer += 2\n }\n j--\n }\n } else {\n answer++\n }\n }\n //println(\"beta $answer\")\n j = 0\n while (j < n && p[j] == 0) {\n j++\n }\n if (j == n) {\n println(1)\n return\n }\n var chosenRem = if (p[j] % 2 == 0) remEven else remOdd\n var otherRem = if (p[j] % 2 == 1) remEven else remOdd\n j--\n while (j >= 0) {\n if (chosenRem.isNotEmpty()) {\n p[j] = chosenRem.first()\n chosenRem.remove(p[j])\n } else {\n p[j] = otherRem.first()\n otherRem.remove(p[j])\n answer++\n }\n j--\n }\n //println(\"gamma $answer\")\n j = n - 1\n while (j >= 0 && p[j] == 0) {\n j--\n }\n chosenRem = if (p[j] % 2 == 0) remEven else remOdd\n otherRem = if (p[j] % 2 == 1) remEven else remOdd\n j++\n while (j < n) {\n if (chosenRem.isNotEmpty()) {\n p[j] = chosenRem.first()\n chosenRem.remove(p[j])\n } else {\n p[j] = otherRem.first()\n otherRem.remove(p[j])\n answer++\n }\n j++\n }\n //println(\"delta $answer\")\n println(answer)\n}", "lang": "Kotlin", "bug_code_uid": "a916d5e397e5013f7ce5a08d07cbaba4", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "ba8192f9386b793eb224c7e596bedc0d", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7727067329417081, "equal_cnt": 30, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 13, "fix_ops_cnt": 30, "bug_source_code": "import java.util.*\nimport java.math.*\n \nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readInts() = readLn().split(\" \").map{it.toInt()}\nfun readLong() = readLn().toLong()\nfun readLongs() = readLn().split(\" \").map{it.toLong()}\n \nfun main(args: Array) {\n\tvar n = readInt()\n\tvar p = readInts().map{it-1}\n\tvar used = BooleanArray(n)\n\tfor(i in p)\n\t\tif(i!=-1)\n\t\t\tused[i]=true\n\tvar gaps = Array(2){Array(2){ArrayList()}}\n\tvar numCnt = Array(2){0}\n\tfor(i in 0..n-1)\n\t\tif(!used[i])\n\t\t\tnumCnt[i%2]++\n\t\n\tvar prv = -1\n\tvar cnt = 0\n\tfor(i in p)\n\t\tif(i!=-1) {\n\t\t\tif(prv==-1)\n\t\t\t\tprv=i\n\t\t\tif(cnt!=0) {\n\t\t\t\tgaps[prv%2][i%2].add(cnt)\n\t\t\t}\n\t\t\tcnt=0\n\t\t\tprv=i\n\t\t}\n\t\telse\n\t\t\tcnt++\n\tif(cnt!=0) {\n\t\tif(prv==-1)\n\t\t\tprv=0\n\t\tgaps[prv%2][prv%2].add(cnt)\n\t}\n\tvar res = 0\n\tfor(i in 1..n-1)\n\t\tif(p[i]!=-1 && p[i-1]!=-1 && p[i-1]%2!=p[i]%2)\n\t\t\tres++\n\t\n\tres+=gaps[1][0].size+gaps[0][1].size\n\t\n\tfor(i in 0..1) {\n\t\tgaps[i][i].sort()\n\t\tfor(j in gaps[i][i])\n\t\t\tif(numCnt[i]>=j) {\n\t\t\t\tnumCnt[i]-=j\n\t\t\t}\n\t\t\telse\n\t\t\t\tres++\n\t}\n\t\n\tprintln(res)\n}", "lang": "Kotlin", "bug_code_uid": "c35fbd3218dba07737dbe466e18c8022", "src_uid": "90db6b6548512acfc3da162144169dba", "apr_id": "51a1511277fc95d345cc7576afb19768", "difficulty": 1800, "tags": ["dp", "greedy", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9902506963788301, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.lang.Integer.max\nimport java.util.*\n\nfun main() {\n val scanner = Scanner(System.`in`)\n val n = scanner.nextInt()\n var minElement = Int.MAX_VALUE\n var maxElement = Int.MIN_VALUE\n var minElementPos = -1\n var maxElementPos = -1\n\n repeat (n) {\n val current = scanner.nextInt()\n if (current < minElement) {\n minElement = current\n minElementPos = it\n } else if (current > maxElement) {\n maxElement = current\n maxElementPos = it\n }\n }\n\n if (minElementPos < maxElementPos) {\n println(max(maxElementPos, n - 1 - minElementPos))\n } else {\n println(max(minElementPos, n - 1 - maxElementPos))\n }\n}", "lang": "Kotlin", "bug_code_uid": "cf5e80697fe6ed1e6d9510f264cb87ef", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4", "apr_id": "ec26f62c36c38d24b0e8040db6f3f686", "difficulty": 800, "tags": ["constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9398907103825137, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package codeforces.globalround5\n\nprivate fun solve(n: Int, m: Int = 1): Int {\n\tif (m == n || m + 1 == n) return 1\n\tif (m > n) return 0\n\treturn solve(n, 2 * m + 1 + m % 2)\n}\n\nfun main() = println(solve(readInt()))\n\nprivate fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\n", "lang": "Kotlin", "bug_code_uid": "b5a4e33818491118e75dd4aecb7e78ca", "src_uid": "821409c1b9bdcd18c4dcf35dc5116501", "apr_id": "4c52e41286b8b8c4b9fb9666f665acdc", "difficulty": 2400, "tags": ["dp", "math"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9975111996017919, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\n\n// 25 50 75 00\nfun main(args: Array) = with(Scanner(System.`in`)) {\n val n = nextLine()\n val l = n.length\n val ref = ArrayList()\n\n var flag = false\n\n val _0 = n.count { it == '0' }\n val _2 = n.count { it == '2' }\n val _5 = n.count { it == '5' }\n val _7 = n.count { it == '7' }\n\n var leadingZeros = 0\n for (i in 1 until l) {\n if (n[i] == '0') {\n leadingZeros++\n } else {\n break\n }\n }\n\n if (_0 >= 2) { // ..00\n flag = true\n\n val i0a = n.lastIndexOf('0')\n val i0b = n.substring(0 until i0a).lastIndexOf('0')\n\n ref.add(2 * l - i0a - i0b - 3)\n }\n\n if (_2 >= 1 && _5 >= 1) if (leadingZeros != l - 2 || l == 2) { // ..25\n flag = true\n\n val i2 = n.lastIndexOf('2')\n val i5 = n.lastIndexOf('5')\n\n var r = 2 * l - i2 - i5 - 3\n if (i2 > i5) {\n if (i5 == 0) r += leadingZeros\n r += 1\n } else {\n if (i2 == 0) r += leadingZeros\n }\n\n ref.add(r)\n }\n\n if (_5 >= 1 && _0 >= 1) if (leadingZeros != l - 1) { // ..50\n flag = true\n var _leadingZeros = leadingZeros\n\n val i5 = n.lastIndexOf('5')\n val i0 = n.lastIndexOf('0')\n\n if (i0 == _leadingZeros) _leadingZeros--\n\n var r = 2 * l - i5 - i0 - 3\n if (i5 > i0) {\n r += 1\n } else {\n if (i5 == 0) r += _leadingZeros\n }\n\n ref.add(r)\n }\n\n if (_7 >= 1 && _5 >= 1) if (leadingZeros != l - 2 || l == 2) { // ..75\n flag = true\n\n val i7 = n.lastIndexOf('7')\n val i5 = n.lastIndexOf('5')\n\n var r = 2 * l - i7 - i5 - 3\n if (i7 > i5) {\n if (i5 == 0) r += leadingZeros\n r += 1\n } else {\n if (i7 == 0) r += leadingZeros\n }\n\n ref.add(r)\n }\n\n if (flag) {\n println(ref.min())\n } else {\n println(-1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "7836c76674fc8e61bc5f48d71a5a8c52", "src_uid": "ea1c737956f88be94107f2565ca8bbfd", "apr_id": "77024962ce7ea2d2531f04a568e69b66", "difficulty": 2100, "tags": ["brute force", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.14002642007926025, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "fun main(args: Array) {\n var (n,m) = readLine()!!.split(' ').map(String::toInt)\n var a = readLine()!!.split(' ').map(String::toInt)\n a = a.sorted()\n if ((m >= a.last()) || (m % a.last() == 0)) {\n print(a.lastIndex + 1)\n }\n else\n print(a.last())\n}", "lang": "Kotlin", "bug_code_uid": "fb928a72ec31ae3c46c4b272f767c983", "src_uid": "c0ef1e4d7df360c5c1e52bc6f16ca87c", "apr_id": "d6db1545efbdf232b1f03fa2ba6fbc7f", "difficulty": 1000, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9217230199166281, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 11, "bug_source_code": "/**\n * Description: Kotlin tips for dummies\n * Source: own\n */\n\n/* sorting\n * 1 (ok)\n val a = nextLongs().sorted() // a is mutable list\n * 2 (ok)\n val a = arrayListOf() // or ArrayList()\n a.addAll(nextLongs())\n a.sort()\n *.3 (ok)\n val A = nextLongs()\n val a = Array(n,{0})\n for (i in 0..n-1) a[i] = A[i]\n a.sort()\n * 4 (ok)\n val a = ArrayList(nextLongs())\n a.sort()\n * 5 (NOT ok)\n val a = LongArray(N) // or nextLongs().toLongArray()\n Arrays.sort(a)\n */\n/* 2D array\n * val ori = Array(n, {IntArray(n)})\n * val ori = arrayOf(\n intArrayOf(8, 9, 1, 13),\n intArrayOf(3, 12, 7, 5),\n intArrayOf(0, 2, 4, 11),\n intArrayOf(6, 10, 15, 14)\n )\n */\n/* printing variables:\n * println(\"${l+1} and $r\")\n * print d to 8 decimal places: String.format(\"%.8g%n\", d)\n * try to print one stringbuilder instead of multiple prints\n */\n/* comparing pairs\n val pq = PriorityQueue>({x,y -> x.first.compareTo(y.first)})\n val pq = PriorityQueue>(compareBy {it.first})\n val A = arrayListOf(Pair(1,3),Pair(3,2),Pair(2,3))\n val B = A.sortedWith(Comparator>{x,y -> x.first.compareTo(y.first)})\n sortBy\n */\n/* hashmap\n val h = HashMap()\n for (i in 0..n-2) {\n val w = s.substring(i,i+2)\n val c = h.getOrElse(w){0}\n h.put(w,c+1)\n }\n */\n/* basically switch, can be used as expression\n when (x) {\n 0,1 -> print(\"x <= 1\")\n 2 -> print(\"x == 2\")\n else -> { // Note the block\n print(\"x is neither 1 nor 2\")\n }\n }\n*/\n// swap : a = b.also { b = a }\n// arraylist remove element at index: removeAt, not remove ...\n// lower bound: use .binarySearch()\n\nimport java.util.*\n// import kotlin.math.*\n\nval MOD = 1000000007\nval SZ = 1 shl 18\nval INF = (1e18).toLong()\n\nfun add(a: Int, b: Int) = (a+b) % MOD // from tourist :o\nfun sub(a: Int, b: Int) = (a-b+MOD) % MOD\nfun mul(a: Int, b: Int) = ((a.toLong() * b) % MOD).toInt()\nfun po(a: Int, b: Int): Int {\n if (b == 0) return 1\n var res: Int = po(mul(a,a),b/2)\n if ((b and 1) == 1) res = mul(res,a)\n return res\n}\n\nfun next() = readLine()!!\nfun nextInt() = next().toInt()\nfun nextLong() = next().toLong()\nfun nextInts() = next().split(\" \").map { it.toInt() }\nfun nextLongs() = next().split(\" \").map { it.toLong() }\n\nval out = StringBuilder()\nfun YN(b: Boolean):String { return if (b) \"YES\" else \"NO\" }\n\nfun gcd(a: Int, b: Int): Int {\n return if (a == 0) b else gcd(b%a,a)\n}\n\nfun bad() {\n println(-1)\n System.exit(0)\n}\n\nfun get(n: Int, k: Int, mid: Int) : Long {\n var res: Long = mid.toLong()\n var cur = mid\n // println(\"HA ${cur}\")\n for (i in k-1 downTo 1) {\n cur = maxOf(cur-1,1)\n res += cur\n // println(\"?? ${cur} ${res}\")\n }\n cur = mid\n // println(\"HA ${cur}\")\n for (i in k+1..n) {\n cur = maxOf(cur-1,1)\n res += cur\n // println(\"?? ${cur} ${res}\")\n }\n return res\n}\n\nfun solve() {\n val (n,m,k) = nextInts()\n var (lo, hi) = arrayOf(1,m)\n // println(get(n,k,5))\n while (lo < hi) {\n val mid = (lo+hi+1)/2\n if (get(n,k,mid) <= m) lo = mid\n else hi = mid-1\n }\n println(lo)\n}\n\nfun main(args: Array) {\n solve()\n}", "lang": "Kotlin", "bug_code_uid": "9f3a558ec15b8f9bbcc1788baf3353dc", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "apr_id": "085ab8179901c06c59ef93c1bfa9400c", "difficulty": 1500, "tags": ["greedy", "binary search"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9811202013845186, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "/**\n * Description: Kotlin tips for dummies\n * Source: own\n */\n\n/* sorting\n * 1 (ok)\n val a = nextLongs().sorted() // a is mutable list\n * 2 (ok)\n val a = arrayListOf() // or ArrayList()\n a.addAll(nextLongs())\n a.sort()\n *.3 (ok)\n val A = nextLongs()\n val a = Array(n,{0})\n for (i in 0..n-1) a[i] = A[i]\n a.sort()\n * 4 (ok)\n val a = ArrayList(nextLongs())\n a.sort()\n * 5 (NOT ok)\n val a = LongArray(N) // or nextLongs().toLongArray()\n Arrays.sort(a)\n */\n/* 2D array\n * val ori = Array(n, {IntArray(n)})\n * val ori = arrayOf(\n intArrayOf(8, 9, 1, 13),\n intArrayOf(3, 12, 7, 5),\n intArrayOf(0, 2, 4, 11),\n intArrayOf(6, 10, 15, 14)\n )\n */\n/* printing variables:\n * println(\"${l+1} and $r\")\n * print d to 8 decimal places: String.format(\"%.8g%n\", d)\n * try to print one stringbuilder instead of multiple prints\n */\n/* comparing pairs\n val pq = PriorityQueue>({x,y -> x.first.compareTo(y.first)})\n val pq = PriorityQueue>(compareBy {it.first})\n val A = arrayListOf(Pair(1,3),Pair(3,2),Pair(2,3))\n val B = A.sortedWith(Comparator>{x,y -> x.first.compareTo(y.first)})\n sortBy\n */\n/* hashmap\n val h = HashMap()\n for (i in 0..n-2) {\n val w = s.substring(i,i+2)\n val c = h.getOrElse(w){0}\n h.put(w,c+1)\n }\n */\n/* basically switch, can be used as expression\n when (x) {\n 0,1 -> print(\"x <= 1\")\n 2 -> print(\"x == 2\")\n else -> { // Note the block\n print(\"x is neither 1 nor 2\")\n }\n }\n*/\n// swap : a = b.also { b = a }\n// arraylist remove element at index: removeAt, not remove ...\n// lower bound: use .binarySearch()\n\nimport java.util.*\n// import kotlin.math.*\n\nval MOD = 1000000007\nval SZ = 1 shl 18\nval INF = (1e18).toLong()\n\nfun add(a: Int, b: Int) = (a+b) % MOD // from tourist :o\nfun sub(a: Int, b: Int) = (a-b+MOD) % MOD\nfun mul(a: Int, b: Int) = ((a.toLong() * b) % MOD).toInt()\nfun po(a: Int, b: Int): Int {\n if (b == 0) return 1\n var res: Int = po(mul(a,a),b/2)\n if ((b and 1) == 1) res = mul(res,a)\n return res\n}\n\nfun next() = readLine()!!\nfun nextInt() = next().toInt()\nfun nextLong() = next().toLong()\nfun nextInts() = next().split(\" \").map { it.toInt() }\nfun nextLongs() = next().split(\" \").map { it.toLong() }\n\nval out = StringBuilder()\nfun YN(b: Boolean):String { return if (b) \"YES\" else \"NO\" }\n\nfun gcd(a: Int, b: Int): Int {\n return if (a == 0) b else gcd(b%a,a)\n}\n\nfun bad() {\n println(-1)\n System.exit(0)\n}\n\nfun ari(a: Int, b: Int): Long {\n return (a+b).toLong()*(b-a+1)/2\n}\n\nfun get(n: Int, k: Int, mid: Int) : Long {\n var res: Long = mid.toLong()\n // println(\"HA ${cur}\")\n // cur-(k-1) to cur-1\n res += ari(maxOf(mid-(k-1),1),mid-1)\n res += ari(maxOf(mid-(n-k),1),mid-1)\n return res\n}\n\nfun solve() {\n val (n,m,k) = nextInts()\n var (lo, hi) = arrayOf(1,m)\n // println(get(n,k,5))\n while (lo < hi) {\n val mid = (lo+hi+1)/2\n if (get(n,k,mid) <= m) lo = mid\n else hi = mid-1\n }\n println(lo)\n}\n\nfun main(args: Array) {\n solve()\n}", "lang": "Kotlin", "bug_code_uid": "f31b5d88bf80641b85d13297ff5bdb90", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "apr_id": "085ab8179901c06c59ef93c1bfa9400c", "difficulty": 1500, "tags": ["greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9369592088998764, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val (n, m, k) = readLine()!!.split(\" \").map { it.toInt() }\n var p = m - n\n var f = 1\n var i = 1\n var j = 1\n\n while(p > 0) {\n f++\n\n if(i != n) {\n if(j < k) {\n i += 2\n j++\n } else {\n i++\n }\n }\n\n p -= i\n }\n\n println(f)\n}", "lang": "Kotlin", "bug_code_uid": "d0d1e45208d42fd174564ad473ec4dd2", "src_uid": "da9ddd00f46021e8ee9db4a8deed017c", "apr_id": "b84344f52527feb95967cd46543e1b96", "difficulty": 1500, "tags": ["greedy", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9279279279279279, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val (n, k) = r.readLine()!!.split(\" \").map { it.toInt() }\n val n = r.readLine()!!.toInt()\n println((n/2-1)/2)\n}", "lang": "Kotlin", "bug_code_uid": "8b8d08359e4dba45fea3d8aada305dcc", "src_uid": "32b59d23f71800bc29da74a3fe2e2b37", "apr_id": "4d261c37b20d5145796a1feaee089cb5", "difficulty": 1000, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9573283858998145, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n //val n = r.readLine()!!.split(\" \").map { it.toInt() }\n val n = r.readLine()!!.toInt()\n val min = n/7*2\n val max = n/7*2+ minOf(2, n%7)\n println(\"$min $max\")\n}", "lang": "Kotlin", "bug_code_uid": "5915cabc8b29b5e80ef3bb4a3caa1413", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "apr_id": "75af16d474cbdc9fd9b7ce4199a85738", "difficulty": 900, "tags": ["brute force", "math", "constructive algorithms", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9035812672176309, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "//package codeforces.com.tasks.task670A\n\nfun main() {\n val days = readLine()!!.toInt()\n val weeks = days / 7\n var minDaysOff = weeks * 2\n var maxDaysOff = weeks * 2\n\n when(days % 7) {\n 1 -> maxDaysOff += 1\n 2 -> maxDaysOff += 2\n 6 -> { maxDaysOff += 2; minDaysOff += 1 }\n }\n println(\"$minDaysOff $maxDaysOff\")\n}", "lang": "Kotlin", "bug_code_uid": "1f1959ef9904c38a30d93c23d7a99a00", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "apr_id": "31d4c425324695496f3c6ad351d93c4e", "difficulty": 900, "tags": ["brute force", "math", "constructive algorithms", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9005524861878453, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "package codeforces.com.tasks.task670A\n\nfun main() {\n val days = readLine()!!.toInt()\n val weeks = days / 7\n var minDaysOff = weeks * 2\n var maxDaysOff = weeks * 2\n\n when(days % 7) {\n 1 -> maxDaysOff += 1\n 2 -> maxDaysOff += 2\n 6 -> { maxDaysOff += 2; minDaysOff += 1 }\n }\n println(\"$minDaysOff $maxDaysOff\")\n}", "lang": "Kotlin", "bug_code_uid": "280c3e81db8752dbefcb259d494c9ccd", "src_uid": "8152daefb04dfa3e1a53f0a501544c35", "apr_id": "31d4c425324695496f3c6ad351d93c4e", "difficulty": 900, "tags": ["brute force", "math", "constructive algorithms", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9909801563439568, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n val board = Array(8) { CharArray(8) }\n for (numRow in 0 until 8)\n board[numRow] = readLine()!!.toCharArray()\n var bestB = Int.MAX_VALUE\n var bestW = Int.MAX_VALUE\n for (row in 0 until 8)\n loop@ for (column in 0 until 8) {\n when (board[row][column]) {\n 'B' -> {\n for (rowCheck in row + 1 until 8)\n if (board[rowCheck][column] == 'W') continue@loop\n bestB = min(bestB, 7 - row)\n }\n 'W' -> {\n for (rowCheck in row - 1 until 8)\n if (board[rowCheck][column] == 'B') continue@loop\n bestW = min(bestW, row)\n }\n }\n }\n print(if (bestB < bestW) 'B' else 'A')\n}", "lang": "Kotlin", "bug_code_uid": "e6fb26e6edf41812e3863ac1dab1bbdf", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "apr_id": "e1fa1edf3d8ab17d83a267f38a071aea", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9195205479452054, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.lang.Integer.min\n\nfun main(args: Array) {\n var t = arrayListOf()\n repeat(8) { t.add(readLine()!!) }\n var (a, b) = 8 to 8\n for (i in 0..7) {\n t.map { it[i] }.foldIndexed(false to 8) { i, acc, c ->\n var (metB, bestB) = acc\n if (c == 'W' && !metB) {\n a = min(a, i)\n bestB = 8\n }\n if (c == 'B') {\n metB = true\n bestB = 7 - i\n }\n\n metB to bestB\n }.let { b = min(b, it.second) }\n }\n print(if (b < a) \"B\" else \"A\")\n}", "lang": "Kotlin", "bug_code_uid": "d8eeb6121037f2e7a8438a9f5767263e", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd", "apr_id": "5de235d632f1e58d0103b418f232542f", "difficulty": 1200, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9706601466992665, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val a = sc.nextLong()\n val b = sc.nextLong()\n\n print(solve(a, b))\n}\n\nfun solve(a: Long, b: Long): Int {\n if(a == 0L && b == 0L) return 1\n\n var res = b % 10\n\n for(i in b - 1 downTo a + 1) {\n res = (res * (i % 10)) % 10\n if(res % 10 == 0L) return 0\n }\n return res.toInt()\n}\n", "lang": "Kotlin", "bug_code_uid": "fc1192d3c5da7c6b5e811aaae1327224", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "apr_id": "8c3d13d2d020b691d47dbb56b055e670", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7065462753950339, "equal_cnt": 14, "replace_cnt": 10, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.math.BigInteger\n\nfun factorialZone(lower: Long, upper:Long) : BigInteger {\n var ret: BigInteger = BigInteger.valueOf(1)\n for (i in (lower+1)..upper) {\n ret *= BigInteger.valueOf(i)\n }\n return ret\n}\n\nfun main(args: Array) {\n val (a, b) = readLine()!!.split(' ').map(String::toLong)\n\n //val ret: BigInteger = factorial(b) / factorial(a)\n val ret = factorialZone(a, b)\n \n val retStr = ret.toString()\n println(retStr.last())\n}\n", "lang": "Kotlin", "bug_code_uid": "52bb132383f12655738b6877f11dd9c2", "src_uid": "2ed5a7a6176ed9b0bda1de21aad13d60", "apr_id": "06c9a5161ebb5370afd04a0786be3798", "difficulty": 1100, "tags": ["math"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5331529093369418, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n var (x, y) = r.readLine()!!.split(\" \").map { it.toLong() }\n val n = r.readLine()!!.toInt()\n repeat(maxOf(0, n-2)){\n y =(y- x)%1000000007L.also { x = y }\n }\n when(n){\n 1 -> println(x)\n else -> println(if (y<0) y+ 1000000007L else y)\n }\n}", "lang": "Kotlin", "bug_code_uid": "31c24f0914a68b1aee6e34f1c2ee5f9a", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "c08b168d46b91b497688bb078f887826", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9144385026737968, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n var (x, y) = r.readLine()!!.split(\" \").map { it.toLong() }\n val n = r.readLine()!!.toInt()\n val ans = when (n % 6) {\n 2 -> y\n 3 -> y - x\n 4 -> -x\n 5 -> -y\n 0 -> x - y\n else -> x\n }\n println(if (ans<0) ans+1000000007 else ans)\n}", "lang": "Kotlin", "bug_code_uid": "77a4b3dfe12b15c13f9c174bd72f3251", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "c08b168d46b91b497688bb078f887826", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9940828402366864, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "const val M = 1000000007\nfun main(args: Array) {\n val (x,y) = readLine()!!.split(' ').take(2).map{it.toLong()}\n val n = readLine()!!.toLong()\n val nums= arrayOf(x-y,x,y)\n val (div,mod)=(n/3L) to (n%3L)\n val sign = -1L*((div%2L)*2L-1L)\n val ans = nums[mod.toInt()]*sign\n println(if (ans<0) M+ans else ans)\n\n}", "lang": "Kotlin", "bug_code_uid": "82e103201b7c948fd86512cfd5d865e0", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "b68479bc1995893bcb6fe6e6bc45d391", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8975155279503105, "equal_cnt": 11, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 11, "bug_source_code": "fun main(args: Array) {\n val (x,y) = readLine()!!.split(' ').take(2).map{it.toLong()}\n val n = readLine()!!.toLong()\n val nums= arrayOf(x-y,x,y)\n val (div,mod)=(n/3) to n%3\n val sign = -1*((div%2)*2-1)\n val ans = nums[mod]*sign\n println(if (ans<0) 1000000007+ans else ans)\n\n}", "lang": "Kotlin", "bug_code_uid": "eb08d2ccc9d12b2808d61f590875bf1e", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "b68479bc1995893bcb6fe6e6bc45d391", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9453717754172989, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.min\nimport kotlin.math.sign\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readLong() = readLn().toLong() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readLongs() = readStrings().map { it.toLong() } // list of ints\n\nfun main() {\n val (x, y) = readLongs()\n val arr = listOf(x, y, y - x, -x, -y, x - y)\n val n = readInt()\n println(((if (n % 6 == 0) arr[5] else arr[(n % 6) - 1]) + 1000000007) % 1000000007)\n\n}", "lang": "Kotlin", "bug_code_uid": "6922e202e69a6d3e487ce7f5b83acd25", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "a5bbb5a84004b30346d301e509aafc46", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9076023391812865, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n fun readInt() = readLine()!!.toInt()\n fun readLong() = readLine()!!.toLong()\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n fun readLongs() = readLine()!!.split(\" \").map(String::toLong)\n\n val (f1, f2) = readLongs()\n var goal = readLong()\n if (goal == 1L) {\n print(Math.floorMod(f1, 1000000007))\n return\n }\n if (goal == 2L) {\n print(Math.floorMod(f2, 1000000007))\n return\n }\n var currentPos = 1L\n var previous = f1\n var current = f2\n while (++currentPos < goal) {\n val new = current - previous\n previous = current\n current = new\n if(previous == f1 && current == f2) {\n val cycle = current - 2\n goal = (goal - 2) % cycle + 2\n current = 1\n }\n }\n print(current % 1000000007)\n}", "lang": "Kotlin", "bug_code_uid": "0baa8459941a7997466d3bc77fc0758b", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "b80ab39982bf4d617727e03164913bd2", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5478615071283096, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\n\nfun main () {\n val scanner = Scanner(System.`in`)\n var prevPrev = scanner.nextInt()\n var prev = scanner.nextInt()\n\n val message = when (val targetN = scanner.nextInt()) {\n 1 -> prevPrev\n 2 -> prev\n else -> {\n var current = 0\n repeat(targetN - 2) {\n current = Math.floorMod(prev - prevPrev, 1000000007)\n prevPrev = prev\n prev = current\n }\n current\n }\n }\n println(\n Math.floorMod(message, 1000000007)\n )\n}", "lang": "Kotlin", "bug_code_uid": "6a6621d20835d8582ec7b4b8ee0ee50c", "src_uid": "2ff85140e3f19c90e587ce459d64338b", "apr_id": "42883e79f6154e29054b9156f2e6699f", "difficulty": 1300, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9942363112391931, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main() {\n val s = Scanner(System.`in`)\n\n val input = s.nextLine()\n val myRank = input[0]\n val mySuite = input[1]\n\n val ar = Array>(5) {\n val yeet = s.nextLine();\n Pair(yeet[0], yeet[1])\n }\n println(if(ar.any { it.first == myRank || it.second == mySuite}) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "88d418cd8447543246de5390bb7d2baa", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "311531a3a53598f371be3b890c0d6cf8", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9990319457889641, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.ArrayList\n\nclass InputReader(stream: InputStream) {\n\n private var r = BufferedReader(InputStreamReader(stream), 32768)\n private var t = StringTokenizer(\"\")\n private fun next(): String {\n while (!t.hasMoreTokens()) t = StringTokenizer(r.readLine())\n return t.nextToken()\n }\n\n fun nextInt() = java.lang.Integer.parseInt(next())\n fun nextLong() = java.lang.Long.parseLong(next())\n fun nextDouble() = java.lang.Double.parseDouble(next())\n fun nextLine() = r.readLine()!!\n fun nextIntArray(n: Int): ArrayList {\n val v = ArrayList()\n for (i in 0 until n) v.add(nextInt())\n return v\n }\n}\n\nvar cin: InputReader = InputReader(System.`in`)\nvar cout: PrintWriter = PrintWriter(System.`out`)\n\nfun main() {\n solve()\n cout.close()\n}\n\nfun solve() {\n val s = cin.nextLine()\n val h = cin.nextLine().split(\" \")\n\n if (h.find { it[0]==s[0] || it[1]==s[0] } == null) print(\"NO\")\n else print(\"YES\")\n}", "lang": "Kotlin", "bug_code_uid": "b14711dddba4ef7d21970b979695ff68", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "f3c927dd7189719bede86672c20b8300", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9642857142857143, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n val reader = Scanner(System.`in`)\n val tablet = reader.next()\n val hand = reader.next()\n \n if (tablet[0] in hand || tablet[1] in hand) println(\"YES\")\n else println(\"NO\")\n\n}", "lang": "Kotlin", "bug_code_uid": "f2f7cadf93800371fef7d7dec12f708d", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "d2fb544a3841044c28358807de1b1898", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7161125319693095, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main()\n{ var c=0\n\tvar s= readLine()!!\n\tfor(i in 1..5)\n\t{\n\t\tvar n= readLine()!!\n\t\tif(s[0]==n[0]||s[1]==n[1])\n\t\t\t{\n\t\t\t\tc=1\n\t\t\t\t\n\t\t\t}\n\t}\n\t\n\tprintln(if(c==1) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "128f7d9aa0a47290e98f7d8600069224", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "b8e4fc64724b2b2ab206ecc4dcc3e891", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.684596577017115, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 3, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "fun main(args: Array)\n{ var c=0\n\tvar s= readLine()!!\n\tfor(i in 1..5)\n\t{\n\t\tvar n= readLine()!!\n\t\tif(s[0]==n[0]||s[1]==n[1])\n\t\t\t{\n\t\t\t\tc=1\n\t\t\t\t\n\t\t\t}\n\t}\n\t\n\tprintln(if(c==1) \"YES\" else \"NO\")\n", "lang": "Kotlin", "bug_code_uid": "fbfa6eae9fdd0a41fd41c075baaf7e50", "src_uid": "699444eb6366ad12bc77e7ac2602d74b", "apr_id": "b8e4fc64724b2b2ab206ecc4dcc3e891", "difficulty": 800, "tags": ["brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9705132872224245, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.abs\nimport kotlin.math.max\nimport kotlin.math.min\n\nval MOD = 1_000_000_007L\n\nclass Solver(stream: InputStream, private val out: java.io.PrintWriter) {\n fun solve() {\n val H = ni()\n var N = nl() - 1\n var x = 0\n var node = 2L\n var leaf = 1L\n for (i in 0 until H - 1) {\n node *= 2\n leaf *= 2\n }\n var ans = 0L\n for (i in 0 until H) {\n if (x == 0 && N >= leaf || x == 1 && N < leaf) {\n N -= leaf\n ans += node - 1\n } else {\n x = x xor 1\n }\n node /= 2\n leaf /= 2\n }\n out.println(ans + H)\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n private val isDebug = try {\n // \u306a\u3093\u304b\u672c\u756a\u3067\u30a8\u30e9\u30fc\u3067\u308b\n System.getenv(\"MY_DEBUG\") != null\n } catch (t: Throwable) {\n false\n }\n\n private var tokenizer: StringTokenizer? = null\n private val reader = BufferedReader(InputStreamReader(stream), 32768)\n private fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n tokenizer = StringTokenizer(reader.readLine())\n }\n return tokenizer!!.nextToken()\n }\n\n private fun ni() = next().toInt()\n private fun nl() = next().toLong()\n private fun ns() = next()\n private fun na(n: Int, offset: Int = 0): IntArray {\n return map(n) { ni() + offset }\n }\n private fun nal(n: Int, offset: Int = 0): LongArray {\n val res = LongArray(n)\n for (i in 0 until n) {\n res[i] = nl() + offset\n }\n return res\n }\n\n private fun na2(n: Int, offset: Int = 0): Array {\n val a = Array(2){IntArray(n)}\n for (i in 0 until n) {\n for (e in a) {\n e[i] = ni() + offset\n }\n }\n return a\n }\n\n private inline fun map(n: Int, f: (Int) -> Int): IntArray {\n val res = IntArray(n)\n for (i in 0 until n) {\n res[i] = f(i)\n }\n return res\n }\n\n private inline fun debug(msg: () -> String) {\n if (isDebug) System.err.println(msg())\n }\n\n private fun debug(a: LongArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: IntArray) {\n debug { a.joinToString(\" \") }\n }\n\n private fun debug(a: BooleanArray) {\n debug { a.map { if (it) 1 else 0 }.joinToString(\"\") }\n }\n\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n private fun debugDim(A: Array) {\n if (isDebug) {\n for (a in A) {\n debug(a)\n }\n }\n }\n\n /**\n * \u52dd\u624b\u306bimport\u6d88\u3055\u308c\u308b\u306e\u3092\u9632\u304e\u305f\u3044\n */\n private fun hoge() {\n min(1, 2)\n max(1, 2)\n abs(-10)\n }\n}\n\nfun main() {\n val out = java.io.PrintWriter(System.out)\n Solver(System.`in`, out).solve()\n out.flush()\n}", "lang": "Kotlin", "bug_code_uid": "1c3192cc57bcaaa814f1af3b745d157f", "src_uid": "3dc25ccb394e2d5ceddc6b3a26cb5781", "apr_id": "83866176db5cb2373a6f54e9475d6f9b", "difficulty": 1700, "tags": ["trees", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6147186147186147, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "\nimport java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)){\n val n = nextInt()\n val k = nextLong()\n val arrSize = getArrSize(n.toLong())\n println(findTargetIndex(n.toLong(), arrSize, k - 1)) \n\n}\nfun findTargetIndex(step: Long, size: Long, targetIndex: Long): Long{\n val next = size / 2\n\n if(next == targetIndex) {\n return step\n }\n if(targetIndex > next) {\n return next + findTargetIndex(step - 1, next, targetIndex)\n }\n return findTargetIndex(step - 1, next, targetIndex)\n}\n\nfun getArrSize(step: Long): Long { \n if(step <= 1L) {\n return 1\n }\n return (2 * getArrSize(step - 1)) + 1\n}", "lang": "Kotlin", "bug_code_uid": "355b6ae202407dc0008260f436c7fedc", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "apr_id": "418044ccbb15738f3717867389087bd7", "difficulty": 1200, "tags": ["implementation", "constructive algorithms", "bitmasks", "binary search"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5180375180375181, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "\nimport java.util.*\n\nfun main(args: Array) = with(Scanner(System.`in`)){\n val n = nextInt()\n val k = nextLong()\n val arrSize = getArrSize(n.toLong())\n println(findTargetIndex(n.toLong(), arrSize, k - 1)) \n\n}\nfun findTargetIndex(step: Long, size: Long, targetIndex: Long): Long{\n val next = size / 2\n\n if(next <= targetIndex) {\n return step\n }\n if(targetIndex > next) {\n return next + findTargetIndex(step - 1, next, targetIndex)\n }\n return findTargetIndex(step - 1, next, targetIndex)\n}\n\nfun getArrSize(step: Long): Long { \n if(step <= 1L) {\n return 1\n }\n return (2 * getArrSize(step - 1)) + 1\n}", "lang": "Kotlin", "bug_code_uid": "75fa5c2b6ccdb089a01345cb6d355652", "src_uid": "0af400ea8e25b1a36adec4cc08912b71", "apr_id": "418044ccbb15738f3717867389087bd7", "difficulty": 1200, "tags": ["implementation", "constructive algorithms", "bitmasks", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9876543209876543, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readString() = readLn().trim()\nprivate fun readInt() = readLn().toInt()\nprivate fun readLong() = readLn().toLong()\nprivate val regSpace = \"\\\\s+\".toRegex()\nprivate fun readSomeInts(): List {\n return readLn().trim().split(regSpace).map { it.toInt() }\n}\nprivate fun readSomeLongs(): List {\n return readLn().trim().split(regSpace).map { it.toLong() }\n}\n\nfun main() {\n\n val s = readString()\n val t = readString()\n\n val result = calcMaxLen(s, t)\n println(\"$result\")\n}\n\n\nfun calcMaxLen(s: String, t: String): Int {\n val sLen = s.length\n val tLen = t.length\n if (sLen == tLen)\n return 0\n\n val relIdxs: MutableList> = mutableListOf()\n for (j: Int in 0 until tLen) {\n val c = t[j]\n val idxs = s.withIndex().filter { it.value == c }.map { it.index }\n relIdxs.add(idxs.toMutableList())\n }\n\n var prevBgnIdx = -1\n for (j: Int in 0 until tLen) {\n relIdxs[j].removeAll { it <= prevBgnIdx }\n prevBgnIdx = relIdxs[j][0]\n }\n\n var prevEndIdx = sLen\n for (j: Int in tLen - 1 downTo 0) {\n relIdxs[j].removeAll { it >= prevEndIdx }\n prevEndIdx = relIdxs[j].last()\n }\n\n val m0 = relIdxs[0].last()\n val mz = sLen - relIdxs.last().first() - 1\n val m0z = if (mz > m0) mz else m0\n\n\n val mp = relIdxs.fold(Pair(m0z, relIdxs[0])) { (z, prev), xs ->\n val mx = xs.last() - prev.first() - 1\n Pair(if (mx > m0) mx else m0, xs)\n }\n\n return mp.first\n}\n", "lang": "Kotlin", "bug_code_uid": "3237f74a23b264edd5b31b388c751e2b", "src_uid": "0fd33e1bdfd6c91feb3bf00a2461603f", "apr_id": "83a2955489e5b08256128b44b9d1da68", "difficulty": 1600, "tags": ["greedy", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9985720727491357, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\n\nclass Solution : Runnable {\n override fun run() {\n solve()\n }\n\n fun start() {\n Thread(null, Solution(), \"whatever\", (1 shl 27).toLong()).start()\n }\n}\n\nfun main(args: Array) {\n Solution().start()\n}\n\n\nclass IO {\n companion object {\n\n private val reader: InputReader\n private val writer: OutputWriter\n\n init {\n if (System.getProperty(\"ONLINE_JUDGE\") == null ) {\n reader = InputReader(FileInputStream(\"/Users/300041735/competitiveProgramming/src/codeforces/in.txt\"))\n writer = OutputWriter(FileOutputStream(\"/Users/300041735/competitiveProgramming/src/codeforces/out.txt\"))\n } else {\n reader = InputReader(System.`in`)\n writer = OutputWriter(System.`out`)\n }\n }\n\n private fun readMultipleInts(count: Int): List {\n val map = mutableListOf()\n repeat(count) {\n map.add(reader.readInt())\n }\n return map\n }\n\n fun readInt() = reader.readInt()\n fun readLong() = reader.readLong()\n fun readTwoInts() = readMultipleInts(2)\n fun readThreeInts() = readMultipleInts(3)\n fun readFourInts() = readMultipleInts(4)\n fun readFiveInts() = readMultipleInts(5)\n fun readSixInts() = readMultipleInts(6)\n fun readString() = reader.readString()\n fun readTree(n: Int): MutableMap> {\n val graph = mutableMapOf>()\n repeat(n - 1) {\n val u = reader.readInt()\n val v = reader.readInt()\n if (!graph.containsKey(u)) graph[u] = mutableListOf()\n if (!graph.containsKey(v)) graph[v] = mutableListOf()\n graph[u]!!.add(v)\n graph[v]!!.add(u)\n }\n return graph\n }\n\n fun readIntArray(n: Int): IntArray {\n return IntArray(n) { readInt() }\n }\n\n fun readLongArray(n: Int): Array {\n return Array(n) { readLong() }\n }\n\n fun write(obj: Any) {\n writer.printLine(obj)\n }\n\n fun flushOutput() {\n writer.flush()\n }\n\n fun closeOutput() {\n writer.close()\n }\n }\n}\n\n\nclass MATH {\n companion object {\n\n val mod = 1000000007\n var ispre = false\n\n val factMod = Array(300002) { 1 }\n\n fun pre() {\n for (i in 2 until 300001) {\n factMod[i] = ((factMod[i - 1] * i.toLong()) % MATH.mod).toInt()\n }\n }\n\n fun gcd(a: Int, b: Int): Int {\n if (b == 0)\n return a\n return gcd(b, a % b)\n }\n\n fun gcd(a: Long, b: Long): Long {\n if (b == 0L)\n return a\n return gcd(b, a % b)\n }\n\n fun inverseMod(a: Int): Int {\n return powMod(a, mod - 2)\n }\n\n fun powMod(a: Int, b: Int): Int {\n //calculate a to the power b mod m\n if (b == 0) return 1\n return if (b % 2 == 1) {\n prodMod(a, powMod(a, b - 1))\n } else {\n val p = powMod(a, b / 2)\n prodMod(p, p)\n }\n }\n\n fun ncr(n: Int, r: Int): Int {\n if (!ispre) pre(); ispre = true\n return ((factMod[n].toLong() * inverseMod(((factMod[r].toLong() * factMod[n - r]) % mod).toInt())) % mod).toInt()\n }\n\n fun prodMod(val1: Int, val2: Int): Int {\n return ((val1.toLong() * val2) % mod).toInt()\n }\n\n }\n}\n\nfun solve() {\n\n\n val (n1, n2, k1, k2) = IO.readFourInts()\n val dp = DP(n1, n2, k1,k2)\n IO.write(dp.dp(1, 0, 0, 0 ))\n\n IO.flushOutput()\n IO.closeOutput()\n}\n\nclass DP(val n1 : Int, val n2 : Int, val k1 : Int,val k2 : Int){\n\n\n val map = Array(201) { Array(101) { Array(11) { IntArray(11) { -1 } } } }\n\n fun dp(pos : Int, horses : Int, lastHorses : Int, lastMen : Int) : Int {\n //dp[pos][horses already placed][last placed horsed][last placed men] 200*100*10*10 ~ 2 million states , should be okay\n //possible optimisation if we get TLE dp[pos][horses already placed][last placed whom ?][quantity] 200*100*2*10 ~ 0.4 million states\n\n if (pos == n1 + n2 + 1) return 1\n\n if (map[pos][horses][lastHorses][lastMen] != -1) return map[pos][horses][lastHorses][lastMen]\n val horsesRemaingToBePlaced = n2 - horses\n val footMenRemainingToBePlaced = n1 - (pos - 1 - horses)\n\n var ways= 0\n\n if (horsesRemaingToBePlaced != 0 && lastHorses < k2){\n //horse can be placed\n ways+= dp(pos + 1, horses + 1, lastHorses + 1, 0 )\n }\n if (footMenRemainingToBePlaced != 0 && lastMen < k1){\n ways+= dp(pos + 1, horses, 0, lastMen + 1)\n }\n\n map[pos][horses][lastHorses][lastMen] = ways\n return ways\n }\n}\n\ndata class Graph(val edges: MutableMap>)\n\n\nclass MinSegmentTree(\n input: Array\n) {\n private val tree: Array\n private val lazy: Array\n\n constructor(size: Int) : this(Array(size) { Int.MAX_VALUE })\n\n init {\n val size = nextPowerOfTwo(input.size)\n tree = Array(2 * size) { Int.MAX_VALUE }\n lazy = Array(2 * size) { Int.MAX_VALUE }\n for (i in 0 until input.size) {\n tree[i + size] = input[i]\n }\n for (i in (size - 1) downTo 1) {\n tree[i] = Math.min(tree[leftChild(i)], tree[rightChild(i)])\n }\n }\n\n private fun updateTree(lowerRange: Int, upperRange: Int, lowerBound: Int, upperBound: Int, index: Int, value: Int) {\n updateLazyNode(index, lowerBound, upperBound, lazy[index])\n if (noOverlap(lowerRange, upperRange, lowerBound, upperBound)) return\n else if (completeOverlap(lowerRange, upperRange, lowerBound, upperBound)) updateLazyNode(index, lowerBound, upperBound, value)\n else {\n updateTree(lowerRange, upperRange, lowerBound, midIndex(lowerBound, upperBound), leftChild(index), value)\n updateTree(lowerRange, upperRange, midIndex(lowerBound, upperBound) + 1, upperBound, rightChild(index), value)\n tree[index] = Math.min(tree[leftChild(index)], tree[rightChild(index)])\n }\n }\n\n private fun queryTree(lowerRange: Int, upperRange: Int, lowerBound: Int, upperBound: Int, index: Int): Int {\n updateLazyNode(index, lowerBound, upperBound, lazy[index])\n if (noOverlap(lowerRange, upperRange, lowerBound, upperBound)) return Int.MAX_VALUE\n else if (completeOverlap(lowerRange, upperRange, lowerBound, upperBound)) return tree[index]\n else {\n return Math.min(queryTree(lowerRange, upperRange, lowerBound, midIndex(lowerBound, upperBound), leftChild(index)),\n queryTree(lowerRange, upperRange, midIndex(lowerBound, upperBound) + 1, upperBound, rightChild(index)))\n }\n }\n\n private fun updateLazyNode(index: Int, lowerBound: Int, upperBound: Int, delta: Int) {\n tree[index] += delta\n if (lowerBound != upperBound) {\n lazy[leftChild(index)] += delta\n lazy[rightChild(index)] += delta\n }\n lazy[index] = 0\n }\n\n fun getElements(N: Int): List {\n return tree.copyOfRange(tree.size / 2, tree.size / 2 + N).asList()\n }\n\n fun update(lowerRange: Int, upperRange: Int, value: Int) {\n updateTree(lowerRange, upperRange, 1, lazy.size / 2, 1, value)\n }\n\n fun query(lowerRange: Int, upperRange: Int): Int {\n return queryTree(lowerRange, upperRange, 1, lazy.size / 2, 1)\n }\n\n private fun noOverlap(l: Int, u: Int, lb: Int, ub: Int): Boolean = (lb > u || ub < l)\n\n private fun completeOverlap(l: Int, u: Int, lb: Int, ub: Int): Boolean = (lb >= l && ub <= u)\n\n\n private fun nextPowerOfTwo(num: Int): Int {\n var exponent = 2\n while (true) {\n if (exponent >= num) {\n return exponent\n }\n exponent *= 2\n }\n }\n\n private fun midIndex(l: Int, r: Int) = (l + r) / 2\n private fun parent(i: Int) = i / 2\n private fun leftChild(i: Int) = 2 * i\n private fun rightChild(i: Int) = 2 * i + 1\n\n}\n\nclass InputReader(private val stream: InputStream) {\n private val buf = ByteArray(1024)\n private var curChar: Int = 0\n private var numChars: Int = 0\n private val filter: SpaceCharFilter? = null\n\n fun read(): Int {\n if (numChars == -1)\n throw InputMismatchException()\n if (curChar >= numChars) {\n curChar = 0\n try {\n numChars = stream.read(buf)\n } catch (e: IOException) {\n throw InputMismatchException()\n }\n\n if (numChars <= 0)\n return -1\n }\n return buf[curChar++].toInt()\n }\n\n fun readInt(): Int {\n var c = read()\n while (isSpaceChar(c))\n c = read()\n var sgn = 1\n if (c == '-'.toInt()) {\n sgn = -1\n c = read()\n }\n var res = 0\n do {\n if (c < '0'.toInt() || c > '9'.toInt())\n throw InputMismatchException()\n res *= 10\n res += c - '0'.toInt()\n c = read()\n } while (!isSpaceChar(c))\n return res * sgn\n }\n\n fun readLong(): Long {\n var c = read()\n while (isSpaceChar(c)) {\n c = read()\n }\n var sgn: Long = 1\n if (c == '-'.toInt()) {\n sgn = -1\n c = read()\n }\n var number: Long = 0\n do {\n number *= 10L\n number += (c - '0'.toInt()).toLong()\n c = read()\n } while (!isSpaceChar(c))\n return number * sgn\n }\n\n fun readString(): String {\n var c = read()\n while (isSpaceChar(c))\n c = read()\n val res = StringBuilder()\n do {\n res.appendCodePoint(c)\n c = read()\n } while (!isSpaceChar(c))\n return res.toString()\n }\n\n fun isSpaceChar(c: Int): Boolean {\n return filter?.isSpaceChar(c)\n ?: (c == ' '.toInt() || c == '\\n'.toInt() || c == '\\r'.toInt() || c == '\\t'.toInt() || c == -1)\n }\n\n operator fun next(): String {\n return readString()\n }\n\n interface SpaceCharFilter {\n fun isSpaceChar(ch: Int): Boolean\n }\n}\n\nclass OutputWriter {\n private val writer: PrintWriter\n\n constructor(outputStream: OutputStream) {\n writer = PrintWriter(BufferedWriter(OutputStreamWriter(outputStream)))\n }\n\n constructor(writer: Writer) {\n this.writer = PrintWriter(writer)\n }\n\n fun print(vararg objects: Any) {\n for (i in objects.indices) {\n if (i != 0)\n writer.print(' ')\n writer.print(objects[i])\n }\n }\n\n fun printLine(vararg objects: Any) {\n print(*objects)\n writer.println()\n }\n\n fun close() {\n writer.close()\n }\n\n fun flush() {\n writer.flush()\n }\n\n}\n\nclass DinitzMaxFlowSolver(val n: Int, val s: Int, val t: Int, val graph: MutableMap>, val edgeMap: MutableMap, Edge>) {\n\n private val level = IntArray(n + 1) { -1 } //storing levels of each vertex in level graph\n var maxFlow = 0L\n\n init {\n solve()\n }\n\n fun solve() {\n val next = IntArray(n + 1) { 0 }\n while (bfs()) {\n Arrays.fill(next, 0)\n var flow = 0L\n do {\n maxFlow += flow\n flow = dfs(s, next, Long.MAX_VALUE)\n } while (flow != 0L)\n }\n }\n\n private fun dfs(at: Int, next: IntArray, flow: Long): Long {\n if (at == t) return flow\n var size = 0\n if (graph.containsKey(at)) size = graph[at]!!.size\n while (next[at] < size) {\n val edge = graph[at]!!.get(next[at])\n if (edge.remainingCapacity() > 0 && level[edge.to] == level[at] + 1) {\n val bottleNeck = dfs(edge.to, next, Math.min(flow, edge.remainingCapacity()))\n if (bottleNeck > 0) {\n edgeMap[Pair(edge.from, edge.to)]!!.flow += bottleNeck\n edgeMap[Pair(edge.to, edge.from)]!!.flow -= bottleNeck\n return bottleNeck\n }\n }\n next[at]++\n }\n return 0\n }\n\n private fun bfs(): Boolean {\n Arrays.fill(level, -1)\n val curLevel = ArrayDeque()\n curLevel.add(s)\n level[s] = 0\n\n while (curLevel.isNotEmpty()) {\n val top = curLevel.poll()\n if (graph.containsKey(top)) {\n graph[top]!!.forEach {\n if (it.remainingCapacity() > 0 && level[it.to] == -1) {\n level[it.to] = level[top] + 1\n curLevel.offer(it.to)\n }\n }\n }\n }\n return level[t] != -1\n }\n\n\n}\n\nclass Edge(val from: Int, val to: Int, val capacity: Long) {\n var flow = 0L\n fun remainingCapacity(): Long {\n return capacity - flow\n }\n}", "lang": "Kotlin", "bug_code_uid": "bdc148d018b29d32580fa24b8d65313e", "src_uid": "63aabef26fe008e4c6fc9336eb038289", "apr_id": "a18041809909e087dd1a48883261f954", "difficulty": 1700, "tags": ["dp"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7865921787709497, "equal_cnt": 14, "replace_cnt": 5, "delete_cnt": 8, "insert_cnt": 1, "fix_ops_cnt": 14, "bug_source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n\n val reader = Scanner(System.`in`)\n var n: Int = reader.nextInt()\n var a: Int = reader.nextInt()\n var b: Int = reader.nextInt()\n var c: Int = reader.nextInt()\n\n var p = 0\n\n for(i in 0..a step 2){\n for(j in 0..b){\n for(k in 0..c){\n if((i*0.5+j*1+k*2).toInt()==n){\n p++\n }\n }\n }\n }\n println(p)\n}\n", "lang": "Kotlin", "bug_code_uid": "49fc13751685c4d3e97b6adafd205bf4", "src_uid": "474e527d41040446a18186596e8bdd83", "apr_id": "89c087f0348a0d7c21aa1460fac21baa", "difficulty": 1500, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9960391911611424, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n val (n, changeTime) = r.readLine()!!.split(\" \").map { it.toInt() }\n val v = r.readLine()!!\n val t = r.readLine()!!\n // dp[i][j][k] i mean ith char( start from 0 ), j mean change times, k mean number of t[0] in front\n val dp = List(n) { List(changeTime + 1) { MutableList(n + 1) { -1 } } }\n if (v[0]==t[0]){\n dp[0][0][1] = 0\n } else{\n dp[0][0][0] = 0\n dp[0][1][1] = 0\n }\n // Start with character 0, end with n-1. this build next, not prev build this\n for (i in 0 until n-1) {\n // Loop through change time, vary from 0 to c,\n for (j in 0 until changeTime + 1) {\n // Loop through how many t[0] include ith character in the front, not include ith char\n for (k in 0 until n) {\n // Is not start state came from\n if (dp[i][j][k]==-1) continue\n // current char is t[0]\n val t0 = if (v[i + 1] == t[0]) 1 else 0\n // current char is t[1]\n val t1 = if (v[i + 1] == t[1]) 1 else 0\n // do not change ith char\n dp[i + 1][j][k + t0] =\n maxOf(dp[i + 1][j][k + t0], dp[i][j][k] + if (t1 == 1) k else 0)\n //println(\"i is $i\")\n //println(\"do not change, i: $i, j: $j, k: $k, before: ${dp[i][j][k]}, after: ${dp[i + 1][j][k + t0]}\")\n // change ith character\n //println(\"dp[$i][$j][$k] is ${dp[i][j][k]}, if not change, ${dp[i + 1][j][k + t0]}\")\n if (j < changeTime) {\n val same = if (t[0] == t[1]) 1 else 0\n // change to t[0], even it is t[0]\n dp[i + 1][j + 1][k + 1] =\n maxOf(dp[i + 1][j + 1][k + 1], dp[i][j][k] + if (same == 1) k else 0)\n // change to t[1], even it is t[1]\n dp[i + 1][j + 1][k] = maxOf(dp[i + 1][j + 1][k], dp[i][j][k] + k)\n //println(\"change to t[0], ${dp[i + 1][j + 1][k + 1]}, change to t[1], ${dp[i + 1][j + 1][k]}\")\n }\n }\n }\n }\n var max = 0\n //dp.forEach { println(it) }\n for (i in 0 until changeTime + 1) {\n for (j in 0 until n + 1) {\n max = maxOf(max, dp[n-1][i][j])\n }\n }\n print(max)\n}\n", "lang": "Kotlin", "bug_code_uid": "dabeaf9a02603721a058bc4040627fbf", "src_uid": "9c700390ac13942cbde7c3428965b18a", "apr_id": "feaefc52c2905ac6c60015b7f3795f7b", "difficulty": 2100, "tags": ["dp", "strings"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9911783238815375, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\nimport kotlin.math.max\nimport kotlin.math.min\n\n// solution is at the bottom\n\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n\nconst val _BUFFER_SIZE = 1 shl 16\n@JvmField val _buffer = ByteArray(_BUFFER_SIZE)\n@JvmField var _bufferPt = 0\n@JvmField var _bytesRead = 0\n\ntailrec fun readChar(): Char {\n if(_bufferPt == _bytesRead) {\n _bufferPt = 0\n _bytesRead = INPUT.read(_buffer, 0, _BUFFER_SIZE)\n }\n return if(_bytesRead < 0) Char.MIN_VALUE\n else {\n val c = _buffer[_bufferPt++].toChar()\n if (c == '\\r') readChar()\n else c\n }\n}\n\nfun readLine(): String? {\n var c = readChar()\n return if(c == Char.MIN_VALUE) null\n else buildString {\n while(true) {\n when(c) {\n '\\n', Char.MIN_VALUE -> return@buildString\n else -> {\n append(c)\n c = readChar()\n }\n }\n }\n }\n}\nfun readLn() = readLine()!!\n\nfun read() = buildString {\n var c = readChar()\n while(c <= ' ') {\n if(c == Char.MIN_VALUE) return@buildString\n c = readChar()\n }\n do {\n append(c)\n c = readChar()\n } while(c > ' ')\n}\nfun readInt() = read().toInt()\nfun readDouble() = read().toDouble()\nfun readLong() = read().toLong()\nfun readStrings(n: Int) = List(n) { read() }\nfun readLines(n: Int) = List(n) { readLn() }\nfun readInts(n: Int) = List(n) { read().toInt() }\nfun readIntArray(n: Int) = IntArray(n) { read().toInt() }\nfun readDoubles(n: Int) = List(n) { read().toDouble() }\nfun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }\nfun readLongs(n: Int) = List(n) { read().toLong() }\nfun readLongArray(n: Int) = LongArray(n) { read().toLong() }\n\nfun main() {\n val (n, k) = readIntArray(2)\n\n val s = read()\n val t = read()\n\n if (t[0] == t[1]) {\n val count = min(s.count { it == t[0] } + k, n).toLong()\n println(count*(count - 1) / 2)\n } else {\n val dp = Array(n) {Array(n) {LongArray(k + 1) {-1L} } }\n\n fun solve(pos: Int, fstCount: Int, k: Int): Long {\n if (pos >= n) {\n return 0\n }\n\n if (dp[pos][fstCount][k] == -1L) {\n var res = 0L\n if (s[pos] == t[0]) {\n res = solve(pos + 1, fstCount + 1, k)\n if (k > 0) {\n res = max(res, solve(pos + 1, fstCount, k - 1) + fstCount)\n }\n } else if (s[pos] == t[1]) {\n res = fstCount + solve(pos + 1, fstCount, k)\n if (k > 0) {\n res = max(res, solve(pos + 1, fstCount + 1, k - 1))\n }\n } else {\n res = solve(pos + 1, fstCount, k)\n if (k > 0) {\n res = max(solve(pos + 1, fstCount, k - 1) + fstCount, solve(pos + 1, fstCount + 1, k - 1))\n }\n }\n\n dp[pos][fstCount][k] = res\n }\n\n return dp[pos][fstCount][k]\n }\n\n println(solve(0, 0, k))\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "7b0b561a6175cc1228f3d39e09a523e0", "src_uid": "9c700390ac13942cbde7c3428965b18a", "apr_id": "f88c181ec00aba030566bab4aaa509f2", "difficulty": 2100, "tags": ["dp", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9920508744038156, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n if (args.size > 0) System.setIn(FileInputStream(args[0]))\n val br = BufferedReader(InputStreamReader(System.`in`))\n val bw = BufferedWriter(OutputStreamWriter(System.out))\n\n var st = StringTokenizer(br.readLine())\n val n = st.nextToken().toInt()\n val m = st.nextToken().toInt()\n if (n == 0) {\n bw.write(\"Impossible\")\n } else if (m == 0) {\n bw.write(\"${n} ${n}\")\n } else if (n >= m) {\n bw.write(\"${n} ${n + m - 1}\")\n } else {\n bw.write(\"${m} ${n + m - 1}\")\n }\n bw.newLine()\n bw.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "8e5bb816212ebeaef56b7a2269d18b7e", "src_uid": "1e865eda33afe09302bda9077d613763", "apr_id": "6c1236150c4517990e41ce7ab6385c88", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9874326750448833, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "//http://rextester.com Kotlin 1.1\nimport java.io.*\nimport java.util.*\nfun main(args:Array){\n val(a,b)=readLine()!!.split(' ');val c=a.toInt();val d=b.toInt()\n if(c<1&&d>0){print(\"Impossible\");return}\n var e=c+d-1\n if(d==0)e=c\n print(\"${maxOf(c,d)} $e\")\n}", "lang": "Kotlin", "bug_code_uid": "759b4a9f67dfcdeef75b11dc7c161239", "src_uid": "1e865eda33afe09302bda9077d613763", "apr_id": "40a00d57e41d065afb05a3355a09ec3f", "difficulty": 1100, "tags": ["math", "greedy"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5637450199203188, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "fun main(args : Array) {\n val (x1, y1) = readLine()!!.split(' ')\n var n = x1.toInt()\n var m = y1.toInt()\n\n if(n==m){\n println(0)\n }\n else if(m%n!=0){\n println(-1)\n }\n else{\n var c3 = 0\n var c2 = 0\n\n while(m!=n){\n\n if(m%3==0 && (m/3)%n==0){\n c3++\n m = m/3\n }\n else if(m%2==0 && (m/2)%n==0){\n c2++\n m = m/2\n }\n }\n\n println(c2+c3)\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "ca6ef696086164880ada666df18add3a", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "f5e10e6982e4393aa3300e72cc8b4494", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9814073899741116, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n val n: Int = ir.nextInt()\n val m: Int = ir.nextInt()\n var count = 0\n\n if (m % n == 0) {\n var num = m / n\n while (num % 2 == 0 || num % 3 == 0)\n if (num % 2 == 0)\n num /= 2\n else (num % 3 == 0)\n num /= 3\n count++\n\n if (num == 1)\n pw.print(count)\n else\n pw.print(-1)\n\n } else\n pw.print(-1)\n\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "d41e975e4b093b2084bc1c3eb8fd90e6", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "cc92d4be18947c356ae58a7523267028", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9628019323671497, "equal_cnt": 11, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 8, "fix_ops_cnt": 10, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main() {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = Reader(input) //Reader(FileInputStream(File(\"portals.in\")))\n val writer = PrintWriter(BufferedOutputStream(output)) //PrintWriter(FileOutputStream(File(\"output.txt\")))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(ir : Reader, pw : PrintWriter) {\n\n val n: Int = ir.nextInt()\n val m: Int = ir.nextInt()\n var count = 0\n\n var num = m / n\n while (num % 2 == 0 || num % 3 == 0) {\n if (num % 2 == 0)\n num /= 2\n else\n num /= 3\n count++\n }\n\n if (num == 1)\n pw.print(count)\n else\n pw.print(-1)\n\n}\n\nclass Reader(stream: InputStream) {\n private val reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n init {\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens())\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return tokenizer!!.nextToken()\n }\n\n fun nextLine(): String? {\n val fullLine: String\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n fullLine = reader.readLine()\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n return fullLine\n }\n return null\n }\n\n fun toArray(): Array {\n return nextLine()!!.split(\" \".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "e3a17448f43ff24198d8478ef87260cd", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "cc92d4be18947c356ae58a7523267028", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8020477815699659, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n val (m, n) = readLongs()\n val leftOver = n.factorize().sorted().toMutableList()\n m.factorize().forEach { leftOver -= it }\n\n println(when {\n leftOver.isEmpty() -> 0\n leftOver.max()!! > 3 -> -1\n else -> leftOver.size\n })\n}\n\nfun readLongs(separator: String = \" \") =\n readStrings(separator).map(String::toLong).toLongArray()\n\nfun Long.factorize(): List {\n var sub = takeIf { it > 1 } ?: return emptyList()\n\n return sequence {\n for (p in Primes.primes) {\n if (sub <= 1) {\n break\n }\n\n while (sub % p == 0L) {\n sub /= p\n yield(p)\n }\n }\n }.toList()\n}\n\nobject Primes {\n const val MAX = 2_000_000\n\n val bitmap: BitSet by lazy { Primes.sieve(MAX) }\n val primes: List by lazy { (1..MAX).filter { isPrime(it) }.toList() }\n\n fun isPrime(num: Int) = bitmap[num - 1]\n\n fun nthPrime(n: Int) = primes[n - 1]\n\n private fun sieve(max: Int): BitSet {\n val primeMap = BitSet(max)\n primeMap.set(0, primeMap.size() - 1)\n primeMap.set(0, false)\n\n for (i in 2..primeMap.size()) {\n if (primeMap[i - 1]) {\n for (j in i + i..primeMap.size() step i) {\n primeMap.set(j - 1, false)\n }\n }\n }\n\n return primeMap\n }\n}", "lang": "Kotlin", "bug_code_uid": "e2fd69b31305868cfd571448630ba152", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "8519422799df95bde3c0b6d16a470d73", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9779179810725552, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n val (m, n) = readLongs()\n\n if (n % m != 0L) {\n println(-1)\n return\n }\n\n val leftOver = n.factorize().sorted().toMutableList()\n m.factorize().forEach { leftOver -= it }\n\n println(when {\n leftOver.isEmpty() -> 0\n leftOver.max()!! > 3 -> -1\n else -> leftOver.size\n })\n}\n\nfun readLongs(separator: String = \" \") =\n readStrings(separator).map(String::toLong).toLongArray()\n\nfun readStrings(separator: String = \" \", emptyWords: Boolean = false): Array {\n val line = readLine()!!\n val list = ArrayList()\n var builder = StringBuilder()\n\n for (i in 0..line.length) {\n if (i == line.length || separator.contains(line[i])) {\n if (emptyWords || builder.isNotEmpty()) {\n list.add(builder.toString())\n builder = StringBuilder()\n }\n } else {\n builder.append(line[i])\n }\n }\n\n return list.toTypedArray()\n}\n\nfun Long.factorize(): List {\n var sub = takeIf { it > 1 } ?: return emptyList()\n\n return sequence {\n for (p in Primes.primes) {\n if (sub <= 1) {\n break\n }\n\n while (sub % p == 0L) {\n sub /= p\n yield(p)\n }\n }\n }.toList()\n}\n\nobject Primes {\n const val MAX = 2_000_000\n\n val bitmap: BitSet by lazy { Primes.sieve(MAX) }\n val primes: List by lazy { (1..MAX).filter { isPrime(it) }.toList() }\n\n fun isPrime(num: Int) = bitmap[num - 1]\n\n fun nthPrime(n: Int) = primes[n - 1]\n\n private fun sieve(max: Int): BitSet {\n val primeMap = BitSet(max)\n primeMap.set(0, primeMap.size() - 1)\n primeMap.set(0, false)\n\n for (i in 2..primeMap.size()) {\n if (primeMap[i - 1]) {\n for (j in i + i..primeMap.size() step i) {\n primeMap.set(j - 1, false)\n }\n }\n }\n\n return primeMap\n }\n}", "lang": "Kotlin", "bug_code_uid": "ac913a4d1ac515f6ea33b9c7563f59a8", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "8519422799df95bde3c0b6d16a470d73", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9799291617473436, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun main() {\n\n var (n, m) = readLine()!!.split(\" \").map { it.toLong() }\n\n var result = -1\n if (m % n == 0L) {\n result = 0\n var d = m / n\n while (d % 2 == 0L) {\n d /= 2\n result++\n }\n while (d % 3 == 0L) {\n d /= 3\n result++\n }\n if (d != 1L) {\n println(-1)\n }\n }\n println(result)\n\n}", "lang": "Kotlin", "bug_code_uid": "0277fb3394d82d092b941f5b04db1eba", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "69af96a11e144754200e4e0739f203f6", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4666666666666667, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val scan = Scanner(System.`in`)\n\n val x = scan.nextInt()\n val y = scan.nextInt()\n\n if (x == y){\n println(\"0\")\n return\n }\n var result = y / x\n var counter = 0\n\n while (result % 3 == 0){\n result /= 3\n counter++\n }\n\n while (result % 2 == 0 && result > 0){\n result /= 2\n counter++\n }\n\n if (counter == 0){\n println(\"-1\")\n } else {\n println(counter)\n }\n}", "lang": "Kotlin", "bug_code_uid": "46aa86c3dd6e07f20829b3a9de0fef4a", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "7525e596ba55afa0d9080339f75b8f4c", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7897623400365631, "equal_cnt": 9, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.ceil\nimport kotlin.reflect.jvm.internal.impl.resolve.constants.LongValue\n\nfun main() {\n\n var n = readLine()!!.toInt()\n var m = readLine()!!.toInt()\n\n if(m%n!=0)\n print(-1)\n else {\n var rem = m/n\n var ct = 0\n while(rem>=1){\n rem /= if(rem%2==0) 2\n else if(rem%3==0) 3\n else break\n ct++\n }\n if(rem==1)\n println(ct)\n else\n println(-1)\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "bb80ab4a21782ccad028084bdc07c2e7", "src_uid": "3f9980ad292185f63a80bce10705e806", "apr_id": "ca44c78b012cef207dd2b5d9793bd96f", "difficulty": 1000, "tags": ["math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9651972157772621, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun solvit(a: Int, b: Int, ans: String): String? {\n if (a > b) return null\n else if (a == b) return ans\n val x2 = solvit(a * 2, b, ans + \"0\")\n if (x2 != null) return x2\n val x101 = solvit(1 + a * 10, b, ans + \"1\")\n if (x101 != null) return x101\n return null\n}\n\nfun main(args: Array) {\n if (args.size > 0) System.setIn(FileInputStream(args[0]))\n val br = BufferedReader(InputStreamReader(System.`in`))\n val bw = BufferedWriter(OutputStreamWriter(System.out))\n\n var st = StringTokenizer(br.readLine())\n var a = st.nextToken().toInt()\n val b = st.nextToken().toInt()\n val res = solvit(a, b, \"\")\n if (res != null) {\n bw.write(\"${res.length + 1}\\n$a\")\n for (c in res) {\n if (c == '0') {\n a *= 2\n bw.write(\" $a\")\n } else if (c == '1') {\n a = (a * 10) + 1\n bw.write(\" $a\")\n }\n }\n }\n else bw.write(\"NO\")\n bw.newLine()\n bw.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "7813794558eab6c2a1d7ec146b55460c", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "2b9670de54237d74e557d27a65d9fb40", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9675925925925926, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun solvit(a: Int, b: Int, ans: String): String? {\n if (a > b) return null\n else if (a == b) return ans\n val x2 = solvit(a * 2, b, ans + \"0\")\n if (x2 != null) return x2\n val x101 = solvit(1 + a * 10, b, ans + \"1\")\n if (x101 != null) return x101\n return null\n}\n\nfun main(args: Array) {\n if (args.size > 0) System.setIn(FileInputStream(args[0]))\n val br = BufferedReader(InputStreamReader(System.`in`))\n val bw = BufferedWriter(OutputStreamWriter(System.out))\n\n var st = StringTokenizer(br.readLine())\n var a = st.nextToken().toInt()\n val b = st.nextToken().toInt()\n val res = solvit(a, b, \"\")\n if (res != null) {\n bw.write(\"YES\\n${res.length + 1}\\n$a\")\n for (c in res) {\n if (c == '0') {\n a *= 2\n bw.write(\" $a\")\n } else if (c == '1') {\n a = (a * 10) + 1\n bw.write(\" $a\")\n }\n }\n }\n else bw.write(\"NO\")\n bw.newLine()\n bw.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "7a34ae828d3975e7d73765b697e74ce9", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "2b9670de54237d74e557d27a65d9fb40", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9395711500974658, "equal_cnt": 6, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args: Array) {\n if (args.size > 0) System.setIn(FileInputStream(args[0]))\n val br = BufferedReader(InputStreamReader(System.`in`))\n val bw = BufferedWriter(OutputStreamWriter(System.out))\n\n var st = StringTokenizer(br.readLine())\n val a = st.nextToken().toInt()\n var b = st.nextToken().toInt()\n val arr = mutableListOf(b)\n while (a < b) {\n if (b and 1 == 0) {\n b /= 2\n } else {\n b -= 1\n b /= 10\n }\n arr.add(b)\n }\n if (a == b) {\n bw.write(\"YES\\n${arr.size}\\n\")\n bw.write(arr.reversed().joinToString(separator = \" \"))\n }\n else bw.write(\"NO\")\n bw.newLine()\n bw.flush()\n}\n", "lang": "Kotlin", "bug_code_uid": "5473c3851427cde16c393d77ddf5b856", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "2b9670de54237d74e557d27a65d9fb40", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9632481624081204, "equal_cnt": 16, "replace_cnt": 15, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 15, "bug_source_code": "import java.util.*\nimport java.util.Queue\n\nfun main(){\n var scanner : Scanner = Scanner(System.`in`)\n var a : Int = scanner.nextInt()\n var b : Int = scanner.nextInt()\n var visited : MutableMap = mutableMapOf(\n a to true\n )\n var parent : MutableMap = mutableMapOf()\n var done : Boolean = false\n var bfs_q : Queue = LinkedList()\n bfs_q.add(a)\n parent[a] = a\n while(!bfs_q.isEmpty()){\n var curr : Int = bfs_q.peek()\n bfs_q.remove()\n\n if (curr == b){\n done = true\n break\n }\n\n var c1 : Int = curr * 2\n var c2 : Int = 10 * curr + 1\n\n if(c1 >= 0 && c1 <= 1e9 && !visited.containsKey(c1)){\n visited[c1] = true\n bfs_q.add(c1)\n parent[c1] = curr\n }\n if(c2 >= 0 && c2 <= 1e9 && !visited.containsKey(c2)){\n visited[c2] = true\n bfs_q.add(c2)\n parent[c2] = curr\n }\n }\n\n if(!done){\n print(\"NO\")\n } else {\n println(\"YES\")\n var steps : Stack = Stack()\n\n var currStep : Int = b\n while(currStep != a) {\n steps.push(currStep)\n currStep = parent[currStep]!!\n }\n steps.push(a)\n println(steps.size)\n while(!steps.isEmpty()){\n print(\"${steps.peek()} \")\n steps.pop()\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "7e4c749c78acf6eda5fb0d5f2995f8c2", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "9081d099ce2761a1ba2fbb7362fd2f5b", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9180492709904474, "equal_cnt": 15, "replace_cnt": 7, "delete_cnt": 3, "insert_cnt": 4, "fix_ops_cnt": 14, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun memo (f: (A, B) -> C): (A, B) -> C{\n val vals = mutableMapOf, C>()\n return {\n x: A, y: B -> vals.getOrPut(Pair(x, y)){f(x, y)}\n }\n}\n\nfun isThereAWay(a: Int, b: Int): List {\n fun go(a: Int, b: Int, ls: List): List =\n if(a == b) ls + listOf(b)\n else if (a > b) emptyList()\n else go(a*2, b, ls + listOf(a)) + go(a*10 + 1, b, ls + listOf(a))\n return go(a, b, emptyList())\n}\n\n\n\n\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ab = br.readLine().split(\" \").map { it.toInt() }\n val a = ab[0]\n val b = ab[1]\n val result = memo(::isThereAWay)(a, b)\n if (result.isEmpty()){\n println(\"NO\")\n }else{\n println(\"YES\")\n println(result.size)\n print(result[0])\n for (i in 1 until result.size){\n print(\" \" + result[i])\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "0831d88fc8e2e03b80f88ee14a25ef80", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "8b792d089ac3f7981b6976071a6cf39c", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9617706237424547, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun memo (f: (A, B) -> C): (A, B) -> C{\n val vals = mutableMapOf, C>()\n return {\n x: A, y: B -> vals.getOrPut(Pair(x, y)){f(x, y)}\n }\n\n}\n\n\nfun isThereAWay(a: Int, b: Int): List {\n\n fun go(a: Int, b: Int, ls: List): List =\n if(a == b) ls + listOf(b)\n else if (a > b || a < 0) emptyList()\n else go(a*2, b, ls + listOf(a)) + go(a*10 + 1, b, ls + listOf(a))\n\n\n return go(a, b, emptyList())\n}\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val ab = br.readLine().split(\" \").map { it.toInt() }\n val a = ab[0]\n val b = ab[1]\n val result = memo(::isThereAWay)(a, b)\n if (result.isEmpty()){\n println(\"NO\")\n }else{\n println(\"YES\")\n println(result.size)\n print(result[0])\n for (i in 1 until result.size){\n print(\" \" + result[i])\n }\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "2d43f96ee3269ebc803e419c008888f8", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "8b792d089ac3f7981b6976071a6cf39c", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9700332963374029, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n var (a, b) = readInts()\n val sol = mutableListOf()\n while (b >= a) {\n sol.add(b)\n b /= when {\n b and 1 == 0 -> 2\n b % 10 == 1 -> 10\n else -> return print(\"NO\")\n }\n }\n if (sol.last() != a) return print(\"NO\")\n println(\"YES\")\n println(sol.size)\n println(sol.reversed().joinToString(\" \"))\n}", "lang": "Kotlin", "bug_code_uid": "dbf10a6d3f55d70f43e56b72a012917c", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3", "apr_id": "918b775c2e4b7634f363455b8aae119d", "difficulty": 1000, "tags": ["brute force", "math", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6664298401420959, "equal_cnt": 17, "replace_cnt": 6, "delete_cnt": 4, "insert_cnt": 7, "fix_ops_cnt": 17, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n\n val scanner = Scanner(System.`in`)\n\n val a1 = scanner.nextLine().toCharArray()\n val a2 = scanner.nextLine().toCharArray()\n val a3 = scanner.nextLine().toCharArray()\n val a4 = scanner.nextLine().toCharArray()\n val array = arrayOf(a1, a2, a3, a4)\n\n var ans = \"NO\"\n\n for (i in 0 until 4) {\n for (j in 0 until 4) {\n if (array[i][j] == '.') {\n array[i][j] = 'x'\n\n if (checkResult(array)) {\n ans = \"YES\"\n }\n\n array[i][j] = '.'\n\n }\n\n\n\n }\n\n }\n\n System.out.println(ans)\n\n}\n\n\nfun checkResult(array: Array) : Boolean {\n var ans = false\n\n for (i in 0 until 4) {\n for (j in 0 until 2) {\n if (array[i][j] == 'x' && array[i][j+1] == 'x' && array[i][j+2] == 'x') {\n ans = true\n }\n }\n }\n\n for (i in 0 until 2) {\n for (j in 0 until 4) {\n if (array[i][j] == 'x' && array[i+1][j] == 'x' && array[i+2][j] == 'x') {\n ans = true\n }\n }\n }\n\n return ans\n}", "lang": "Kotlin", "bug_code_uid": "75ada4d8f9633d72bffcceb1e21f2c84", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "apr_id": "0420adbdd27b792c560c13348ec1b163", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9929627023223082, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*;\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readDouble() = readLn().toDouble() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\nprivate fun readDoubles() = readStrings().map { it.toDouble() } // list of ints\n\nfun main(args: Array) {\n solve()\n /*\n val t = readInt()\n repeat(t) {\n solve()\n }\n */\n}\n\nfun solve() {\n val g = arrayOf(readLn(), readLn(), readLn(), readLn())\n val dx = arrayOf(-1, -1, -1, 0, 0, 1, 1, 1)\n val dy = arrayOf(-1, 0, 1, -1, 1, -1, 0, 1)\n for(i in 0 until 4) {\n for(j in 0 until 4) {\n for(k in 0 until dx.size) {\n var good = 0\n var valid = true\n for(l in 0 until 3) {\n var nx = i + dx[k] * l\n var ny = j + dy[k] * l\n if(nx < 0 || nx >= 4 || ny < 0 || ny >= 4) valid = false\n if(valid && g[nx][ny] == 'x') good++\n }\n if(good == 2 && valid) {\n println(\"YES\")\n System.exit(0);\n }\n }\n }\n }\n println(\"NO\")\n}\n\n/*\nuseful things:\nJava: int[] dx = new int[]{-1,1,0,0}\nKotlin: val dx = arrayOf(-1, 1, 0, 0)\n*/", "lang": "Kotlin", "bug_code_uid": "5ab59c5f17d9d1ddc2b77062440994ad", "src_uid": "ca4a77fe9718b8bd0b3cc3d956e22917", "apr_id": "22ae04c592c8f077ae82856b5ab080be", "difficulty": 1100, "tags": ["brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9434585224927775, "equal_cnt": 6, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "private fun readInt() = readLine()!!.toInt()\n\nvar FF = MutableList>(21) { _ -> MutableList(1_000_000) { _->-1L}}\nvar FF3 = MutableList>(21) {_-> MutableList(1_000_000) {_->-1L}}\nvar n = 0\nvar k = 0\n\nfun F3(q:Int, w:Int) : Long {\n if (FF3[q][w] == -1L) {\n if (q >= k - 1 || w > n / (3 shl q) || w == 0) {\n FF3[q][w] = 0\n return 0\n }\n FF3[q][w] = F3(q+1, w-1)*(n / (3 shl q) - n / (3 shl (q+1))) + F3(q, w-1)*(n / (3 shl q) - w + 1)\n FF3[q][w] = FF3[q][w]%1_000_000_009\n }\n return FF3[q][w]\n}\n\nfun F(q:Int, w:Int) : Long {\n if (FF[q][w] == -1L) {\n if (q >= k || w > n / (1 shl q) || w == 0) {\n FF[q][w] = 0\n return 0\n }\n FF[q][w] = F3(q, w-1)*(n / (1 shl q) - n / (3 shl q)) + F(q+1, w-1)*(n / (1 shl q) - n / (1 shl (q+1))) + F(q, w-1)*(n / (1 shl q) - w + 1)\n FF[q][w] = FF[q][w] % 1_000_000_009\n }\n return FF[q][w]\n}\n\nfun main() {\n n = readInt()\n k = 1\n while (n >= (1 shl k)) k++\n k--\n if (k > 0 && n >= (1 shl (k-1))*3) FF3[k-1][1] = 1\n FF[k][1] = 1\n println(F(0, n))\n}", "lang": "Kotlin", "bug_code_uid": "7902c1acdbcf6e08ec9ace3d1e686d1e", "src_uid": "b2d59b1279d891dba9372a52364bced2", "apr_id": "480e139010196cbe2bcf34f5f8bb3d92", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9451093685513826, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "private fun readInt() = readLine()!!.toInt()\n\nvar FF = MutableList>(21) { _ -> MutableList(1_000_000) { _->-1L}}\nvar FF3 = MutableList>(21) {_-> MutableList(1_000_000) {_->-1L}}\nvar n = 0\nvar k = 0\n\nfun F3(q:Int, w:Int) : Long {\n if (FF3[q][w] == -1L) {\n if (q >= k - 1 || w > n / (3 shl q) || w == 0) {\n FF3[q][w] = 0\n return 0\n }\n FF3[q][w] = F3(q+1, w-1)*(n / (3 shl q) - n / (3 shl (q+1))) + F3(q, w-1)*(n / (3 shl q) - w + 1)\n FF3[q][w] = FF3[q][w]%1_000_000_007\n }\n return FF3[q][w]\n}\n\nfun F(q:Int, w:Int) : Long {\n if (FF[q][w] == -1L) {\n if (q >= k || w > n / (1 shl q) || w == 0) {\n FF[q][w] = 0\n return 0\n }\n FF[q][w] = F3(q, w-1)*(n / (1 shl q) - n / (3 shl q)) + F(q+1, w-1)*(n / (1 shl q) - n / (1 shl (q+1))) + F(q, w-1)*(n / (1 shl q) - w + 1)\n FF[q][w] = FF[q][w] % 1_000_000_007\n }\n return FF[q][w]\n}\n\nfun main() {\n n = readInt()\n k = 1\n while (n >= (1 shl k)) k++\n k--\n if (k > 0 && n >= (1 shl (k-1))*3) FF3[k-1][1] = 1\n FF[k][1] = 1\n println(F(0, n))\n}", "lang": "Kotlin", "bug_code_uid": "728be66437b704cfbc3bd5f78abf22d1", "src_uid": "b2d59b1279d891dba9372a52364bced2", "apr_id": "480e139010196cbe2bcf34f5f8bb3d92", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9051847608135205, "equal_cnt": 10, "replace_cnt": 1, "delete_cnt": 7, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "const val MOD = 1000000007L\n\nfun main() {\n val n = readLine()!!.toInt()\n val factorial = LongArray(n + 1)\n factorial[0] = 1L\n for (j in 1..n) {\n factorial[j] = (j.toLong() * factorial[j - 1]) % MOD\n }\n val factInv = LongArray(n + 1) { factorial[it] pow -1 }\n fun permute(a: Int, b: Int) = if (b < 0L || b > a) 0L else ((factorial[a] * factInv[b]) % MOD)\n fun arrange(a: Int, b: Int): Long {\n val here = n / a\n val above = here / b\n return ((here - above).toLong() * permute(n - above - 1, n - here)) % MOD\n }\n var lg = 0\n while (1 shl lg <= n) {\n lg++\n }\n lg--\n var curr = factorial[n - (n / 2)]\n for (e in 1..lg) {\n curr *= arrange(1 shl e, 2)\n }\n var answer = curr\n if (n >= 3 * (1 shl (lg - 1))) {\n for (e in lg downTo 1) {\n curr *= arrange(1 shl e, 3) pow -1\n curr %= MOD\n curr *= arrange(3 * (1 shl (e - 1)), 2)\n curr %= MOD\n if (e > 1) {\n curr *= arrange(1 shl (e - 1), 2) pow -1\n curr %= MOD\n curr *= arrange(1 shl (e - 1), 3)\n curr %= MOD\n } else {\n curr *= factInv[n - (n / 2)]\n curr %= MOD\n curr *= factorial[n - (n / 3)]\n curr %= MOD\n }\n answer += curr\n }\n answer %= MOD\n }\n println(answer)\n}\n\nval MOD_TOTIENT = (MOD - 1).toInt()\n\ninfix fun Long.pow(power: Int): Long {\n var e = power\n e %= MOD_TOTIENT\n if (e < 0) {\n e += MOD_TOTIENT\n }\n if (e == 0 && this == 0L) {\n return this\n }\n var b = this % MOD\n var res = 1L\n while (e > 0) {\n if (e and 1 != 0) {\n res *= b\n res %= MOD\n }\n b *= b\n b %= MOD\n e = e shr 1\n }\n return res\n}", "lang": "Kotlin", "bug_code_uid": "f6904c5e604d9cd86a07ca29432ecb8e", "src_uid": "b2d59b1279d891dba9372a52364bced2", "apr_id": "da900dd286dfa6fbbf5ea82ddb379517", "difficulty": 2500, "tags": ["dp", "math", "combinatorics", "number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8690909090909091, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.Scanner\n\nfun main(args : Array) {\n var list1: MutableList = mutableListOf()\n for (i in 0..7) {\n list1.add(readLine()!!)\n }\n\n var row = 0\n var a = 0\n for (i in 0..7) {\n var col = 0\n for (char in list1[i]) {\n if (char == 'B') {\n col++\n }\n if (col == 8) {\n row++\n }\n }\n a = col\n }\n\n var c = row + a\n if (c==16){ println(8) }\n else { println(c)}\n}\n", "lang": "Kotlin", "bug_code_uid": "e3a9b022a51cf282075eeee4abba4dad", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "apr_id": "526ed1e278147f60c82c0ad573ec6787", "difficulty": 1100, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9741863075196409, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun a7() {\n val list = mutableListOf()\n val listV = booleanArrayOf(false, false, false, false, false, false, false, false)\n var vertical = 0\n var horizontal = 0\n for (i in 0..7) {\n list.add(i, readLine()!!.toCharArray())\n }\n\n for (i in 0..7) {\n var lineH = true\n for (j in 0..7) {\n if (list[i][j] != 'B')\n lineH = false\n\n if (i == 0) {\n if (list[i][j] == 'B')\n listV[j] = true\n } else {\n if (list[i][j] != 'B')\n listV[j] = false\n }\n }\n\n if (lineH)\n horizontal++\n\n if (i == 7) {\n listV.forEach {\n if (it)\n vertical++\n }\n }\n }\n\n print(\"${vertical + horizontal}\")\n}\n\nfun main() {\n a7()\n}", "lang": "Kotlin", "bug_code_uid": "38d926c7dd81ef7318b598f1e0015d15", "src_uid": "8b6ae2190413b23f47e2958a7d4e7bc0", "apr_id": "9ff792f81db8f480dd638a8ead0c83c1", "difficulty": 1100, "tags": ["brute force", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9511111111111111, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "\nimport java.util.*\n\n//https://codeforces.com/problemset/problem/1099/B\n\nfun main(args: Array) = with(Scanner(System.`in`)){\n val n = nextLong()\n\n val x = Math.sqrt(n.toDouble())\n\n var iX = x.toLong()\n var iY = iX\n if(iX * iY == n) {\n println(iX * 2)\n return\n }\n iX++\n while(true) {\n if (iX * iY > n){\n println(iX + iY - 1)\n break\n }\n iY++\n }\n}", "lang": "Kotlin", "bug_code_uid": "27af81f9219fd7f8293f240fb9e6d83a", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "apr_id": "56e5a236fdef1c613976abdaec69e4e5", "difficulty": 1100, "tags": ["math", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9838297872340426, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "//package com.happypeople.codeforces.c1099\n\nimport java.io.ByteArrayInputStream\nimport java.io.InputStream\nimport java.util.*\nimport kotlin.math.sqrt\n\nfun main(args: Array) {\n try {\n B().run()\n } catch (e: Throwable) {\n B.log(\"\" + e)\n }\n}\n\nclass B {\n fun run() {\n val sc = Scanner(systemIn())\n val n=sc.nextInt()\n val s=sqrt(n.toDouble()).toInt()\n var r=n-s*s\n\n var ans=s\n var nextS=s\n var flip=true\n val seq= generateSequence {\n val tmp=nextS\n if(flip)\n nextS++\n flip=!flip\n tmp\n }.iterator()\n\n while(r>0) {\n ans++\n r-=seq.next()\n }\n\n println(\"$ans\")\n }\n\n companion object {\n var inputStr: String? = null\n\n fun systemIn(): InputStream {\n if (inputStr != null)\n return ByteArrayInputStream(inputStr!!.toByteArray())\n else\n return System.`in`\n }\n\n var printLog = false\n fun log(str: String) {\n if (printLog)\n println(str)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "0ee07c6a8353906fab6b0e85b1f0e52d", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "apr_id": "ffa68b10e52f79f81e44dc894a85a0c8", "difficulty": 1100, "tags": ["math", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5150684931506849, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n solve()\n}\n\nprivate fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\n\nprivate fun solve() {\n var (n) = read().map(String::toLong)\n\n if(n == 1L) {\n println(2)\n }\n if(n == 2L) {\n println(3)\n }\n if(n == 3L) {\n println(4)\n }\n if(n >= 4L) {\n println(n)\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "765426379feefb066c0b135632ab2cca", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "apr_id": "dd87c6f62c31887487fda87f6228a80b", "difficulty": 1100, "tags": ["math", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9389567147613762, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.sqrt\n\nfun main(args: Array) {\n// val x = readLine()!!.split(\" \").map { it.toInt() }\n// val a = readLine()!!.split(\" \").map { it.toInt() }\n// val b = readLine()!!.split(\" \").map { it.toInt() }\n val n = readLine()!!.toInt()\n val x = 4\n\n if (n == 1) println(2)\n if (n == 2) println(3)\n\n var a = 1\n var b = 1\n\n var t = 1\n\n while (a * b < n) {\n if (t==1) a++\n else b++\n t = -t\n }\n println(a+b)\n}\n", "lang": "Kotlin", "bug_code_uid": "ba1ed2d66ebe235ae4bc1b92eb6d239f", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "apr_id": "ae3dbbe29cf49b3ab45a8b4dc98b4117", "difficulty": 1100, "tags": ["math", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7566765578635015, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "import java.lang.Integer.min\nimport kotlin.math.abs\nimport kotlin.math.roundToInt\nimport kotlin.math.sqrt\n\nfun main(args: Array) {\n// var str = readLine()!!\n var n = readLine()!!.toInt()\n// var ball = readLine()!!.split(\" \").map { x -> x.toInt() }\n var result = 0\n when (n) {\n 1 -> result = 2\n 2 -> result = 3\n 3 -> result = 4\n 4 -> result = 4\n 5 -> result = 5\n 6 -> result = 5\n else -> result = finds(n)*2\n }\n\n println(result)\n}\n\nfun finds(n: Int) : Int {\n var i = sqrt(n.toDouble()).roundToInt()\n while (true) {\n if (i*i >= n) return i\n i++\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "de2d9ad0c7cb7ec5ba217fbd888c891c", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "apr_id": "7ba0bbfca1a5dad6817d0d66c44b2e91", "difficulty": 1100, "tags": ["math", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9425981873111783, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.*\nfun main(arg: Array){\n\tval sq = readLine()!!.toInt()\n\tval h = sqrt(sq.toDouble()).toInt()\n\tval w = sq/h + sq.rem(h)\n\tprintln(h+w)\n}", "lang": "Kotlin", "bug_code_uid": "bd0b1a2d7d36baa8b555a8719e04a379", "src_uid": "eb8212aec951f8f69b084446da73eaf7", "apr_id": "42c3d0d12491ea3bb7881a9778bc7d94", "difficulty": 1100, "tags": ["math", "constructive algorithms", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7900355871886121, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n val x = restore(n)\n\n println(\"${x.a} ${x.b}\")\n}\n\nfun restore(n: Int) =\n (n-1 downTo 1)\n .filter { n - it > it }\n .map { Fraction(it, n - it) }\n .first()\n\ndata class Fraction(val a:Int, val b:Int)", "lang": "Kotlin", "bug_code_uid": "bf938a1891965e30262217e1957d2806", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "872bfb00c9849ebc910dc60e49d609b7", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9930116472545757, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val n = input.nextInt()\n\n for (a in 1 until n) {\n val b = n - a\n\n if (b <= a) continue\n\n if (gcd(a, b) == 1) {\n output.print(a)\n output.print(\" \")\n output.print(b)\n break\n }\n }\n }\n\n private fun gcd(a: Int, b: Int): Int {\n var a = a\n var b = b\n while (b != 0) {\n val tmp = a % b\n a = b\n b = tmp\n }\n return a\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return next().toInt()\n }\n\n}\n", "lang": "Kotlin", "bug_code_uid": "c95c965f629b42a7f765dcdcfa1cb907", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "0def2ff423cd9c6b791e40b4fe45442d", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5965417867435159, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 4, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "class Fraction {\n fun main(args: Array) {\n val n = readLine()!!.toInt()\n var a = 0\n var b = 0\n\n if ((n % 2) == 0) {\n a = (n / 2) - 1\n b = (n / 2) + 1\n } else {\n a = (n / 2) - 1\n b = n / 2\n }\n\n println(\"$a $b\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "1c2e09037d5fe0e8cad1d4e2b0f23322", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "2df5b62fd7832e9e426df3ff09288a73", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7058823529411765, "equal_cnt": 8, "replace_cnt": 2, "delete_cnt": 5, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "class programkt {\n fun main(args: Array) {\n val n = readLine()!!.toInt()\n val a: Int\n val b: Int\n\n if ((n % 2) == 0) {\n a = (n / 2) - 1\n b = (n / 2) + 1\n } else {\n a = (n / 2) - 1\n b = n / 2\n }\n\n println(\"$a $b\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "cd9f6a9aca3a3a8e40a339c14613409f", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "2df5b62fd7832e9e426df3ff09288a73", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8064, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n val a: Int\n val b: Int\n\n if ((n % 2) == 0) {\n a = (n / 2) - 1\n b = (n / 2) + 1\n } else {\n a = n / 2\n b = (n / 2) + 1\n }\n\n println(\"$a $b\")\n}", "lang": "Kotlin", "bug_code_uid": "3e085cb26c876a7bcacdd9f18271d680", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "2df5b62fd7832e9e426df3ff09288a73", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9674329501915708, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "\nfun main(args: Array) {\n ex1(readLine()?.toInt() ?: return)\n}\n\nfun ex1(n: Int): Pair {\n var a = n / 2\n var b = n - a\n\n if (a == b) {\n a--\n b++\n }\n\n while(a != 1) {\n if (nod(a, b) == 1) return a to b\n a--\n b++\n }\n\n return a to b\n}\n\nfun nod(a: Int, b: Int): Int {\n var tmp: Int\n var valA = a\n var valB = b\n\n while(valB != 0) {\n tmp = valB\n valB = valA % valB\n valA = tmp\n }\n\n return valA\n}\n", "lang": "Kotlin", "bug_code_uid": "e4edfd37e57d7ff7e1773c04368f6669", "src_uid": "0af3515ed98d9d01ce00546333e98e77", "apr_id": "fea54a4780684a710cfe6e54f6e5e450", "difficulty": 800, "tags": ["brute force", "math", "constructive algorithms"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7581818181818182, "equal_cnt": 17, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 12, "fix_ops_cnt": 17, "bug_source_code": "private fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n val nums = readInts()\n var n = nums[0]\n val k = nums[1]\n while (k > 0) {\n if (n % 2 == 0) {\n n /= 10\n } else {\n n--\n }\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "078cac58cd2122bbf920511be5ee7823", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "0e29dc2fb92239b3d0df68eaf6630638", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8392415498763397, "equal_cnt": 22, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 14, "fix_ops_cnt": 21, "bug_source_code": "/**\n * You can edit, run, and share this code. \n * play.kotlinlang.org \n */\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n println(readLine())\n val nums = readInts()\n var n = nums[0]\n val k = nums[1]\n while (k > 0) {\n if (n % 2 == 0) {\n n /= 10\n } else {\n n--\n }\n k--\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "c2faa5ec03be264a24580bdb0731dee6", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "0e29dc2fb92239b3d0df68eaf6630638", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8408903544929925, "equal_cnt": 21, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 14, "fix_ops_cnt": 20, "bug_source_code": "/**\n * You can edit, run, and share this code. \n * play.kotlinlang.org \n */\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { it.toInt() } // list of ints\n\nfun main() {\n println(readLine())\n val nums = readInts()\n var n = nums[0]\n var k = nums[1]\n while (k > 0) {\n if (n % 2 == 0) {\n n /= 10\n } else {\n n--\n }\n k--\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "68c329a23e8fc845180ea382cc21c9c1", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "0e29dc2fb92239b3d0df68eaf6630638", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6233766233766234, "equal_cnt": 12, "replace_cnt": 5, "delete_cnt": 6, "insert_cnt": 2, "fix_ops_cnt": 13, "bug_source_code": " import java.util.*\n import kotlin.sequences.*\n \n fun main() {\n val (orig, count) = readLine().split(\" \").map { it.toInt() }\n generateSequence(orig) {\n if (it % 10 == 0)\n it / 10\n else\n it - 1\n }.drop(count).first().apply(::println)\n }", "lang": "Kotlin", "bug_code_uid": "0dada000b2160176bf204dde12b052b3", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "45c50bcd9f12cb00577c279cba42d0ea", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9507735583684951, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val line = readLine()\n val strs = line.split(' ')\n var num = strs[0].toInt()\n var count = strs[1].toInt()\n \n while(count != 0) {\n --count\n val lastDigit = num % 10\n if(lastDigit == 0) {\n num /= 10\n } else {\n --num\n }\n }\n \n return num\n}", "lang": "Kotlin", "bug_code_uid": "a2f984aa5f5d7ba99b7f07fa7f28e611", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "9d3e05a1dc059a273c5a95ef3256102f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9959514170040485, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n \nfun main() {\n val input = Scanner(System.`in`)\n \n val line = input.nextLine()\n val values = line.split(' ')\n var n = values[0].toLong()\n val k = values[1].toInt()\n \n while (k > 0) {\n if (n % 10 != 0) {\n n--\n } else {\n n /= 10\n }\n k--\n }\n print(n)\n}", "lang": "Kotlin", "bug_code_uid": "8e19cb296a971eb3b691f705524c3462", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "0cd7e6f0d58e64d0313abf513b0c814e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.806966618287373, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*\n \nfun main() {\n val input = Scanner(System.`in`)\n \n var n = input.nextLine().toInt()\n var k = input.nextLine().toInt()\n \n while (k > 0) {\n if (n % 10 != 0) {\n n--\n } else {\n n /= 10\n }\n k--\n }\n print(n)\n}", "lang": "Kotlin", "bug_code_uid": "98b9df26d88efa4bc3c9d63c52c8eaba", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "0cd7e6f0d58e64d0313abf513b0c814e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.056129985228951254, "equal_cnt": 13, "replace_cnt": 10, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 13, "bug_source_code": "#include\nusing namespace std;\nint main()\n{\n long long int n,k;\n cin>>n>>k;\n while(k--)\n {\n if(n%10==0)\n n/=10;\n else\n n-=1;\n\n if(k==0)\n break;\n }\n cout<) {\n pba(args[0].toInt(), args[1].toInt())\n}", "lang": "Kotlin", "bug_code_uid": "c7f7659cdc784534cfb1d93c94ef97aa", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "63b85074c9998cd45c406eec41ba8ad8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6068601583113457, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val val1 = readLine()!!\n val val2 = readLine()!!.toInt()\n\n var result = val1\n\n repeat(val2) {\n result = if(result.last().toString().toInt() == 0) {\n (result.toInt()/10).toString()\n } else {\n (result.toInt() - 1).toString()\n }\n }\n\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "1ac39c2630b2051da7924544e50c9c6e", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "8a6f7ea597437d24888996e462a92ffe", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8033012379642366, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (n, k) = readInts()\n\n var result = n.toString()\n\n repeat(k) {\n result = if(result.last().toString().toInt() == 0) {\n (result.toInt()/10).toString()\n } else {\n (result.toInt() - 1).toString()\n }\n }\n\n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "2da26adc038ae35faf6c00993bfe5be7", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "8a6f7ea597437d24888996e462a92ffe", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6391478029294274, "equal_cnt": 17, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 10, "fix_ops_cnt": 17, "bug_source_code": "import java.util.Scanner\nimport java.io.*\n \nfun main() {\n val input = Scanner(System.`in`)\n val a = input.nextInt();\n var b = input.nextInt();\n repeat(b){\n if(a%10==0){\n a=a/10\n print(a)\n }\n else{\n a=a-1\n print(a)\n }\n }\n \n }", "lang": "Kotlin", "bug_code_uid": "dd171650eca6f8b94e36812a6d16633c", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "d8e4b876147fd6bac07d701b652c14e8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.96415770609319, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package playground\n\nimport java.util.*\n\nfun main() {\n val input = Scanner(System.`in`)\n\n var n = input.nextInt()\n val k = input.nextInt()\n\n repeat(k) {\n if (n % 10 == 0) {\n n /= 10\n }\n else {\n n -= 1\n }\n }\n\n println(n)\n}\n", "lang": "Kotlin", "bug_code_uid": "fee75e7eddf8d211c6d9218c505ece51", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "226031c8979da9f793052e8b4d0c0c0c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9693741677762983, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package kotlin_heroes\n\nfun main(args: Array) {\n val data = readLine()?.split(' ')\n\n if (data?.size == 2) {\n var num = data[0].toInt()\n var minusTimes = data[1].toInt()\n\n while (minusTimes > 0) {\n if (num % 10 == 0)\n num /= 10\n else\n num--\n minusTimes--\n }\n print(num)\n }\n}", "lang": "Kotlin", "bug_code_uid": "477bbe9f17e5381797ec153a4e4e6b7f", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "5d40deb11afccf5a97057a6a057a39be", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9988276670574443, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextLong()\n fun getNod(): Long {\n var i: Long = 2\n while (i * i < n) {\n if (n % i == 0L) {\n return i\n }\n i++\n }\n return n\n }\n\n var t = n\n println(if (n % 2L != 0L) {\n t -= getNod()\n 1\n } else {\n 0\n } + t / 2)\n}", "lang": "Kotlin", "bug_code_uid": "99cdcf051afe621da05b5db95860d381", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "ce75fabcf659cde9b4081eb25b0efe23", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9702734839476813, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n fun getNod(): Int {\n var i = 2\n while (i * i < n) {\n if (n % i == 0) {\n return i\n }\n i++\n }\n return n\n }\n var t = n\n println(if (n % 2 != 0) {\n t -= getNod()\n 1\n } else {\n 0\n } + t / 2)\n}", "lang": "Kotlin", "bug_code_uid": "cb02dda552631b8edf872ec48e0213c2", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "ce75fabcf659cde9b4081eb25b0efe23", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.38237885462555066, "equal_cnt": 5, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "fun main(args: Array) {\n solve()\n}\n\nprivate fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\nprivate fun solve() {\n var (n) = read().map(String::toLong)\n var step = 0;\n\n while (n != 0L) {\n if (isPrime(n)) {\n step++\n n -= n\n continue\n }\n for (num in 2..n) {\n if (isPrime(num)) {\n step++\n n -= num\n break\n }\n }\n }\n\n println(step)\n}\n\nprivate fun isPrime(n: Long): Boolean {\n var i = 2\n while (i * i <= n) {\n if (n % i == 0L)\n return false\n i++\n }\n return true\n}", "lang": "Kotlin", "bug_code_uid": "630399d7896f9dab354291d5b5e2e759", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "e680f1d1446bfabad6c46154b4324b50", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.4402390438247012, "equal_cnt": 6, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array) {\n solve()\n}\n\nprivate fun read(delimit: Char = ' ') = readLine()!!.split(delimit)\nprivate fun solve() {\n var (n) = read().map(String::toLong)\n var step = 0L\n\n if(isPrime(n)){\n step = 1\n }else if(n %2 == 0L){\n step = n/2\n }else{\n n--\n step++\n step += n/2\n }\n\n println(step)\n}\n\nprivate fun isPrime(n: Long): Boolean {\n var i = 2\n while (i * i <= n) {\n if (n % i == 0L)\n return false\n i++\n }\n return true\n}", "lang": "Kotlin", "bug_code_uid": "1f852b4b53470279404cf69682be63cc", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "e680f1d1446bfabad6c46154b4324b50", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.16901408450704225, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n fun readLong() = readLine()!!.toLong()\n\n val n = readLong()\n val notPrimes = mutableSetOf()\n\n for (num in 2L..n) {\n if (num !in notPrimes) {\n if (n % num == 0L) return print(n / num)\n var notPrime = num + num\n while (notPrime <= n) {\n notPrimes.add(notPrime)\n notPrime += num\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "f0466ce1484c5d36735bc6f6c7b4ce4e", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "1fedfc06ccba83393ce181ad0e246993", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.1646090534979424, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "fun main() {\n fun readLong() = readLine()!!.toLong()\n\n val n = readLong()\n val notPrimes = mutableSetOf()\n\n if (n % 2 == 0L) return print(n / 2L)\n for (num in 3L..n step 2) {\n if (num !in notPrimes) {\n if (n % num == 0L) return print(n / num)\n var notPrime = num + num\n while (notPrime <= n) {\n notPrimes.add(notPrime)\n notPrime += num\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "a9e966683eb3f1a6dbeb43dce0072f29", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "1fedfc06ccba83393ce181ad0e246993", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.700990099009901, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.sqrt\n\nfun main() {\n fun readLong() = readLine()!!.toLong()\n\n val n = readLong()\n val endLoop = sqrt(n.toDouble()).toLong()\n for (i in 1L..endLoop)\n if (n % i == 0L)\n return print(1 + (n - i) / 2)\n}", "lang": "Kotlin", "bug_code_uid": "a013b7f1d8710d4e080c20c07c84996b", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "1fedfc06ccba83393ce181ad0e246993", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8076923076923077, "equal_cnt": 8, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 6, "fix_ops_cnt": 8, "bug_source_code": "import java.io.File\nimport java.util.*\n\nfun readInt(): Int {\n return sc.nextInt()\n}\n\nfun readInts(): IntArray {\n var line = sc.nextLine()\n if (line.trim().isEmpty()) {\n line = sc.nextLine()\n }\n return line.split(\" \").map { it.toInt() }.toIntArray()\n}\n\nfun readStr(): String {\n var line = sc.nextLine()\n if (line.trim().isEmpty()) {\n line = sc.nextLine()\n }\n return line;\n}\n\nvar debug = false\nvar sc = Scanner(System.`in`)\nfun main(args: Array) {\n val input = File(\"input.in\")\n if (input.exists()) {\n debug = true\n sc = Scanner(input)\n }\n var testCount = 1\n if (debug) {\n testCount = readInt()\n }\n\n for (t in 1..testCount) {\n val n = sc.nextLong()\n if (n % 2 == 0L) {\n println(n / 2)\n } else {\n var x = 3\n while (n % x != 0L) {\n x++\n }\n println((n - x) / 2 + 1)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "85db76002f9167762083ae1f66385c74", "src_uid": "a1e80ddd97026835a84f91bac8eb21e6", "apr_id": "b8f1e84fd3749d7b3cfbfbff68163dd5", "difficulty": 1200, "tags": ["number theory", "math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9990281827016521, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.min\n\nfun main() {\n val input = readLine()!!.split(\" \").map(Integer::parseInt)\n val choose = input[0]\n\n val puzzles = readLine()!!.split(\" \")\n .map(Integer::parseInt)\n .sorted()\n .toMutableList()\n\n var minDiff = Integer.MAX_VALUE\n while (puzzles.size > choose) {\n val window = puzzles.take(choose)\n val diff = (window.max() ?: 0) - (window.min() ?: 0)\n minDiff = min(minDiff, diff)\n puzzles.removeAt(0)\n }\n\n println(minDiff)\n}", "lang": "Kotlin", "bug_code_uid": "83810ba659a209a065b20827dda7398f", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "3efa659da2c26a1ff8999920d1b23b8d", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9898403483309144, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var (n, m) = readLine()!!.split(\" \").map { it.toInt() }\n var pazles = readLine()!!.split(\" \").map { it.toInt() }.sorted()\n var minDiff = Int.MAX_VALUE\n for (i in 0 until m - n) {\n var diff = pazles[i + n - 1] - pazles[i]\n if(minDiff > diff) {\n minDiff = diff\n }\n }\n print(minDiff)\n}", "lang": "Kotlin", "bug_code_uid": "c61f1c98cead77b8403a1aa2959c1dfd", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "847eabde9e8541eb8453879e23ecaaa0", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9879253567508233, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\nimport kotlin.math.min\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (n, m) = br.readLine().split(\" \").map { it.toInt() }\n val f = br.readLine().split(\" \").map { it.toInt() }.sorted()\n var ans = 10000\n var i = 0\n var j = i + n - 1\n while (j < n){\n ans = min(ans, f[j] - f[i])\n i++\n j += i + n - 1\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "1b57695e943535c7b37dfb44e3ec37cd", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "750ac8b5a9f3288c74ed39e73152e342", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6537102473498233, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "fun main(){\n val a = readLine()!!.split(\" \").map { it.toInt() }\n val b = readLine()!!.split(\" \").map{it.toInt()}.sorted()\n var min = b[a[0]-1] - b[0]\n for (i in a[1]-1 downTo 1){\n if (a[i]-a[i-1] < min) min = a[i]-a[i-1]\n }\n if (a[1]-a[0] < min) min = a[1]-a[0]\n print(min)\n}", "lang": "Kotlin", "bug_code_uid": "da74d2d59106fe423549b34b452d1349", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "e1894030dd6c6bb5a20777fa69cde4d5", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5393258426966292, "equal_cnt": 12, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 12, "bug_source_code": "fun main(args:Array){\n var input = readLine()!!.split(' ')\n\n val chaildCount = input[0].toInt()\n val pizzleCount = input[1].toInt()\n\n input = readLine()!!.split(' ')\n\n val partsCounts = mutableListOf()\n\n input.forEach {\n partsCounts.add(it.toInt())\n }\n partsCounts.sort()\n\n if ( partsCounts[chaildCount-1] - partsCounts[0] < partsCounts[partsCounts.lastIndex] - partsCounts[partsCounts.lastIndex - chaildCount-1]){\n print(partsCounts[chaildCount-1] - partsCounts[0])\n } else {\n print(partsCounts[partsCounts.lastIndex] - partsCounts[partsCounts.lastIndex - chaildCount-1])\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "bf1e6ce5c73739a938a6db0cb514b56b", "src_uid": "7830aabb0663e645d54004063746e47f", "apr_id": "c7dfedd7c6e925fefaddd202f4a693fb", "difficulty": 900, "tags": ["greedy"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9693633317376735, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.math.min\n\nfun main(args: Array) {\n solve(System.`in`, System.out)\n}\n\nfun solve(input: InputStream, output: OutputStream) {\n val reader = InputReader(BufferedInputStream(input))\n val writer = PrintWriter(BufferedOutputStream(output))\n\n solve(reader, writer)\n writer.close()\n}\n\nfun solve(reader: InputReader, writer: PrintWriter) {\n val n = reader.nextInt()\n val d = reader.nextInt()\n\n val a = mutableMapOf().toSortedMap()\n for (i in 0 until n) {\n val x = reader.nextInt()\n a.put(x, a.getOrDefault(x, 0) + 1)\n }\n\n if (a.size == 1) {\n writer.print(\"0\")\n return\n }\n\n var ans = n\n var v = a.map { it.key }\n for (i in 0 until v.lastIndex) {\n val c = a.filter { it.key < v[i] || it.key > v[i] + d }.map { it.value }.sum()\n ans = min(ans, c)\n }\n\n writer.print(ans)\n}\n\nclass InputReader(stream: InputStream) {\n val reader: BufferedReader\n var tokenizer: StringTokenizer? = null\n\n init {\n reader = BufferedReader(InputStreamReader(stream), 32768)\n tokenizer = null\n }\n\n operator fun next(): String {\n while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n\n fun nextArrayInt(count: Int): IntArray {\n return nextArrayInt(0, count)\n }\n\n fun nextArrayInt(start: Int, count: Int): IntArray {\n val a = IntArray(start + count)\n for (i in start until start + count) {\n a[i] = nextInt()\n }\n return a\n }\n\n fun nextArrayLong(count: Int): LongArray {\n val a = LongArray(count)\n for (i in 0 until count) {\n a[i] = nextLong()\n }\n return a\n }\n}\n\n", "lang": "Kotlin", "bug_code_uid": "3b1da72cd81b259ccf93555ceeaf0c32", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "apr_id": "0abbb486c4330ff4128dce14c3e7e865", "difficulty": 1200, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8888888888888888, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main() {\n fun readInts() = readLine()!!.split(\" \").map(String::toInt)\n\n fun List.bsRight(value: Int): Int {\n var left = 0\n var right = this.lastIndex\n var pivot: Int\n while (left <= right) {\n pivot = (left + right) / 2\n if (this[pivot] > value) right = pivot - 1 else left = pivot + 1\n }\n return left - 1\n }\n\n val (numPoints, diameter) = readInts()\n val arr = readInts().sorted()\n val stop = arr.last() - diameter\n if (stop <= arr[0]) {\n print(0)\n return\n }\n var result = Integer.MAX_VALUE\n var left = -1\n var right: Int\n while (++left < numPoints && arr[left] <= stop) {\n right = arr.bsRight(arr[left] + diameter)\n val candidate = numPoints - right + left - 1\n if (candidate < result) result = candidate\n }\n print(result)\n}", "lang": "Kotlin", "bug_code_uid": "ace5b92b811fa53caa32fbf6f460a3ed", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "apr_id": "fcd5bf6d0f086f9549d736a31b74fd95", "difficulty": 1200, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9206106870229007, "equal_cnt": 9, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 8, "bug_source_code": "fun main(args:Array) {\n val (m,n) = readLine()!!.split(\" \").map(String::toInt)\n\n val target = readLine()!!.split(\" \").map(String::toInt).sorted()\n\n val ansbox = mutableListOf()\n \n for( start in (0..target.size-1) ) {\n for( end in (start..target.size-1) ) {\n val delta = target[end] - target[start]\n if( n == delta ) {\n val ans = target.size - (end-start + 1)\n ansbox.add(ans)\n }\n }\n }\n if(ansbox.min() == null)\n if( m <= n ) \n println(0)\n else if( n >= 1 ) \n println(target.size - 1)\n else\n println(0)\n else\n println(ansbox.min()!!)\n}", "lang": "Kotlin", "bug_code_uid": "d58f879b6eec4a8368cae035a96b2ab3", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "apr_id": "e6a1cfe595de3028eebfe1e47b6f6cf0", "difficulty": 1200, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9388029589778076, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "package ru.ak.tochki\n\nfun main(args: Array){\n\tval string1: String = readLine().toString()\n\tvar mnozh: List = readLine().toString().split(\" \").map{x -> x.toInt()}\n\tval N = string1.split(\" \")[0].toInt()\n\tval expD = string1.split(\" \")[1].toInt()\n\tmnozh = mnozh.sorted()\n\tval D = mnozh.last() - mnozh.first()\n\tif (D <= expD){\n\t\tprintln(0)\n\t}else{\n\t\t//println(\"Expected: $expD, real: $D\")\n\t\tvar realD: Int = 101\n\t\tvar minDropped = 101\n\t\tvar dropped = 101\n\t\tfor (i in 0..N-2){\n\t\t\tfor (j in i+1..N-1){\n\t\t\t\trealD = mnozh[j]-mnozh[i]\n\t\t\t\tdropped = N - (j - i + 1)\n\t\t\t\tif((realD <= expD) and (dropped <= minDropped)){\n\t\t\t\t\tminDropped = dropped\n\t\t\t\t\t//println(\"i: $i, j: $j, Distance: $realD, dropped: $dropped\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintln(minDropped)\t\t\n\t}\n}\n", "lang": "Kotlin", "bug_code_uid": "61858a4200ab0e574f2c90e765074254", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "apr_id": "b6227a059e097d55e6eb8589cb15938a", "difficulty": 1200, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9972565157750343, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array){\n\tval string1: String = readLine().toString()\n\tvar mnozh: List = readLine().toString().split(\" \").map{x -> x.toInt()}\n\tval N = string1.split(\" \")[0].toInt()\n\tval expD = string1.split(\" \")[1].toInt()\n\tmnozh = mnozh.sorted()\n\tval D = mnozh.last() - mnozh.first()\n\tif (D <= expD){\n\t\tprintln(0)\n\t}else{\n\t\t//println(\"Expected: $expD, real: $D\")\n\t\tvar realD: Int\n\t\tvar minDropped = 101\n\t\tvar dropped: Int\n\t\tfor (i in 0..N-2){\n\t\t\tfor (j in i+1..N-1){\n\t\t\t\trealD = mnozh[j]-mnozh[i]\n\t\t\t\tdropped = N - (j - i + 1)\n\t\t\t\tif((realD <= expD) and (dropped <= minDropped)){\n\t\t\t\t\tminDropped = dropped\n\t\t\t\t\t//println(\"i: $i, j: $j, Distance: $realD, dropped: $dropped\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintln(minDropped)\t\t\n\t}\n}\n", "lang": "Kotlin", "bug_code_uid": "bc50d20477ae0eeec7903ad013db790f", "src_uid": "6bcb324c072f796f4d50bafea5f624b2", "apr_id": "b6227a059e097d55e6eb8589cb15938a", "difficulty": 1200, "tags": ["greedy", "brute force", "sortings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8947895791583166, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.util.*\nimport kotlin.math.max\n\nfun main(args : Array) {\n Thread { run() }.start()\n}\n\nfun run() {\n\n val scanner = Scanner(System.`in`)\n val n = scanner.nextLong()\n var res = n\n var emaxx = 0L\n for (i in n downTo 1)\n emaxx = max(emaxx, nok(res, i))\n res = emaxx\n for (i in n downTo 1)\n emaxx = max(emaxx, nok(res, i))\n println(emaxx)\n\n}\n\nclass Scanner(s: InputStream) {\n var st: StringTokenizer? = null\n var br: BufferedReader = BufferedReader(InputStreamReader(s))\n @Throws(IOException::class)\n operator fun next(): String {\n while (st == null || !st!!.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st!!.nextToken()\n }\n @Throws(IOException::class)\n fun nextInt(): Int {\n return Integer.parseInt(next())\n }\n @Throws(IOException::class)\n fun nextLong(): Long {\n return java.lang.Long.parseLong(next())\n }\n @Throws(IOException::class)\n fun nextLine(): String {\n return br.readLine()\n }\n @Throws(IOException::class)\n fun nextDouble(): Double {\n return java.lang.Double.parseDouble(next())\n }\n @Throws(IOException::class)\n fun ready(): Boolean {\n return br.ready()\n }\n}\nfun IntArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun LongArray.print() {\n println(Arrays.toString(this))\n}\nfun Array.print() {\n for (i in this)\n i.print()\n}\nfun BooleanArray.print() {\n println(Arrays.toString(this))\n}\nfun nod(a: Long, b: Long): Long {\n var a1 = a\n var b1 = b\n while (a1 != 0L && b1 != 0L) {\n if (a1 < b1)\n b1 %= a1\n else\n a1 %= b1\n }\n return a1 + b1\n}\nfun nok(a: Long, b: Long): Long = a * b / nod(a, b)\n", "lang": "Kotlin", "bug_code_uid": "3d448d34f6158a6b4b9cb90613767b3c", "src_uid": "25e5afcdf246ee35c9cef2fcbdd4566e", "apr_id": "db18034db597989454dca7fa9a1ae59e", "difficulty": 1600, "tags": ["number theory"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8381877022653722, "equal_cnt": 9, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 5, "fix_ops_cnt": 8, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun binExp(a: Int, n: Int): Int{\n tailrec fun go(a: Int, n: Int, a1: Int): Int{\n if (n == 0) return 1\n if (n == 1) return a * a1\n\n if (n % 2 == 0) return go(a * a, n/2, a1)\n else return go(a * a, (n - 1)/2, a * a1)\n }\n return go(a, n, 1)\n}\n\nfun main(args: Array) {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val n = br.readLine().toInt()\n val x1 = 4*3* binExp(4, n - 3)*2\n val x2 = if (n > 3) 4*3*3* binExp(4, n - 4)*(n - 3) else 0\n println(x1 + x2)\n}", "lang": "Kotlin", "bug_code_uid": "b7b89e3eb4dc998f4ad11babae038835", "src_uid": "3b02cbb38d0b4ddc1a6467f7647d53a9", "apr_id": "12da4447aca5c8a1672d05874f8d97ab", "difficulty": 1700, "tags": ["math", "combinatorics"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8028169014084507, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 10, "bug_source_code": "import java.util.*\nimport kotlin.math.floor\n\nfun main() {\n val (x, y) = readLine()!!.split(\" \").map { it.toInt() }\n val q = LinkedList()\n for (j in 1..3) {\n q.add(x)\n }\n var answer = 0\n while (!q.all { it == y }) {\n answer++\n q.remove()\n q.add(maxOf(y, floor(q.last().toDouble() / 1.61803398875).toInt() + 1))\n }\n println(answer)\n}", "lang": "Kotlin", "bug_code_uid": "b40f947efcfc8068998dd0bdb4b13fdc", "src_uid": "8edf64f5838b19f9a8b19a14977f5615", "apr_id": "4039d4dc73265552cc2658818dc53063", "difficulty": 1600, "tags": ["math", "greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9839080459770115, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val n = sc.nextInt()\n\n val x = solve(n)\n println(x.size)\n x.forEach { println(it) }\n\n}\n\nfun solve(n: Int) = (1..200)\n .filter {n - it > 0 && (n - it).digits() == it }\n .map { n - it }\n\nfun Int.digits(): Int {\n var sum = 0\n var x = this\n while (x > 0) {\n sum += x % 10\n x /= 10\n }\n return sum\n}\n", "lang": "Kotlin", "bug_code_uid": "94f55bd1fea0562c006a726176819359", "src_uid": "ae20ae2a16273a0d379932d6e973f878", "apr_id": "5812d26020ed6f3f68b920032df9ff67", "difficulty": 1200, "tags": ["math", "brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9061140956766437, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.sqrt\n\nfun main() {\n val n = readLong()\n\n val sqrt = n.sqrtFloor()\n\n var ans = 1L\n\n for(p in primeSieve(sqrt)) {\n if(n % p == 0L) ans *= p\n }\n\n println(ans)\n}\n\nfun Long.sqrtFloor() = sqrt(toDouble()).toLong()\n\nfun primeSieve(upperLimit: Long): Sequence = sequence {\n yield(2L)\n val source = (3..upperLimit step 2).toMutableSet()\n\n while(source.isNotEmpty()) {\n val prime = source.first()\n yield(prime)\n source.remove(prime)\n source.removeAll(prime * prime .. upperLimit step prime)\n }\n}\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readStringSeq() = readLn().splitToSequence(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readIntSeq() = readStringSeq().map { it.toInt() }\nfun readIntArray(size: Int) = readIntSeq().iterator().let { i -> IntArray(size) { i.next() } }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readDoubleSeq() = readStringSeq().map { it.toDouble() }\nfun readDoubleArray(size: Int) = readDoubleSeq().iterator().let { i -> DoubleArray(size) { i.next() } }\nfun readLongs() = readStrings().map { it.toLong() }\nfun readLongSeq() = readStringSeq().map { it.toLong() }\nfun readLongArray(size: Int) = readLongSeq().iterator().let { i -> LongArray(size) { i.next() } }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println() { sb.append('\\n') }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit) { Output().apply(block).nowPrint() }", "lang": "Kotlin", "bug_code_uid": "d728ad2cfd3b95fbea85ce164dff01a8", "src_uid": "6d0da975fa0961acfdbe75f2f29aeb92", "apr_id": "fbebf4e17828a88357a180028db717ae", "difficulty": 1300, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9804772234273319, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.abs\n\nfun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n var (a, b) = r.readLine()!!.split(\" \").map { it.toLong() }\n if (abs(a-b)<=1) println(\"YES\") else println(\"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "7e7ccd9d2323f4f57884bb067c3ff5c7", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "cbebfb08e81a9c5f32b831b4da3a7bcd", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8549618320610687, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val even = reader.nextInt()\n val odd = reader.nextInt()\n if (Math.abs(even - odd) > 1) println(\"NO\") else println(\"YES\")\n}\n", "lang": "Kotlin", "bug_code_uid": "cfef29be9d00ed84a195cd5fdb442402", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "f08ff3071876751039298deac619f8b1", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7678767876787679, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "package codeforces.round394\n\nimport java.io.PrintWriter\nimport java.util.*\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val `in` = Scanner(inputStream)\n val out = PrintWriter(outputStream)\n solve(`in`, out)\n out.close()\n}\n\nprivate fun solve(scanner: Scanner, out: PrintWriter) {\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "8355e4305ec62336cdd79e7ae1f9ebd3", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "363c866468c03572832162b7200c0ca5", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8587896253602305, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun main(vararg args: String) {\n val (a, b) = readLine()!!.split(' ').map(String::toInt)\n println(if (Math.abs(a - b) <= 1 && !(a in 0..1 && b == 0)) \"YES\" else \"NO\")\n}\n", "lang": "Kotlin", "bug_code_uid": "224edf37594c2ed89c7d01e90c8f4081", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "00cee8348facb6de0bf76788f9e96629", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9951690821256038, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\nimport java.io.*\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n val a = sc.nextInt()\n val b = sc.nextInt()\n for (i in 1..200) {\n for (j in i..200) {\n var even = 0\n var odd = 0\n for (k in i..j) {\n if (k mod 2 == 0) even++ else odd++\n }\n if (even == a && odd == b) {\n println(\"YES\")\n return;\n }\n }\n }\n println(\"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "4f4066f8e66255000e3201bc7e917db5", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "5cad1231b6ea4d533dba7e51c4a83973", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8583690987124464, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\n\nfun main() {\n var (a, b) = readLine()!!.split(' ').map { it.toInt() }\n var ans = abs(a-b)\n if (ans<=1){\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "1dfe097ade85e84673187a1cfb2c620d", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "15b023c03dc2bf7e29568f0e4e884267", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9098360655737705, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import kotlin.math.abs\n\nfun main() {\n var (a, b) = readLine()!!.split(' ').map { it.toInt() }\n if (a==b && a==0)\n var ans = abs(a-b)\n if (ans<=1){\n println(\"YES\")\n }else{\n println(\"NO\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "77bb16fa010449780167e2e4eebac22c", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "15b023c03dc2bf7e29568f0e4e884267", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8612099644128114, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val (a, b) = readLine()!!.split(\" \").map(String::toInt)\n print(if (a - b in -1..1) \"YES\" else \"NO\")\n}", "lang": "Kotlin", "bug_code_uid": "ce7cfc1fbc615abbd3fa94a8b901ebbe", "src_uid": "ec5e3b3f5ee6a13eaf01b9a9a66ff037", "apr_id": "9b4d200e7b651f11e80bbab8f93956ed", "difficulty": 1000, "tags": ["brute force", "math", "constructive algorithms", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9427792915531336, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n var n = readLine()!!.toInt()\n var cnt = 0\n var add = 0\n while (n > 0) {\n add++\n cnt += add\n n -= cnt\n }\n println(add-1)\n}", "lang": "Kotlin", "bug_code_uid": "592c69a5652c51c13ac32221c2778848", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "apr_id": "75c9bfa525289a7e552cf103e37244d1", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.985, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n\n (0 .. n).forEach {\n if (it * (it + 1) * (it + 2)/6 > n){\n println(it - 1)\n return\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "c73538c1366b9e22295b7b2a3362e2e5", "src_uid": "873a12edffc57a127fdfb1c65d43bdb0", "apr_id": "bd33e397e452ee6ee6ec625bb9bb15c6", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.0169971671388102, "equal_cnt": 7, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "\n\n \n \n \n \n \n \n \n \n \n", "lang": "Kotlin", "bug_code_uid": "bf34afd665b4dfe30f37215e5d53f9dd", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "7dd7153b1a0b155aa51535bb3501031f", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9633113828786454, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readInts() = readLn().split(\" \").map { it.toInt() }.toMutableList()\n\nfun main() {\n val arr = readLn().toCharArray()\n var i = 0\n var isDang = false\n\n while (i < arr.size) {\n val sign = arr[i]\n var acc = 1\n\n while (arr[i++] == sign) {\n acc += 1\n }\n\n if (acc >= 7) {\n isDang = true\n break\n }\n }\n\n if (isDang) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "58284fb9f94c219279aaf0b9c3bf8f41", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "ad72dbda1210e703db7ff7608b06bb22", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9823584029712163, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readInts() = readLn().split(\" \").map { it.toInt() }.toMutableList()\n\nfun main() {\n val arr = readLn().toCharArray()\n var i = 0\n var isDang = false\n\n while (i < arr.size) {\n val sign = arr[i]\n var acc = 0\n\n while (i < arr.size && arr[i] == sign) {\n acc += 1\n }\n\n if (acc >= 7) {\n isDang = true\n break\n }\n }\n\n if (isDang) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "74890e5a216d9e3c6d556bf9b5fc4b1e", "src_uid": "ed9a763362abc6ed40356731f1036b38", "apr_id": "ad72dbda1210e703db7ff7608b06bb22", "difficulty": 900, "tags": ["strings", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9903846153846154, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main()\n{\n val teams = readLine()!!.toInt()\n var homes = ArrayList()\n var guest = mutableListOf()\n repeat(teams)\n {\n val(a, b) = readLine()!!.split(\" \").map { it.toInt() }\n homes.add(a)\n guest.add(b)\n }\n var answer = 0\n for (g in guest)\n {CFR_268 \n for (a in homes)\n {\n if(a == g){ answer ++}\n }\n }\n println(answer)\n\n}", "lang": "Kotlin", "bug_code_uid": "35b76ff19b3a5d37dcba65a9f14de802", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "apr_id": "2e6a1f47f222fc2f665b6ec452b5488d", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9662569832402235, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import org.omg.PortableInterceptor.INACTIVE\nimport java.io.PrintWriter\nimport java.util.StringTokenizer\nimport kotlin.math.cos\nimport kotlin.math.pow\nimport kotlin.math.sqrt\nimport kotlin.test.currentStackTrace\n\n//private val INPUT = File(\"input.txt\").inputStream()\n//private val OUTPUT = File(\"output.txt\").outputStream()\nprivate val INPUT = System.`in`\nprivate val OUTPUT = System.out\n\nprivate val bufferedReader = INPUT.bufferedReader()\nprivate val outputWriter = PrintWriter(OUTPUT, false)\nprivate fun readLn() = bufferedReader.readLine()!!\n\nprivate fun readList() = readLn().split(' ')\nprivate var tokenizer = StringTokenizer(\"\")\nprivate fun read(): String {\n while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLn(), \" \")\n return tokenizer.nextToken()\n}\n\nprivate fun readInt() = read().toInt()\nprivate fun readLong() = read().toLong()\nprivate fun readDouble() = read().toDouble()\n\nprivate fun readIntList() = readList().map { it.toInt() }\nprivate fun readLongList() = readList().map { it.toLong() }\nprivate fun readDoubleList() = readList().map { it.toDouble() }\n\nprivate fun readIntArray(n: Int = 0) =\n if (n == 0) readList().run { IntArray(size) { get(it).toInt() } } else IntArray(n) { readInt() }\n\nprivate fun readLongArray(n: Int = 0) =\n if (n == 0) readList().run { LongArray(size) { get(it).toLong() } } else LongArray(n) { readLong() }\n\nprivate fun readDoubleArray(n: Int = 0) =\n if (n == 0) readList().run { DoubleArray(size) { get(it).toDouble() } } else DoubleArray(n) { readDouble() }\n\n\nprivate fun Int.modPositive(other: Int): Int = if (this % other < 0) ((this % other) + other) else (this % other)\n\n\nprivate class `CF268-D2-A` {\n fun solveTestCase(): Int {\n var result = 0\n val n = readInt()\n val costume = mutableListOf>()\n repeat(n) {\n costume.add(Pair(readInt(), readInt()))\n }\n \n for(i in 0 until n) {\n for (j in i+1 until n) {\n if (costume[i].first == costume[j].second) result++\n if (costume[i].second == costume[j].first) result++\n }\n }\n\n return result\n }\n}\n\nfun main(args: Array) {\n\n outputWriter.println(\n `CF268-D2-A`()\n .solveTestCase()\n )\n\n outputWriter.flush()\n}", "lang": "Kotlin", "bug_code_uid": "bc1c219adfcea1bcf724bc97e4decb06", "src_uid": "745f81dcb4f23254bf6602f9f389771b", "apr_id": "513be4954b02debac1b49cd65bc8d90f", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7955752212389381, "equal_cnt": 19, "replace_cnt": 15, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 18, "bug_source_code": "import java.io.PrintWriter\n\n\nfun main() {\n io.apply {\n\n val base = int\n val num = str()\n\n var pow = 1L\n var cur = 0L\n\n var ans = 0L\n var b = 1L\n\n for (c in num.reversed()) {\n var x = c - '0'\n if (cur + x * pow >= base || pow >= base) {\n ans += cur * b\n b *= base\n cur = x.toLong()\n pow = 10\n } else {\n cur += x * pow\n pow *= 10\n }\n }\n ans += cur * b\n cout .. ans .. nl\n\n\n\n }.cout.flush()\n}\n\n// @formatter:off\nprivate val io = object {\n private val `in` = System.`in`\n private fun ll(): Long {\n var x: Int; var q = false; var n = 0L; do x = `in`.read() while (x < 33); if (x == 45) { q = true; x = `in`.read() }\n do { n = n * 10 - x + 48; x = `in`.read() } while (x > 32); return if (q) n else -n\n }\n val int get() = ll().toInt(); val long get() = ll()\n fun ints(n: Int = int): IntArray { return IntArray(n) { int } }\n fun ints1(n: Int = int): IntArray { return IntArray(n) { int - 1 } }\n val cout = PrintWriter(System.out); val nl = \"\\n\"\n private var buf = CharArray(32)\n private var bufSize = 32\n fun str(expect: Int = 32): String {\n var ix = 0\n var x: Int\n if (bufSize < expect)\n buf = CharArray(expect)\n do x = `in`.read() while (x < 33)\n do {\n if (ix == bufSize) { bufSize *= 2; buf = buf.copyOf(bufSize) }\n buf[ix++] = x.toChar()\n x = `in`.read()\n } while (x > 32)\n return java.lang.String.copyValueOf(buf, 0, ix)\n }\n operator fun PrintWriter.rangeTo(a: Int): PrintWriter { print(a); print(\" \"); return this }\n operator fun PrintWriter.rangeTo(a: Long): PrintWriter { print(a); print(\" \"); return this }\n operator fun PrintWriter.rangeTo(a: IntArray): PrintWriter { a.forEach { print(it); print(\" \") }; return this }\n operator fun PrintWriter.rangeTo(a: String): PrintWriter { write(a); return this }\n} // @formatter:on\n\n/* ----------- */\n\n", "lang": "Kotlin", "bug_code_uid": "18f9dbec73548d811af4df0d663332ae", "src_uid": "be66399c558c96566a6bb0a63d2503e5", "apr_id": "5ef9a41378d9805a52f51c19324baddb", "difficulty": 2000, "tags": ["dp", "greedy", "math", "constructive algorithms", "strings"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5727611940298507, "equal_cnt": 24, "replace_cnt": 9, "delete_cnt": 0, "insert_cnt": 15, "fix_ops_cnt": 24, "bug_source_code": "\nfun main(args : Array) {\n val s = readLine()!!\n var list: MutableList = mutableListOf()\n var n = s.length-1\n var a = 0\n var c = 0\n while(a!=s.length){\n list.add(s[n-c])\n list.add(s[c])\n c++\n a++\n }\n for (i in s.length - 1 downTo 0) {\n print(list[i])\n }\n\n\n\n\n}\n", "lang": "Kotlin", "bug_code_uid": "586764b05b7f6f6fed9c4036ea79585f", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "apr_id": "d725d21b2f20f14dacab93d070881511", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.7211055276381909, "equal_cnt": 7, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n val t = readLine()!!\n val sb = StringBuilder()\n var right = t.lastIndex\n var left = 0\n while (left <= right) {\n sb.append(t[right])\n if (left < right) sb.append(t[left])\n right--\n left++\n }\n print(sb.reversed().toString())\n}", "lang": "Kotlin", "bug_code_uid": "2ffe978dc489ee14d98a9fc2eeea89fd", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "apr_id": "9d4b5f24e22ae87e44b8e97eca630694", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6695187165775401, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array)\n{\n\tvar str= readLine()!!\n\tvar c=0\n\tvar new: String=\"\"\n\tfor(i in 1..str.length)\n\t\t{\n\t\t\tif(c%2==0)\n\t\t\t{\n\t\t\t\tnew=new+str[str.length-1]\n\t\t\t\tstr= str.substring(0,str.length-1)\n\t\t\t\tc++\n\t\t\t}\n\t else\n\t\t\t{\n\t\t\t\tnew=new+str[0]\n\t\t\t\tstr= str.substring(1,str.length)\n\t\t\t\tc++ \n\t\t\t}\n\t\t}\n\n\tprintln(new.reversed())\n \n}", "lang": "Kotlin", "bug_code_uid": "ec8e2ac22b91c21fd10c4ecac2a76c2f", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "apr_id": "538d4aaba4a74840f6aed56026ba2bdb", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.998017839444995, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.io.PrintWriter\nimport java.lang.StringBuilder\nimport java.util.*\nimport kotlin.Comparator\n\nfun main(args: Array) {\n val sc = FastScanner(System.`in`)\n val pw = PrintWriter(System.out)\n val s = sc.next()\n var t = false\n val mid = (0 + s.length - 1) / 2\n var ans = \"${s[mid]}\"\n var l = mid\n var r = mid\n while (l != 0 && r != s.length - 1) {\n if (t) {\n l--\n ans += s[l]\n } else {\n r++\n ans += s[r]\n }\n t = !t\n }\n pw.println(ans)\n pw.close()\n}\n\ninterface Sum\nclass FastScanner(s: InputStream) {\n val br = BufferedReader(InputStreamReader(s))\n var st = StringTokenizer(\"\")\n fun next(): String {\n if (!st.hasMoreTokens())\n st = StringTokenizer(br.readLine())\n return st.nextToken()\n }\n\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n}", "lang": "Kotlin", "bug_code_uid": "29de78d7278123d514aed90f43b254af", "src_uid": "992ae43e66f1808f19c86b1def1f6b41", "apr_id": "fa7a827d9ec51933fa08cd64eb61bbfc", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.965389369592089, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\n\n\nfun main(args: Array) {\n val n = readLine() ?: \"\"\n val str = readLine() ?: \"\"\n var result = \"\"\n val chars = str.toCharArray()\n var i = 0\n while (i < chars.size) {\n var sum = 0\n var zero = \"\"\n for (j in i until chars.size) {\n if (chars[j] == '1') {\n sum++\n i++\n }\n else {\n i = j + 1\n break\n }\n }\n for (j in i until chars.size -1) {\n if (chars[j] == '0') {\n zero += \"0\"\n i++\n }\n else {\n i = j\n break\n }\n }\n result += sum\n result += zero\n\n }\n println(result)\n\n}\n", "lang": "Kotlin", "bug_code_uid": "44e20622c6b7f3c9121df497888a9fa6", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "apr_id": "8a73aa2394279bb055de8365fd4113bf", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9801136363636364, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n readLine()\n val sol = StringBuilder()\n var sum = 0\n for (c in readLine()!!)\n if (c == '0') {\n sol.append(sum)\n sum = 0\n } else {\n if (sum == 9) {\n sol.append(9)\n sum = 1\n } else sum++\n }\n if (sum != 0) sol.append(sum)\n print(sol)\n}\n", "lang": "Kotlin", "bug_code_uid": "ad66fbc7f585771177e9d8e4ca15056f", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa", "apr_id": "72ff1e36306257f4588244e509c72385", "difficulty": 1100, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.6585034013605442, "equal_cnt": 13, "replace_cnt": 7, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 13, "bug_source_code": "\npackage main\n\nimport java.util.Scanner\n\nfun main(args : Array) {\n val scanner = Scanner(System.`in`)\n var n = scanner.nextInt()\n var s = scanner.nextLine()\n var c: Int = 0\n var z: Int = 0\n while (c) {\n val scanner = Scanner(System.`in`)\n var n = scanner.nextInt()\n var s = scanner.nextLine()\n var c: Int = 0\n var z: Int = 0\n while (c= 2 && !f && s[i] == 'K' && s[i - 1] == 'K' && s[i - 2] == 'K') {\n c++\n s[i - 1] = 'V'\n f = true\n }\n }\n if(l == 2 && s[0] == 'K' && s[1] == 'K') wr(1)\n else if (l > 1) wr(c)\n else wr(0)\n }\n}\n\n@JvmField val INPUT = System.`in`\n@JvmField val OUTPUT = System.out\n@JvmField val _reader = INPUT.bufferedReader()\n\nfun readLine(): String? = _reader.readLine()\nfun readLn(): String = _reader.readLine()!!\n\n@JvmField var _tokenizer: StringTokenizer = StringTokenizer(\"\")\n\nfun read(): String {\n while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return \"\", \" \")\n return _tokenizer.nextToken()\n}\n\nfun readString() = readLn()\nfun readStrings() = readLn().split(\" \")\nfun readInt() = readLn().toInt()\nfun readInts() = readStrings().map { it.toInt() }\nfun readLong() = readLn().toLong()\nfun readLongs() = readStrings().map { it.toLong() }\n\nfun wr(a: String) = println(a)\nfun wr(a: Int) = println(a)\n\n@JvmField val _writer = PrintWriter(OUTPUT, false)\ninline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }", "lang": "Kotlin", "bug_code_uid": "fa6f75e2866ce8dcd65e892623934568", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "apr_id": "bd949838d5b6824a4bf610f819384027", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9923076923076923, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val s = readLine()!!\n var sol = if (s.contains(\"VVV\") || s.contains(\"KKK\") ||\n s.startsWith(\"kk\") || s.endsWith(\"VV\")\n ) 1 else 0\n for (pos in 0 until s.length - 1) if (s[pos] == 'V' && s[pos + 1] == 'K') sol++\n print(sol)\n}", "lang": "Kotlin", "bug_code_uid": "d90f8f459f8b3cf892aedcca1893fd6c", "src_uid": "578bae0fe6634882227ac371ebb38fc9", "apr_id": "3bd985bc72de4721977ca0bccffabe8a", "difficulty": 1100, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9841269841269841, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": "@ExperimentalStdlibApi\nfun main() = with(Scanner(System.`in`)) {\n repeat(nextInt()) {\n val candies = ArrayDeque((0 until nextInt()).map { nextInt() })\n var turn = true\n\n var a = 0\n var b = 0\n var turns = 0\n var amount = 0\n\n while (candies.isNotEmpty()) {\n turns++\n var takenSum = 0\n\n if (turn) {\n do {\n takenSum += candies.removeFirst()\n } while (candies.isNotEmpty() && takenSum <= amount)\n a += takenSum\n } else {\n do {\n takenSum += candies.removeLast()\n } while (candies.isNotEmpty() && takenSum <= amount)\n b += takenSum\n }\n amount = takenSum\n turn = !turn\n }\n println(\"$turns $a $b \")\n }\n}", "lang": "Kotlin", "bug_code_uid": "21e950da01f5814819b0555f2dbf80f1", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "c913f8dd0dc5167cfcb9feccfa44f505", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9704075935231714, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val t = readLine()!!.toInt()\n for (i in 1..t) {\n val n = readLine()!!.toInt()\n val aa = readLine()!!.split(' ').map(String::toInt)\n val deque = arrayListOf()\n for (a in aa) deque.add(a)\n val ans = arrayListOf(0, 0)\n var cur = 0\n var move = 0\n var m = 0\n while (deque.isNotEmpty()) {\n if (cur == 0) {\n cur = deque.removeFirst()\n ans[0] += cur\n } else {\n var x = 0\n while (deque.isNotEmpty()) {\n x += if (move == 0) deque.removeFirst() else deque.removeLast()\n if (x > cur) break\n }\n ans[move] += x\n cur = x\n }\n move = 1 - move\n m++\n }\n println(\"$m \" + ans[0] + \" \" + ans[1])\n }\n}", "lang": "Kotlin", "bug_code_uid": "95f85d62bd78b0a777b42b5a1791f0ba", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "7c70700fd0158b57e5e5f5603638a1a2", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9881026925485284, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "//Kotlin is also fun!!\nimport java.util.*\nfun main(args: Array) = with(Scanner(System.`in`))\n{\n var t=readLine()!!.toInt()\n while(t-->0) {\n val n = readLine()!!.toInt()\n val a = IntArray(n) { nextInt() }\n var l = 0\n var r = n\n var mv = 0\n var turn = 0\n var x = 0\n var y = 0\n var pre = 0\n while (l < r) {\n var curr = 0\n if (turn == 0) {\n while (l < r && curr <= pre)\n curr += a[l++]\n x += curr\n } else {\n while (l < r && curr <= pre)\n curr += a[--r]\n y += curr\n }\n ++mv;\n turn = 1 - turn\n pre = curr\n }\n println(\"$mv $x $y\")\n }\n}", "lang": "Kotlin", "bug_code_uid": "7b88c82582a788871ca36ae14f749b50", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "5b9b0646b36fe8ae1da5b2b474b748d8", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9477806788511749, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\nfun main(){\n var sc = Scaner(System.`in`)\n var t = sc.nextInt()\n while(t-->0){\n var n = sc.nextInt()\n val a = Array(n) {sc.nextInt()}\n var start = 0\n var end = n-1\n var alice = 0\n var bob = 0\n var moves = 0\n var sum1 = 0\n var sum2 = 0\n while(start<=end){\n var cur = 0\n while(start<=end && cur<=sum2){\n cur+=a[start]\n start++\n }\n moves++\n alice+=cur\n sum1 = cur\n cur = 0\n while(start<=end && cur) {\n val sc = Scanner(System.`in`)\n var t = 1\n t = sc.nextInt()\n while (t-- > 0)\n {\n var n = sc.nextInt()\n var a = IntArray(n)\n for (i in 0 until n)\n {\n a[i] = sc.nextInt()\n }\n var st = 1\n var en = n - 1\n var cnt = 1\n var prev = a[0]\n var al = a[0]\n var bo = 0\n while (true)\n {\n if (cnt % 2 == 1)\n {\n var qw = 0\n while (qw <= prev && en >= st)\n {\n qw += a[en]\n en--\n }\n bo += qw\n if (qw > prev)\n {\n prev = qw\n cnt++\n }\n else\n {\n if (qw != 0)\n {\n cnt++\n }\n break\n }\n }\n else\n {\n var qw = 0\n while (qw <= prev && en >= st)\n {\n qw += a[st]\n st++\n }\n al += qw\n if (qw > prev)\n {\n prev = qw\n cnt++\n }\n else\n {\n if (qw != 0)\n {\n cnt++\n }\n break\n }\n }\n }\n println(\"$cnt $al $bo\")\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "30afb0f3c9e67da3d1067c3e27c16251", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "613d299148dd89dc1706c4163a1416ad", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.44749249892841836, "equal_cnt": 29, "replace_cnt": 13, "delete_cnt": 3, "insert_cnt": 12, "fix_ops_cnt": 28, "bug_source_code": "fun main(args: Array) {\n val n = readLine()!!.toInt()\n for (i in 0 until n) {\n var candiesCount = readLine()!!.toInt()\n var candies = readLine()!!.split(' ').map(String::toInt).toMutableList()\n val aliceSizes = mutableListOf(candies[0])\n val bobSizes = mutableListOf()\n var previous = candies[0]\n candies.removeAt(0)\n\n\n while (candies.isNotEmpty()) {\n candies = candies.asReversed()\n previous = move(candies, previous)\n\n if (aliceSizes.size > bobSizes.size)\n bobSizes.add(previous)\n else aliceSizes.add(previous)\n }\n\n println(\"${aliceSizes.size + bobSizes.size} ${aliceSizes.sum()} ${bobSizes.sum()}\")\n }\n}\n\nfun move(candies: MutableList, previous: Int): Int {\n var size = 0\n if (candies.sum() > previous) {\n while (size <= previous) {\n size += candies[0]\n candies.removeAt(0)\n }\n } else {\n size = candies.sum()\n candies.clear()\n }\n\n return size\n}", "lang": "Kotlin", "bug_code_uid": "6c0ff97c1e51fb49c4ade410aff8aa78", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "3612c278e23daf5150b9b378bbbb24d6", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9847799259563965, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n BufferedReader(InputStreamReader(System.`in`)).use {\n val countLine = it.readLine().toInt()\n\n for (i in 1..countLine) {\n val countCandy = it.readLine().toInt()\n val candy = it.readLine().split(\" \").map { it.toInt() }\n\n println(simulateGame(candy).toList().joinToString(\" \"))\n }\n }\n}\n\nfun simulateGame(candyList: List): Triple {\n var a = 0\n var b = 0\n var step = 0\n\n var lastSum = 0\n val currentCandyList = candyList.toMutableList()\n\n while (currentCandyList.isNotEmpty()) {\n var currentSum = 0\n\n while (currentSum <= lastSum && currentCandyList.isNotEmpty()) {\n if (!step.isOdd()) {\n val candy = currentCandyList.removeFirst()\n currentSum += candy\n a += candy\n } else {\n val candy = currentCandyList.removeLast()\n currentSum += candy\n b += candy\n }\n }\n\n lastSum = currentSum\n step++\n }\n\n return Triple(step, a, b)\n}\n\nfun Int.isOdd(): Boolean = this % 2 != 0", "lang": "Kotlin", "bug_code_uid": "8d3526d600d2c229eb3f59a3a5da5e54", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "67f5011abf98b22e5ec984765db5a85b", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.998298355076574, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nval scanner = Scanner(System.`in`)\n\nfun main() {\n repeat(scanner.nextInt()) {\n val num = scanner.nextInt()\n val array = ArrayDeque((0 until num).map { scanner.nextInt() })\n var alisa = 0\n var bob = 0\n var prev = 0\n var turnAlisa = true\n var turns = 0\n while (!array.isEmpty()) {\n var max = 0\n turns++\n if (turnAlisa) {\n do {\n max += array.pollFirst()\n } while (!array.isEmpty() && max <= prev)\n alisa += max\n } else {\n do {\n max += array.pollLast()\n } while (!array.isEmpty() && max <= prev)\n bob += max\n }\n prev = max\n turnAlisa = !turnAlisa\n }\n println(\"$turns $alisa $bob\")\n }", "lang": "Kotlin", "bug_code_uid": "8168611b558b0eb6610a6d8252aea4aa", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "a8c6ea0dd636b72f0815225a1aa1d20c", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.026382978723404255, "equal_cnt": 16, "replace_cnt": 16, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 17, "bug_source_code": "#include\n#define ll long long int\n#define ld long double\n#define pb push_back\n#define pob pop_back\n#define vi vector\n#define mp make_pair\n#define sz size()\n#define rep1(i,n) for(ll i=1;i<=n;i++)\n#define rep(i,n) for(ll i=0;i\n#define mod 1000000007\nusing namespace std;\n\n\n\n\n\n/*\nvoid sieve()\n{\n ll n=100000;\n ll i;\n ll prime[n+1]={0}; \n ll j;\n prime[1]=1;\n prime[0]=1;\n for(i=2;i*i<=n;i++)\n {\n if(prime[i]==0)\n {\n for(j=2*i;j<=n;j=j+i)\n {\n prime[j]=1;\n }\n }\n }\n \n ll cnt=0;\n for(i=0;i<=n;i++)\n {\n \tif(prime[i]==0)\n \t{\n \t\tv.pb(i);\n\t\t}\n }\n // return v;\n}\n*/\n\n\n\n\nint main()\n{\n\tll t;\n\tcin>>t;\n\twhile(t--)\n\t{\n\t\t\n\tchar ch;\n\t//db aa,bb,cc,dd,xx;\n\tstring s1,s2,s3,str;\n ll i,j,k,a,b,c,d,n,m,l,r,x,y,z,low,high,mid,sum=0,ans=0,temp,t;\n cin >> n;\n low=1;high=n-1;\n ll arr[n];\n rep(i,n)\tcin >> arr[i];\n x=0;y=0;z=0;ll w=0;\n ll cntt=0;\n for(i=0;ihigh){\n \t\t\tok=false;break;\n \t\t}\n \t}\n \tans++;x+=z;if(!ok)\tbreak;\n }\n ans++;\n cout<(a1);\n\n var numMoves = 0;\n var a = 0;\n var b = 0;\n var prevA = 0;\n var prevB = 0;\n while (q.isNotEmpty()) {\n var curA = 0;\n while (curA <= prevB && q.isNotEmpty()) {\n curA += q.removeFirst();\n }\n a += curA;\n prevA = curA;\n if (curA > 0) {\n numMoves++;\n }\n\n var curB = 0;\n while (curB <= prevA && q.isNotEmpty()) {\n curB += q.removeLast();\n }\n b += curB;\n prevB = curB;\n if (curB > 0) {\n numMoves++;\n }\n }\n println(\"$numMoves $a $b\");\n}\n\nfun main() {\n var t = 1;\n t = readInt();\n for (i in 1..t) {\n solve();\n }\n}", "lang": "Kotlin", "bug_code_uid": "46deaf78fa5e8b6b75d425d257459642", "src_uid": "d70ee6d3574e0f2cac3c683729e2979d", "apr_id": "186ad9efbf23ea0807de2a4089479b86", "difficulty": 1300, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9135229251305862, "equal_cnt": 11, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 9, "fix_ops_cnt": 10, "bug_source_code": "fun main() {\n var list = readLine()!!.split(' ').map { it.toInt() }.sorted().toMutableList()\n// if (list.sum() % 2 == 0) {\n// println(\"NO\")\n// return\n// }\n var flag = false\n var midSum = list.sum() / 2\n var temp = false\n for (i in 0..4) {\n var sum = list[5] + list[i]\n for (j in i + 1..4) {\n sum += list[j]\n if (sum == midSum) {\n list[5] = 0\n list[i] = 0\n list[j] = 0\n flag = true\n temp = true\n break\n }\n }\n if (temp) break\n }\n if (flag) {\n if (list.sum() == midSum) {\n println(\"YES\")\n } else {\n println(\"NO\")\n }\n } else {\n println(\"NO\")\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "a29280d6a507a243be71b9a90e9f0295", "src_uid": "2acf686862a34c337d1d2cbc0ac3fd11", "apr_id": "209ae45d3a0038d8c5626671a2c1a77b", "difficulty": 1000, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8773006134969326, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import kotlin.math.*\n\nfun main(args: Array) {\n val (n, k) = readLine()!!.split(\" \").map { it.toLong() }\n println(countWays(n, k))\n}\n\nfun countWays(n: Long, k: Long): Long {\n if (k < 3 || k > 2 * n - 1) return 0\n val m1 = k / 2\n val m2 = k - m1\n return min(n - m2 + 1, m1)\n}\n", "lang": "Kotlin", "bug_code_uid": "d4daa56552e647657378ca934b73e071", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "apr_id": "c3e202c559938df59b4a43f31801c675", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9749647390691114, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 5, "bug_source_code": "import java.io.*\nimport java.util.*\nimport kotlin.collections.ArrayList\n\ntypealias IntMatrix = Array\ntypealias Graph = IntMatrix\n\ntypealias LongMatrix = Array\n\ntypealias IndexPair = Pair\ntypealias IntIndexPair = IndexPair\n\ntypealias IntIntPair = Pair\n\ntypealias ListArray = Array>\n\nfun init() { }\n\nfun solve() {\n val (n, k) = readLongs()\n\n val answer = getAnswer(n, k)\n out.println(answer)\n}\n\nfun getAnswer(n : Long, k : Long) : Long {\n var result = 0L\n\n if (k <= n) {\n result = k / 2\n } else {\n val maxPossible = n\n val minPossible = k - n\n\n val count = Math.max(0L, (maxPossible - minPossible + 1))\n result = count / 2\n }\n\n if (k % 2 == 0L) {\n val half = k / 2\n if (half <= n) result = Math.max(result - 1, 0)\n }\n\n return result\n}\n\nclass FenwickTree(n : Int) {\n\n val size = n + 1\n val tree = LongArray(size) { 0L }\n\n fun update(index : Int, delta : Int) {\n var x = index + 1\n while (x < size) {\n tree[x] = tree[x] + delta\n x += x and -x\n }\n }\n\n fun get(start : Int, end : Int) =\n get(end) - get(start - 1)\n\n fun get(index : Int) : Long {\n var result : Long = 0\n\n var x = index + 1\n while (x > 0) {\n result += tree[x]\n x -= x and -x\n }\n\n return result\n }\n}\n\nfun yesNo(yes : Boolean) {\n out.println(if (yes) \"YES\" else \"NO\")\n}\n\nfun run() {\n init()\n solve()\n out.close()\n}\n\nfun main(args: Array) {\n run()\n}\n\nval ONLINE_JUDGE = true//!File(\"input.txt\").exists()\n\nval input = BufferedReader(\n if (ONLINE_JUDGE) InputStreamReader(System.`in`) else FileReader(\"input.txt\")\n)\nval out =\n if (ONLINE_JUDGE) PrintWriter(System.out)\n else PrintWriter(\"output.txt\")\n\nfun readStrings(separator: String = \" \", emptyWords: Boolean = false) : Array {\n val line = input.readLine()\n\n val list = ArrayList()\n var builder = StringBuilder()\n\n for (i in 0..line.length) {\n if (i == line.length || separator.contains(line[i])) {\n if (emptyWords || builder.isNotEmpty()) {\n list.add(builder.toString())\n builder = StringBuilder()\n }\n } else {\n builder.append(line[i])\n }\n }\n\n return list.toTypedArray()\n}\n\nfun readString(separator: String = \" \") =\n readStrings(separator).first()\n\nfun readInts(separator: String = \" \") =\n readStrings(separator).map(String::toInt).toIntArray()\n\n\nfun readSortedInts(separator: String = \" \") : IntArray {\n val a = readInts(separator)\n\n val aInteger : Array = Array(a.size, { a[it] })\n Arrays.sort(aInteger)\n\n return aInteger.toIntArray()\n}\n\nfun readInt(separator: String = \" \") =\n readInts(separator).first()\n\nfun readLongs(separator: String = \" \") =\n readStrings(separator).map(String::toLong).toLongArray()\n\nfun readLong(separator: String = \" \") =\n readLongs(separator).first()\n\nfun readDoubles(separator: String = \" \") =\n readStrings(separator).map(String::toDouble).toDoubleArray()\n\nfun readDouble(separator: String = \" \") =\n readDoubles(separator).first()\n\nfun readTree(n : Int, indexing : Int = 1) =\n readGraph(n, n - 1, true, indexing)\n\nfun readGraph(n: Int, m : Int,\n undirected : Boolean = true,\n indexing : Int = 1) : Graph {\n val builder = GraphBuilder()\n\n for (i in 1..m) {\n var (from, to) = readInts()\n\n from -= indexing\n to -= indexing\n\n if (undirected) builder.addEdge(from, to)\n else builder.addDirectedEdge(from, to)\n }\n\n return builder.build(n)\n}\n\nclass GraphBuilder {\n\n val froms : MutableList\n val tos : MutableList\n\n init {\n this.froms = ArrayList()\n this.tos = ArrayList()\n }\n\n fun addEdge(from : Int, to : Int) {\n addDirectedEdge(from, to)\n addDirectedEdge(to, from)\n }\n\n fun addDirectedEdge(from : Int, to : Int) {\n froms.add(from)\n tos.add(to)\n }\n\n fun build(n : Int) : Graph {\n val sizes = IntArray(n) { 0 }\n froms.forEach { ++sizes[it] }\n\n val graph = Array(n) { IntArray(sizes[it]) { 0 } }\n\n for (i in 0 until n) {\n sizes[i] = 0\n }\n\n for (i in 0 until froms.size) {\n val from = froms[i]\n val to = tos[i]\n\n graph[from][sizes[from]++] = to\n }\n\n return graph\n }\n}\n\nfun checkIndex(index : Int, size : Int) =\n (index in 0..(size - 1))\n\nfun checkCell(x : Int, n : Int, y : Int, m : Int) =\n checkIndex(x, n) && checkIndex(y, m)\n\nfun toChar(index : Int, start : Char) =\n (index + start.toInt()).toChar()\n\nclass DSU {\n\n var sizes : IntArray\n var ranks : IntArray\n var parents : IntArray\n\n constructor(n : Int)\n : this(\n IntArray(n) { 1 }\n )\n\n constructor(sizes : IntArray) {\n val size = sizes.size\n this.sizes = sizes\n this.ranks = IntArray(size) { 1 }\n this.parents = IntArray(size) { it }\n }\n\n operator fun get(v : Int) : Int {\n val parent = parents[v]\n if (parent == v) return v\n parents[v] = get(parent)\n return parents[v]\n }\n\n fun union(aUniting : Int, bUniting : Int) {\n var a = get(aUniting)\n var b = get(bUniting)\n\n if (a == b) return\n\n if (ranks[a] < ranks[b]) {\n val tmp = a\n a = b\n b = tmp\n }\n\n parents[b] = a\n sizes[a] += sizes[b]\n if (ranks[a] == ranks[b]) ++ranks[a]\n }\n\n fun size(v : Int) : Int = sizes[get(v)]\n}\n", "lang": "Kotlin", "bug_code_uid": "f5142497d871b09529581e11fd961f2c", "src_uid": "98624ab2fcd2a50a75788a29e04999ad", "apr_id": "f2d2d303527c88b59b0fe3ea8bf4e4cf", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.810368349249659, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s1 = StringBuilder()\n val num = r.readLine()!!.toInt()\n //var (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n val m = r.readLine()!!.split(\" \").map { it.toInt() }\n val n = r.readLine()!!.split(\" \").map { it.toInt() }\n val c1 = m.subList(1, m[0]+1).toMutableList()\n val c2 = n.subList(1, n[0]+1).toMutableList()\n val hash = mutableSetOf()\n var ans = 0\n while (c1.size!=0&&c2.size!=0){\n ans ++\n when{\n c1[0]>c2[0] -> {\n c1 += c2[0]\n c1 += c1[0]\n c1.removeAt(0)\n c2.removeAt(0)\n }\n c1[0] {\n c2 += c1[0]\n c2 += c2[0]\n c1.removeAt(0)\n c2.removeAt(0)\n }\n }\n if ((c1+c2).hashCode() !in hash) {\n hash += (c1+c2).hashCode()\n } else {\n ans = -1\n break\n }\n }\n val win = if (c1.size==0) 2 else 1\n println(if (ans==-1) -1 else \"$ans $win\")\n}", "lang": "Kotlin", "bug_code_uid": "fdf8348e9d962fbcbdb54b4824aadb82", "src_uid": "f587b1867754e6958c3d7e0fe368ec6e", "apr_id": "1afbaac654d47ac3bdc3883213ef1b26", "difficulty": 1400, "tags": ["brute force", "games", "dfs and similar"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.47746541722445335, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package _Kozmirchuk\n\nimport java.util.*\n\n/**\n * Created by kozmirchuk on 12/28/16.\n */\n\n\nfun > Iterable.kths(k : Int) : T {\n\n val array = ArrayList()\n array.addAll(this)\n\n if (k !in 1..array.size) {\n throw IllegalArgumentException()\n }\n\n fun MutableList.swap(i : Int, j : Int) {\n val temp = this[i]\n this[i] = this[j]\n this[j] = temp\n }\n\n fun search(l : Int, r : Int, n : Int) : T {\n\n if (l + 1 >= r) {\n\n if (array[l] > array[r])\n array.swap(l, r)\n\n return if (n == 1) array[l] else array[r]\n }\n\n val pivot = array[(l + r) / 2]\n array.swap((l + r) / 2, l)\n\n var i = l + 1\n var last = i\n while (i <= r) {\n\n if (array[i] < pivot) {\n array.swap(i, last)\n last += 1\n }\n\n i += 1\n }\n\n array.swap(l, last - 1)\n\n return when {\n last - l == n -> array[last - 1]\n last - l > n -> search(l, last - 2, k)\n else -> search(last, r, n - last - l)\n }\n }\n\n\n return search(0, array.size - 1, k)\n}\n\nfun main(args: Array) {\n\n\n fun who(n : Int) = when(n) {\n 1 -> \"Sheldon\"\n 2 -> \"Leonard\"\n 3 -> \"Penny\"\n 4 -> \"Rajesh\"\n else -> \"Howard\"\n }\n\n\n val n = readLine()!!.toInt()\n\n\n fun solve(n : Int) {\n var cnt = 1\n\n while (5 * (2 * cnt - 1) < n) {\n cnt *= 2\n }\n\n var N = 5 * (cnt - 1) + 1\n\n for (i in 1..5) {\n if ( (n >= N) && n < (cnt + N))\n println(who(i))\n N += cnt\n }\n\n }\n\n solve(n)\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "11694a1a4d90f13c849afce263b4b9a1", "src_uid": "023b169765e81d896cdc1184e5a82b22", "apr_id": "28b8840217793b83382716227d2e61da", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.7116486314449395, "equal_cnt": 15, "replace_cnt": 8, "delete_cnt": 2, "insert_cnt": 5, "fix_ops_cnt": 15, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStream\nimport java.io.InputStreamReader\nimport java.math.BigDecimal\nimport java.util.*\nimport kotlin.collections.HashMap\n\nobject programkt {\n internal class FastScanner(inpStr: InputStream, private var br: BufferedReader = BufferedReader(InputStreamReader(inpStr)), private var stok: StringTokenizer? = null) {\n private fun nextToken(): String? {\n while (stok == null || !stok!!.hasMoreTokens())\n stok = StringTokenizer(br.readLine() ?: return null)\n return stok!!.nextToken()\n }\n\n fun nextInt() = nextToken()!!.toInt()\n fun nextLong() = nextToken()!!.toLong()\n fun nextDouble() = nextToken()!!.toDouble()\n fun nextChar() = br.read().toChar()\n fun nextLine() = br.readLine()\n fun nextBigInteger() = nextToken()!!.toBigInteger()\n fun nextBigDecimal() = nextToken()!!.toBigDecimal()\n }\n\n @JvmStatic\n fun main(args: Array) {\n val sc = FastScanner(System.`in`)\n val n = sc.nextInt()\n\n val list = LinkedList()\n list.addAll(listOf(1, 2, 3, 4, 5))\n\n val result = drink(list, 1, n)\n\n println(when (result) {\n 1 -> \"Sheldon\"\n 2 -> \"Leonard\"\n 3 -> \"Penny\"\n 4 -> \"Rajesh\"\n 5 -> \"Howard\"\n else -> \"FAIL\"\n })\n }\n\n private fun drink(list: LinkedList, currentNumber: Int, number: Int): Int {\n return if (currentNumber == number) list.first()\n else {\n val first = list.first\n list.addLast(first)\n list.addLast(first)\n list.removeFirst()\n drink(list, currentNumber + 1, number)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "f0ceb4c992f386328312f47b54d0f35d", "src_uid": "023b169765e81d896cdc1184e5a82b22", "apr_id": "1b3405b3eb88a5b87f5c19869272a81c", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7264233576642336, "equal_cnt": 16, "replace_cnt": 12, "delete_cnt": 3, "insert_cnt": 1, "fix_ops_cnt": 16, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val n = input.nextLong()\n\n val a: MutableList = mutableListOf('s', 'l', 'p', 'r', 'h')\n\n var p: Char = a.first()\n (1..n).forEach {\n p = a.first()\n a.removeAt(0)\n a.add(a.size, p)\n a.add(a.size, p)\n }\n\n output.println(\n when(p) {\n 's' -> \"Sheldon\"\n 'l' -> \"Leonard\"\n 'p' -> \"Penny\"\n 'r' -> \"Rajesh\"\n 'h' -> \"Howard\"\n\n else -> throw IllegalArgumentException()\n }\n )\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextLong(): Long {\n return next().toLong()\n }\n}", "lang": "Kotlin", "bug_code_uid": "5120f7dfb1511cd725025489b116a5b8", "src_uid": "023b169765e81d896cdc1184e5a82b22", "apr_id": "2d81144a19a0f6fb6f46e3d69a40786f", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9872998343456654, "equal_cnt": 6, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.io.*\nimport java.util.*\n\n\nfun main(args: Array) {\n val inputStream = System.`in`\n val outputStream = System.out\n val input = InputReader(inputStream)\n val output = PrintWriter(outputStream)\n val solver = Task()\n solver.solve(input, output)\n output.close()\n}\n\nprivate class Task {\n fun solve(input: InputReader, output: PrintWriter) {\n val n = input.nextLong()\n\n var index = 1\n var length = 5\n var multiplier = 1\n\n while (true) {\n val newIndex = index + length\n\n if (n in index..(newIndex - 1)) {\n break\n } else {\n length *= 2\n index = newIndex\n multiplier *= 2\n }\n }\n\n val diff = n - index\n\n val res = when (diff) {\n in 0..multiplier -> \"Sheldon\"\n in multiplier..2 * multiplier -> \"Leonard\"\n in 2 * multiplier..3 * multiplier -> \"Penny\"\n in 3 * multiplier..4 * multiplier -> \"Rajesh\"\n in 4 * multiplier..5 * multiplier -> \"Howard\"\n\n else -> throw IllegalArgumentException()\n }\n\n output.println(res)\n }\n}\n\n\nprivate class InputReader(stream: InputStream) {\n private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)\n private var tokenizer: StringTokenizer? = null\n\n\n operator fun next(): String {\n while (tokenizer == null || tokenizer?.hasMoreTokens()?.not() == true) {\n try {\n tokenizer = StringTokenizer(reader.readLine())\n } catch (e: IOException) {\n throw RuntimeException(e)\n }\n\n }\n return tokenizer!!.nextToken()\n }\n\n fun nextLong(): Long {\n return next().toLong()\n }\n}", "lang": "Kotlin", "bug_code_uid": "f90f730fa6e97299f5bd9c2c7e4750a5", "src_uid": "023b169765e81d896cdc1184e5a82b22", "apr_id": "2d81144a19a0f6fb6f46e3d69a40786f", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7937219730941704, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n var n = readLine()!!.toInt()\n var k = 1\n while (5 * k * (k + 1) / 2 < n) k++\n n -= 5 * k * (k - 1) / 2\n n = (n - 1) / k\n println(arrayOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")[n])\n}", "lang": "Kotlin", "bug_code_uid": "72d57128f6944b63f1a539a0f33d7e80", "src_uid": "023b169765e81d896cdc1184e5a82b22", "apr_id": "9f6f7b001fb579ef1bba4fa95339761c", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.3971223021582734, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nval names = listOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\")\n\nfun main(args: Array) {\n val reader = BufferedReader(InputStreamReader(System.`in`))\n val n = reader.readLine().toInt()\n var nodesCount = 5\n var sum = 5\n var offset = n\n while (sum < n) {\n offset -= nodesCount\n nodesCount *= 2\n sum += nodesCount\n }\n val width = nodesCount / 5\n val index = if (offset / width - 1 < 0) 0 else offset / width\n println(names[index])\n}", "lang": "Kotlin", "bug_code_uid": "4682a61224b3510f8014f7637311c8a2", "src_uid": "023b169765e81d896cdc1184e5a82b22", "apr_id": "8ead8f3ed58dd95c20cd812579641e89", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.4040114613180516, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 8, "bug_source_code": "import java.util.*\n\nfun main(args: Array) {\n val n = readLine()!!.toInt()\n val list = LinkedList()\n list.addAll(arrayOf(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\"))\n\n (0 until n).forEach{\n list.removeFirst().let {\n list.add(it)\n list.add(it)\n }\n }\n println(list.last)\n}", "lang": "Kotlin", "bug_code_uid": "b69b5d5609c4e99d0eef1ec95cfc6aac", "src_uid": "023b169765e81d896cdc1184e5a82b22", "apr_id": "b56751b70c644e42ee0ab31b71f1e3fd", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9873980726464048, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main(args: Array) {\n\tvar nums = mutableListOf(5)\n\tvar index: Double = 0.0\n\twhile(true) {\n\t\tnums.add(nums[index.toInt()] + 5*Math.pow(2.0, (index + 1.0)).toInt())\n\t\tindex++\n\t\tif(nums[index.toInt()] > 1000000000) {\n\t\t\tbreak\n\t\t}\n\t}\n\t\n\tprintln(nums)\n\tvar n = readLine()!!.toInt()\n\tvar result: Double = 0.0\n\tfor(i in 0..nums.size - 1) {\n\t\tif(nums[i] >= n) {\n\t\t\tif(i == 0)\n\t\t\t\tresult = n.toDouble()\n\t\t\telse\n\t\t\t\tresult = ((n - nums[i-1]).toDouble())/Math.pow(2.0, i.toDouble())\n\t\t\tresult = Math.ceil(result)\n\t\t\tbreak\n\t\t}\n\t}\n\twhen(result.toInt()) {\n\t\t1 -> println(\"Sheldon\")\n\t\t2 -> println(\"Leonard\")\n\t\t3 -> println(\"Penny\")\n\t\t4 -> println(\"Rajesh\")\n\t\t5 -> println(\"Howard\")\n\t}\n}", "lang": "Kotlin", "bug_code_uid": "0a5b30148a94bdc84b5a461dffef7837", "src_uid": "023b169765e81d896cdc1184e5a82b22", "apr_id": "156ac4972d116820f484a8cf9a5d01bc", "difficulty": 1100, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9588268471517203, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val r = System.`in`.bufferedReader()\n val s = StringBuilder()\n //val len = r.readLine()!!.toInt()\n //val (n, m) = r.readLine()!!.split(\" \").map { it.toInt() }\n var (a, b, n) = r.readLine()!!.split(\" \").map { it.toInt() }\n var sturn = true\n var finish = false\n var swin = false\n while (!finish){\n if (sturn){\n val remove = gcd(a, n)\n if (remove<=n){\n n -= remove\n sturn = false\n } else {\n swin = false\n finish = true\n }\n } else {\n val remove = gcd(b, n)\n if (remove<=n){\n n -= remove\n sturn = true\n } else {\n swin = true\n finish = true\n }\n }\n }\n println(if (swin) 0 else 1)\n}", "lang": "Kotlin", "bug_code_uid": "2026a904a882f1ccfbb54afae22ce01e", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "apr_id": "e5fc604a3b004484d3a317a85ef9e2de", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.3813953488372093, "equal_cnt": 3, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main() {\n val (a, b, n) = readLine()!!.split(\" \").map { it.toInt() }\n if (a % 2 != 0 && b % 2 != 0 && n % 2 != 0) println(0)\n else println(1)\n}", "lang": "Kotlin", "bug_code_uid": "bc2f4fc9ba75bed3869696728ec8e5a6", "src_uid": "0bd6fbb6b0a2e7e5f080a70553149ac2", "apr_id": "40ad9bb7087d2f70a8dd9a40c50bf65a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8178861788617886, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n val a = readLine()!!.split(' ').map(String::toInt).toIntArray()\n val f = IntArray(k)\n val last = IntArray(n + 1)\n for (i in 0 until n) {\n last[a[i]] = i\n }\n var ans = 0\n for (i in 0 until n) {\n if (a[i] in f) continue\n var r = 0\n for (j in 0 until k) {\n if (f[j] == 0 || last[f[j]] <= i) { r = j; break }\n }\n f[r] = a[i]\n ans++\n }\n println(ans)\n}\n", "lang": "Kotlin", "bug_code_uid": "020c886d2d3f73d1f6233eeb633e16b4", "src_uid": "956228e31679caa9952b216e010f9773", "apr_id": "4da58c33fef102a2b3a08f791b987e16", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9677777777777777, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.*\n\nfun readInts(n: Int): IntArray {\n val line = readLine()!!\n val st = StringTokenizer(line)\n val result = IntArray(n)\n for (i in 0 until n) result[i] = st.nextToken().toInt()\n return result\n}\n\nfun computeNextsAndPos(a: IntArray): Pair {\n val n = a.size\n val pos = IntArray(n + 1) { n }\n val nexts = IntArray(n)\n for (i in a.indices.reversed()) {\n nexts[i] = pos[a[i]]\n pos[a[i]] = i\n }\n return nexts to pos\n}\n\nfun main(args: Array) {\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n val a = readInts(n)\n\n val (nexts, pos) = computeNextsAndPos(a)\n\n val f = IntArray(k)\n var ans = 0\n for (i in 0 until n) {\n if (a[i] in f) continue\n pos[a[i]] = nexts[i]\n val r = (0 until k).maxBy { j -> pos[f[j]] }!!\n f[r] = a[i]\n ans++\n }\n println(ans)\n}\n", "lang": "Kotlin", "bug_code_uid": "9f54d7ce4aa7f4790095ce176926dd8f", "src_uid": "956228e31679caa9952b216e010f9773", "apr_id": "4da58c33fef102a2b3a08f791b987e16", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9991126885536823, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "import java.util.*\n\nfun readInts(n: Int): IntArray {\n val line = readLine()!!\n val st = StringTokenizer(line)\n val result = IntArray(n)\n for (i in 0 until n) result[i] = st.nextToken().toInt()\n return result\n}\n\nfun computeNextsAndPos(a: IntArray): Pair {\n val n = a.size\n val pos = IntArray(n + 1) { n }\n val nexts = IntArray(n)\n for (i in a.indices.reversed()) {\n nexts[i] = pos[a[i]]\n pos[a[i]] = i\n }\n return nexts to pos\n}\n\nval t = IntArray(1 shl 20)\n\nfun main(args: Array) {\n val (n, k) = readLine()!!.split(' ').map(String::toInt)\n val a = readInts(n)\n\n val (nexts, pos) = computeNextsAndPos(a)\n\n val f = IntArray(k)\n val ft = IntArray(n + 1) { -1 }\n\n for (j in 0 until k) t[j] = n\n\n var ans = 0\n for (i in 0 until n) {\n pos[a[i]] = nexts[i]\n if (ft[a[i]] != -1) {\n t[ft[a[i]]] = nexts[i]\n continue\n }\n val r = (0 until k).maxBy { j -> t[j] }!!\n ft[f[r]] = -1\n f[r] = a[i]\n t[r] = pos[a[r]]\n ft[a[i]] = r\n ans++\n }\n println(ans)\n}\n", "lang": "Kotlin", "bug_code_uid": "49b8721250e97b6db0e93fd0105af0ac", "src_uid": "956228e31679caa9952b216e010f9773", "apr_id": "4da58c33fef102a2b3a08f791b987e16", "difficulty": 1800, "tags": ["greedy"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9532497149372862, "equal_cnt": 11, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 10, "fix_ops_cnt": 10, "bug_source_code": "fun main() {\n val princessSpeed = readLine()!!.toDouble()\n val dragonSpeed = readLine()!!.toDouble()\n val discoveryTime = readLine()!!.toInt()\n val timeWastedInCave = readLine()!!.toInt()\n val distanceToCastle = readLine()!!.toInt()\n var coinsCount = 0\n var princessLocation = discoveryTime * princessSpeed\n var overtakeLocation = princessLocation + (princessSpeed * (princessLocation / (dragonSpeed - princessSpeed)))\n while (overtakeLocation < distanceToCastle) {\n princessLocation = overtakeLocation\n coinsCount++\n val bufferTime = (princessLocation / dragonSpeed) + timeWastedInCave\n princessLocation += bufferTime * princessSpeed\n overtakeLocation = princessLocation + (princessSpeed * (princessLocation / (dragonSpeed - princessSpeed)))\n }\n println(coinsCount)\n}", "lang": "Kotlin", "bug_code_uid": "8f916b8dc312bdff247b8d1dbb17bc90", "src_uid": "c9c03666278acec35f0e273691fe0fff", "apr_id": "d73bb59d76dfc989645da7c19167a835", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8998849252013809, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val (vp, vd, t, f, c) = List(5){br.readLine().toDouble()}\n if (vp >= vd) println(0)\n else {\n var cnt = 0\n var p = vd*(vp*t/(vd - vp))\n while (p < c) {\n p = vd*(vp*(f + p/vd) + p)/(vd - vp)\n cnt += if (p < c) 1 else 0\n }\n println(cnt)\n }\n}", "lang": "Kotlin", "bug_code_uid": "8454117ee9b1c3657eeed14602c68720", "src_uid": "c9c03666278acec35f0e273691fe0fff", "apr_id": "9821059e48c48765eecc5fd527ca679c", "difficulty": 1500, "tags": ["math", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.07550731477111845, "equal_cnt": 22, "replace_cnt": 18, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 22, "bug_source_code": "/**\n *You are given a rectangular board of M\u2009\u00d7\u2009N squares. Also you are given an unlimited number of standard domino\n * pieces of 2\u2009\u00d7\u20091 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible\n * on the board so as to meet the following conditions:\n * 1. Each domino completely covers two squares.\n * 2. No two dominoes overlap.\n * 3. Each domino lies entirely inside the board. It is allowed to touch the edges of the board.\n * Find the maximum number of dominoes, which can be placed under these restrictions.\n *\n *\n * Input\n * In a single line you are given two integers M and N \u2014 board sizes in squares (1\u2009\u2264\u2009M\u2009\u2264\u2009N\u2009\u2264\u200916).\n *\n *\n * Output\n * Output one number \u2014 the maximal number of dominoes, which can be placed.\n */\nfun main(){\n val (m, n) = readLine()!!.split(\" \", limit= 3)\n val numberPieces = m.toInt()*n.toInt() /2\n println(numberPieces)\n}", "lang": "Kotlin", "bug_code_uid": "cc41c1e68833715fa152d1080feba2ab", "src_uid": "ffeae332696a901813677bd1033cf01e", "apr_id": "ffa9694b27d9a62d3b18787717d0a7e5", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8116279069767441, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 5, "bug_source_code": "fun main() {\n\n val y = readLine()!!.toInt()\n val b = readLine()!!.toInt()\n val r = readLine()!!.toInt()\n\n var wantedR = r\n var wantedB = r - 1\n var wantedY = r - 2\n\n while (true) {\n\n if (wantedY <= y && wantedB <= b && wantedR <= r) {\n println(wantedB + wantedR + wantedY)\n break\n } else {\n wantedY--\n wantedB--\n wantedR--\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "a50107c45234fa8e4ecb9868ce221ab7", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "d4f86508e97dadd0676518de6f6b3407", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6976264189886481, "equal_cnt": 7, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "package koitlin_heroes_practice\n\nfun main() {\n val (y, b, r) = readLine()!!.split(\" \").map { it.toInt() }\n val min = minOf(y, b, r)\n if (min == r) {\n println(3 * r - 3)\n return\n }\n\n if (min == b) {\n println(3 * (b))\n return\n }\n\n if (min == y) {\n if (r > b) {\n println((3 * y) + 3)\n } else {\n println(y + 2 * r - 2)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "8e44bcd1a17294159aa522f36d15d526", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "862b1860aff96bb77852125ea855193d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.5916305916305916, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.Scanner\nimport kotlin.math.min\n\nfun main(args: Array) {\n val sc = Scanner(System.`in`)\n //arrayOf(\"8\",\"13\",\"9\")\n val yellowOrnaments = args[0].toInt()\n val blueOrnaments = args[1].toInt()\n val redOrnaments = args[2].toInt()\n\n println(3 * min(yellowOrnaments, min(blueOrnaments, redOrnaments - 1) - 1) + 3)\n}\n", "lang": "Kotlin", "bug_code_uid": "285e5516576cfad848a763fb2d0d9018", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "371fde74c5ab8b5a1b506501b324e53c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9521247982786444, "equal_cnt": 22, "replace_cnt": 2, "delete_cnt": 6, "insert_cnt": 13, "fix_ops_cnt": 21, "bug_source_code": "import java.io.File\nimport kotlin.test.todo\n\nclass MyReader(fileName: String) {\n val file = File(fileName)\n\n\n val contents : List?\n\n init {\n contents = try {\n file.readLines()\n } catch (e : Throwable) {\n null\n }\n }\n\n\n val line : String\n get() {\n return if (contents != null) {\n contents[pointer++]\n } else {\n readLine()!!\n }\n }\n\n var pointer = 0\n}\n\nvar reader : MyReader = MyReader(\"src/input.txt\")\n\nfun getLine() = reader.line\nfun readInt() = getLine().toInt()\nfun readInts() = getLine().split(\" \").map { it.toInt() }\n\nfun RE() : Nothing {\n throw RuntimeException()\n}\n\nfun main() {\n val (y, b, r) = readInts()\n val ans = when {\n b >= r-1 && y >= r-2 -> 3*r - 3\n r >= b + 1 && y >= b - 1 -> b*3\n b >= y + 1 && r >= y + 2 -> 3*y + 3\n else -> RE()\n }\n println(ans)\n}", "lang": "Kotlin", "bug_code_uid": "34a8dbd6e0e87cfee3eb336357feced8", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "3b92f9fee25aa995376800beb1d8610e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.6814903846153846, "equal_cnt": 8, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": " fun main(args: Array): Int {\n val yellow = readLine()!!.toInt()\n val blue = readLine()!!.toInt()\n val red = readLine()!!.toInt()\n\n if (yellow < blue) {\n if (blue < red) {\n //yellow < blue < red\n println(yellow * 3 + 3)\n } else {\n //yellow < blue >= red\n println(red * 3 - 3)\n }\n } else {\n //blue <= yellow\n if (blue < red) {\n //blue < red && blue < yellow\n println(blue * 3)\n } else {\n //red <= blue && blue <= yellow\n println(red * 3 - 2)\n }\n }\n\n return 0\n}", "lang": "Kotlin", "bug_code_uid": "a0590a5cc26f7d2cef72c85adc905396", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "5dcba41d1fb5f6ec92846e981895b4f8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.48573163327261687, "equal_cnt": 23, "replace_cnt": 12, "delete_cnt": 2, "insert_cnt": 10, "fix_ops_cnt": 24, "bug_source_code": "class Main {\n\n fun main(): Int {\n val yellow = readLine()!!.toInt()\n val blue = readLine()!!.toInt()\n val red = readLine()!!.toInt()\n\n if (yellow < blue){\n if(blue < red){\n //yellow < blue < red\n println(yellow*3+3)\n }else{\n //yellow < blue >= red\n println(red*3-2)\n }\n }else{\n //blue <= yellow\n if(blue < red){\n //blue < red && blue < yellow\n println(blue*3)\n }else{\n //red <= blue && blue <= yellow\n println(red*3 - 2)\n }\n }\n\n return 0\n }\n\n}", "lang": "Kotlin", "bug_code_uid": "77beecbb21c53bb6af96af2892987561", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "5dcba41d1fb5f6ec92846e981895b4f8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6259168704156479, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "fun main(args: Array){\nvar y=readLine()!!.toInt()\ny=y+2\nvar b=readLine()!!.toInt()\nb=b+1\nvar r=readLine()!!.toInt()\nvar temp=kotlin.math.min(b,r)\nvar ans=kotlin.math.min(temp,y)\nprintln((ans*3-3))\n}", "lang": "Kotlin", "bug_code_uid": "d8201ed305629eba1b7eca19bb4c1263", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "2d4b871db38f72c0a39ef49895c692fc", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.966542750929368, "equal_cnt": 5, "replace_cnt": 1, "delete_cnt": 3, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "import java.util.*;\nfun main()\n{\n var sc = Scanner(System.`in`)\n var y:Int = sc.nextInt()\n var b:Int = sc.nextInt()\n var r:Int = sc.nextInt()\n y += 2\n b += 1\n var lol:Int = maxOf(y: Int, b: Int, r:Int)\n if ( lol < 2)\n println(\"0\")\n else\n println(\"${lol*3 - 3} \")\n\n}", "lang": "Kotlin", "bug_code_uid": "354b162c0d18118a667fef0f0efdc68f", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "c9bf0d113f801f895d09d018dad421ec", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8287671232876712, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 3, "bug_source_code": "fun main()\n{\n var y = readLine()!!.toInt()\n var b = readLine()!!.toInt()\n var r = readLine()!!.toInt()\n \n var a = 6\n \n y -= 1\n b -= 2\n r -= 3\n \n while (!(y == 0 || b == 0 || r == 0))\n {\n y--\n b--\n r--\n \n a += 3\n }\n \n println(a)\n}\n", "lang": "Kotlin", "bug_code_uid": "b2379ebf7998a501eea881b69f2c3064", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "50ac45b218d1e8c71681a687770c6c9e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9640831758034026, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main()\n{\n var (y, b, r) = readLine()!!.split(' ')\n \n var a = 6\n \n y -= 1\n b -= 2\n r -= 3\n \n while (!(y == 0 || b == 0 || r == 0))\n {\n y--\n b--\n r--\n \n a += 3\n }\n \n println(a)\n}\n", "lang": "Kotlin", "bug_code_uid": "48ad41f9a22f72722ac04f79202b47bd", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "50ac45b218d1e8c71681a687770c6c9e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.05011389521640091, "equal_cnt": 8, "replace_cnt": 8, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "fun getOrnamentNumber(b: Int, r: Int): Int {\n if (b != 0) {\n return (b - 1) + b + (b + 1)\n }\n if (r != 0) {\n return (r - 2) + (r - 1) + r\n }\n\n return 0\n}\n\nfun findOrnamentNumber(y: Int, b: Int, r: Int): Int {\n return when (maxOf(y, b, r)) {\n y -> findOrnamentNumber(-1, b, r)\n b -> getOrnamentNumber(0, r)\n r -> getOrnamentNumber(b, 0)\n else -> 0\n }\n}", "lang": "Kotlin", "bug_code_uid": "ff16516fb057a2b2ababbc79600baa02", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "17683056635b7aba9b81de0c271f97d0", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7978580990629184, "equal_cnt": 5, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val inputLine = readLine()!!\n val parts = inputLine.split(' ')\n\n if (parts.size != 3) {\n throw Exception()\n }\n\n val yellow = parts[0].toInt()\n val blue = parts[1].toInt()\n val red = parts[2].toInt()\n\n check(yellow)\n check(blue)\n check(red)\n\n println(calculate(yellow, blue, red))\n}\n\nfun check(number: Int) {\n if (number !in 2..100) {\n throw Exception()\n }\n}\n\nfun calculate(yellow: Int, blue: Int, red: Int): Int {\n return if (yellow + 2 <= blue + 1 && yellow + 2 <= red) {\n ((yellow + 2) * 3 - 3)\n } else if (blue + 1 <= yellow + 2 && blue + 1 <= red) {\n ((blue + 1) * 3 - 3)\n } else {\n ((red) * 3 - 3)\n }\n}", "lang": "Kotlin", "bug_code_uid": "ff81e2ab0dc748ea57d5dec789d5d446", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "6dc59a7725335bb50f8b23a7a0177f5e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9978902953586498, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.lang.Math.min\n\nfun main(args: Array) {\n val (y, b, r) = readLine()!!.split(' ')\n val yellow = y.toInt()\n val blue = b.toInt()\n val red = r.toInt()\n print(findSolve(yellow, blue, red))\n}\n\nfun findSolve(yellow : Int, blue : Int, red : Int) : Int {\n val minValue = min(yellow, min(blue, red))\n if (minValue == yellow) {\n var temp = yellow\n while (true) {\n if (temp + 1 <= blue && temp + 2 <= red) {\n return temp * 3 + 3\n }\n temp -= 1\n }\n } else if (minValue == blue) {\n var temp = blue\n while (true) {\n if (temp - 1 <= yellow && temp + 1 <= red) {\n return temp * 3\n }\n temp -= 1\n }\n }\n else {\n var temp = red\n while (true) {\n if (temp - 2 == yellow && temp -1 == blue) {\n return temp * 3 - 3\n }\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "5994ac49380f6b406c6e6d61dbbf9adc", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "01d0a72b70fdbaa9e9f147f4f93d6872", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "TIME_LIMIT_EXCEEDED", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6783369803063457, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val (y, b, r) = readLine()?.split(\" \").map { it.toInt() }\n\n val base = listOf(y - 2, b - 1, r).min()!!\n\n val result = base * 3 - 3\n \n println(result)\n}", "lang": "Kotlin", "bug_code_uid": "ba0e90345864f899d831d8b35d4a94fa", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "3dacd44e0a0e1f670decbca049349a48", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8756423432682425, "equal_cnt": 4, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n val input = args.map { Integer.parseInt(it) }.toList()\n\n fun isValid(yellow: Int, blue: Int, red: Int): Boolean {\n return yellow <= input[0] && blue <= input[1] && red <= input[2] && yellow == blue + blue - red\n }\n\n var yellow = input[0]\n var blue = yellow + 1\n var red = blue + 1\n\n while (!isValid(yellow, blue, red)) {\n yellow--\n blue--\n red--\n }\n\n print(yellow + blue + red)\n}", "lang": "Kotlin", "bug_code_uid": "0e9cda7bbfe7c50b8938903566dc0493", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "4d02e88f34e3d800cf4cd8e241ce249a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9798387096774194, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val input = Scanner(System.`in`).nextLine().split(\" \").map { Integer.parseInt(it) }.toList()\n\n fun isValid(yellow: Int, blue: Int, red: Int): Boolean {\n return yellow <= input[0] && blue <= input[1] && red <= input[2] && yellow == blue + blue - red\n }\n\n var yellow = input[0]\n var blue = yellow + 1\n var red = blue + 1\n\n while (!isValid(yellow, blue, red)) {\n yellow--\n blue--\n red--\n }\n\n print(yellow + blue + red)\n}", "lang": "Kotlin", "bug_code_uid": "b45a49e662156bac727c05a0649127fd", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "4d02e88f34e3d800cf4cd8e241ce249a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9767441860465116, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "fun main(args: Array) {\n val (yellow, blue, red) = args.map { it.toInt() }\n val configuration = Configuration(yellow, blue, red)\n val perfectConfiguration = configuration.findPerfectConfiguration()\n\n println(perfectConfiguration.sum())\n}\n\nprivate class Configuration(var yellow: Int, var blue: Int, var red: Int) {\n fun findPerfectConfiguration(): Configuration {\n val perfectConfiguration = Configuration(this.red - 2, this.red - 1, this.red)\n\n while (!this.hasEnoughOrnaments(perfectConfiguration)) {\n perfectConfiguration.reduce()\n }\n\n return perfectConfiguration\n }\n\n fun sum() = this.yellow + this.blue + this.red\n\n\tprivate fun hasEnoughOrnaments(configuration: Configuration): Boolean {\n \treturn configuration.yellow <= this.yellow\n \t\t&& configuration.blue <= this.blue\n\t \t&& configuration.red <= this.red\n\t}\n\n private fun reduce() {\n this.yellow--\n this.blue--\n this.red--\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "6eae8a11ba33ce5a2a07dae2b45d9380", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "96e7402b2cc581a378bd3debb96215ee", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.13186813186813187, "equal_cnt": 11, "replace_cnt": 9, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 10, "bug_source_code": "fun main(args:Array) {\n val s = Scanner(System.`in`)\n val a:Long\n val b:Long\n val i:Long\n val j:Long\n val c:Long\n a = s.nextLong()\n b = s.nextLong()\n c = s.nextLong()\n i = Math.min(b, Math.min(a + 1, c - 1))\n System.out.println(3 * x)\n }", "lang": "Kotlin", "bug_code_uid": "6954ba0020ccab2a69a78cd3cadba5e5", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "0c1dddbd795293c6a5fb13b968ae2ce5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6438356164383562, "equal_cnt": 8, "replace_cnt": 7, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 7, "bug_source_code": "fun main() {\n val br = Scanner(System.`in`)\n val a = br.nextInt()\n val b = br.nextInt()\n val c = br.nextInt()\n for (i in c downTo 3) {\n if (a >= i - 2 && b >= i - 1) {\n println(i + (i - 1) + (i - 2))\n break\n }\n }\n }", "lang": "Kotlin", "bug_code_uid": "0dcc79619c7c48a88d25685bd5853624", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "989c3ffb65e0e642d201e7ba995bb4d7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.6959578207381371, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "fun main() {\n var a = readLine()!!.toInt()\n var b = readLine()!!.toInt()\n var c =readLine()!!.toInt()\n for (i in c downTo 3) {\n if (a >= i - 2 && b >= i - 1) {\n println(i + (i - 1) + (i - 2))\n break\n }\n }\n }", "lang": "Kotlin", "bug_code_uid": "bb51a3b5acba89c67fadf5831b8e7a32", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5", "apr_id": "989c3ffb65e0e642d201e7ba995bb4d7", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9307479224376731, "equal_cnt": 3, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 2, "bug_source_code": " fun main(args: Array) {\n\n var s=readLine()!!.toLowerCase().toSet()\n if(s.size==26)\n print(\"YES\")\n else\n print(\"NO\")\n \n }", "lang": "Kotlin", "bug_code_uid": "bc8e401d8de4cd0cae7a27593148546f", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "apr_id": "75318ef862bc42c0313dd708b6de762c", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.5957805907172996, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "import java.util.*\nimport kotlin.collections.ArrayList\nimport kotlin.collections.HashMap\n//author:Ismail moussi\nfun main()\n{\n val scan=Scanner(System.`in`)\n val n:Int=scan.nextInt()\n var s:String=scan.next()\n var map=HashMap()\n if(s.length<26)\n print(\"NO\")\n else {\n s.toLowerCase()\n for (i in 0 until s.length) {\n map.put(s.get(i), 0)\n }\n\n when(map.size)\n {\n in 0..25-> print(\"NO\")\n else -> print(\"YES\")\n }\n\n// if (map.size == 26)\n// print(\"YES\") else\n// print(\"NO\")\n }\n}\n\n\n\n\n\n", "lang": "Kotlin", "bug_code_uid": "39d6f47ffda75c320546ae1bb1998686", "src_uid": "f13eba0a0fb86e20495d218fc4ad532d", "apr_id": "4dba0c7773e791fea2ef782181374a68", "difficulty": 800, "tags": ["strings", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.753315649867374, "equal_cnt": 11, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 4, "fix_ops_cnt": 10, "bug_source_code": "fun main() {\n val (total, num) = readLine()!!.split().map { it.toInt() }\n println(\n generateSequence { if (total % 10 == 0) total / 10 else total -1 }.take(num)\n )\n}", "lang": "Kotlin", "bug_code_uid": "f17faa4993d7df1dadb306b402c989ac", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "dde5d1025625547e9b575d852a0c76e9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7258064516129032, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "package example.myapp\n\nfun main(args: Array) {\n wrongSubstraction(args[0].toInt(), args[1].toInt())\n}\n\nfun wrongSubstraction(number: Int, steps: Int) {\n if (steps == 0) {\n println(number)\n return\n }\n if (number % 10 != 0) {\n wrongSubstraction(number - 1, steps - 1)\n } else {\n wrongSubstraction(number / 10, steps - 1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "c357f454e6d5259bb7fe48c6480ca5ad", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "c902d9d9ceb262dad9d932543b891042", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8377253814147018, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "fun main(args: Array) {\n wrongSubstraction(args[0].toInt(), args[1].toInt())\n}\n\nfun wrongSubstraction(number: Int, steps: Int) {\n if (steps == 0) {\n println(number)\n return\n }\n if (number % 10 != 0) {\n wrongSubstraction(number - 1, steps - 1)\n } else {\n wrongSubstraction(number / 10, steps - 1)\n }\n}", "lang": "Kotlin", "bug_code_uid": "82ef26a7ca9e7227555a4aab077a946b", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "c902d9d9ceb262dad9d932543b891042", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9320905459387483, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package com.sys1yagi.codeforces.wrong_subtraction\n\nfun main() {\n val numbers = readLine()?.split(' ') ?: return\n if (numbers.size != 2) {\n return\n }\n var result = numbers[0].toInt()\n val count = numbers[1].toInt()\n for (i in 0.until(count)) {\n if (result % 10 == 0) {\n result /= 10\n } else {\n result--\n }\n }\n println(result)\n}\n", "lang": "Kotlin", "bug_code_uid": "ff8bd41b1f4f8e72ee3cf508315195b1", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "c62def37bfad7d1f07392a4c3e34083e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9803063457330415, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n var (a, b) = readLine()!!.split(' ')\n var n = a.toInt(), k = b.toInt()\n for (i in 1..k) {\n if (n % 10 == 0) {\n n /= 10\n } else {\n n--\n }\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "fdb36a8927620c595e9a269a053c2bce", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "7f69db6c7be415007587ca6f47af93b5", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9954954954954955, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "package Codeforces\n\nfun main(args: Array){\n var (n , k) = readLine()!!.split(' ').map{it.toInt()}\n while(k-->0){\n if(n%10 == 0 ){\n n /=10\n }\n else n-=1\n }\n println(n)\n}\n", "lang": "Kotlin", "bug_code_uid": "f1690b6f849937ecdd799ca7ed447202", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3c821c38cf18f9215e94e7eeba61819c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9427027027027027, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 6, "bug_source_code": "package random.walk\n\nimport java.util.*\n\n/**\n * Created: Saturday 5/25/2019, 1:16 PM Eastern Time\n */\nobject CodeForceIncorrectMinus {\n\n fun execute(n: String, k: String): String {\n\n val na = n.toCharArray().mapTo(LinkedList()) { it.toString().toInt() }\n\n for (ki in 1..k.toInt()) {\n\n if (na.isEmpty()) {\n break\n }\n\n val last = na.last\n if (last == 0) {\n na.removeLast()\n } else {\n val lastIndex = na.lastIndex\n na[lastIndex] = last - 1\n }\n\n }\n\n return na.fold(StringBuilder()) { sb, i -> sb.append(i.toString()) }.toString()\n }\n\n\n}\n\nfun main() {\n\n val scan = Scanner(System.`in`)\n\n val tokens = scan.nextLine().trim().split(' ')\n\n val n = tokens[0]\n val k = tokens[1]\n\n val result = CodeForceIncorrectMinus.execute(n, k)\n\n println(\"result=$result\")\n\n}\n\n", "lang": "Kotlin", "bug_code_uid": "64487988823a5bedf94f0c1144780aae", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "d85f54a85d636ec7aa48c9cfa370f002", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9924242424242424, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 3, "bug_source_code": "package platforms.codeforces.problemset\n\nfun main() {\n val a = readLine()!!.split(\" \").map { it.toInt() }\n var r = a[0];\n for (i in 1..a[1]) {\n if (r % 10 != 0) {\n r--\n } else {\n r /= 10\n }\n }\n print(r)\n}", "lang": "Kotlin", "bug_code_uid": "80226f88e6c0c6085c0646b82d0de169", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a2b21bd01443941c6f08e1e13eb43ecd", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9347496206373292, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\n\nobject WrongSubtraction {\n @JvmStatic\n fun main(args: Array) {\n val sc = Scanner(System.`in`)\n var n = sc.nextInt()\n var k = sc.nextInt()\n while (k-- > 0) {\n if (n % 10 > 0)\n n--\n else\n n /= 10\n }\n println(n)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "0a82a57e8b17bc327924d8fd86a6c749", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "6529013c7e2abbb2c4da2408e05b5c6f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8016528925619835, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import java.util.*\n\nfun printResult() {\n val input = Scanner(System.`in`)\n fun wrongSub(n: Long, k: Int): Long {\n return when {\n k==0 -> n\n n % 10!=0L -> wrongSub(n - 1, k - 1)\n else -> wrongSub(n / 10, k - 1)\n }\n }\n\n println(\n wrongSub(\n input.nextLong(),\n input.nextInt()\n )\n )\n}", "lang": "Kotlin", "bug_code_uid": "780d5e6e5a4337a5faa7e1e5086102bb", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "919c01f2889bd07a51b0d2b51f30d9b8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7677053824362606, "equal_cnt": 10, "replace_cnt": 6, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 10, "bug_source_code": "fun printResult() {\n val input = Scanner(System.`in`)\n fun wrongSub(n: Long, k: Int): Long {\n return when {\n k==0 -> n\n n % 10!=0L -> wrongSub(n - 1, k - 1)\n else -> wrongSub(n / 10, k - 1)\n }\n }\n\n println(\n wrongSub(\n input.nextLong(),\n input.nextInt()\n )\n )\n}", "lang": "Kotlin", "bug_code_uid": "fcabb45509b2189c00d1d0aacb350501", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "919c01f2889bd07a51b0d2b51f30d9b8", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9603174603174603, "equal_cnt": 7, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 6, "fix_ops_cnt": 7, "bug_source_code": "//utilities\nfun readLn() = readLine()!! // string line\nfun readInt() = readLn().toInt() // single int\nfun readStrings() = readLn().split(\" \") // list of strings\nfun readInts() = readStrings().map { it.toInt() }\n\n//production code\nfun subtractOne(value: Int): Int {\n if (value.rem(10) == 0) {\n return value / 10\n } else {\n return value - 1\n }\n}\n\nval (n, k) = readInts()\n\nvar answer = n\nfor (idx in 1..k) {\n answer = subtractOne(answer)\n}\nprintln(answer) //50\n\n", "lang": "Kotlin", "bug_code_uid": "acc61464a2d98e9170beb605c4a12574", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "0ec916478e92d6907bb164f7d308ef96", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9947089947089947, "equal_cnt": 3, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": " fun main(arguments: Array){\n val input : String? = readLine();\n val inputs = input!!.split(\" \");\n val number = Integer.parseInt(inputs[0]);\n val count = Integer.parseInt(inputs[1]);\n \n while(count > 0){\n if(number % 10 == 0){\n number = number / 10;\n } else {\n number = number - 1;\n }\n \n count = count - 1;\n }\n \n println(number);\n }\n\n", "lang": "Kotlin", "bug_code_uid": "ce2a031bdd5463ad6de9179ca5b67fb3", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "048519efe0faf2bd76655bcf3ef34c69", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9246323529411765, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "// 02.09.2019\n\n\nimport java.util.*\nimport kotlin.system.exitProcess\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { x: String -> x.toInt() } // list of ints\n\nfun main ()\n{\n var n = readInt();\n var k = readInt();\n while( k != 0 )\n {\n k--;\n if ( n % 10 == 0 )\n n /= 10;\n else\n n --;\n println (\"$n\");\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "1a655c78571de9139873cdc97e96e15f", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4e46cf0ef9587bbc5f2c354befe2339c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.960820895522388, "equal_cnt": 6, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 4, "fix_ops_cnt": 6, "bug_source_code": "// 02.09.2019\n\n\nimport java.util.*\nimport kotlin.system.exitProcess\n\nprivate fun readLn() = readLine()!! // string line\nprivate fun readInt() = readLn().toInt() // single int\nprivate fun readStrings() = readLn().split(\" \") // list of strings\nprivate fun readInts() = readStrings().map { x: String -> x.toInt() } // list of ints\n\nfun main ()\n{\n val (n, k) = readInts ();\n while( k != 0 )\n {\n k--;\n if ( n % 10 == 0 )\n n /= 10;\n else\n n --;\n println (\"$n\");\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "13f5af25385377547b77b7e64ee8591a", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4e46cf0ef9587bbc5f2c354befe2339c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.866721177432543, "equal_cnt": 4, "replace_cnt": 0, "delete_cnt": 4, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": " package com.my.stuff\n\n class programkt {\n companion object {\n @JvmStatic fun main(args: Array) {\n while (true) {\n print(\" Enter text: \")\n print(run(readLine()!!))\n }\n }\n fun parseInts(input: String) = input.split(\" \").map{it->it.toInt()}\n fun run(input: String):Int {\n val pars = parseInts(input)\n var numb = pars[0] // input validation goes somewhere else\n val iter = pars[1]\n for (i in 1..iter) numb = if (numb%10==0) numb/10 else numb-1\n return numb\n }\n }\n }", "lang": "Kotlin", "bug_code_uid": "a676d5e30fbc7fe984ae01c14b555999", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "991a2dd7a8e0bf1537400756366190c4", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.5553047404063205, "equal_cnt": 8, "replace_cnt": 5, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 8, "bug_source_code": "\nfun main(args: Array) {\n var n = args[0].toInt()\n val k = args[1].toInt()\n\n repeat(k) {\n when(n) {\n 0 -> n /= 10\n else -> n -= 1\n }\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "a634743e24307dda80c092bebd63d1b1", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "73ca9d26618b0ee73d6f042a5d82504e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8586387434554974, "equal_cnt": 5, "replace_cnt": 4, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n var n = args[0].toInt()\n var k = args[1].toInt()\n //println(\"n: $n, k: $k\")\n\n while (k > 0) {\n if(n.toString().endsWith(\"0\")) {\n n /= 10\n } else {\n --n\n }\n --k\n }\n print(n)\n}", "lang": "Kotlin", "bug_code_uid": "380bb5386faffb8116a291ec422dc006", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "1a77e9a00da512fceacd0013f4f60a8f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9251497005988024, "equal_cnt": 4, "replace_cnt": 3, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 3, "bug_source_code": "\nfun main() {\n val input = readLine()!!\n var i = input.indexOf(' ') - 1\n var k = input.substring(i + 2).toInt()\n var digit = input[i].toInt() - 48\n\n while (k > digit) {\n k -= digit + 1\n digit = input[--i].toInt() - 48\n }\n\n val output = Integer.parseInt(input, 0, i + 1, 10) - k\n println(output)\n}\n\n", "lang": "Kotlin", "bug_code_uid": "60013dbdfb73c12f8655ea377035a2c8", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3347f9edbe1ef0f78bfe09a1d74ee1aa", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.04681404421326398, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 9, "bug_source_code": "package com.example.kotlinheroes\n\nimport kotlin.math.max\n\nfun main(args: Array) {\n if(args.size != 2) return\n\n var number = args[0].toInt()\n val subtractions = args[1].toInt()\n\n for (i in 1..subtractions) {\n number = number.wrongSubtraction()\n }\n\n println(max(0, number))\n}\n\nprivate fun Int.wrongSubtraction(): Int =\n if (this % 10 == 0) this / 10 else this - 1\n", "lang": "Kotlin", "bug_code_uid": "c0b562ac74328bf6baaf0056d05f4241", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "2736a706681d781d74851f9d7879405c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.26373626373626374, "equal_cnt": 9, "replace_cnt": 7, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 9, "bug_source_code": "import kotlin.math.max\n\nfun main(args: Array) {\n require(args.size == 2)\n\n var number = args[0].toInt()\n val subtractions = args[1].toInt()\n\n for (i in 1..subtractions) {\n number = number.wrongSubtraction()\n }\n\n println(max(0, number))\n}\n\nprivate fun Int.wrongSubtraction(): Int =\n if (this % 10 == 0) this / 10 else this - 1", "lang": "Kotlin", "bug_code_uid": "d18d0e994c1a177b960acabf926c0dc0", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "2736a706681d781d74851f9d7879405c", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9552549427679501, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 0, "fix_ops_cnt": 1, "bug_source_code": "package com.vjgarcia.kotlinheroespractice\n\nimport java.util.*\n\nfun main() {\n Scanner(System.`in`).use { scanner ->\n val n = scanner.nextInt()\n val k = scanner.nextInt()\n println(solve(n, k))\n }\n}\n\nprivate fun solve(n: Int, k: Int): Int {\n var number = n\n\n for (index in 0 until k) {\n number = decrease(number)\n }\n\n return number\n}\n\nprivate fun decrease(number: Int): Int =\n when (number % 10) {\n 0 -> number / 10\n else -> number - 1\n }\n", "lang": "Kotlin", "bug_code_uid": "f731b3846a8ef326b4116f140e573e96", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "63875cf229fdc794d8df0ef404786c3e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.748730964467005, "equal_cnt": 7, "replace_cnt": 5, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array){\n var n:Int=Integer.valueOf(readLine())\n var k=Integer.valueOf(readLine())\n var i:Int=1\n while(i<=k)\n {\n if(n%10==0)\n {\n n=n/10\n }\n else if(n%10!=0)\n {\n n=n-1\n }\n i++\n }\n println(num)\n \n}", "lang": "Kotlin", "bug_code_uid": "97e811420ab2b5686ac21c6f208cef90", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4ed67e3cdffa5c145581b96813ab6ac4", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.7557251908396947, "equal_cnt": 7, "replace_cnt": 4, "delete_cnt": 1, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "fun main(args: Array){\n var n:Int=Integer.valueOf(readLine())\n var k=Integer.valueOf(readLine())\n var i:Int=1\n while(i<=k)\n {\n if(n%10==0)\n {\n n=n/10\n }\n else if(n%10!=0)\n {\n n=n-1\n }\n i++\n }\n println(n)\n \n}", "lang": "Kotlin", "bug_code_uid": "e5d818f053a7bcf7423f4ab6bc9dc310", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "4ed67e3cdffa5c145581b96813ab6ac4", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.40520748576078114, "equal_cnt": 9, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 7, "fix_ops_cnt": 9, "bug_source_code": "fun main(args: Array) {\n\n var subtractionTarget = args[0].toInt()\n val subtractionNumber = args[1].toInt()\n for (i in 1..subtractionNumber) {\n if (subtractionTarget.toString().last() === '0') subtractionTarget /= 10 else subtractionTarget--\n }\n\n println(subtractionTarget)\n}", "lang": "Kotlin", "bug_code_uid": "f123f78dddfb3503270cb3e0a49902cb", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "a04bb1e0d2f0248c0825863362c81f0f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8080357142857143, "equal_cnt": 7, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 7, "bug_source_code": "package main\n\nfun main(){\n var input: List = readLine()!!.split(\" \").map { it.toInt() }\n var retVar = input[0]\n for(i in 1..input[1].toInt()){\n retVar = if(retVar % 10 == 0) retVar / 10 else retVar - 1\n }\n println(retVar)\n}", "lang": "Kotlin", "bug_code_uid": "d065fcd1749f2ce75f8ff82a9a376f23", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "66fa4131aa3b0473995242f345351bda", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9882747068676717, "equal_cnt": 5, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 3, "fix_ops_cnt": 4, "bug_source_code": "fun main(args: Array) {\n\n var Input = (readLine() + \"\").split(\" \")\n var n = Integer.parseInt(Input[0])\n var b = Integer.parseInt(Input[1])\n\n while (b --) {\n if (n % 10 == 0) {\n n /= 10\n }\n else {\n n--\n }\n }\n println(n)\n}", "lang": "Kotlin", "bug_code_uid": "c3bc8fd23c5aa83ce0df4af16665e919", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "248e8fa9aca9a3bfe666ce856843018e", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8030018761726079, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 6, "bug_source_code": "package kotlinheroes\n\nfun Int.lastChar(): Int {\n return this.toString().last().toInt()-48\n}\n\nfun substruct(num: Int): Int {\n return when {\n num.lastChar() > 0 -> num-1\n else -> num/10\n }\n}\n\n\nfun substructMultiple(num: Int, div: Int) : Int {\n var current = num\n for (count in 1..div) {\n current = substruct(current)\n }\n\n return current\n}\n\n\nfun main() {\n val num = readLine()\n val div = readLine()\n\n require(num != null && div != null)\n\n print(substructMultiple(num.toInt(), div.toInt()))\n}", "lang": "Kotlin", "bug_code_uid": "6b29434eb99fd2344e8d2cb2522aedb3", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "b6e6eabdd9b2a44ff04b4451ec0801b9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.8183556405353728, "equal_cnt": 6, "replace_cnt": 3, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 5, "bug_source_code": "\n\nfun Int.lastChar(): Int {\n return this.toString().last().toInt()-48\n}\n\nfun substruct(num: Int): Int {\n return when {\n num.lastChar() > 0 -> num-1\n else -> num/10\n }\n}\n\n\nfun substructMultiple(num: Int, div: Int) : Int {\n var current = num\n for (count in 1..div) {\n current = substruct(current)\n }\n\n return current\n}\n\n\nfun main() {\n val num = readLine()\n val div = readLine()\n\n require(num != null && div != null)\n\n print(substructMultiple(num.toInt(), div.toInt()))\n}", "lang": "Kotlin", "bug_code_uid": "b52f7ee7b93027762fbe203d4cded5f0", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "b6e6eabdd9b2a44ff04b4451ec0801b9", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9433962264150944, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "package heroes2.practice\n\nfun main() {\n var (n, k) = readLine()!!.split(\" \").map(String::toInt)\n\n for (i in 1..k) {\n n = substract(n)\n }\n\n println(n)\n}\n\nfun substract(n: Int): Int = if (n % 10 == 0) {\n n / 10\n} else {\n n - 1\n}", "lang": "Kotlin", "bug_code_uid": "de4b78656863003ecbac4a404ac35a34", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "17881dfbdf1b09de8945de428fc4a9f3", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.8008948545861297, "equal_cnt": 9, "replace_cnt": 6, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 9, "bug_source_code": "fun main() {\n val value: ULong = readLine()!!.trim().toULong()\n val subOperations: Int = readLine()!!.trim().toInt()\n println(subtractResult(value,subOperations))\n}\n\nfun subtractResult(value: ULong, subOp: Int): ULong {\n if (subOp == 0) {\n return value\n } else {\n if ((value % 10UL) == 0UL) {\n return subtractResult((value/10UL),subOp-1)\n } else {\n return subtractResult((value-1UL),subOp-1)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "4cd6498e56b0746e9da5fe9849fdf610", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3d7c5d3b4239bba8096ebc8f50dc536a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9964830011723329, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val x = readLine()!!.trim().split().map({y:String -> y.toULong()})\n println(subtractResult(x[0],x[1]))\n}\n\nfun subtractResult(value: ULong, subOp: ULong): ULong {\n if (subOp == 0UL) {\n return value\n } else {\n if ((value % 10UL) == 0UL) {\n return subtractResult((value/10UL),subOp-1UL)\n } else {\n return subtractResult((value-1UL),subOp-1UL)\n }\n }\n}", "lang": "Kotlin", "bug_code_uid": "a33aa92743465d94651b398de8589f97", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "3d7c5d3b4239bba8096ebc8f50dc536a", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9883720930232558, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "import java.util.Scanner\n \nfun main(args: Array) {\n val inp = Scanner(System.`in`)\n var n = inp.nextInt()\n var k = inp.nextInt()\n while(k-->0){\n if(n%10)\n n--;\n else\n n = n/10;\n }\n println(n)\n}\n", "lang": "Kotlin", "bug_code_uid": "ce55d4692b037584f256a23c8be7d10e", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "dd185e2c3ce0299d1fdde4aff46bb40f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.9476268412438625, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 2, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.IOException\nimport java.io.InputStreamReader\nimport java.util.StringTokenizer\n\nobject TaskA {\n @Throws(IOException::class)\n @JvmStatic\n fun main(args: Array) {\n var n: Int\n val k: Int\n val br = BufferedReader(InputStreamReader(System.`in`))\n val zer = StringTokenizer(br.readLine())\n n = Integer.parseInt(zer.nextToken())\n k = Integer.parseInt(zer.nextToken())\n for (i in 0 until k) {\n if (n % 10 == 0) {\n n /= 10\n } else {\n n--\n }\n }\n println(n)\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "450b3bcd1e02db9658f62e05c1951ac2", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "d757798a7a7af002f9956e306cb7140d", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "delete", "lang_cluster": "Kotlin"} {"similarity_score": 0.726775956284153, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 4, "bug_source_code": "private fun readLn() = readLine()!!\nprivate fun readInt() = readLn().toInt()\n\nfun main(args: Array) {\n var n = readInt()\n val k = readInt()\n \n for(i in 1..k) {\n if (n%10 == 0) {\n n = n/10\n } else {\n n--\n }\n }\n print(n)\n}", "lang": "Kotlin", "bug_code_uid": "5a06d416f468c87c87603e4a8b8b9584", "src_uid": "064162604284ce252b88050b4174ba55", "apr_id": "ec0bdbedb06f95e2a4e35243a19b7b9f", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9904852521408183, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args : Array) {\n //====== Input preparations ========================================================\n// val fin = BufferedReader(FileReader(\"b.in\"))\n val fin = BufferedReader(InputStreamReader(System.`in`))\n val fout = PrintWriter (System.out)\n var tokenizer = StringTokenizer(\"\")\n fun next() : String {\n while (!tokenizer.hasMoreTokens())\n tokenizer = StringTokenizer(fin.readLine())\n return tokenizer.nextToken()\n }\n fun nextInt() = next().toInt()\n fun nextPair() = nextInt() to nextInt()\n fun nextPairDec() = nextInt()-1 to nextInt()-1\n //====== Solution below ============================================================\n var cntIn = 0\n var maxOut = 0\n next()\n val words = next().split('(', ')')\n for (i in words.indices) {\n val s = words[i]\n for (w in s.split('_')) {\n if (i % 2 == 0)\n maxOut = Math.max(maxOut, w.length)\n else\n cntIn++\n }\n }\n fout.print(\"%d %d\".format(maxOut, cntIn))\n\n fout.close()\n fin.close()\n}\n\n", "lang": "Kotlin", "bug_code_uid": "dd1076cbad0e794abcc4bcf6b1efb7d6", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "apr_id": "f301b044d2e5d66d69d699038ef3d4ab", "difficulty": 1100, "tags": ["strings", "implementation", "expression parsing"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.48093083387201035, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 2, "fix_ops_cnt": 8, "bug_source_code": "import kotlin.math.max\n\nfun main() {\n var insideParenthesis = false\n readLine()\n var countInside = 0\n var maxOutside = 0\n var count = 0\n for (c in readLine()!!)\n when (c) {\n '_' -> {\n if (insideParenthesis) {\n if (count > 0) countInside++\n } else maxOutside = max(maxOutside, count)\n count = 0\n }\n '(' -> {\n maxOutside = max(maxOutside, count)\n count = 0\n insideParenthesis = true\n }\n ')' -> {\n if (count > 0) countInside++\n count = 0\n insideParenthesis = false\n }\n else -> count++\n }\n print(\"$maxOutside $countInside\")\n}", "lang": "Kotlin", "bug_code_uid": "0daedfcdf02a007e94ded9005a3b4121", "src_uid": "fc86df4931e787fa3a1a40e2aecf0b92", "apr_id": "dcbd18baf14d75c4f0deea3924d6782f", "difficulty": 1100, "tags": ["strings", "implementation", "expression parsing"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.983750846310088, "equal_cnt": 1, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "import java.io.InputStream\nimport java.util.*\nimport kotlin.math.min\n\nconst val CODE_0 = '0'.toByte()\nconst val CODE_1 = '9'.toByte()\n\nvar s: String = \"\"\nvar n: Int = 0\nval dp = Array(500) { IntArray(500) }\n\nclass Main {\n companion object {\n @JvmStatic\n private fun ans(l: Int, r: Int): Int {\n dp[l][r] = when {\n dp[l][r] > 0 -> dp[l][r]\n l == r -> 1\n l > r -> 0\n else -> ((l + 1)..r).fold(1 + ans(l + 1, r)) { acc, i ->\n if (s[i] != s[l]) acc else min(acc, ans(l + 1, i - 1) + ans(i, r))\n }\n }\n return dp[l][r]\n }\n\n @JvmStatic\n fun main(args: Array) = with(Scanner(System.`in`)) {\n n = nextInt()\n s = next()\n println(ans(0, n - 1))\n }\n }\n\n\n // -----------------------------------------------------------------------------------------------------------------\n\n private class FastScanner(private val iss: InputStream = System.`in`) {\n fun nextInt(): Int {\n var v = 0\n var begin = false\n while (true) {\n val c = iss.read()\n if (c in CODE_0..CODE_1) {\n begin = true\n v *= 10\n v += c - CODE_0\n } else if (begin) {\n return v\n }\n }\n }\n }\n}\n", "lang": "Kotlin", "bug_code_uid": "be3baf85ab54c5a180adfb1587aac77b", "src_uid": "516a89f4d1ae867fc1151becd92471e6", "apr_id": "6ec85542ca3b6a4c5cf5479027106ec0", "difficulty": 2000, "tags": ["dp"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.8017676767676768, "equal_cnt": 4, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 2, "fix_ops_cnt": 3, "bug_source_code": "import kotlin.math.*\n\nfun procrust(inp: String): List{\n\t\tval retList = mutableListOf()\n\t\tfor (j in 0..inp.length-1){\n\t\t\tval tmpS = inp.substring(0..j-1) + inp.substring(j+1)\n\t\t\tif (tmpS[0] != '0') retList.add(tmpS)\n\t\t}\n\t\treturn retList\n\t}\n\nfun main(args: Array){\n\tfun checkQ(inp: String): Int{\n\t\t//println(inp)\n\t\tvar reslt: Int\n\t\tval cand = sqrt(inp.toDouble()).roundToInt()\n\t\tif (inp.toInt().rem(cand) == 0){\n\t\t\treslt = inp.length\n\t\t}else{\n\t\t\tif (inp.length > 1) {\n\t\t\t\treslt = procrust(inp).map{checkQ(it)}.max()!!.toInt()\n\t\t\t\t//println(reslt)\n\t\t\t}else{\n\t\t\t\treslt = -1\n\t\t\t}\n\t\t}\n\t\treturn reslt\n\t}\n\n\tvar inp = readLine().toString()\n\tval initL = inp.length\n\tval checked = checkQ(inp)\n\tif (checked == -1) println(-1) else println(initL-checked)\n}\n", "lang": "Kotlin", "bug_code_uid": "591d214bf92bac6d82c22eac70c4aff3", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "1a33218119b2f7fc9873516db1d134d8", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9454314720812182, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 3, "fix_ops_cnt": 5, "bug_source_code": "val squares = ArrayList()\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val n = reader.nextInt()\n\n val max: Int = Math.sqrt(n.toDouble()).toInt()\n for (i in 1..max) {\n squares.add((i*i).toString())\n }\n\n println(containsSubstring(n.toString()))\n}\n\nfun containsSubstring(n: String): String {\n\n for (square in squares.reversed()) {\n var indexOf = 0\n\n var winner = true\n for (char in square.toCharArray()) {\n indexOf = n.indexOf(char, indexOf, true)\n if (indexOf == -1){\n winner = false\n break\n }\n }\n if (winner) {\n return (n.length - square.length).toString()\n }\n }\n\n return \"-1\"\n}", "lang": "Kotlin", "bug_code_uid": "64e34698431fda561e917730e65a2221", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "ea03fef456996a7c0d08c961997d6956", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "COMPILATION_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9957081545064378, "equal_cnt": 3, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "\nimport java.util.ArrayList\nimport java.util.Scanner\n\n\nval squares = ArrayList()\n\nfun main(args: Array) {\n val reader = Scanner(System.`in`)\n val n = reader.nextInt()\n\n val max: Int = Math.sqrt(n.toDouble()).toInt()\n for (i in 1..max) {\n squares.add((i*i).toString())\n }\n\n println(containsSubstring(n.toString()))\n}\n\nfun containsSubstring(n: String): String {\n\n for (square in squares.reversed()) {\n var indexOf = 0\n\n var winner = true\n for (char in square.toCharArray()) {\n indexOf = n.indexOf(char, indexOf, true)\n if (indexOf == -1){\n winner = false\n break\n }\n }\n if (winner) {\n return (n.length - square.length).toString()\n }\n }\n\n return \"-1\"\n}", "lang": "Kotlin", "bug_code_uid": "d52a1d0d460f064770ad206aa8fa9ae2", "src_uid": "fa4b1de79708329bb85437e1413e13df", "apr_id": "ea03fef456996a7c0d08c961997d6956", "difficulty": 1400, "tags": ["math", "brute force", "implementation"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9944994499449945, "equal_cnt": 2, "replace_cnt": 1, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 2, "bug_source_code": "fun solve(i: Int): Int {\n val a: Int = i % 10\n val b: Int = (i / 10) % 10\n val c: Int = (i / 100) % 10\n val d: Int = (i / 1000) % 10\n return if (a != b && a != c && a != d && b != c && b != d && c != d) {\n 1\n } else\n 0\n\n\n}\n\nfun main() {\n\n val n = readLine()?.toInt()!!\n var x: Int\n for (i in (n+1) until 9001) {\n x = solve(i)\n if(x==1){\n println(i)\n break\n }\n\n\n }\n\n\n}", "lang": "Kotlin", "bug_code_uid": "91abdb16880ba1195ab68c0e8cada2ad", "src_uid": "d62dabfbec52675b7ed7b582ad133acd", "apr_id": "38c0a2633fcb3885f06fc2e6ccac74d2", "difficulty": 800, "tags": ["brute force"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9605442176870749, "equal_cnt": 8, "replace_cnt": 4, "delete_cnt": 2, "insert_cnt": 1, "fix_ops_cnt": 7, "bug_source_code": "import java.io.*\nimport java.util.*\n\nfun main(args : Array) {\n //====== Input preparations ========================================================\n// val fin = BufferedReader(FileReader(\"c.in\"))\n val fin = BufferedReader(InputStreamReader(System.`in`))\n val fout = PrintWriter (System.out)\n var tokenizer = StringTokenizer(\"\")\n fun next() : String {\n while (!tokenizer.hasMoreTokens())\n tokenizer = StringTokenizer(fin.readLine())\n return tokenizer.nextToken()\n }\n fun nextInt() = next().toInt()\n fun nextLong() = next().toLong()\n fun nextPair() = nextInt() to nextInt()\n fun nextPairDec() = nextInt()-1 to nextInt()-1\n //====== Solution below ============================================================\n val (n,m) = nextPair()\n val k = nextLong()\n val (x,y) = nextPairDec()\n val p = (n-1) * m\n if (p == 0) {\n val d = k / m\n val rem = k % m\n val max = d + (if (rem > 0) 1 else 0)\n val min = d\n val cnt = d + if (rem > y) 1 else 0\n fout.print(\"$max $min $cnt\")\n } else {\n val d = k / p\n val rem = k % p\n val max = d + (if (d == 0L || rem > m) 1 else 0)\n val min = d / 2 + (if (d % 2 == 1L || rem >= m) 1 else 0)\n val (x1,y1) = if (d % 2 == 0L) (x to y) else (n - x - 1 to y)\n var cnt = if (x1 == 0) d/2 else if (x1 == n-1) (d+1)/2 else d\n// println(\"$x $y\")\n if (x1 * m + y1 + 1 <= rem)\n cnt++\n fout.print(\"$max $min $cnt\")\n }\n\n fout.close()\n fin.close()\n}\n\n", "lang": "Kotlin", "bug_code_uid": "40b4f8bd806a49da39bdcc5f0d7264a2", "src_uid": "e61debcad37eaa9a6e21d7a2122b8b21", "apr_id": "5b258e888d03d2bb2867bf4b28c942b7", "difficulty": 1700, "tags": ["math", "constructive algorithms", "implementation", "binary search"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9950248756218906, "equal_cnt": 2, "replace_cnt": 0, "delete_cnt": 0, "insert_cnt": 1, "fix_ops_cnt": 1, "bug_source_code": "fun main() {\n val parameters = readLine()!!\n .split(\" \")\n .map { it.toInt() }\n .toIntArray()\n val scores = readLine()!!\n .split(\" \")\n .map { it.toInt() }\n .toIntArray()\n var count = 0\n val qualThreshold = scores[parameters[1]]\n scores.forEach {\n if(it >= qualThreshold && it > 0) count++\n }\n print(count)\n}", "lang": "Kotlin", "bug_code_uid": "bc939b62d40e3eac1c51a59f3cf7cd84", "src_uid": "193ec1226ffe07522caf63e84a7d007f", "apr_id": "0ca1a357e2c93e981d227efab04eaa09", "difficulty": 800, "tags": ["implementation"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"} {"similarity_score": 0.9508344609833108, "equal_cnt": 5, "replace_cnt": 2, "delete_cnt": 1, "insert_cnt": 1, "fix_ops_cnt": 4, "bug_source_code": "fun main() {\n val s = readLn()\n\n var ans = (s.length + 1) / 2\n if((1..s.lastIndex).all { s[it] == '0' }) ans--\n\n println(ans)\n}\n\nfun readLn() = readLine()!!\nfun readInt() = readLn().toInt()\nfun readDouble() = readLn().toDouble()\nfun readLong() = readLn().toLong()\nfun readStrings() = readLn().split(' ')\nfun readStringSeq() = readLn().splitToSequence(' ')\nfun readInts() = readStrings().map { it.toInt() }\nfun readIntSeq() = readStringSeq().map { it.toInt() }\nfun readDoubles() = readStrings().map { it.toDouble() }\nfun readDoubleSeq() = readStringSeq().map { it.toDouble() }\nfun readLongs() = readStrings().map { it.toLong() }\nfun readLongSeq() = readStringSeq().map { it.toLong() }\n\nclass Output {\n private val sb = StringBuilder()\n fun print(o: Any?) { sb.append(o) }\n fun println() { sb.append('\\n') }\n fun println(o: Any?) { sb.append(o).append('\\n') }\n @JvmName(\"_print\") fun Any?.print() = print(this)\n @JvmName(\"_println\") fun Any?.println() = println(this)\n fun nowPrint() { kotlin.io.print(sb) }\n}\ninline fun output(block: Output.()->Unit) { Output().apply(block).nowPrint() }", "lang": "Kotlin", "bug_code_uid": "6daa3a240c6ed3c810a812c62b4b2af3", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "apr_id": "24a8c601d1421c4749a46bc811682af5", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.9338842975206612, "equal_cnt": 2, "replace_cnt": 2, "delete_cnt": 0, "insert_cnt": 0, "fix_ops_cnt": 2, "bug_source_code": "import java.io.BufferedReader\nimport java.io.InputStreamReader\n\nfun main() {\n val br = BufferedReader(InputStreamReader(System.`in`))\n val s = br.readLine()\n val n = s.length\n println(\n if (s == \"0\") {\n 0\n } else if (s.filter { it == '1' }.length == 1) {\n n/2\n } else {\n n/2 + 1\n }\n )\n}", "lang": "Kotlin", "bug_code_uid": "27ef9bf2716c4f3379b3b76779e58667", "src_uid": "d8ca1c83b431466eff6054d3b422ab47", "apr_id": "62add1fa50789adff465b8e05dcb6f75", "difficulty": 1000, "tags": ["math"], "bug_exec_outcome": "WRONG_ANSWER", "potential_dominant_fix_op": "replace", "lang_cluster": "Kotlin"} {"similarity_score": 0.21561338289962825, "equal_cnt": 6, "replace_cnt": 2, "delete_cnt": 2, "insert_cnt": 3, "fix_ops_cnt": 7, "bug_source_code": "\nfun main(){\n var str = readLine()!!\n var four = 1\n var des = Integer.parseInt(str,2)\n var flag = true\n var count = 0\n while (flag){\n if (four0) \"First\" else \"Second\")\n}", "lang": "Kotlin", "bug_code_uid": "92d99e840fb962997bc4b3075c29a358", "src_uid": "aed24ebab3ed9fd1741eea8e4200f86b", "apr_id": "aa6e1d6679ecdb564a39ac0aebfa7570", "difficulty": 800, "tags": ["math", "constructive algorithms"], "bug_exec_outcome": "RUNTIME_ERROR", "potential_dominant_fix_op": "insert", "lang_cluster": "Kotlin"}